Skip to content

Commit 0d24acd

Browse files
committed
Automatically rotate video based on its orientation tag
This adds the videoflip filter to our playbin in the auto-mode, which will automatically rotate the video based on any potential orientation tag. Fix: #61
1 parent d6edbd4 commit 0d24acd

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

extensions/gstreamer_tools/gth-media-viewer-page.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,13 @@ _gth_media_viewer_page_set_uri (GthMediaViewerPage *self,
13781378

13791379
gst_element_set_state (self->priv->playbin, GST_STATE_NULL);
13801380

1381+
/* Re-create videoflip every time because the auto-mode will remember
1382+
the last-seen orientation tag and will happily use it for a new
1383+
file that does not contain any orientation tag. */
1384+
GstElement *videoflip = gst_element_factory_make ("videoflip", "");
1385+
g_object_set (videoflip, "video-direction", GST_VIDEO_ORIENTATION_AUTO, NULL);
1386+
g_object_set (self->priv->playbin, "video-filter", videoflip, NULL);
1387+
13811388
g_object_set (G_OBJECT (self->priv->playbin), "uri", uri, NULL);
13821389
gst_element_set_state (self->priv->playbin, state);
13831390
wait_playbin_state_change_to_complete (self);

0 commit comments

Comments
 (0)