diff options
author | Wolfram Gloger <wmglo@dent.med.uni-muenchen.de> | 2012-03-16 21:17:00 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-03-16 21:27:23 +0100 |
commit | f8353d5fdab24ecfb0989c9751007592f83543da (patch) | |
tree | 580ad92bea86a9bbc373ad42e28f5c4cecf77c63 /libavcodec | |
parent | 6f9803e5e02c557e1003cface9f3084a7e1e43e4 (diff) | |
download | ffmpeg-f8353d5fdab24ecfb0989c9751007592f83543da.tar.gz |
mpegvideo: don't pretend the first frame is always a key frame
Signed-off-by: Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>
Modify the parser initialization so that parsers can
set pict_type themselves. Use this in the mpegvideo parser
so that initial frames are not unconditionally I frames.
I have had this in my tree for several years.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mpegvideo_parser.c | 7 | ||||
-rw-r--r-- | libavcodec/parser.c | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index 776052d252..5658cdeb36 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -182,9 +182,16 @@ static int mpegvideo_split(AVCodecContext *avctx, 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, diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 0be793506d..58be89f349 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -63,6 +63,8 @@ AVCodecParserContext *av_parser_init(int codec_id) av_free(s); return NULL; } + s->fetch_timestamp=1; + s->pict_type = AV_PICTURE_TYPE_I; if (parser->parser_init) { ret = parser->parser_init(s); if (ret != 0) { @@ -71,8 +73,6 @@ AVCodecParserContext *av_parser_init(int codec_id) return NULL; } } - s->fetch_timestamp=1; - s->pict_type = AV_PICTURE_TYPE_I; s->key_frame = -1; s->convergence_duration = 0; s->dts_sync_point = INT_MIN; |