diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-12-30 21:23:02 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-12-30 21:23:02 +0000 |
commit | f48d5457369ef6d1cc434f0059ef3deb7b20c69b (patch) | |
tree | 294696740b5331e6916e9fb04063f1f4fa7e3723 /libavformat/rmdec.c | |
parent | e45673cb3abc4a99e39b0be07db23d0cda9d1a45 (diff) | |
download | ffmpeg-f48d5457369ef6d1cc434f0059ef3deb7b20c69b.tar.gz |
Simplify the top of rm_assemble_video_frame().
Originally committed as revision 16400 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rmdec.c')
-rw-r--r-- | libavformat/rmdec.c | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index edea8dad2e..7e67d18a19 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -492,42 +492,30 @@ static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb, hdr = get_byte(pb); len--; type = hdr >> 6; - switch(type){ - case 0: // slice - case 2: // last slice + + if(type != 3){ // not frame as a part of packet seq = get_byte(pb); len--; + } + if(type != 1){ // not whole frame len2 = get_num(pb, &len); - pos = get_num(pb, &len); - if(len < 1) - return -1; + pos = get_num(pb, &len); pic_num = get_byte(pb); len--; - rm->remaining_len = len; - break; - case 1: //whole frame - if(len<1) + } + if(len<0) + return -1; + rm->remaining_len = len; + if(type&1){ // frame, not slice + if(type == 3) // frame as a part of packet + len= len2; + if(rm->remaining_len < len) return -1; - seq = get_byte(pb); len--; + rm->remaining_len -= len; if(av_new_packet(pkt, len + 9) < 0) return AVERROR(EIO); pkt->data[0] = 0; AV_WL32(pkt->data + 1, 1); AV_WL32(pkt->data + 5, 0); get_buffer(pb, pkt->data + 9, len); - rm->remaining_len = 0; - return 0; - case 3: //frame as a part of packet - len2 = get_num(pb, &len); - pos = get_num(pb, &len); - pic_num = get_byte(pb); len--; - if(len < len2) - return -1; - rm->remaining_len = len - len2; - if(av_new_packet(pkt, len2 + 9) < 0) - return AVERROR(EIO); - pkt->data[0] = 0; - AV_WL32(pkt->data + 1, 1); - AV_WL32(pkt->data + 5, 0); - get_buffer(pb, pkt->data + 9, len2); return 0; } //now we have to deal with single slice |