[totem/wip/hadess/glsink: 22/33] rotation support
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/glsink: 22/33] rotation support
- Date: Thu, 27 Jan 2022 12:09:21 +0000 (UTC)
commit 4e937c1f3414e4840768b63f26ba9bf4ccb85516
Author: Bastien Nocera <hadess hadess net>
Date: Tue May 4 12:28:06 2021 +0200
rotation support
We still need a way to "reset orientation", and figure out a test for
in-stream orientation changes if needed.
We bumped the metadata name to another version, not sure if needed.
src/backend/bacon-video-widget.c | 93 ++++-------------------------------
src/plugins/rotation/totem-rotation.c | 5 --
2 files changed, 10 insertions(+), 88 deletions(-)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index 596cf196e..f296e3b0f 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -108,19 +108,6 @@
#define I_(string) (g_intern_static_string (string))
-typedef enum
-{
- GST_GTK_GL_ROTATE_METHOD_IDENTITY,
- GST_GTK_GL_ROTATE_METHOD_90R,
- GST_GTK_GL_ROTATE_METHOD_180,
- GST_GTK_GL_ROTATE_METHOD_90L,
- GST_GTK_GL_ROTATE_METHOD_FLIP_HORIZ,
- GST_GTK_GL_ROTATE_METHOD_FLIP_VERT,
- GST_GTK_GL_ROTATE_METHOD_FLIP_UL_LR,
- GST_GTK_GL_ROTATE_METHOD_FLIP_UR_LL,
- GST_GTK_GL_ROTATE_METHOD_AUTO,
-} GstGtkGLRotateMethod;
-
static void bacon_video_widget_initable_iface_init (GInitableIface *iface);
/* Signals */
@@ -2041,37 +2028,6 @@ bvw_check_missing_plugins_on_preroll (BaconVideoWidget * bvw)
return bvw_emit_missing_plugins_signal (bvw, TRUE);
}
-static void
-update_orientation_from_video (BaconVideoWidget *bvw)
-{
- BvwRotation rotation = BVW_ROTATION_R_ZERO;
- char *orientation_str = NULL;
- gboolean ret;
- gdouble angle;
-
- /* Don't change the rotation if explicitely set */
- if (bvw->rotation != BVW_ROTATION_R_ZERO)
- return;
-
- ret = gst_tag_list_get_string_index (bvw->tagcache,
- GST_TAG_IMAGE_ORIENTATION, 0, &orientation_str);
- if (!ret || !orientation_str || g_str_equal (orientation_str, "rotate-0"))
- rotation = BVW_ROTATION_R_ZERO;
- else if (g_str_equal (orientation_str, "rotate-90"))
- rotation = BVW_ROTATION_R_90R;
- else if (g_str_equal (orientation_str, "rotate-180"))
- rotation = BVW_ROTATION_R_180;
- else if (g_str_equal (orientation_str, "rotate-270"))
- rotation = BVW_ROTATION_R_90L;
- else
- g_warning ("Unhandled orientation value: '%s'", orientation_str);
-
- g_free (orientation_str);
-
- angle = rotation * 90.0;
- //totem_aspect_frame_set_rotation (TOTEM_ASPECT_FRAME (bvw->frame), angle);
-}
-
static void
bvw_update_tags (BaconVideoWidget * bvw, GstTagList *tag_list, const gchar *type)
{
@@ -2113,8 +2069,6 @@ bvw_update_tags (BaconVideoWidget * bvw, GstTagList *tag_list, const gchar *type
g_signal_emit (bvw, bvw_signals[SIGNAL_GOT_METADATA], 0);
- update_orientation_from_video (bvw);
-
set_current_actor (bvw);
}
@@ -4364,7 +4318,9 @@ bvw_stop_play_pipeline (BaconVideoWidget * bvw)
bvw->movie_par_n = bvw->movie_par_d = 1;
clutter_actor_hide (bvw->spinner);
g_object_set (G_OBJECT (bvw->spinner), "percent", 0.0, NULL);
- totem_aspect_frame_set_internal_rotation (TOTEM_ASPECT_FRAME (bvw->frame), 0.0);
+ g_object_set (bvw->video_sink,
+ "rotate-method", GST_VIDEO_ORIENTATION_AUTO,
+ NULL);
GST_DEBUG ("stopped");
}
@@ -4881,11 +4837,7 @@ bacon_video_widget_set_zoom (BaconVideoWidget *bvw,
{
g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- if (bvw->frame == NULL)
- return;
-
- totem_aspect_frame_set_expand (TOTEM_ASPECT_FRAME (bvw->frame),
- (mode == BVW_ZOOM_EXPAND));
+ g_warning ("Not implemented");
}
/**
@@ -4901,10 +4853,10 @@ bacon_video_widget_get_zoom (BaconVideoWidget *bvw)
{
gboolean expand;
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 1.0);
+ g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), BVW_ZOOM_NONE);
- expand = totem_aspect_frame_get_expand (TOTEM_ASPECT_FRAME (bvw->frame));
- return expand ? BVW_ZOOM_EXPAND : BVW_ZOOM_NONE;
+ g_warning ("Not implemented");
+ return BVW_ZOOM_NONE;
}
/**
@@ -4918,22 +4870,16 @@ void
bacon_video_widget_set_rotation (BaconVideoWidget *bvw,
BvwRotation rotation)
{
- gfloat angle;
-
g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- if (bvw->frame == NULL)
- return;
-
GST_DEBUG ("Rotating to %s (%f degrees) from %s",
g_enum_to_string (BVW_TYPE_ROTATION, rotation),
rotation * 90.0,
g_enum_to_string (BVW_TYPE_ROTATION, bvw->rotation));
bvw->rotation = rotation;
-
- angle = rotation * 90.0;
- //totem_aspect_frame_set_rotation (TOTEM_ASPECT_FRAME (bvw->frame), angle);
+ //FIXME figure out when to reset "auto"
+ g_object_set (bvw->video_sink, "rotate-method", rotation, NULL);
}
/**
@@ -6043,7 +5989,7 @@ bacon_video_widget_initable_init (GInitable *initable,
//g_object_unref (area);
g_object_set (bvw->video_sink,
- "rotate-method", GST_GTK_GL_ROTATE_METHOD_AUTO,
+ "rotate-method", GST_VIDEO_ORIENTATION_AUTO,
NULL);
#if 0
bvw->stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (bvw));
@@ -6054,14 +6000,6 @@ bacon_video_widget_initable_init (GInitable *initable,
clutter_actor_set_name (bvw->stage, "stage");
clutter_actor_set_background_color (bvw->stage, CLUTTER_COLOR_Black);
- /* Video sink, with aspect frame */
- bvw->texture = g_object_new (CLUTTER_TYPE_ACTOR,
- "content", g_object_new (CLUTTER_GST_TYPE_CONTENT,
- "sink", bvw->video_sink,
- NULL),
- "name", "texture",
- "reactive", TRUE,
- NULL);
listen_navigation_events (bvw->texture, bvw);
/* The logo */
@@ -6073,17 +6011,6 @@ bacon_video_widget_initable_init (GInitable *initable,
clutter_actor_add_child (bvw->stage, bvw->logo_frame);
clutter_actor_hide (CLUTTER_ACTOR (bvw->logo_frame));
- /* The video */
- bvw->frame = totem_aspect_frame_new ();
- clutter_actor_set_name (bvw->frame, "frame");
- totem_aspect_frame_set_child (TOTEM_ASPECT_FRAME (bvw->frame), bvw->texture);
-
- clutter_actor_add_child (bvw->stage, bvw->frame);
-
- clutter_actor_set_child_above_sibling (bvw->stage,
- bvw->logo_frame,
- bvw->frame);
-
/* The video's actions */
action = clutter_tap_action_new ();
clutter_actor_add_action (bvw->texture, action);
diff --git a/src/plugins/rotation/totem-rotation.c b/src/plugins/rotation/totem-rotation.c
index 3402de98c..087915a09 100644
--- a/src/plugins/rotation/totem-rotation.c
+++ b/src/plugins/rotation/totem-rotation.c
@@ -160,8 +160,6 @@ update_state (TotemRotationPlugin *pi,
TotemRotationPluginPrivate *priv = pi->priv;
if (mrl == NULL) {
- bacon_video_widget_set_rotation (BACON_VIDEO_WIDGET (priv->bvw),
- BVW_ROTATION_R_ZERO);
g_simple_action_set_enabled (priv->rotate_left_action, FALSE);
g_simple_action_set_enabled (priv->rotate_right_action, FALSE);
} else {
@@ -298,9 +296,6 @@ impl_deactivate (PeasActivatable *plugin)
g_action_map_remove_action (G_ACTION_MAP (priv->totem), "rotate-left");
g_action_map_remove_action (G_ACTION_MAP (priv->totem), "rotate-right");
- bacon_video_widget_set_rotation (BACON_VIDEO_WIDGET (priv->bvw),
- BVW_ROTATION_R_ZERO);
-
priv->totem = NULL;
priv->bvw = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]