get_byte(pb); get_byte(pb); get_be16(pb); get_be16(pb); get_byte(pb); len -= 7;
int full_frame, h, pic_num;  h= get_byte(pb); if ((h & 0xc0) == 0xc0) { int len2, pos; full_frame = 1; len2= get_num(pb, &len); pos = get_num(pb, &len);  len -= 2; } else { int seq, frame_size, pos; full_frame = 0; seq = get_byte(pb); frame_size = get_num(pb, &len); pos = get_num(pb, &len);  len -= 3; }  pic_num= get_byte(pb);  av_new_packet(pkt, len+1); pkt->stream_index = i;   pkt->data[0]= h;  get_buffer(pb, pkt->data+1, len);
static int rm_read_packet(AVFormatContext *s, AVPacket *pkt){    RMContext *rm = s->priv_data;    ByteIOContext *pb = &s->pb;    AVStream *st;    int len, num, timestamp, i, tmp, j;    UINT8 *ptr;    int flags; redo:    if (rm->nb_packets == 0)        return -EIO;    get_be16(pb);    len = get_be16(pb);    if (len < 12)        return -EIO;    num = get_be16(pb);    timestamp = get_be32(pb);    get_byte(pb); /* reserved */    flags = get_byte(pb); /* flags */    rm->nb_packets--;    len -= 12;    st = NULL;    for(i=0;i<s->nb_streams;i++) {        st = s->streams[i];        if (num == st->id)            break;    }    if (i == s->nb_streams) {        /* skip packet if unknown number */        url_fskip(pb, len);        goto redo;    }    if (st->codec.codec_type == CODEC_TYPE_VIDEO) {        get_byte(pb);        get_byte(pb);        get_be16(pb);        get_be16(pb);        get_byte(pb);        len -= 7;    }        av_new_packet(pkt, len);    pkt->stream_index = i;    get_buffer(pb, pkt->data, len);    /* for AC3, needs to swap bytes */    if (st->codec.codec_id == CODEC_ID_AC3) {        ptr = pkt->data;        for(j=0;j<len;j+=2) {            tmp = ptr[0];            ptr[0] = ptr[1];            ptr[1] = tmp;                ptr += 2;        }    }    return 0;}