diff options
Diffstat (limited to 'libavcodec/mpeg4video_parser.c')
-rw-r--r-- | libavcodec/mpeg4video_parser.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c index 246bb9c..aa5e87a 100644 --- a/libavcodec/mpeg4video_parser.c +++ b/libavcodec/mpeg4video_parser.c @@ -3,23 +3,25 @@ * Copyright (c) 2003 Fabrice Bellard * Copyright (c) 2003 Michael Niedermayer * - * 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 */ +#define UNCHECKED_BITSTREAM_READER 1 + #include "internal.h" #include "parser.h" #include "mpegvideo.h" @@ -86,6 +88,8 @@ static int mpeg4_decode_header(AVCodecParserContext *s1, AVCodecContext *avctx, if (avctx->extradata_size && pc->first_picture) { init_get_bits(gb, avctx->extradata, avctx->extradata_size * 8); ret = ff_mpeg4_decode_picture_header(dec_ctx, gb); + if (ret < -1) + av_log(avctx, AV_LOG_WARNING, "Failed to parse extradata\n"); } init_get_bits(gb, buf, 8 * buf_size); @@ -96,6 +100,13 @@ static int mpeg4_decode_header(AVCodecParserContext *s1, AVCodecContext *avctx, if (ret < 0) return ret; } + if((s1->flags & PARSER_FLAG_USE_CODEC_TS) && s->avctx->time_base.den>0 && ret>=0){ + av_assert1(s1->pts == AV_NOPTS_VALUE); + av_assert1(s1->dts == AV_NOPTS_VALUE); + + s1->pts = av_rescale_q(s->time, (AVRational){1, s->avctx->time_base.den}, (AVRational){1, 1200000}); + } + s1->pict_type = s->pict_type; pc->first_picture = 0; return ret; @@ -105,8 +116,12 @@ static av_cold int mpeg4video_parse_init(AVCodecParserContext *s) { struct Mp4vParseContext *pc = s->priv_data; + ff_mpeg4videodec_static_init(); + pc->first_picture = 1; + pc->dec_ctx.m.quant_precision = 5; pc->dec_ctx.m.slice_context_count = 1; + pc->dec_ctx.showed_packed_warning = 1; return 0; } |