[empathy] Call: flip video preview horizontally



commit a0c74363c0617abaa5522c2e0ffeb0a9372349d1
Author: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
Date:   Tue Jul 5 12:30:53 2011 +0100

    Call: flip video preview horizontally
    
    https://bugzilla.gnome.org/show_bug.cgi?id=639353

 src/empathy-call-window.c           |    6 +++++-
 src/empathy-streamed-media-window.c |    6 +++++-
 src/empathy-video-widget.c          |   30 +++++++++++++++++++++++++++---
 3 files changed, 37 insertions(+), 5 deletions(-)
---
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 3dbac9e..5e8db3e 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -708,7 +708,11 @@ create_video_preview (EmpathyCallWindow *self)
 
   priv->video_preview = empathy_video_widget_new_with_size (bus,
       SELF_VIDEO_SECTION_WIDTH, SELF_VIDEO_SECTION_HEIGTH);
-  g_object_set (priv->video_preview, "sync", FALSE, "async", TRUE, NULL);
+  g_object_set (priv->video_preview,
+      "sync", FALSE,
+      "async", TRUE,
+      "flip-video", TRUE,
+      NULL);
 
   gtk_box_pack_start (GTK_BOX (priv->self_user_output_hbox),
       priv->video_preview, TRUE, TRUE, 0);
diff --git a/src/empathy-streamed-media-window.c b/src/empathy-streamed-media-window.c
index e932810..0e70dd9 100644
--- a/src/empathy-streamed-media-window.c
+++ b/src/empathy-streamed-media-window.c
@@ -721,7 +721,11 @@ create_video_preview (EmpathyStreamedMediaWindow *self)
 
   priv->video_preview = empathy_video_widget_new_with_size (bus,
       SELF_VIDEO_SECTION_WIDTH, SELF_VIDEO_SECTION_HEIGTH);
-  g_object_set (priv->video_preview, "sync", FALSE, "async", TRUE, NULL);
+  g_object_set (priv->video_preview,
+      "sync", FALSE,
+      "async", TRUE,
+      "flip-video", TRUE,
+      NULL);
 
   gtk_box_pack_start (GTK_BOX (priv->self_user_output_hbox),
       priv->video_preview, TRUE, TRUE, 0);
diff --git a/src/empathy-video-widget.c b/src/empathy-video-widget.c
index b4b39ff..492e192 100644
--- a/src/empathy-video-widget.c
+++ b/src/empathy-video-widget.c
@@ -55,6 +55,7 @@ enum {
   PROP_MIN_HEIGHT,
   PROP_SYNC,
   PROP_ASYNC,
+  PROP_FLIP_VIDEO,
 };
 
 /* private structure */
@@ -67,11 +68,13 @@ struct _EmpathyVideoWidgetPriv
   GstElement *videosink;
   GstPad *sink_pad;
   GstElement *overlay;
+  GstElement *flip;
   FsElementAddedNotifier *notifier;
   gint min_width;
   gint min_height;
   gboolean sync;
   gboolean async;
+  gboolean flip_video;
 
   GMutex *lock;
 };
@@ -138,14 +141,20 @@ empathy_video_widget_constructed (GObject *object)
 
   g_object_set (colorspace, "qos", FALSE, NULL);
 
+  priv->flip = gst_element_factory_make ("videoflip", NULL);
+  g_assert (priv->flip != NULL);
+
   gst_bin_add_many (GST_BIN (priv->videosink), colorspace, videoscale,
-    sink, NULL);
+    priv->flip, sink, NULL);
 
   if (!gst_element_link (colorspace, videoscale))
     g_error ("Failed to link ffmpegcolorspace and videoscale");
 
-  if (!gst_element_link (videoscale, sink))
-    g_error ("Failed to link videoscale and gconfvideosink");
+  if (!gst_element_link (videoscale, priv->flip))
+    g_error ("Failed to link videoscale and videoflip");
+
+  if (!gst_element_link (priv->flip, sink))
+    g_error ("Failed to link videoflip and gconfvideosink");
 
   pad = gst_element_get_static_pad (colorspace, "sink");
   g_assert (pad != NULL);
@@ -203,6 +212,11 @@ empathy_video_widget_set_property (GObject *object,
         empathy_video_widget_element_set_sink_properties (
           EMPATHY_VIDEO_WIDGET (object));
         break;
+      case PROP_FLIP_VIDEO:
+        priv->flip_video = g_value_get_boolean (value);
+        gst_util_set_object_arg (G_OBJECT (priv->flip), "method",
+            priv->flip_video ? "horizontal-flip" : "none");
+        break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
     }
@@ -234,6 +248,9 @@ empathy_video_widget_get_property (GObject *object,
       case PROP_ASYNC:
         g_value_set_boolean (value, priv->async);
         break;
+      case PROP_FLIP_VIDEO:
+        g_value_set_boolean (value, priv->flip_video);
+        break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
     }
@@ -301,6 +318,13 @@ empathy_video_widget_class_init (
     TRUE,
     G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
   g_object_class_install_property (object_class, PROP_ASYNC, param_spec);
+
+  param_spec = g_param_spec_boolean ("flip-video",
+    "flip video",
+    "Whether the video should be flipped horizontally or not",
+    FALSE,
+    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+  g_object_class_install_property (object_class, PROP_FLIP_VIDEO, param_spec);
 }
 
 void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]