From 0a4c2524fad98d2cc4ec125db78e6cbc1c5c3bef Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Sat, 8 Sep 2012 17:03:33 +0200 Subject: [PATCH] mpeg4videoparse: Don't override upstream framerate and PAR If upstream provided some, there's a good chance they are the ones to use --- gst/videoparsers/gstmpeg4videoparse.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gst/videoparsers/gstmpeg4videoparse.c b/gst/videoparsers/gstmpeg4videoparse.c index f55f09ea49..526edc7cb0 100644 --- a/gst/videoparsers/gstmpeg4videoparse.c +++ b/gst/videoparsers/gstmpeg4videoparse.c @@ -533,6 +533,7 @@ static void gst_mpeg4vparse_update_src_caps (GstMpeg4VParse * mp4vparse) { GstCaps *caps = NULL; + GstStructure *s = NULL; GST_LOG_OBJECT (mp4vparse, "Updating caps"); @@ -547,6 +548,7 @@ gst_mpeg4vparse_update_src_caps (GstMpeg4VParse * mp4vparse) GstCaps *tmp = gst_caps_copy (caps); gst_caps_unref (caps); caps = tmp; + s = gst_caps_get_structure (caps, 0); } else { caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 4, NULL); @@ -570,8 +572,9 @@ gst_mpeg4vparse_update_src_caps (GstMpeg4VParse * mp4vparse) "height", G_TYPE_INT, mp4vparse->vol.height, NULL); } - /* perhaps we have a framerate */ - if (mp4vparse->vol.fixed_vop_time_increment != 0) { + /* perhaps we have a framerate */ + if (mp4vparse->vol.fixed_vop_time_increment != 0 && + (!s || !gst_structure_has_field (s, "framerate"))) { gint fps_num = mp4vparse->vol.vop_time_increment_resolution; gint fps_den = mp4vparse->vol.fixed_vop_time_increment; GstClockTime latency = gst_util_uint64_scale (GST_SECOND, fps_den, fps_num); @@ -584,7 +587,8 @@ gst_mpeg4vparse_update_src_caps (GstMpeg4VParse * mp4vparse) } /* or pixel-aspect-ratio */ - if (mp4vparse->vol.par_width > 0 && mp4vparse->vol.par_height > 0) { + if (mp4vparse->vol.par_width > 0 && mp4vparse->vol.par_height > 0 && + (!s || !gst_structure_has_field (s, "pixel-aspect-ratio"))) { gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION, mp4vparse->vol.par_width, mp4vparse->vol.par_height, NULL);