summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg4video_parser.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-21 14:36:21 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-22 14:59:02 +0200
commit035f6620ceb43622847e704a3b032a33ba329b29 (patch)
tree867757971ca240c3aff814c61f1530377a896c72 /libavcodec/mpeg4video_parser.c
parenta6b3471c44fd981d3b33ea9050f78a0bc9494c5e (diff)
mpeg4videoparser: support using timestamps from codec.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpeg4video_parser.c')
-rw-r--r--libavcodec/mpeg4video_parser.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index e9d713f371..f987330100 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -93,6 +93,13 @@ static int av_mpeg4_decode_header(AVCodecParserContext *s1,
if (s->width && (!avctx->width || !avctx->height || !avctx->coded_width || !avctx->coded_height)) {
avcodec_set_dimensions(avctx, s->width, s->height);
}
+ 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;