X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=subprojects%2Fgst-editing-services%2Fges%2Fges-video-uri-source.c;h=fe6d5149e21be4c5a2e85da54ff93b2443e14079;hb=2b943597657c46ac11135ead4dd30db5fd565d50;hp=3eef67bb0d88ec7c96adfeeff36a1cc752ca7caa;hpb=ca7081c482ef83960e2cc9685d765d79350351a0;p=platform%2Fupstream%2Fgstreamer.git diff --git a/subprojects/gst-editing-services/ges/ges-video-uri-source.c b/subprojects/gst-editing-services/ges/ges-video-uri-source.c index 3eef67b..fe6d514 100644 --- a/subprojects/gst-editing-services/ges/ges-video-uri-source.c +++ b/subprojects/gst-editing-services/ges/ges-video-uri-source.c @@ -108,6 +108,7 @@ ges_video_uri_source_get_natural_size (GESVideoSource * source, gint * width, const GstTagList *tags = NULL; gchar *rotation_info = NULL; gint videoflip_method, rotate_angle; + guint par_n, par_d; GstDiscovererVideoInfo *info = _get_video_stream_info (GES_VIDEO_URI_SOURCE (source)); @@ -116,6 +117,21 @@ ges_video_uri_source_get_natural_size (GESVideoSource * source, gint * width, *width = gst_discoverer_video_info_get_width (info); *height = gst_discoverer_video_info_get_height (info); + + /* account for source video PAR being not 1/1 */ + par_n = gst_discoverer_video_info_get_par_num (info); + par_d = gst_discoverer_video_info_get_par_denom (info); + + if (par_n > 0 && par_d > 0) { + if (*height % par_n == 0) { + *height = gst_util_uint64_scale_int (*height, par_d, par_n); + } else if (*width % par_d == 0) { + *height = gst_util_uint64_scale_int (*width, par_n, par_d); + } else { + *width = gst_util_uint64_scale_int (*height, par_d, par_n); + } + } + if (!ges_timeline_element_lookup_child (GES_TIMELINE_ELEMENT (source), "GstVideoFlip::video-direction", NULL, NULL)) goto done; @@ -151,11 +167,14 @@ done: return TRUE; rotate: - GST_INFO_OBJECT (source, "Stream is rotated, taking that into account"); - *width = - gst_discoverer_video_info_get_height (GST_DISCOVERER_VIDEO_INFO (info)); - *height = - gst_discoverer_video_info_get_width (GST_DISCOVERER_VIDEO_INFO (info)); + { + gint tmp; + + GST_INFO_OBJECT (source, "Stream is rotated, taking that into account"); + tmp = *width; + *width = *height; + *height = tmp; + } goto done; }