965da34
Index: wxwidgets3.0-3.0.2+dfsg/configure.in
965da34
===================================================================
965da34
--- wxwidgets3.0-3.0.2+dfsg.orig/configure.in
965da34
+++ wxwidgets3.0-3.0.2+dfsg/configure.in
965da34
@@ -7543,43 +7543,22 @@ if test "$wxUSE_MEDIACTRL" = "yes" -o "$
965da34
         wxUSE_GSTREAMER="no"
965da34
 
965da34
         dnl -------------------------------------------------------------------
965da34
-        dnl Test for at least 0.8 gstreamer module from pkg-config
965da34
-        dnl Even totem doesn't accept 0.9 evidently.
965da34
-        dnl
965da34
-        dnl So, we first check to see if 0.10 if available - if not we
965da34
-        dnl try the older 0.8 version
965da34
+        dnl Test for at least gstreamer 1.0 module from pkg-config
965da34
         dnl -------------------------------------------------------------------
965da34
-        GST_VERSION_MAJOR=0
965da34
-        GST_VERSION_MINOR=10
965da34
+        GST_VERSION_MAJOR=1
965da34
+        GST_VERSION_MINOR=0
965da34
         GST_VERSION=$GST_VERSION_MAJOR.$GST_VERSION_MINOR
965da34
 
965da34
-        if test "$wxUSE_GSTREAMER8" = "no"; then
965da34
-            PKG_CHECK_MODULES(GST,
965da34
-                [gstreamer-$GST_VERSION gstreamer-plugins-base-$GST_VERSION],
965da34
-                [
965da34
-                    wxUSE_GSTREAMER="yes"
965da34
-                    GST_LIBS="$GST_LIBS -lgstinterfaces-$GST_VERSION"
965da34
-                ],
965da34
-                [
965da34
-                    AC_MSG_WARN([GStreamer 0.10 not available, falling back to 0.8])
965da34
-                    GST_VERSION_MINOR=8
965da34
-                ]
965da34
-            )
965da34
-        else
965da34
-            dnl check only for 0.8
965da34
-            GST_VERSION_MINOR=8
965da34
-        fi
965da34
-
965da34
-        if test $GST_VERSION_MINOR = "8"; then
965da34
-            GST_VERSION=$GST_VERSION_MAJOR.$GST_VERSION_MINOR
965da34
-            PKG_CHECK_MODULES(GST,
965da34
-                [gstreamer-$GST_VERSION gstreamer-interfaces-$GST_VERSION gstreamer-gconf-$GST_VERSION],
965da34
-                wxUSE_GSTREAMER="yes",
965da34
-                [
965da34
-                    AC_MSG_WARN([GStreamer 0.8/0.10 not available.])
965da34
-                ])
965da34
-        fi
965da34
-
965da34
+        PKG_CHECK_MODULES(GST,
965da34
+            [gstreamer-$GST_VERSION gstreamer-plugins-base-$GST_VERSION],
965da34
+            [
965da34
+                wxUSE_GSTREAMER="yes"
965da34
+                GST_LIBS="$GST_LIBS -lgstvideo-$GST_VERSION"
965da34
+            ],
965da34
+            [
965da34
+                AC_MSG_WARN([GStreamer 1.0 not available])
965da34
+            ]
965da34
+        )
965da34
 
965da34
         if test "$wxUSE_GSTREAMER" = "yes"; then
965da34
             CPPFLAGS="$GST_CFLAGS $CPPFLAGS"
965da34
Index: wxwidgets3.0-3.0.2+dfsg/src/unix/mediactrl.cpp
965da34
===================================================================
965da34
--- wxwidgets3.0-3.0.2+dfsg.orig/src/unix/mediactrl.cpp
965da34
+++ wxwidgets3.0-3.0.2+dfsg/src/unix/mediactrl.cpp
965da34
@@ -19,13 +19,7 @@
965da34
 
965da34
 #include <gst/gst.h>                // main gstreamer header
965da34
 
965da34
-// xoverlay/video stuff, gst-gconf for 0.8
965da34
-#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10
965da34
-#   include <gst/interfaces/xoverlay.h>
965da34
-#else
965da34
-#   include <gst/xoverlay/xoverlay.h>
965da34
-#   include <gst/gconf/gconf.h>        // gstreamer glib configuration
965da34
-#endif
965da34
+#include <gst/video/videooverlay.h>
965da34
 
965da34
 #ifndef  WX_PRECOMP
965da34
     #include "wx/log.h"             // wxLogDebug/wxLogSysError/wxLogTrace
965da34
@@ -48,11 +42,11 @@
965da34
 //-----------------------------------------------------------------------------
965da34
 
965da34
 /*
965da34
-   This is the GStreamer backend for unix. Currently we require 0.8 or
965da34
-   0.10. Here we use the "playbin" GstElement for ease of use.
965da34
+   This is the GStreamer backend for unix. Currently we require 1.0.
965da34
+   Here we use the "playbin" GstElement for ease of use.
965da34
 
965da34
-   Note that now we compare state change functions to GST_STATE_FAILURE
965da34
-   now rather than GST_STATE_SUCCESS as newer gstreamer versions return
965da34
+   Note that now we compare state change functions to GST_STATE_CHANGE_FAILURE
965da34
+   now rather than GST_STATE_CHANGE_SUCCESS as newer gstreamer versions return
965da34
    non-success values for returns that are otherwise successful but not
965da34
    immediate.
965da34
 
965da34
@@ -60,11 +54,8 @@
965da34
    moment but with a tad bit of work it could theorectically work in
965da34
    straight wxX11 et al.
965da34
 
965da34
-   One last note is that resuming from pausing/seeking can result
965da34
-   in erratic video playback (GStreamer-based bug, happens in totem as well)
965da34
-   - this is better in 0.10, however. One thing that might make it worse
965da34
-   here is that we don't preserve the aspect ratio of the video and stretch
965da34
-   it to the whole window.
965da34
+   One last note is that we don't preserve the aspect ratio of the video and
965da34
+   stretch it to the whole window.
965da34
 
965da34
    Note that there are some things used here that could be undocumented -
965da34
    for reference see the media player Kiss and Totem as well as some
965da34
@@ -72,12 +63,10 @@
965da34
    that attempted thread-safety...
965da34
 
965da34
    Then there is the issue of m_asynclock. This serves several purposes:
965da34
-   1) It prevents the C callbacks from sending wx state change events
965da34
-      so that we don't get duplicate ones in 0.8
965da34
-   2) It makes the sync and async handlers in 0.10 not drop any
965da34
+   1) It makes the sync and async handlers not drop any
965da34
       messages so that while we are polling it we get the messages in
965da34
       SyncStateChange instead of the queue.
965da34
-   3) Keeps the pausing in Stop() synchronous
965da34
+   2) Keeps the pausing in Stop() synchronous
965da34
 
965da34
    RN: Note that I've tried to follow the wxGTK conventions here as close
965da34
    as possible. In the implementation the C Callbacks come first, then
965da34
@@ -90,43 +79,9 @@
965da34
 //=============================================================================
965da34
 
965da34
 //-----------------------------------------------------------------------------
965da34
-//  GStreamer (most version compatibility) macros
965da34
+//  GStreamer macros
965da34
 //-----------------------------------------------------------------------------
965da34
 
965da34
-// In 0.9 there was a HUGE change to GstQuery and the
965da34
-// gst_element_query function changed dramatically and split off
965da34
-// into two separate ones
965da34
-#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR <= 8
965da34
-#    define wxGst_element_query_duration(e, f, p) \
965da34
-                gst_element_query(e, GST_QUERY_TOTAL, f, p)
965da34
-#    define wxGst_element_query_position(e, f, p) \
965da34
-                gst_element_query(e, GST_QUERY_POSITION, f, p)
965da34
-#elif GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 9
965da34
-// However, the actual 0.9 version has a slightly different definition
965da34
-// and instead of gst_element_query_duration it has two parameters to
965da34
-// gst_element_query_position instead
965da34
-#    define wxGst_element_query_duration(e, f, p) \
965da34
-                gst_element_query_position(e, f, 0, p)
965da34
-#    define wxGst_element_query_position(e, f, p) \
965da34
-                gst_element_query_position(e, f, p, 0)
965da34
-#else
965da34
-#    define wxGst_element_query_duration \
965da34
-                gst_element_query_duration
965da34
-#    define wxGst_element_query_position \
965da34
-                gst_element_query_position
965da34
-#endif
965da34
-
965da34
-// Other 0.10 macros
965da34
-#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10
965da34
-#   define GST_STATE_FAILURE GST_STATE_CHANGE_FAILURE
965da34
-#   define GST_STATE_SUCCESS GST_STATE_CHANGE_SUCCESS
965da34
-#   define GstElementState GstState
965da34
-#   define gst_gconf_get_default_video_sink() \
965da34
-        gst_element_factory_make ("gconfvideosink", "video-sink");
965da34
-#   define gst_gconf_get_default_audio_sink() \
965da34
-        gst_element_factory_make ("gconfaudiosink", "audio-sink");
965da34
-#endif
965da34
-
965da34
 // Max wait time for element state waiting - GST_CLOCK_TIME_NONE for inf
965da34
 #define wxGSTREAMER_TIMEOUT (100 * GST_MSECOND) // Max 100 milliseconds
965da34
 
965da34
@@ -189,11 +144,11 @@ public:
965da34
     bool CheckForErrors();
965da34
     bool DoLoad(const wxString& locstring);
965da34
     wxMediaCtrl* GetControl() { return m_ctrl; } // for C Callbacks
965da34
-    void HandleStateChange(GstElementState oldstate, GstElementState newstate);
965da34
+    void HandleStateChange(GstState oldstate, GstState newstate);
965da34
     bool QueryVideoSizeFromElement(GstElement* element);
965da34
     bool QueryVideoSizeFromPad(GstPad* caps);
965da34
-    void SetupXOverlay();
965da34
-    bool SyncStateChange(GstElement* element, GstElementState state,
965da34
+    void SetupVideoOverlay();
965da34
+    bool SyncStateChange(GstElement* element, GstState state,
965da34
                          gint64 llTimeout = wxGSTREAMER_TIMEOUT);
965da34
     bool TryAudioSink(GstElement* audiosink);
965da34
     bool TryVideoSink(GstElement* videosink);
965da34
@@ -203,7 +158,7 @@ public:
965da34
     double          m_dRate;        // Current playback rate -
965da34
                                     // see GetPlaybackRate for notes
965da34
     wxLongLong      m_llPausedPos;  // Paused position - see Pause()
965da34
-    GstXOverlay*    m_xoverlay;     // X Overlay that contains the GST video
965da34
+    GstVideoOverlay*    m_videooverlay;     // Video Overlay that contains the GST video
965da34
     wxMutex         m_asynclock;    // See "discussion of internals"
965da34
     class wxGStreamerMediaEventHandler* m_eventHandler; // see below
965da34
 
965da34
@@ -284,7 +239,7 @@ expose_event(GtkWidget* widget, GdkEvent
965da34
 {
965da34
     // I've seen this recommended somewhere...
965da34
     // TODO: Is this needed? Maybe it is just cruft...
965da34
-    // gst_x_overlay_set_xwindow_id( GST_X_OVERLAY(be->m_xoverlay),
965da34
+    // gst_video_overlay_set_window_handle( GST_VIDEO_OVERLAY(be->m_videooverlay),
965da34
     //                              GDK_WINDOW_XWINDOW( window ) );
965da34
 
965da34
     // If we have actual video.....
965da34
@@ -294,7 +249,7 @@ expose_event(GtkWidget* widget, GdkEvent
965da34
         // GST Doesn't redraw automatically while paused
965da34
         // Plus, the video sometimes doesn't redraw when it looses focus
965da34
         // or is painted over so we just tell it to redraw...
965da34
-        gst_x_overlay_expose(be->m_xoverlay);
965da34
+        gst_video_overlay_expose(be->m_videooverlay);
965da34
     }
965da34
     else
965da34
     {
965da34
@@ -334,7 +289,7 @@ static gint gtk_window_realize_callback(
965da34
     GdkWindow* window = gtk_widget_get_window(widget);
965da34
     wxASSERT(window);
965da34
 
965da34
-    gst_x_overlay_set_xwindow_id( GST_X_OVERLAY(be->m_xoverlay),
965da34
+    gst_video_overlay_set_window_handle( GST_VIDEO_OVERLAY(be->m_videooverlay),
965da34
                                 GDK_WINDOW_XID(window)
965da34
                                 );
965da34
     GtkWidget* w = be->GetControl()->m_wxwindow;
965da34
@@ -349,30 +304,6 @@ static gint gtk_window_realize_callback(
965da34
 #endif // wxGTK
965da34
 
965da34
 //-----------------------------------------------------------------------------
965da34
-// "state-change" from m_playbin/GST_MESSAGE_STATE_CHANGE
965da34
-//
965da34
-// Called by gstreamer when the state changes - here we
965da34
-// send the appropriate corresponding wx event.
965da34
-//
965da34
-// 0.8 only as HandleStateChange does this in both versions
965da34
-//-----------------------------------------------------------------------------
965da34
-#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR < 10
965da34
-extern "C" {
965da34
-static void gst_state_change_callback(GstElement *play,
965da34
-                                      GstElementState oldstate,
965da34
-                                      GstElementState newstate,
965da34
-                                      wxGStreamerMediaBackend* be)
965da34
-{
965da34
-    if(be->m_asynclock.TryLock() == wxMUTEX_NO_ERROR)
965da34
-    {
965da34
-        be->HandleStateChange(oldstate, newstate);
965da34
-        be->m_asynclock.Unlock();
965da34
-    }
965da34
-}
965da34
-}
965da34
-#endif // <0.10
965da34
-
965da34
-//-----------------------------------------------------------------------------
965da34
 // "eos" from m_playbin/GST_MESSAGE_EOS
965da34
 //
965da34
 // Called by gstreamer when the media is done playing ("end of stream")
965da34
@@ -425,69 +356,17 @@ static void gst_notify_caps_callback(Gst
965da34
 }
965da34
 
965da34
 //-----------------------------------------------------------------------------
965da34
-// "notify::stream-info" from m_playbin
965da34
-//
965da34
-// Run through the stuff in "stream-info" of m_playbin for a valid
965da34
-// video pad, and then attempt to query the video size from it - if not
965da34
-// set up an event to do so when ready.
965da34
-//
965da34
-// Currently unused - now we just query it directly using
965da34
-// QueryVideoSizeFromElement.
965da34
-//
965da34
-// (Undocumented?)
965da34
-//-----------------------------------------------------------------------------
965da34
-#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10
965da34
-extern "C" {
965da34
-static void gst_notify_stream_info_callback(GstElement* WXUNUSED(element),
965da34
-                                            GParamSpec* WXUNUSED(pspec),
965da34
-                                            wxGStreamerMediaBackend* be)
965da34
-{
965da34
-    wxLogTrace(wxTRACE_GStreamer, wxT("gst_notify_stream_info_callback"));
965da34
-    be->QueryVideoSizeFromElement(be->m_playbin);
965da34
-}
965da34
-}
965da34
-#endif
965da34
-
965da34
-//-----------------------------------------------------------------------------
965da34
-// "desired-size-changed" from m_xoverlay
965da34
-//
965da34
-// 0.8-specific this provides us with the video size when it changes -
965da34
-// even though we get the caps as well this seems to come before the
965da34
-// caps notification does...
965da34
-//
965da34
-// Note it will return 16,16 for an early-bird value or for audio
965da34
-//-----------------------------------------------------------------------------
965da34
-#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR < 10
965da34
-extern "C" {
965da34
-static void gst_desired_size_changed_callback(GstElement * play,
965da34
-                                              guint width, guint height,
965da34
-                                              wxGStreamerMediaBackend* be)
965da34
-{
965da34
-    if(!(width == 16 && height == 16))
965da34
-    {
965da34
-        be->m_videoSize.x = width;
965da34
-        be->m_videoSize.y = height;
965da34
-    }
965da34
-    else
965da34
-        be->QueryVideoSizeFromElement(be->m_playbin);
965da34
-}
965da34
-}
965da34
-#endif
965da34
-
965da34
-//-----------------------------------------------------------------------------
965da34
 // gst_bus_async_callback [static]
965da34
 // gst_bus_sync_callback [static]
965da34
 //
965da34
-// Called by m_playbin for notifications such as end-of-stream in 0.10 -
965da34
-// in previous versions g_signal notifications were used. Because everything
965da34
+// Called by m_playbin for notifications such as end-of-stream. Because everything
965da34
 // in centered in one switch statement though it reminds one of old WinAPI
965da34
 // stuff.
965da34
 //
965da34
 // gst_bus_sync_callback is that sync version that is called on the main GUI
965da34
 // thread before the async version that we use to set the xwindow id of the
965da34
-// XOverlay (NB: This isn't currently used - see CreateControl()).
965da34
+// VideoOverlay (NB: This isn't currently used - see CreateControl()).
965da34
 //-----------------------------------------------------------------------------
965da34
-#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10
965da34
 extern "C" {
965da34
 static gboolean gst_bus_async_callback(GstBus* WXUNUSED(bus),
965da34
                                        GstMessage* message,
965da34
@@ -537,8 +416,7 @@ static GstBusSyncReply gst_bus_sync_call
965da34
 {
965da34
     // Pass a non-xwindowid-setting event on to the async handler where it
965da34
     // belongs
965da34
-    if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT ||
965da34
-        !gst_structure_has_name (message->structure, "prepare-xwindow-id"))
965da34
+    if (!gst_is_video_overlay_prepare_window_handle_message (message))
965da34
     {
965da34
         //
965da34
         // NB: Unfortunately, the async callback can be quite
965da34
@@ -552,12 +430,11 @@ static GstBusSyncReply gst_bus_sync_call
965da34
             return GST_BUS_DROP;
965da34
     }
965da34
 
965da34
-    wxLogTrace(wxTRACE_GStreamer, wxT("Got prepare-xwindow-id"));
965da34
-    be->SetupXOverlay();
965da34
+    wxLogTrace(wxTRACE_GStreamer, wxT("Got prepare-window-handle"));
965da34
+    be->SetupVideoOverlay();
965da34
     return GST_BUS_DROP; // We handled this message - drop from the queue
965da34
 }
965da34
 }
965da34
-#endif
965da34
 
965da34
 //-----------------------------------------------------------------------------
965da34
 //
965da34
@@ -569,11 +446,11 @@ static GstBusSyncReply gst_bus_sync_call
965da34
 // wxGStreamerMediaBackend::HandleStateChange
965da34
 //
965da34
 // Handles a state change event from our C Callback for "state-change" or
965da34
-// the async queue in 0.10. (Mostly this is here to avoid locking the
965da34
+// the async queue . (Mostly this is here to avoid locking the
965da34
 // the mutex twice...)
965da34
 //-----------------------------------------------------------------------------
965da34
-void wxGStreamerMediaBackend::HandleStateChange(GstElementState oldstate,
965da34
-                                                GstElementState newstate)
965da34
+void wxGStreamerMediaBackend::HandleStateChange(GstState oldstate,
965da34
+                                                GstState newstate)
965da34
 {
965da34
     switch(newstate)
965da34
     {
965da34
@@ -604,83 +481,13 @@ void wxGStreamerMediaBackend::HandleStat
965da34
 }
965da34
 
965da34
 //-----------------------------------------------------------------------------
965da34
-// wxGStreamerMediaBackend::QueryVideoSizeFromElement
965da34
-//
965da34
-// Run through the stuff in "stream-info" of element for a valid
965da34
-// video pad, and then attempt to query the video size from it - if not
965da34
-// set up an event to do so when ready. Return true
965da34
-// if we got a valid video pad.
965da34
-//-----------------------------------------------------------------------------
965da34
-bool wxGStreamerMediaBackend::QueryVideoSizeFromElement(GstElement* element)
965da34
-{
965da34
-    const GList *list = NULL;
965da34
-    g_object_get (G_OBJECT (element), "stream-info", &list, NULL);
965da34
-
965da34
-    for ( ; list != NULL; list = list->next)
965da34
-    {
965da34
-        GObject *info = (GObject *) list->data;
965da34
-        gint type;
965da34
-        GParamSpec *pspec;
965da34
-        GEnumValue *val;
965da34
-        GstPad *pad = NULL;
965da34
-
965da34
-        g_object_get (info, "type", &type, NULL);
965da34
-        pspec = g_object_class_find_property (
965da34
-                        G_OBJECT_GET_CLASS (info), "type");
965da34
-        val = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)->enum_class, type);
965da34
-
965da34
-        if (!strncasecmp(val->value_name, "video", 5) ||
965da34
-            !strncmp(val->value_name, "GST_STREAM_TYPE_VIDEO", 21))
965da34
-        {
965da34
-            // Newer gstreamer 0.8+ plugins are SUPPOSED to have "object"...
965da34
-            // but a lot of old plugins still use "pad" :)
965da34
-            pspec = g_object_class_find_property (
965da34
-                        G_OBJECT_GET_CLASS (info), "object");
965da34
-
965da34
-            if (!pspec)
965da34
-                g_object_get (info, "pad", &pad, NULL);
965da34
-            else
965da34
-                g_object_get (info, "object", &pad, NULL);
965da34
-
965da34
-#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR <= 8
965da34
-            // Killed in 0.9, presumely because events and such
965da34
-            // should be pushed on pads regardless of whether they
965da34
-            // are currently linked
965da34
-            pad = (GstPad *) GST_PAD_REALIZE (pad);
965da34
-            wxASSERT(pad);
965da34
-#endif
965da34
-
965da34
-            if(!QueryVideoSizeFromPad(pad))
965da34
-            {
965da34
-                // wait for those caps to get ready
965da34
-                g_signal_connect(
965da34
-                pad,
965da34
-                "notify::caps",
965da34
-                G_CALLBACK(gst_notify_caps_callback),
965da34
-                this);
965da34
-            }
965da34
-            break;
965da34
-        }// end if video
965da34
-    }// end searching through info list
965da34
-
965da34
-    // no video (or extremely delayed stream-info)
965da34
-    if(list == NULL)
965da34
-    {
965da34
-        m_videoSize = wxSize(0,0);
965da34
-        return false;
965da34
-    }
965da34
-
965da34
-    return true;
965da34
-}
965da34
-
965da34
-//-----------------------------------------------------------------------------
965da34
 // wxGStreamerMediaBackend::QueryVideoSizeFromPad
965da34
 //
965da34
 // Gets the size of our video (in wxSize) from a GstPad
965da34
 //-----------------------------------------------------------------------------
965da34
 bool wxGStreamerMediaBackend::QueryVideoSizeFromPad(GstPad* pad)
965da34
 {
965da34
-    const GstCaps* caps = GST_PAD_CAPS(pad);
965da34
+    GstCaps* caps = gst_pad_get_current_caps(pad);
965da34
     if ( caps )
965da34
     {
965da34
         const GstStructure *s = gst_caps_get_structure (caps, 0);
965da34
@@ -706,23 +513,26 @@ bool wxGStreamerMediaBackend::QueryVideo
965da34
                 m_videoSize.y = (int) ((float) den * m_videoSize.y / num);
965da34
         }
965da34
 
965da34
-         wxLogTrace(wxTRACE_GStreamer, wxT("Adjusted video size: [%i,%i]"),
965da34
-                     m_videoSize.x, m_videoSize.y);
965da34
+        wxLogTrace(wxTRACE_GStreamer, wxT("Adjusted video size: [%i,%i]"),
965da34
+                    m_videoSize.x, m_videoSize.y);
965da34
+
965da34
+        gst_caps_unref (caps);
965da34
         return true;
965da34
     } // end if caps
965da34
 
965da34
+    m_videoSize = wxSize(0,0);
965da34
     return false; // not ready/massive failure
965da34
 }
965da34
 
965da34
 //-----------------------------------------------------------------------------
965da34
-// wxGStreamerMediaBackend::SetupXOverlay
965da34
+// wxGStreamerMediaBackend::SetupVideoOverlay
965da34
 //
965da34
-// Attempts to set the XWindow id of our GstXOverlay to tell it which
965da34
+// Attempts to set the XWindow id of our GstVideoOverlay to tell it which
965da34
 // window to play video in.
965da34
 //-----------------------------------------------------------------------------
965da34
-void wxGStreamerMediaBackend::SetupXOverlay()
965da34
+void wxGStreamerMediaBackend::SetupVideoOverlay()
965da34
 {
965da34
-    // Use the xoverlay extension to tell gstreamer to play in our window
965da34
+    // Use the videooverlay extension to tell gstreamer to play in our window
965da34
 #ifdef __WXGTK__
965da34
     if (!gtk_widget_get_realized(m_ctrl->m_wxwindow))
965da34
     {
965da34
@@ -739,7 +549,7 @@ void wxGStreamerMediaBackend::SetupXOver
965da34
         GdkWindow* window = gtk_widget_get_window(m_ctrl->m_wxwindow);
965da34
         wxASSERT(window);
965da34
 #endif
965da34
-        gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_xoverlay),
965da34
+        gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videooverlay),
965da34
 #ifdef __WXGTK__
965da34
                         GDK_WINDOW_XID(window)
965da34
 #else
965da34
@@ -769,9 +579,8 @@ void wxGStreamerMediaBackend::SetupXOver
965da34
 //
965da34
 // PRECONDITION: Assumes m_asynclock is Lock()ed
965da34
 //-----------------------------------------------------------------------------
965da34
-#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10
965da34
 bool wxGStreamerMediaBackend::SyncStateChange(GstElement* element,
965da34
-                                              GstElementState desiredstate,
965da34
+                                              GstState desiredstate,
965da34
                                               gint64 llTimeout)
965da34
 {
965da34
     GstBus* bus = gst_element_get_bus(element);
965da34
@@ -844,23 +653,6 @@ bool wxGStreamerMediaBackend::SyncStateC
965da34
 
965da34
     return bSuccess;
965da34
 }
965da34
-#else // 0.8 implementation
965da34
-bool wxGStreamerMediaBackend::SyncStateChange(GstElement* element,
965da34
-                                              GstElementState desiredstate,
965da34
-                                              gint64 llTimeout)
965da34
-{
965da34
-    gint64 llTimeWaited = 0;
965da34
-    while(GST_STATE(element) != desiredstate)
965da34
-    {
965da34
-        if(llTimeWaited >= llTimeout)
965da34
-            break;
965da34
-        llTimeWaited += 10*GST_MSECOND;
965da34
-        wxMilliSleep(10);
965da34
-    }
965da34
-
965da34
-    return llTimeWaited != llTimeout;
965da34
-}
965da34
-#endif
965da34
 
965da34
 //-----------------------------------------------------------------------------
965da34
 // wxGStreamerMediaBackend::TryAudioSink
965da34
@@ -884,25 +676,25 @@ bool wxGStreamerMediaBackend::TryAudioSi
965da34
 
965da34
 bool wxGStreamerMediaBackend::TryVideoSink(GstElement* videosink)
965da34
 {
965da34
-    // Check if the video sink either is an xoverlay or might contain one...
965da34
-    if( !GST_IS_BIN(videosink) && !GST_IS_X_OVERLAY(videosink) )
965da34
+    // Check if the video sink either is an videooverlay or might contain one...
965da34
+    if( !GST_IS_BIN(videosink) && !GST_IS_VIDEO_OVERLAY(videosink) )
965da34
     {
965da34
         if(G_IS_OBJECT(videosink))
965da34
             g_object_unref(videosink);
965da34
         return false;
965da34
     }
965da34
 
965da34
-    // Make our video sink and make sure it supports the x overlay interface
965da34
-    // the x overlay enables us to put the video in our control window
965da34
+    // Make our video sink and make sure it supports the video overlay interface
965da34
+    // the video overlay enables us to put the video in our control window
965da34
     // (i.e. we NEED it!) - also connect to the natural video size change event
965da34
     if( GST_IS_BIN(videosink) )
965da34
-        m_xoverlay = (GstXOverlay*)
965da34
+        m_videooverlay = (GstVideoOverlay*)
965da34
                         gst_bin_get_by_interface (GST_BIN (videosink),
965da34
-                                                  GST_TYPE_X_OVERLAY);
965da34
+                                                  GST_TYPE_VIDEO_OVERLAY);
965da34
     else
965da34
-        m_xoverlay = (GstXOverlay*) videosink;
965da34
+        m_videooverlay = (GstVideoOverlay*) videosink;
965da34
 
965da34
-    if ( !GST_IS_X_OVERLAY(m_xoverlay) )
965da34
+    if ( !GST_IS_VIDEO_OVERLAY(m_videooverlay) )
965da34
     {
965da34
         g_object_unref(videosink);
965da34
         return false;
965da34
@@ -1046,11 +838,7 @@ bool wxGStreamerMediaBackend::CreateCont
965da34
     //Really init gstreamer
965da34
     gboolean bInited;
965da34
     GError* error = NULL;
965da34
-#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10
965da34
     bInited = gst_init_check(&argcGST, &argvGST, &error);
965da34
-#else
965da34
-    bInited = gst_init_check(&argcGST, &argvGST);
965da34
-#endif
965da34
 
965da34
     // Cleanup arguments for unicode case
965da34
 #if wxUSE_UNICODE
965da34
@@ -1117,78 +905,52 @@ bool wxGStreamerMediaBackend::CreateCont
965da34
         return false;
965da34
     }
965da34
 
965da34
-#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR < 10
965da34
-    // Connect the glib events/callbacks we want to our playbin
965da34
-    g_signal_connect(m_playbin, "eos",
965da34
-                     G_CALLBACK(gst_finish_callback), this);
965da34
-    g_signal_connect(m_playbin, "error",
965da34
-                     G_CALLBACK(gst_error_callback), this);
965da34
-    g_signal_connect(m_playbin, "state-change",
965da34
-                     G_CALLBACK(gst_state_change_callback), this);
965da34
-#else
965da34
-    // GStreamer 0.10+ uses GstBus for this now, connect to the sync
965da34
-    // handler as well so we can set the X window id of our xoverlay
965da34
+    // GStreamer uses GstBus for this now, connect to the sync
965da34
+    // handler as well so we can set the video window id of our videooverlay
965da34
     gst_bus_add_watch (gst_element_get_bus(m_playbin),
965da34
                        (GstBusFunc) gst_bus_async_callback, this);
965da34
     gst_bus_set_sync_handler(gst_element_get_bus(m_playbin),
965da34
-                             (GstBusSyncHandler) gst_bus_sync_callback, this);
965da34
-    g_signal_connect(m_playbin, "notify::stream-info",
965da34
-                     G_CALLBACK(gst_notify_stream_info_callback), this);
965da34
-#endif
965da34
+                             (GstBusSyncHandler) gst_bus_sync_callback, this, NULL);
965da34
 
965da34
     // Get the audio sink
965da34
-    GstElement* audiosink = gst_gconf_get_default_audio_sink();
965da34
+    // Use autodetection, then alsa, then oss as a stopgap
965da34
+    GstElement* audiosink = gst_element_factory_make ("autoaudiosink", "audio-sink");
965da34
     if( !TryAudioSink(audiosink) )
965da34
     {
965da34
-        // fallback to autodetection, then alsa, then oss as a stopgap
965da34
-        audiosink = gst_element_factory_make ("autoaudiosink", "audio-sink");
965da34
+        audiosink = gst_element_factory_make ("alsasink", "alsa-output");
965da34
         if( !TryAudioSink(audiosink) )
965da34
         {
965da34
-            audiosink = gst_element_factory_make ("alsasink", "alsa-output");
965da34
+            audiosink = gst_element_factory_make ("osssink", "play_audio");
965da34
             if( !TryAudioSink(audiosink) )
965da34
             {
965da34
-                audiosink = gst_element_factory_make ("osssink", "play_audio");
965da34
-                if( !TryAudioSink(audiosink) )
965da34
-                {
965da34
-                    wxLogSysError(wxT("Could not find a valid audiosink"));
965da34
-                    return false;
965da34
-                }
965da34
+                wxLogSysError(wxT("Could not find a valid audiosink"));
965da34
+                return false;
965da34
             }
965da34
         }
965da34
     }
965da34
 
965da34
     // Setup video sink - first try gconf, then auto, then xvimage and
965da34
     // then finally plain ximage
965da34
-    GstElement* videosink = gst_gconf_get_default_video_sink();
965da34
+    GstElement* videosink = gst_element_factory_make ("autovideosink", "video-sink");
965da34
     if( !TryVideoSink(videosink) )
965da34
     {
965da34
-        videosink = gst_element_factory_make ("autovideosink", "video-sink");
965da34
+        videosink = gst_element_factory_make ("xvimagesink", "video-sink");
965da34
         if( !TryVideoSink(videosink) )
965da34
         {
965da34
-            videosink = gst_element_factory_make ("xvimagesink", "video-sink");
965da34
+            // finally, do a final fallback to ximagesink
965da34
+            videosink =
965da34
+                gst_element_factory_make ("ximagesink", "video-sink");
965da34
             if( !TryVideoSink(videosink) )
965da34
             {
965da34
-                // finally, do a final fallback to ximagesink
965da34
-                videosink =
965da34
-                    gst_element_factory_make ("ximagesink", "video-sink");
965da34
-                if( !TryVideoSink(videosink) )
965da34
-                {
965da34
-                    g_object_unref(audiosink);
965da34
-                    wxLogSysError(wxT("Could not find a suitable video sink"));
965da34
-                    return false;
965da34
-                }
965da34
+                g_object_unref(audiosink);
965da34
+                wxLogSysError(wxT("Could not find a suitable video sink"));
965da34
+                return false;
965da34
             }
965da34
         }
965da34
     }
965da34
 
965da34
-#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR < 10
965da34
-    // Not on 0.10... called when video size changes
965da34
-    g_signal_connect(m_xoverlay, "desired-size-changed",
965da34
-                     G_CALLBACK(gst_desired_size_changed_callback), this);
965da34
-#endif
965da34
-    // Tell GStreamer which window to draw to in 0.8 - 0.10
965da34
-    // sometimes needs this too...
965da34
-    SetupXOverlay();
965da34
+    // Tell GStreamer which window to draw to
965da34
+    SetupVideoOverlay();
965da34
 
965da34
     // Now that we know (or, rather think) our video and audio sink
965da34
     // are valid set our playbin to use them
965da34
@@ -1197,6 +959,10 @@ bool wxGStreamerMediaBackend::CreateCont
965da34
                   "audio-sink", audiosink,
965da34
                    NULL);
965da34
 
965da34
+    GstPad *video_sinkpad = gst_element_get_static_pad (videosink, "sink");
965da34
+    g_signal_connect (video_sinkpad, "notify::caps", G_CALLBACK (gst_notify_caps_callback), this);
965da34
+    gst_object_unref (video_sinkpad);
965da34
+
965da34
     m_eventHandler = new wxGStreamerMediaEventHandler(this);
965da34
     return true;
965da34
 }
965da34
@@ -1213,26 +979,10 @@ bool wxGStreamerMediaBackend::Load(const
965da34
 
965da34
 //-----------------------------------------------------------------------------
965da34
 // wxGStreamerMediaBackend::Load (URI version)
965da34
-//
965da34
-// In the case of a file URI passes it unencoded -
965da34
-// also, as of 0.10.3 and earlier GstURI (the uri parser for gstreamer)
965da34
-// is sort of broken and only accepts uris with at least two slashes
965da34
-// after the scheme (i.e. file: == not ok, file:// == ok)
965da34
 //-----------------------------------------------------------------------------
965da34
 bool wxGStreamerMediaBackend::Load(const wxURI& location)
965da34
 {
965da34
-    if(location.GetScheme().CmpNoCase(wxT("file")) == 0)
965da34
-    {
965da34
-        wxString uristring = location.BuildUnescapedURI();
965da34
-
965da34
-        //Workaround GstURI leading "//" problem and make sure it leads
965da34
-        //with that
965da34
-        return DoLoad(wxString(wxT("file://")) +
965da34
-                      uristring.Right(uristring.length() - 5)
965da34
-                     );
965da34
-    }
965da34
-    else
965da34
-        return DoLoad(location.BuildURI());
965da34
+    return DoLoad(location.BuildURI());
965da34
 }
965da34
 
965da34
 //-----------------------------------------------------------------------------
965da34
@@ -1258,7 +1008,7 @@ bool wxGStreamerMediaBackend::DoLoad(con
965da34
 
965da34
     // Set playbin to ready to stop the current media...
965da34
     if( gst_element_set_state (m_playbin,
965da34
-                               GST_STATE_READY) == GST_STATE_FAILURE ||
965da34
+                               GST_STATE_READY) == GST_STATE_CHANGE_FAILURE ||
965da34
         !SyncStateChange(m_playbin, GST_STATE_READY))
965da34
     {
965da34
         CheckForErrors();
965da34
@@ -1281,7 +1031,7 @@ bool wxGStreamerMediaBackend::DoLoad(con
965da34
     // Try to pause media as gstreamer won't let us query attributes
965da34
     // such as video size unless it is paused or playing
965da34
     if( gst_element_set_state (m_playbin,
965da34
-                               GST_STATE_PAUSED) == GST_STATE_FAILURE ||
965da34
+                               GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE ||
965da34
         !SyncStateChange(m_playbin, GST_STATE_PAUSED))
965da34
     {
965da34
         CheckForErrors();
965da34
@@ -1307,12 +1057,11 @@ bool wxGStreamerMediaBackend::DoLoad(con
965da34
 //
965da34
 // Sets the stream to a playing state
965da34
 //
965da34
-// THREAD-UNSAFE in 0.8, maybe in 0.10 as well
965da34
 //-----------------------------------------------------------------------------
965da34
 bool wxGStreamerMediaBackend::Play()
965da34
 {
965da34
     if (gst_element_set_state (m_playbin,
965da34
-                               GST_STATE_PLAYING) == GST_STATE_FAILURE)
965da34
+                               GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE)
965da34
     {
965da34
         CheckForErrors();
965da34
         return false;
965da34
@@ -1326,13 +1075,12 @@ bool wxGStreamerMediaBackend::Play()
965da34
 //
965da34
 // Marks where we paused and pauses the stream
965da34
 //
965da34
-// THREAD-UNSAFE in 0.8, maybe in 0.10 as well
965da34
 //-----------------------------------------------------------------------------
965da34
 bool wxGStreamerMediaBackend::Pause()
965da34
 {
965da34
     m_llPausedPos = wxGStreamerMediaBackend::GetPosition();
965da34
     if (gst_element_set_state (m_playbin,
965da34
-                               GST_STATE_PAUSED) == GST_STATE_FAILURE)
965da34
+                               GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE)
965da34
     {
965da34
         CheckForErrors();
965da34
         return false;
965da34
@@ -1353,7 +1101,7 @@ bool wxGStreamerMediaBackend::Stop()
965da34
     {   // begin state lock
965da34
         wxMutexLocker lock(m_asynclock);
965da34
         if(gst_element_set_state (m_playbin,
965da34
-                                  GST_STATE_PAUSED) == GST_STATE_FAILURE ||
965da34
+                                  GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE ||
965da34
           !SyncStateChange(m_playbin, GST_STATE_PAUSED))
965da34
         {
965da34
             CheckForErrors();
965da34
@@ -1417,10 +1165,8 @@ wxLongLong wxGStreamerMediaBackend::GetP
965da34
     else
965da34
     {
965da34
         gint64 pos;
965da34
-        GstFormat fmtTime = GST_FORMAT_TIME;
965da34
 
965da34
-        if (!wxGst_element_query_position(m_playbin, &fmtTime, &pos) ||
965da34
-            fmtTime != GST_FORMAT_TIME || pos == -1)
965da34
+        if (!gst_element_query_position(m_playbin, GST_FORMAT_TIME, &pos) || pos == -1)
965da34
             return 0;
965da34
         return pos / GST_MSECOND ;
965da34
     }
965da34
@@ -1438,44 +1184,21 @@ wxLongLong wxGStreamerMediaBackend::GetP
965da34
 // This is also an exceedingly ugly function due to the three implementations
965da34
 // (or, rather two plus one implementation without a seek function).
965da34
 //
965da34
-// This is asynchronous and thread-safe on both 0.8 and 0.10.
965da34
-//
965da34
 // NB: This fires both a stop and play event if the media was previously
965da34
 // playing... which in some ways makes sense. And yes, this makes the video
965da34
 // go all haywire at times - a gstreamer bug...
965da34
 //-----------------------------------------------------------------------------
965da34
 bool wxGStreamerMediaBackend::SetPosition(wxLongLong where)
965da34
 {
965da34
-#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 8 \
965da34
-                           && GST_VERSION_MICRO == 0
965da34
-    // 0.8.0 has no gst_element_seek according to official docs!!!
965da34
-    wxLogSysError(wxT("GStreamer 0.8.0 does not have gst_element_seek")
965da34
-                  wxT(" according to official docs"));
965da34
-    return false;
965da34
-#else // != 0.8.0
965da34
-
965da34
-#   if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10
965da34
-        gst_element_seek (m_playbin, m_dRate, GST_FORMAT_TIME,
965da34
+    if ( gst_element_seek (m_playbin, m_dRate, GST_FORMAT_TIME,
965da34
            (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT),
965da34
                           GST_SEEK_TYPE_SET, where.GetValue() * GST_MSECOND,
965da34
-                          GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE );
965da34
-#   else
965da34
-        // NB: Some gstreamer versions return false basically all the time
965da34
-        // here - even totem doesn't bother to check the return value here
965da34
-        // so I guess we'll just assume it worked -
965da34
-        // TODO: maybe check the gst error callback???
965da34
-        gst_element_seek (m_playbin, (GstSeekType) (GST_SEEK_METHOD_SET |
965da34
-            GST_FORMAT_TIME | GST_SEEK_FLAG_FLUSH),
965da34
-            where.GetValue() * GST_MSECOND );
965da34
-
965da34
-#   endif // GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10
965da34
-
965da34
+                          GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE ) )
965da34
     {
965da34
         m_llPausedPos = where;
965da34
         return true;
965da34
     }
965da34
-    return true;
965da34
-#endif //== 0.8.0
965da34
+    return false;
965da34
 }
965da34
 
965da34
 //-----------------------------------------------------------------------------
965da34
@@ -1487,10 +1210,8 @@ bool wxGStreamerMediaBackend::SetPositio
965da34
 wxLongLong wxGStreamerMediaBackend::GetDuration()
965da34
 {
965da34
     gint64 length;
965da34
-    GstFormat fmtTime = GST_FORMAT_TIME;
965da34
 
965da34
-    if(!wxGst_element_query_duration(m_playbin, &fmtTime, &length) ||
965da34
-       fmtTime != GST_FORMAT_TIME || length == -1)
965da34
+    if(!gst_element_query_duration(m_playbin, GST_FORMAT_TIME, &length) || length == -1)
965da34
         return 0;
965da34
     return length / GST_MSECOND ;
965da34
 }
965da34
@@ -1512,7 +1233,7 @@ void wxGStreamerMediaBackend::Move(int W
965da34
 // wxGStreamerMediaBackend::GetVideoSize
965da34
 //
965da34
 // Returns our cached video size from Load/gst_notify_caps_callback
965da34
-// gst_x_overlay_get_desired_size also does this in 0.8...
965da34
+// gst_video_overlay_get_desired_size also does this in 0.8...
965da34
 //-----------------------------------------------------------------------------
965da34
 wxSize wxGStreamerMediaBackend::GetVideoSize() const
965da34
 {
965da34
@@ -1539,9 +1260,8 @@ wxSize wxGStreamerMediaBackend::GetVideo
965da34
 //TODO: forcing frame/samplerates, see audioscale and videorate. Audioscale is
965da34
 //TODO: part of playbin.
965da34
 //
965da34
-// In 0.10 GStreamer has new gst_element_seek API that might
965da34
-// support this - and I've got an attempt to do so but it is untested
965da34
-// but it would appear to work...
965da34
+// In has new gst_element_seek API that supports this - and I've got an attempt
965da34
+// to do so but it is untested but it would appear to work...
965da34
 //-----------------------------------------------------------------------------
965da34
 double wxGStreamerMediaBackend::GetPlaybackRate()
965da34
 {
965da34
@@ -1552,7 +1272,6 @@ double wxGStreamerMediaBackend::GetPlayb
965da34
 
965da34
 bool wxGStreamerMediaBackend::SetPlaybackRate(double dRate)
965da34
 {
965da34
-#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10
965da34
 #if 0 // not tested enough
965da34
     if( gst_element_seek (m_playbin, dRate, GST_FORMAT_TIME,
965da34
                  (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT),
965da34
@@ -1565,7 +1284,6 @@ bool wxGStreamerMediaBackend::SetPlaybac
965da34
 #else
965da34
     wxUnusedVar(dRate);
965da34
 #endif
965da34
-#endif
965da34
 
965da34
     // failure
965da34
     return false;
965da34
@@ -1593,10 +1311,8 @@ wxLongLong wxGStreamerMediaBackend::GetD
965da34
 wxLongLong wxGStreamerMediaBackend::GetDownloadTotal()
965da34
 {
965da34
     gint64 length;
965da34
-    GstFormat fmtBytes = GST_FORMAT_BYTES;
965da34
 
965da34
-    if (!wxGst_element_query_duration(m_playbin, &fmtBytes, &length) ||
965da34
-          fmtBytes != GST_FORMAT_BYTES || length == -1)
965da34
+    if (!gst_element_query_duration(m_playbin, GST_FORMAT_BYTES, &length) || length == -1)
965da34
         return 0;
965da34
     return length;
965da34
 }