mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-06 10:42:22 +00:00
ges/videourisource: handle non-1/1 PAR source videos
The automatic scaling done by framepositioner does not account for the par of the video source. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2614>
This commit is contained in:
parent
0df0dd7fe3
commit
d1bb5e014d
1 changed files with 24 additions and 5 deletions
|
@ -108,6 +108,7 @@ ges_video_uri_source_get_natural_size (GESVideoSource * source, gint * width,
|
||||||
const GstTagList *tags = NULL;
|
const GstTagList *tags = NULL;
|
||||||
gchar *rotation_info = NULL;
|
gchar *rotation_info = NULL;
|
||||||
gint videoflip_method, rotate_angle;
|
gint videoflip_method, rotate_angle;
|
||||||
|
guint par_n, par_d;
|
||||||
GstDiscovererVideoInfo *info =
|
GstDiscovererVideoInfo *info =
|
||||||
_get_video_stream_info (GES_VIDEO_URI_SOURCE (source));
|
_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);
|
*width = gst_discoverer_video_info_get_width (info);
|
||||||
*height = gst_discoverer_video_info_get_height (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),
|
if (!ges_timeline_element_lookup_child (GES_TIMELINE_ELEMENT (source),
|
||||||
"GstVideoFlip::video-direction", NULL, NULL))
|
"GstVideoFlip::video-direction", NULL, NULL))
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -151,11 +167,14 @@ done:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
rotate:
|
rotate:
|
||||||
|
{
|
||||||
|
gint tmp;
|
||||||
|
|
||||||
GST_INFO_OBJECT (source, "Stream is rotated, taking that into account");
|
GST_INFO_OBJECT (source, "Stream is rotated, taking that into account");
|
||||||
*width =
|
tmp = *width;
|
||||||
gst_discoverer_video_info_get_height (GST_DISCOVERER_VIDEO_INFO (info));
|
*width = *height;
|
||||||
*height =
|
*height = tmp;
|
||||||
gst_discoverer_video_info_get_width (GST_DISCOVERER_VIDEO_INFO (info));
|
}
|
||||||
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue