[totem/wip/hadess/glsink: 76/89] rotation support
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/glsink: 76/89] rotation support
- Date: Thu, 14 Oct 2021 08:58:05 +0000 (UTC)
commit 4b28e12087712d2a09f53b748af9810ffb3cab1f
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 | 78 ++++-------------------------------
src/plugins/rotation/totem-rotation.c | 7 +---
2 files changed, 10 insertions(+), 75 deletions(-)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index 59d415c08..ea7a45f33 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -2070,37 +2070,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)
{
@@ -2142,8 +2111,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);
}
@@ -4393,7 +4360,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_GTK_GL_ROTATE_METHOD_AUTO,
+ NULL);
GST_DEBUG ("stopped");
}
@@ -4910,11 +4879,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");
}
/**
@@ -4930,10 +4895,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;
}
/**
@@ -4947,22 +4912,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",
get_type_name (BVW_TYPE_ROTATION, rotation),
rotation * 90.0,
get_type_name (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);
}
/**
@@ -6094,14 +6053,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 */
@@ -6113,17 +6064,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 183fcd475..53cf65652 100644
--- a/src/plugins/rotation/totem-rotation.c
+++ b/src/plugins/rotation/totem-rotation.c
@@ -43,7 +43,7 @@
#define TOTEM_IS_ROTATION_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TOTEM_TYPE_ROTATION_PLUGIN))
#define TOTEM_ROTATION_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_ROTATION_PLUGIN,
TotemRotationPluginClass))
-#define GIO_ROTATION_FILE_ATTRIBUTE "metadata::totem::rotation"
+#define GIO_ROTATION_FILE_ATTRIBUTE "metadata::totem::rotation2"
#define STATE_COUNT 4
typedef struct {
@@ -164,8 +164,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 {
@@ -302,9 +300,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]