diff options
Diffstat (limited to 'libavcodec/mpegvideo_parser.c')
-rw-r--r-- | libavcodec/mpegvideo_parser.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index af4b6e42ba..5658cdeb36 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -3,20 +3,20 @@ * Copyright (c) 2000,2001 Fabrice Bellard * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -170,18 +170,28 @@ static int mpegvideo_split(AVCodecContext *avctx, { int i; uint32_t state= -1; + int found=0; for(i=0; i<buf_size; i++){ state= (state<<8) | buf[i]; - if(state != 0x1B3 && state != 0x1B5 && state < 0x200 && state >= 0x100) + if(state == 0x1B3){ + found=1; + }else if(found && state != 0x1B5 && state < 0x200 && state >= 0x100) return i-3; } return 0; } +static int mpegvideo_parse_init(AVCodecParserContext *s) +{ + s->pict_type = AV_PICTURE_TYPE_NONE; // first frame might be partial + return 0; +} + AVCodecParser ff_mpegvideo_parser = { .codec_ids = { CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO }, .priv_data_size = sizeof(struct MpvParseContext), + .parser_init = mpegvideo_parse_init, .parser_parse = mpegvideo_parse, .parser_close = ff_parse_close, .split = mpegvideo_split, |