From 3021a8a70b44096aef84cc4656ff804028c57973 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 30 Jan 2009 17:13:03 +0000 Subject: [PATCH] =?UTF-8?q?Make=20ff=5Fh263=5Fresync()=20return=20the=20bi?= =?UTF-8?q?t=20position=20of=20the=20resync=5Fmarker=20or=20a=20negative?= =?UTF-8?q?=20number=20if=20none=20was=20found.=20Patch=20by=20Gwenol?= =?UTF-8?q?=C3=A9=20Beauchesne:=20gbeauchesne=20splitted=20minus=20desktop?= =?UTF-8?q?=20com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Originally committed as revision 16858 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/h263.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 396a69eafc..bdc020b652 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -3296,10 +3296,10 @@ void ff_mpeg4_clean_buffers(MpegEncContext *s) /** * decodes the group of blocks / video packet header. - * @return <0 if no resync found + * @return bit position of the resync_marker, or <0 if none was found */ int ff_h263_resync(MpegEncContext *s){ - int left, ret; + int left, pos, ret; if(s->codec_id==CODEC_ID_MPEG4){ skip_bits1(&s->gb); @@ -3307,12 +3307,13 @@ int ff_h263_resync(MpegEncContext *s){ } if(show_bits(&s->gb, 16)==0){ + pos= get_bits_count(&s->gb); if(s->codec_id==CODEC_ID_MPEG4) ret= mpeg4_decode_video_packet_header(s); else ret= h263_decode_gob_header(s); if(ret>=0) - return 0; + return pos; } //OK, it's not where it is supposed to be ... s->gb= s->last_resync_gb; @@ -3323,12 +3324,13 @@ int ff_h263_resync(MpegEncContext *s){ if(show_bits(&s->gb, 16)==0){ GetBitContext bak= s->gb; + pos= get_bits_count(&s->gb); if(s->codec_id==CODEC_ID_MPEG4) ret= mpeg4_decode_video_packet_header(s); else ret= h263_decode_gob_header(s); if(ret>=0) - return 0; + return pos; s->gb= bak; }