From 654744a03c807b6c1f7ece6d8316a899237fda11 Mon Sep 17 00:00:00 2001 From: Sreerenj Balachandran Date: Thu, 11 Jul 2013 17:46:37 +0300 Subject: [PATCH] mpegvideoparse: Use sequence_display_extension values to update the src caps The caps should always represent what the user is supposed to see. So if there is a sequence_display_extension associated with the stream then use the display_horizontal_size/display_vertical_size to update the src caps (if they are less than the values provided by sequence header). https://bugzilla.gnome.org/show_bug.cgi?id=704009 --- gst/videoparsers/gstmpegvideoparse.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c index 78dc85eb36..c0a2ffd04c 100644 --- a/gst/videoparsers/gstmpegvideoparse.c +++ b/gst/videoparsers/gstmpegvideoparse.c @@ -737,8 +737,26 @@ gst_mpegv_parse_update_src_caps (GstMpegvParse * mpvparse) "parsed", G_TYPE_BOOLEAN, TRUE, NULL); if (mpvparse->sequencehdr.width > 0 && mpvparse->sequencehdr.height > 0) { - gst_caps_set_simple (caps, "width", G_TYPE_INT, mpvparse->sequencehdr.width, - "height", G_TYPE_INT, mpvparse->sequencehdr.height, NULL); + GstMpegVideoSequenceDisplayExt *seqdispext; + gint width, height; + + width = mpvparse->sequencehdr.width; + height = mpvparse->sequencehdr.height; + + if (mpvparse->config_flags & FLAG_SEQUENCE_DISPLAY_EXT) { + seqdispext = &mpvparse->sequencedispext; + + if (seqdispext->display_horizontal_size <= width + && seqdispext->display_vertical_size <= height) { + width = seqdispext->display_horizontal_size; + height = seqdispext->display_vertical_size; + GST_INFO_OBJECT (mpvparse, + "stream has display extension: display_width=%d display_height=%d", + width, height); + } + } + gst_caps_set_simple (caps, "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, NULL); } /* perhaps we have a framerate */