From 0e0dd05fd645b32a10b5d5da74f2feb67010ec87 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 13 Dec 2012 14:12:52 +0100 Subject: [PATCH] h264parse: use upstream width/height when given The upstream width and height should override the dimension detected in the file. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=683142 --- gst/videoparsers/gsth264parse.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c index 6fa77dd720..fdf7d97497 100644 --- a/gst/videoparsers/gsth264parse.c +++ b/gst/videoparsers/gsth264parse.c @@ -1196,12 +1196,24 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps) if (G_UNLIKELY (modified)) { gint fps_num = h264parse->fps_num; gint fps_den = h264parse->fps_den; + gint width, height; GstClockTime latency; caps = gst_caps_copy (sink_caps); - /* sps should give this */ - gst_caps_set_simple (caps, "width", G_TYPE_INT, sps->width, - "height", G_TYPE_INT, sps->height, NULL); + + /* sps should give this but upstream overrides */ + if (s && gst_structure_has_field (s, "width")) + gst_structure_get_int (s, "width", &width); + else + width = sps->width; + + if (s && gst_structure_has_field (s, "height")) + gst_structure_get_int (s, "height", &height); + else + height = sps->height; + + gst_caps_set_simple (caps, "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, NULL); /* upstream overrides */ if (s && gst_structure_has_field (s, "framerate"))