Mercurial > libavformat.hg
changeset 4142:5d57b8a9e597 libavformat
Simplify the top of rm_assemble_video_frame().
author | michael |
---|---|
date | Tue, 30 Dec 2008 21:23:02 +0000 |
parents | 657498d1307e |
children | 6b3d9d41f18c |
files | rmdec.c |
diffstat | 1 files changed, 15 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/rmdec.c Tue Dec 30 20:51:18 2008 +0000 +++ b/rmdec.c Tue Dec 30 21:23:02 2008 +0000 @@ -492,42 +492,30 @@ 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) + pos = get_num(pb, &len); + pic_num = get_byte(pb); len--; + } + 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; - pic_num = get_byte(pb); len--; - rm->remaining_len = len; - break; - case 1: //whole frame - if(len<1) - 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