diff options
author | Jakub Adam <jakub.adam@collabora.com> | 2019-03-15 16:24:16 +0100 |
---|---|---|
committer | Jakub Adam <jakub.adam@collabora.com> | 2019-03-19 10:01:40 +0100 |
commit | 77dac21488f2217c9fc0cb7a7bfba1f5c0ef8789 (patch) | |
tree | 62ade87741b6dc72be3aaf1a4ab4f4fe4b195d3a | |
parent | 64f23a2a801502e9a4e22be7339e0b2a87b1e57e (diff) |
videosource: auto-flip the image according to image-orientation tag
If there's image-orientation tag, make sure the image is correctly
oriented before we scale it.
-rw-r--r-- | ges/ges-video-source.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ges/ges-video-source.c b/ges/ges-video-source.c index 4433d887..2006f689 100644 --- a/ges/ges-video-source.c +++ b/ges/ges-video-source.c @@ -82,6 +82,7 @@ #endif #include <gst/pbutils/missing-plugins.h> +#include <gst/video/video.h> #include "ges-internal.h" #include "ges/ges-meta-container.h" @@ -135,8 +136,8 @@ ges_video_source_create_element (GESTrackElement * trksrc) GstElement *queue = gst_element_factory_make ("queue", NULL); GESVideoSourceClass *source_class = GES_VIDEO_SOURCE_GET_CLASS (trksrc); GESVideoSource *self; - GstElement *positioner, *videoscale, *videorate, *capsfilter, *videoconvert, - *deinterlace; + GstElement *positioner, *videoflip, *videoscale, *videorate, *capsfilter, + *videoconvert, *deinterlace; const gchar *positioner_props[] = { "alpha", "posx", "posy", "width", "height", NULL }; const gchar *deinterlace_props[] = { "mode", "fields", "tff", NULL }; @@ -154,6 +155,11 @@ ges_video_source_create_element (GESTrackElement * trksrc) g_object_set (positioner, "zorder", G_MAXUINT - GES_TIMELINE_ELEMENT_PRIORITY (self), NULL); + /* If there's image-orientation tag, make sure the image is correctly oriented + * before we scale it. */ + videoflip = gst_element_factory_make ("videoflip", "track-element-videoflip"); + g_object_set (videoflip, "video-direction", GST_VIDEO_ORIENTATION_AUTO, NULL); + videoscale = gst_element_factory_make ("videoscale", "track-element-videoscale"); videoconvert = @@ -177,13 +183,14 @@ ges_video_source_create_element (GESTrackElement * trksrc) "deinterlace"), ("deinterlacing won't work")); topbin = ges_source_create_topbin ("videosrcbin", sub_element, queue, - videoconvert, positioner, videoscale, videorate, capsfilter, NULL); + videoconvert, positioner, videoflip, videoscale, videorate, capsfilter, + NULL); } else { ges_track_element_add_children_props (trksrc, deinterlace, NULL, NULL, deinterlace_props); topbin = ges_source_create_topbin ("videosrcbin", sub_element, queue, - videoconvert, deinterlace, positioner, videoscale, videorate, + videoconvert, deinterlace, positioner, videoflip, videoscale, videorate, capsfilter, NULL); } |