emotion: add basic xoverlay infrastructure to emotion. not ready at all yet.
authorCedric BAIL <cedric.bail@free.fr>
Mon, 19 Sep 2011 15:33:02 +0000 (15:33 +0000)
committerCedric BAIL <cedric.bail@free.fr>
Mon, 19 Sep 2011 15:33:02 +0000 (15:33 +0000)
SVN revision: 63482

legacy/emotion/configure.ac
legacy/emotion/src/modules/gstreamer/Makefile.am
legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h
legacy/emotion/src/modules/gstreamer/emotion_sink.c

index d431700..fa12e68 100644 (file)
@@ -251,6 +251,54 @@ PKG_CHECK_MODULES([EIO],
 
 AM_CONDITIONAL([HAVE_EIO], [test "x${have_eio}" = "xyes"])
 
+## Check Ecore-X availability, used for XV, VAAPI, VDPAU output.
+
+have_ecore_x="no"
+want_ecore_x="auto"
+AC_ARG_ENABLE([ecore-x],
+   [AC_HELP_STRING([--disable-ecore-x], [disable ecore-x support. @<:@default=detect@:>@])],
+   [want_ecore_x=$enableval], [])
+
+if test "x$want_ecore_x" != "xno"; then
+   PKG_CHECK_MODULES([ECORE_X],
+      [ecore-x >= 1.0.0],
+      [
+       AC_DEFINE(HAVE_ECORE_X, 1, [X11 support for Ecore])
+       have_ecore_x="yes"
+       requirement_elm="ecore-x >= 1.0.0 ${requirement_elm}"
+      ],
+      [have_ecore_x="no"]
+   )
+else
+    have_ecore_x="no"
+fi
+if test "x$want_ecore_x" = "xyes" -a "x$have_ecore_x" = "xno"; then
+    AC_MSG_ERROR([ecore-x support requested, but not found by pkg-config.])
+fi
+
+## Check if gstreamer X Overlay is available
+build_xoverlay="no"
+if test "x$enable_gstreamer" = "xyes"; then
+   save_CFLAGS=$CFLAGS
+   CFLAGS="$CFLAGS ${GSTREAMER_CFLAGS}"
+   AC_CHECK_HEADER([gst/interfaces/xoverlay.h],
+     [
+        AC_DEFINE(HAVE_XOVERLAY_H, 1, [Build with Gstreamer Xoverlay support])
+       build_xoverlay="yes"
+     ], [
+       build_xoverlay="no"
+     ]
+   )
+   CFLAGS=$save_CFLAGS
+   if test "x${build_xoverlay}" = "xyes"; then
+      PKG_CHECK_MODULES([GSTREAMER_INTERFACE],
+       [ gstreamer-interfaces-0.10 >= 0.10.34 ],
+       [ build_xoverlay="yes" ],
+       [ build_xoverlay="no" ]
+      )
+   fi
+fi
+
 ### install and build examples
 
 EFL_CHECK_BUILD_EXAMPLES([enable_build_examples="yes"], [enable_build_examples="no"])
@@ -293,7 +341,7 @@ echo "Configuration Options Summary:"
 echo
 echo "  Modules:"
 echo "    Xine...............: ${enable_xine}"
-echo "    Gstreamer..........: ${enable_gstreamer}"
+echo "    Gstreamer..........: ${enable_gstreamer} (X: ${have_ecore_x}/${build_xoverlay})"
 echo "    Generic............: ${enable_generic}"
 
 if test "x${enable_generic}" = "xyes" || test "x${enable_generic}" = "xstatic"; then
index ac4b81c..8ac1d2f 100644 (file)
@@ -9,7 +9,9 @@ AM_CPPFLAGS = \
 @EMOTION_CFLAGS@ \
 @EMOTION_CPPFLAGS@ \
 @EFL_EMOTION_BUILD@ \
-@GSTREAMER_CFLAGS@
+@GSTREAMER_CFLAGS@ \
+@GSTREAMER_INTERFACE_CFLAGS@ \
+@ECORE_X_CFLAGS@
 
 if EMOTION_BUILD_GSTREAMER
 if !EMOTION_STATIC_BUILD_GSTREAMER
@@ -21,7 +23,7 @@ gstreamer_la_SOURCES = \
 emotion_gstreamer.c \
 emotion_sink.c \
 emotion_alloc.c
-gstreamer_la_LIBADD  = @GSTREAMER_LIBS@ $(top_builddir)/src/lib/libemotion.la
+gstreamer_la_LIBADD  = @ECORE_X_LIBS@ @GSTREAMER_LIBS@ @GSTREAMER_INTERFACE_LIBS@ $(top_builddir)/src/lib/libemotion.la
 gstreamer_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version
 gstreamer_la_LIBTOOLFLAGS = --tag=disable-static
 gstreamer_la_DEPENDENCIES = $(top_builddir)/config.h
index 6a27d9c..ce903ee 100644 (file)
@@ -396,6 +396,9 @@ em_shutdown(void *video)
 
        ev->pipeline = NULL;
        ev->sink = NULL;
+
+       if (ev->win) ecore_x_window_free(ev->win);
+       ev->win = 0;
      }
 
    EINA_LIST_FREE(ev->audio_streams, astream)
index d4a15c1..fbcde1e 100644 (file)
@@ -1,9 +1,21 @@
 #ifndef __EMOTION_GSTREAMER_H__
 #define __EMOTION_GSTREAMER_H__
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <Evas.h>
 #include <Ecore.h>
 
+#ifdef HAVE_ECORE_X
+# include <Ecore_X.h>
+# ifdef HAVE_XOVERLAY_H
+#  include <gst/interfaces/xoverlay.h>
+# endif
+#endif
+
+
 #define HTTP_STREAM 0
 #define RTSP_STREAM 1
 #include <glib.h>
@@ -93,6 +105,10 @@ struct _Emotion_Gstreamer_Video
 
    Emotion_Gstreamer_Metadata *metadata;
 
+#ifdef HAVE_ECORE_X
+   Ecore_X_Window    win;
+#endif
+
    Emotion_Vis       vis;
 
    int               in;
index fe8c44c..d9a2392 100644 (file)
@@ -1,5 +1,3 @@
-#include <Ecore.h>
-
 #include "emotion_gstreamer.h"
 
 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE("sink",
@@ -992,9 +990,13 @@ gstreamer_video_sink_new(Emotion_Gstreamer_Video *ev,
                         const char *uri)
 {
    GstElement *playbin;
-   GstElement *sink;
+   GstElement *sink = NULL;
    Evas_Object *obj;
    int flags;
+#if defined HAVE_ECORE_X && defined HAVE_XOVERLAY_H
+   const char *engine;
+   Eina_List *engines;
+#endif
 
    obj = emotion_object_image_get(o);
    if (!obj)
@@ -1016,21 +1018,58 @@ gstreamer_video_sink_new(Emotion_Gstreamer_Video *ev,
         return NULL;
      }
 
-   sink = gst_element_factory_make("emotion-sink", "sink");
+#if defined HAVE_ECORE_X && defined HAVE_XOVERLAY_H
+   engines = evas_render_method_list();
+
+   engine = eina_list_nth(engines, evas_output_method_get(evas_object_evas_get(obj)) - 1);
+
+   if (engine && strstr(engine, "_x11") != NULL)
+     {
+#if 0
+        Evas_Coord x, y, w, h;
+       Ecore_X_Window win;
+
+       evas_object_geometry_get(obj, &x, &y, &w, &h);
+
+       win = ecore_x_window_new(0, x, y, w, h);
+       if (win)
+         {
+            sink = gst_element_factory_make("xvimagesink", NULL);
+            if (sink)
+              {
+                 gst_x_overlay_set_window_handle(GST_X_OVERLAY(sink), win);
+                 ev->win = win;
+              }
+            else
+              {
+                 ecore_x_window_free(win);
+              }
+         }
+#endif
+     }
+   evas_render_method_list_free(engines);
+#else
+# warning "no ecore_x or xoverlay"
+#endif
+   fprintf(stderr, "sink: %p\n", sink);
    if (!sink)
      {
-        ERR("Unable to create 'emotion-sink' GstElement.");
-        goto unref_pipeline;
+        sink = gst_element_factory_make("emotion-sink", "sink");
+       if (!sink)
+         {
+            ERR("Unable to create 'emotion-sink' GstElement.");
+            goto unref_pipeline;
+         }
+
+       g_object_set(G_OBJECT(sink), "evas-object", obj, NULL);
+       g_object_set(G_OBJECT(sink), "ev", ev, NULL);
+
+       evas_object_image_pixels_get_callback_set(obj, NULL, NULL);
      }
 
 #define GST_PLAY_FLAG_NATIVE_VIDEO  (1 << 6)
 #define GST_PLAY_FLAG_DOWNLOAD      (1 << 7)
 
-   g_object_set(G_OBJECT(sink), "evas-object", obj, NULL);
-   g_object_set(G_OBJECT(sink), "ev", ev, NULL);
-
-   evas_object_image_pixels_get_callback_set(obj, NULL, NULL);
-
    g_object_get(G_OBJECT(playbin), "flags", &flags, NULL);
    g_object_set(G_OBJECT(playbin), "flags", flags | GST_PLAY_FLAG_NATIVE_VIDEO | GST_PLAY_FLAG_DOWNLOAD, NULL);
    g_object_set(G_OBJECT(playbin), "video-sink", sink, NULL);