Commit 3021a8a7 authored by Gwenole Beauchesne's avatar Gwenole Beauchesne Committed by Benoit Fouet

Make ff_h263_resync() return the bit position of the resync_marker or

a negative number if none was found.
Patch by Gwenolé Beauchesne: gbeauchesne splitted minus desktop com

Originally committed as revision 16858 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 5449a787
...@@ -3296,10 +3296,10 @@ void ff_mpeg4_clean_buffers(MpegEncContext *s) ...@@ -3296,10 +3296,10 @@ void ff_mpeg4_clean_buffers(MpegEncContext *s)
/** /**
* decodes the group of blocks / video packet header. * 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 ff_h263_resync(MpegEncContext *s){
int left, ret; int left, pos, ret;
if(s->codec_id==CODEC_ID_MPEG4){ if(s->codec_id==CODEC_ID_MPEG4){
skip_bits1(&s->gb); skip_bits1(&s->gb);
...@@ -3307,12 +3307,13 @@ int ff_h263_resync(MpegEncContext *s){ ...@@ -3307,12 +3307,13 @@ int ff_h263_resync(MpegEncContext *s){
} }
if(show_bits(&s->gb, 16)==0){ if(show_bits(&s->gb, 16)==0){
pos= get_bits_count(&s->gb);
if(s->codec_id==CODEC_ID_MPEG4) if(s->codec_id==CODEC_ID_MPEG4)
ret= mpeg4_decode_video_packet_header(s); ret= mpeg4_decode_video_packet_header(s);
else else
ret= h263_decode_gob_header(s); ret= h263_decode_gob_header(s);
if(ret>=0) if(ret>=0)
return 0; return pos;
} }
//OK, it's not where it is supposed to be ... //OK, it's not where it is supposed to be ...
s->gb= s->last_resync_gb; s->gb= s->last_resync_gb;
...@@ -3323,12 +3324,13 @@ int ff_h263_resync(MpegEncContext *s){ ...@@ -3323,12 +3324,13 @@ int ff_h263_resync(MpegEncContext *s){
if(show_bits(&s->gb, 16)==0){ if(show_bits(&s->gb, 16)==0){
GetBitContext bak= s->gb; GetBitContext bak= s->gb;
pos= get_bits_count(&s->gb);
if(s->codec_id==CODEC_ID_MPEG4) if(s->codec_id==CODEC_ID_MPEG4)
ret= mpeg4_decode_video_packet_header(s); ret= mpeg4_decode_video_packet_header(s);
else else
ret= h263_decode_gob_header(s); ret= h263_decode_gob_header(s);
if(ret>=0) if(ret>=0)
return 0; return pos;
s->gb= bak; s->gb= bak;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment