From 23e312872e4131b95c7807f621cd442c3830665b Mon Sep 17 00:00:00 2001 From: Matej Knopp Date: Sat, 14 Apr 2012 20:53:47 +0200 Subject: [PATCH] mpegvideoparse: Fix FPS and frame duration for telecine files --- gst/videoparsers/gstmpegvideoparse.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c index 9bb046e270..5b6a572e9f 100644 --- a/gst/videoparsers/gstmpegvideoparse.c +++ b/gst/videoparsers/gstmpegvideoparse.c @@ -283,7 +283,7 @@ gst_mpegv_parse_process_config (GstMpegvParse * mpvparse, GstBuffer * buf, map.data, map.size, tpoffsz->offset)) { mpvparse->fps_num = mpvparse->sequencehdr.fps_n * (mpvparse->sequenceext.fps_n_ext + - 1) * 2; + 1); mpvparse->fps_den = mpvparse->sequencehdr.fps_d * (mpvparse->sequenceext.fps_d_ext + 1); @@ -737,8 +737,10 @@ gst_mpegv_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) GST_BUFFER_DURATION (buffer) = 0; } - GST_BUFFER_DURATION (buffer) = - (1 + mpvparse->frame_repeat_count) * GST_BUFFER_DURATION (buffer); + if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer))) { + GST_BUFFER_DURATION (buffer) = + (1 + mpvparse->frame_repeat_count) * GST_BUFFER_DURATION (buffer) / 2; + } if (G_UNLIKELY (mpvparse->drop && !mpvparse->config)) { GST_DEBUG_OBJECT (mpvparse, "dropping frame as no config yet");