X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fituh263dec.c;h=1b57e53cad9ff934dde788562b61b9748e8e5d72;hb=5710fdaeae09529282862c984317bd9347d0865d;hp=fc95a532ce79460d3098cc11d80cce318e7a392f;hpb=04e4ab44d7c5eca9e1929b34d8fb966afc403e3a;p=ffmpeg diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index fc95a532ce7..1b57e53cad9 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -207,12 +207,27 @@ static int h263_decode_gob_header(MpegEncContext *s) } /** - * Decode the group of blocks / video packet header. + * Decode the group of blocks / video packet header / slice header (MPEG-4 Studio). * @return bit position of the resync_marker, or <0 if none was found */ int ff_h263_resync(MpegEncContext *s){ int left, pos, ret; + /* In MPEG-4 studio mode look for a new slice startcode + * and decode slice header */ + if(s->codec_id==AV_CODEC_ID_MPEG4 && s->studio_profile) { + align_get_bits(&s->gb); + + while (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) != SLICE_START_CODE) { + get_bits(&s->gb, 8); + } + + if (show_bits_long(&s->gb, 32) == SLICE_START_CODE) + return get_bits_count(&s->gb); + else + return -1; + } + if(s->codec_id==AV_CODEC_ID_MPEG4){ skip_bits1(&s->gb); align_get_bits(&s->gb);