[PATCH] Support sharing X11 display pipeline

Nicolas Dufresne nicolas.dufresne at collabora.com
Mon Oct 17 19:28:48 PDT 2011


---
 src/backend/bacon-video-widget-gst-0.10.c |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 91e531e..6106903 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -50,6 +50,7 @@
 #include <gst/interfaces/colorbalance.h>
 /* for detecting sources of errors */
 #include <gst/video/gstvideosink.h>
+#include <gst/video/gstvideocontext.h>
 #include <gst/video/video.h>
 #include <gst/audio/gstbaseaudiosink.h>
 /* for pretty multichannel strings */
@@ -90,6 +91,10 @@
 #include "bacon-video-widget-enums.h"
 #include "video-utils.h"
 
+#if CLUTTER_WINDOWING_X11
+#include <clutter/x11/clutter-x11.h>
+#endif
+
 #define DEFAULT_USER_AGENT "Videos/"VERSION
 
 #define OSD_SIZE 130                           /* Size of the OSD popup */
@@ -5815,6 +5820,23 @@ bvw_set_playback_direction (BaconVideoWidget *bvw, gboolean forward)
   return retval;
 }
 
+#if CLUTTER_WINDOWING_X11
+static GstBusSyncReply
+on_sync_message (GstBus * bus, GstMessage * message, gpointer display)
+{
+  GstVideoContext *context;
+
+  if (gst_video_context_message_parse_prepare (message, NULL, &context))
+    {
+      gst_video_context_set_context_pointer (context, "x11-display", display);
+      gst_message_unref (message);
+      return GST_BUS_DROP;
+    }
+
+  return GST_BUS_PASS;
+}
+#endif
+
 static gboolean
 bacon_video_widget_initable_init (GInitable     *initable,
 				  GCancellable  *cancellable,
@@ -5868,6 +5890,11 @@ bacon_video_widget_initable_init (GInitable     *initable,
                         G_CALLBACK (bvw_bus_message_cb),
                         bvw);
 
+#if CLUTTER_WINDOWING_X11
+  gst_bus_set_sync_handler (bvw->priv->bus, on_sync_message,
+      clutter_x11_get_default_display ());
+#endif
+
   bvw->priv->speakersetup = BVW_AUDIO_SOUND_STEREO;
   bvw->priv->visq = BVW_VISUALIZATION_SMALL;
   bvw->priv->show_vfx = FALSE;
-- 
1.7.10.2


--=-c7tDP4m4G4WXGoE7rFpT--



More information about the gstreamer-devel mailing list