From 008a2288652fdf25baa5af993b4ac76b0634a7ad Mon Sep 17 00:00:00 2001 From: Stian Selnes Date: Wed, 1 Jul 2015 17:09:35 +0200 Subject: [PATCH] videodecoder: Fix setting default pixel-aspect-ratio It's needed to check if pixel-aspect-ratio exists before fixating. It does not exist if input caps is not set yet and allowed caps does not contain pixel-aspect-ratio (e.g. when using GST_VIDEO_CAPS_MAKE) https://bugzilla.gnome.org/show_bug.cgi?id=751932 --- gst-libs/gst/video/gstvideodecoder.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index a749098..671a66b 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -1097,9 +1097,14 @@ gst_video_decoder_negotiate_default_caps (GstVideoDecoder * decoder) /* Random 1280x720@30 for fixation */ gst_structure_fixate_field_nearest_int (structure, "width", 1280); gst_structure_fixate_field_nearest_int (structure, "height", 720); - gst_structure_fixate_field_nearest_fraction (structure, - "pixel-aspect-ratio", 1, 1); gst_structure_fixate_field_nearest_fraction (structure, "framerate", 30, 1); + if (gst_structure_has_field (structure, "pixel-aspect-ratio")) { + gst_structure_fixate_field_nearest_fraction (structure, + "pixel-aspect-ratio", 1, 1); + } else { + gst_structure_set (structure, "pixel-aspect-ratio", GST_TYPE_FRACTION, + 1, 1, NULL); + } } caps = gst_caps_fixate (caps); structure = gst_caps_get_structure (caps, 0); -- 2.7.4