From 313f8a3eb729b01f22ba15f724b0b0bea5cbc77d Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Thu, 28 Jan 2016 09:21:30 +0200 Subject: [PATCH 1/7] Drop gstreamer-0.8 from configure.in --- configure.in | 46 ++++++++++------------------------------------ 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/configure.in b/configure.in index cb95fb6fb1..a83582d8f1 100644 --- a/configure.in +++ b/configure.in @@ -335,7 +335,6 @@ DEFAULT_wxUSE_LIBSDL=no dnl features disabled by default DEFAULT_wxUSE_ACCESSIBILITY=no DEFAULT_wxUSE_IPV6=no -DEFAULT_wxUSE_GSTREAMER8=no DEFAULT_wxUSE_UNICODE_UTF8=no DEFAULT_wxUSE_UNICODE_UTF8_LOCALE=no @@ -772,7 +771,6 @@ WX_ARG_FEATURE(logdialog, [ --enable-logdialog use wxLogDialog], wxUSE_L WX_ARG_FEATURE(mdi, [ --enable-mdi use multiple document interface architecture], wxUSE_MDI) WX_ARG_FEATURE(mdidoc, [ --enable-mdidoc use docview architecture with MDI], wxUSE_MDI_ARCHITECTURE) WX_ARG_FEATURE(mediactrl, [ --enable-mediactrl use wxMediaCtrl class], wxUSE_MEDIACTRL) -WX_ARG_FEATURE(gstreamer8, [ --enable-gstreamer8 force GStreamer 0.8 instead of 0.10 with the wxMediaCtrl class on unix], wxUSE_GSTREAMER8) WX_ARG_FEATURE(richtext, [ --enable-richtext use wxRichTextCtrl], wxUSE_RICHTEXT) WX_ARG_FEATURE(postscript, [ --enable-postscript use wxPostscriptDC device context (default for gtk+)], wxUSE_POSTSCRIPT) WX_ARG_FEATURE(printarch, [ --enable-printarch use printing architecture], wxUSE_PRINTING_ARCHITECTURE) @@ -7274,44 +7272,20 @@ if test "$wxUSE_MEDIACTRL" = "yes" -o "$wxUSE_MEDIACTRL" = "auto"; then if test "$wxUSE_GTK" = 1; then wxUSE_GSTREAMER="no" - dnl ------------------------------------------------------------------- - dnl Test for at least 0.8 gstreamer module from pkg-config - dnl Even totem doesn't accept 0.9 evidently. - dnl - dnl So, we first check to see if 0.10 if available - if not we - dnl try the older 0.8 version - dnl ------------------------------------------------------------------- GST_VERSION_MAJOR=0 GST_VERSION_MINOR=10 GST_VERSION=$GST_VERSION_MAJOR.$GST_VERSION_MINOR - if test "$wxUSE_GSTREAMER8" = "no"; then - PKG_CHECK_MODULES(GST, - [gstreamer-$GST_VERSION gstreamer-plugins-base-$GST_VERSION], - [ - wxUSE_GSTREAMER="yes" - GST_LIBS="$GST_LIBS -lgstinterfaces-$GST_VERSION" - ], - [ - AC_MSG_WARN([GStreamer 0.10 not available, falling back to 0.8]) - GST_VERSION_MINOR=8 - ] - ) - else - dnl check only for 0.8 - GST_VERSION_MINOR=8 - fi - - if test $GST_VERSION_MINOR = "8"; then - GST_VERSION=$GST_VERSION_MAJOR.$GST_VERSION_MINOR - PKG_CHECK_MODULES(GST, - [gstreamer-$GST_VERSION gstreamer-interfaces-$GST_VERSION gstreamer-gconf-$GST_VERSION], - wxUSE_GSTREAMER="yes", - [ - AC_MSG_WARN([GStreamer 0.8/0.10 not available.]) - ]) - fi - + PKG_CHECK_MODULES(GST, + [gstreamer-$GST_VERSION gstreamer-plugins-base-$GST_VERSION], + [ + wxUSE_GSTREAMER="yes" + GST_LIBS="$GST_LIBS -lgstinterfaces-$GST_VERSION" + ], + [ + AC_MSG_WARN([GStreamer 0.10 not available]) + ] + ) if test "$wxUSE_GSTREAMER" = "yes"; then CPPFLAGS="$GST_CFLAGS $CPPFLAGS" From 4b70102503b61fba9838e34bc9b4a3b3ef300662 Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Thu, 28 Jan 2016 09:33:09 +0200 Subject: [PATCH 2/7] Drop gstreamer-0.8 and gstreamer-0.9 ifdef branches in code --- interface/wx/mediactrl.h | 4 +- src/unix/mediactrl.cpp | 143 ++------------------------------------- 2 files changed, 9 insertions(+), 138 deletions(-) diff --git a/interface/wx/mediactrl.h b/interface/wx/mediactrl.h index cc0fe89279..2184fd6e3d 100644 --- a/interface/wx/mediactrl.h +++ b/interface/wx/mediactrl.h @@ -202,8 +202,8 @@ public: - @b wxMEDIABACKEND_QUICKTIME: Use QuickTime. Mac Only. WARNING: May not working correctly embedded in a wxNotebook. - @b wxMEDIABACKEND_GSTREAMER, Use GStreamer. Unix Only. - Requires GStreamer 0.8 along with at the very least the xvimagesink, xoverlay, - and gst-play modules of gstreamer to function. + Requires GStreamer 0.10 along with at the very least the xvimagesink, + xoverlay and gst-play modules of gstreamer to function. You need the correct modules to play the relevant files, for example the mad module to play mp3s, etc. - @b wxMEDIABACKEND_WMP10, Uses Windows Media Player 10 (Windows only) - diff --git a/src/unix/mediactrl.cpp b/src/unix/mediactrl.cpp index 02f7947d16..ddf7641dab 100644 --- a/src/unix/mediactrl.cpp +++ b/src/unix/mediactrl.cpp @@ -19,13 +19,7 @@ #include // main gstreamer header -// xoverlay/video stuff, gst-gconf for 0.8 -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 -# include -#else -# include -# include // gstreamer glib configuration -#endif +#include #ifndef WX_PRECOMP #include "wx/log.h" // wxLogDebug/wxLogSysError/wxLogTrace @@ -48,8 +42,8 @@ //----------------------------------------------------------------------------- /* - This is the GStreamer backend for unix. Currently we require 0.8 or - 0.10. Here we use the "playbin" GstElement for ease of use. + This is the GStreamer backend for unix. Currently we require 0.10. + Here we use the "playbin" GstElement for ease of use. Note that now we compare state change functions to GST_STATE_FAILURE now rather than GST_STATE_SUCCESS as newer gstreamer versions return @@ -348,30 +342,6 @@ static gint gtk_window_realize_callback(GtkWidget* widget, } #endif // wxGTK -//----------------------------------------------------------------------------- -// "state-change" from m_playbin/GST_MESSAGE_STATE_CHANGE -// -// Called by gstreamer when the state changes - here we -// send the appropriate corresponding wx event. -// -// 0.8 only as HandleStateChange does this in both versions -//----------------------------------------------------------------------------- -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR < 10 -extern "C" { -static void gst_state_change_callback(GstElement *play, - GstElementState oldstate, - GstElementState newstate, - wxGStreamerMediaBackend* be) -{ - if(be->m_asynclock.TryLock() == wxMUTEX_NO_ERROR) - { - be->HandleStateChange(oldstate, newstate); - be->m_asynclock.Unlock(); - } -} -} -#endif // <0.10 - //----------------------------------------------------------------------------- // "eos" from m_playbin/GST_MESSAGE_EOS // @@ -436,7 +406,6 @@ static void gst_notify_caps_callback(GstPad* pad, // // (Undocumented?) //----------------------------------------------------------------------------- -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 extern "C" { static void gst_notify_stream_info_callback(GstElement* WXUNUSED(element), GParamSpec* WXUNUSED(pspec), @@ -446,33 +415,6 @@ static void gst_notify_stream_info_callback(GstElement* WXUNUSED(element), be->QueryVideoSizeFromElement(be->m_playbin); } } -#endif - -//----------------------------------------------------------------------------- -// "desired-size-changed" from m_xoverlay -// -// 0.8-specific this provides us with the video size when it changes - -// even though we get the caps as well this seems to come before the -// caps notification does... -// -// Note it will return 16,16 for an early-bird value or for audio -//----------------------------------------------------------------------------- -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR < 10 -extern "C" { -static void gst_desired_size_changed_callback(GstElement * play, - guint width, guint height, - wxGStreamerMediaBackend* be) -{ - if(!(width == 16 && height == 16)) - { - be->m_videoSize.x = width; - be->m_videoSize.y = height; - } - else - be->QueryVideoSizeFromElement(be->m_playbin); -} -} -#endif //----------------------------------------------------------------------------- // gst_bus_async_callback [static] @@ -487,7 +429,6 @@ static void gst_desired_size_changed_callback(GstElement * play, // thread before the async version that we use to set the xwindow id of the // XOverlay (NB: This isn't currently used - see CreateControl()). //----------------------------------------------------------------------------- -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 extern "C" { static gboolean gst_bus_async_callback(GstBus* WXUNUSED(bus), GstMessage* message, @@ -557,7 +498,6 @@ static GstBusSyncReply gst_bus_sync_callback(GstBus* bus, return GST_BUS_DROP; // We handled this message - drop from the queue } } -#endif //----------------------------------------------------------------------------- // @@ -642,14 +582,6 @@ bool wxGStreamerMediaBackend::QueryVideoSizeFromElement(GstElement* element) else g_object_get (info, "object", &pad, NULL); -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR <= 8 - // Killed in 0.9, presumely because events and such - // should be pushed on pads regardless of whether they - // are currently linked - pad = (GstPad *) GST_PAD_REALIZE (pad); - wxASSERT(pad); -#endif - if(!QueryVideoSizeFromPad(pad)) { // wait for those caps to get ready @@ -769,7 +701,6 @@ void wxGStreamerMediaBackend::SetupXOverlay() // // PRECONDITION: Assumes m_asynclock is Lock()ed //----------------------------------------------------------------------------- -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 bool wxGStreamerMediaBackend::SyncStateChange(GstElement* element, GstElementState desiredstate, gint64 llTimeout) @@ -844,23 +775,6 @@ bool wxGStreamerMediaBackend::SyncStateChange(GstElement* element, return bSuccess; } -#else // 0.8 implementation -bool wxGStreamerMediaBackend::SyncStateChange(GstElement* element, - GstElementState desiredstate, - gint64 llTimeout) -{ - gint64 llTimeWaited = 0; - while(GST_STATE(element) != desiredstate) - { - if(llTimeWaited >= llTimeout) - break; - llTimeWaited += 10*GST_MSECOND; - wxMilliSleep(10); - } - - return llTimeWaited != llTimeout; -} -#endif //----------------------------------------------------------------------------- // wxGStreamerMediaBackend::TryAudioSink @@ -1046,11 +960,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, //Really init gstreamer gboolean bInited; GError* error = NULL; -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 bInited = gst_init_check(&argcGST, &argvGST, &error); -#else - bInited = gst_init_check(&argcGST, &argvGST); -#endif // Cleanup arguments for unicode case #if wxUSE_UNICODE @@ -1117,15 +1027,6 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, return false; } -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR < 10 - // Connect the glib events/callbacks we want to our playbin - g_signal_connect(m_playbin, "eos", - G_CALLBACK(gst_finish_callback), this); - g_signal_connect(m_playbin, "error", - G_CALLBACK(gst_error_callback), this); - g_signal_connect(m_playbin, "state-change", - G_CALLBACK(gst_state_change_callback), this); -#else // GStreamer 0.10+ uses GstBus for this now, connect to the sync // handler as well so we can set the X window id of our xoverlay gst_bus_add_watch (gst_element_get_bus(m_playbin), @@ -1134,7 +1035,6 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, (GstBusSyncHandler) gst_bus_sync_callback, this); g_signal_connect(m_playbin, "notify::stream-info", G_CALLBACK(gst_notify_stream_info_callback), this); -#endif // Get the audio sink GstElement* audiosink = gst_gconf_get_default_audio_sink(); @@ -1181,11 +1081,6 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, } } -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR < 10 - // Not on 0.10... called when video size changes - g_signal_connect(m_xoverlay, "desired-size-changed", - G_CALLBACK(gst_desired_size_changed_callback), this); -#endif // Tell GStreamer which window to draw to in 0.8 - 0.10 // sometimes needs this too... SetupXOverlay(); @@ -1446,33 +1341,13 @@ wxLongLong wxGStreamerMediaBackend::GetPosition() //----------------------------------------------------------------------------- bool wxGStreamerMediaBackend::SetPosition(wxLongLong where) { -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 8 \ - && GST_VERSION_MICRO == 0 - // 0.8.0 has no gst_element_seek according to official docs!!! - wxLogSysError(wxT("GStreamer 0.8.0 does not have gst_element_seek") - wxT(" according to official docs")); - return false; -#else // != 0.8.0 - -# if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 - gst_element_seek (m_playbin, m_dRate, GST_FORMAT_TIME, - (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), - GST_SEEK_TYPE_SET, where.GetValue() * GST_MSECOND, - GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE ); -# else - // NB: Some gstreamer versions return false basically all the time - // here - even totem doesn't bother to check the return value here - // so I guess we'll just assume it worked - - // TODO: maybe check the gst error callback??? - gst_element_seek (m_playbin, (GstSeekType) (GST_SEEK_METHOD_SET | - GST_FORMAT_TIME | GST_SEEK_FLAG_FLUSH), - where.GetValue() * GST_MSECOND ); - -# endif // GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 + gst_element_seek (m_playbin, m_dRate, GST_FORMAT_TIME, + (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), + GST_SEEK_TYPE_SET, where.GetValue() * GST_MSECOND, + GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE ); m_llPausedPos = where; return true; -#endif //== 0.8.0 } //----------------------------------------------------------------------------- @@ -1549,7 +1424,6 @@ double wxGStreamerMediaBackend::GetPlaybackRate() bool wxGStreamerMediaBackend::SetPlaybackRate(double dRate) { -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 #if 0 // not tested enough if( gst_element_seek (m_playbin, dRate, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), @@ -1559,9 +1433,6 @@ bool wxGStreamerMediaBackend::SetPlaybackRate(double dRate) m_dRate = dRate; return true; } -#else - wxUnusedVar(dRate); -#endif #endif // failure From e733fdb14f81e0fe758c74a15c52583c1c33fb6f Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Thu, 28 Jan 2016 09:37:18 +0200 Subject: [PATCH 3/7] Replace deprecated GST_STATE_* defines Use proper gstreamer-0.10 names instead of mapping 0.8 defines to 0.10 ones: * GST_STATE_FAILURE -> GST_STATE_CHANGE_FAILURE * GST_STATE_SUCCESS -> GST_STATE_CHANGE_SUCCESS * GstElementState -> GstState --- src/unix/mediactrl.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/unix/mediactrl.cpp b/src/unix/mediactrl.cpp index ddf7641dab..97adddcf27 100644 --- a/src/unix/mediactrl.cpp +++ b/src/unix/mediactrl.cpp @@ -45,8 +45,8 @@ This is the GStreamer backend for unix. Currently we require 0.10. Here we use the "playbin" GstElement for ease of use. - Note that now we compare state change functions to GST_STATE_FAILURE - now rather than GST_STATE_SUCCESS as newer gstreamer versions return + Note that now we compare state change functions to GST_STATE_CHANGE_FAILURE + now rather than GST_STATE_CHANGE_SUCCESS as newer gstreamer versions return non-success values for returns that are otherwise successful but not immediate. @@ -112,9 +112,6 @@ // Other 0.10 macros #if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 -# define GST_STATE_FAILURE GST_STATE_CHANGE_FAILURE -# define GST_STATE_SUCCESS GST_STATE_CHANGE_SUCCESS -# define GstElementState GstState # define gst_gconf_get_default_video_sink() \ gst_element_factory_make ("gconfvideosink", "video-sink"); # define gst_gconf_get_default_audio_sink() \ @@ -183,11 +180,11 @@ public: bool CheckForErrors(); bool DoLoad(const wxString& locstring); wxMediaCtrl* GetControl() { return m_ctrl; } // for C Callbacks - void HandleStateChange(GstElementState oldstate, GstElementState newstate); + void HandleStateChange(GstState oldstate, GstState newstate); bool QueryVideoSizeFromElement(GstElement* element); bool QueryVideoSizeFromPad(GstPad* caps); void SetupXOverlay(); - bool SyncStateChange(GstElement* element, GstElementState state, + bool SyncStateChange(GstElement* element, GstState state, gint64 llTimeout = wxGSTREAMER_TIMEOUT); bool TryAudioSink(GstElement* audiosink); bool TryVideoSink(GstElement* videosink); @@ -512,8 +509,8 @@ static GstBusSyncReply gst_bus_sync_callback(GstBus* bus, // the async queue in 0.10. (Mostly this is here to avoid locking the // the mutex twice...) //----------------------------------------------------------------------------- -void wxGStreamerMediaBackend::HandleStateChange(GstElementState oldstate, - GstElementState newstate) +void wxGStreamerMediaBackend::HandleStateChange(GstState oldstate, + GstState newstate) { switch(newstate) { @@ -702,7 +699,7 @@ void wxGStreamerMediaBackend::SetupXOverlay() // PRECONDITION: Assumes m_asynclock is Lock()ed //----------------------------------------------------------------------------- bool wxGStreamerMediaBackend::SyncStateChange(GstElement* element, - GstElementState desiredstate, + GstState desiredstate, gint64 llTimeout) { GstBus* bus = gst_element_get_bus(element); @@ -1153,7 +1150,7 @@ bool wxGStreamerMediaBackend::DoLoad(const wxString& locstring) // Set playbin to ready to stop the current media... if( gst_element_set_state (m_playbin, - GST_STATE_READY) == GST_STATE_FAILURE || + GST_STATE_READY) == GST_STATE_CHANGE_FAILURE || !SyncStateChange(m_playbin, GST_STATE_READY)) { CheckForErrors(); @@ -1176,7 +1173,7 @@ bool wxGStreamerMediaBackend::DoLoad(const wxString& locstring) // Try to pause media as gstreamer won't let us query attributes // such as video size unless it is paused or playing if( gst_element_set_state (m_playbin, - GST_STATE_PAUSED) == GST_STATE_FAILURE || + GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE || !SyncStateChange(m_playbin, GST_STATE_PAUSED)) { CheckForErrors(); @@ -1207,7 +1204,7 @@ bool wxGStreamerMediaBackend::DoLoad(const wxString& locstring) bool wxGStreamerMediaBackend::Play() { if (gst_element_set_state (m_playbin, - GST_STATE_PLAYING) == GST_STATE_FAILURE) + GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { CheckForErrors(); return false; @@ -1227,7 +1224,7 @@ bool wxGStreamerMediaBackend::Pause() { m_llPausedPos = wxGStreamerMediaBackend::GetPosition(); if (gst_element_set_state (m_playbin, - GST_STATE_PAUSED) == GST_STATE_FAILURE) + GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE) { CheckForErrors(); return false; @@ -1248,7 +1245,7 @@ bool wxGStreamerMediaBackend::Stop() { // begin state lock wxMutexLocker lock(m_asynclock); if(gst_element_set_state (m_playbin, - GST_STATE_PAUSED) == GST_STATE_FAILURE || + GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE || !SyncStateChange(m_playbin, GST_STATE_PAUSED)) { CheckForErrors(); From 30c443970a92f4ddea2b0d15b9f785cf0f85a859 Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Thu, 28 Jan 2016 09:39:52 +0200 Subject: [PATCH 4/7] Use gconf{audio,video}sink properly --- src/unix/mediactrl.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/unix/mediactrl.cpp b/src/unix/mediactrl.cpp index 97adddcf27..acc3d97055 100644 --- a/src/unix/mediactrl.cpp +++ b/src/unix/mediactrl.cpp @@ -110,14 +110,6 @@ gst_element_query_position #endif -// Other 0.10 macros -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 -# define gst_gconf_get_default_video_sink() \ - gst_element_factory_make ("gconfvideosink", "video-sink"); -# define gst_gconf_get_default_audio_sink() \ - gst_element_factory_make ("gconfaudiosink", "audio-sink"); -#endif - // Max wait time for element state waiting - GST_CLOCK_TIME_NONE for inf #define wxGSTREAMER_TIMEOUT (100 * GST_MSECOND) // Max 100 milliseconds @@ -1034,7 +1026,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, G_CALLBACK(gst_notify_stream_info_callback), this); // Get the audio sink - GstElement* audiosink = gst_gconf_get_default_audio_sink(); + GstElement* audiosink = gst_element_factory_make ("gconfaudiosink", "audio-sink"); if( !TryAudioSink(audiosink) ) { // fallback to autodetection, then alsa, then oss as a stopgap @@ -1056,7 +1048,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, // Setup video sink - first try gconf, then auto, then xvimage and // then finally plain ximage - GstElement* videosink = gst_gconf_get_default_video_sink(); + GstElement* videosink = gst_element_factory_make ("gconfvideosink", "video-sink"); if( !TryVideoSink(videosink) ) { videosink = gst_element_factory_make ("autovideosink", "video-sink"); From 57049329f3f1fcac9839c5cfd0a463b3cbffb8f2 Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Thu, 28 Jan 2016 09:41:41 +0200 Subject: [PATCH 5/7] Replace obsolete wxGst_element_query_duration --- src/unix/mediactrl.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/unix/mediactrl.cpp b/src/unix/mediactrl.cpp index acc3d97055..e061da59a8 100644 --- a/src/unix/mediactrl.cpp +++ b/src/unix/mediactrl.cpp @@ -91,21 +91,15 @@ // gst_element_query function changed dramatically and split off // into two separate ones #if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR <= 8 -# define wxGst_element_query_duration(e, f, p) \ - gst_element_query(e, GST_QUERY_TOTAL, f, p) # define wxGst_element_query_position(e, f, p) \ gst_element_query(e, GST_QUERY_POSITION, f, p) #elif GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 9 // However, the actual 0.9 version has a slightly different definition // and instead of gst_element_query_duration it has two parameters to // gst_element_query_position instead -# define wxGst_element_query_duration(e, f, p) \ - gst_element_query_position(e, f, 0, p) # define wxGst_element_query_position(e, f, p) \ gst_element_query_position(e, f, p, 0) #else -# define wxGst_element_query_duration \ - gst_element_query_duration # define wxGst_element_query_position \ gst_element_query_position #endif @@ -1350,7 +1344,7 @@ wxLongLong wxGStreamerMediaBackend::GetDuration() gint64 length; GstFormat fmtTime = GST_FORMAT_TIME; - if(!wxGst_element_query_duration(m_playbin, &fmtTime, &length) || + if(!gst_element_query_duration(m_playbin, &fmtTime, &length) || fmtTime != GST_FORMAT_TIME || length == -1) return 0; return length / GST_MSECOND ; @@ -1452,7 +1446,7 @@ wxLongLong wxGStreamerMediaBackend::GetDownloadTotal() gint64 length; GstFormat fmtBytes = GST_FORMAT_BYTES; - if (!wxGst_element_query_duration(m_playbin, &fmtBytes, &length) || + if (!gst_element_query_duration(m_playbin, &fmtBytes, &length) || fmtBytes != GST_FORMAT_BYTES || length == -1) return 0; return length; From a797d19bb3b40cab8ee587e8112af7a9506965f6 Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Thu, 28 Jan 2016 09:42:47 +0200 Subject: [PATCH 6/7] Get rid of wxGst_element_query_position --- src/unix/mediactrl.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/unix/mediactrl.cpp b/src/unix/mediactrl.cpp index e061da59a8..50fe86530d 100644 --- a/src/unix/mediactrl.cpp +++ b/src/unix/mediactrl.cpp @@ -83,27 +83,6 @@ // Declarations //============================================================================= -//----------------------------------------------------------------------------- -// GStreamer (most version compatibility) macros -//----------------------------------------------------------------------------- - -// In 0.9 there was a HUGE change to GstQuery and the -// gst_element_query function changed dramatically and split off -// into two separate ones -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR <= 8 -# define wxGst_element_query_position(e, f, p) \ - gst_element_query(e, GST_QUERY_POSITION, f, p) -#elif GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 9 -// However, the actual 0.9 version has a slightly different definition -// and instead of gst_element_query_duration it has two parameters to -// gst_element_query_position instead -# define wxGst_element_query_position(e, f, p) \ - gst_element_query_position(e, f, p, 0) -#else -# define wxGst_element_query_position \ - gst_element_query_position -#endif - // Max wait time for element state waiting - GST_CLOCK_TIME_NONE for inf #define wxGSTREAMER_TIMEOUT (100 * GST_MSECOND) // Max 100 milliseconds @@ -1297,7 +1276,7 @@ wxLongLong wxGStreamerMediaBackend::GetPosition() gint64 pos; GstFormat fmtTime = GST_FORMAT_TIME; - if (!wxGst_element_query_position(m_playbin, &fmtTime, &pos) || + if (!gst_element_query_position(m_playbin, &fmtTime, &pos) || fmtTime != GST_FORMAT_TIME || pos == -1) return 0; return pos / GST_MSECOND ; From 4f5dfd96d9668aa14a3ea4f52fb60e4daf2ac79f Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Thu, 28 Jan 2016 09:44:54 +0200 Subject: [PATCH 7/7] Regenerate autogenerated stuff This stuff doesn't belong in the git repo though... --- configure | 148 +++--------------------------------------------------- 1 file changed, 8 insertions(+), 140 deletions(-) diff --git a/configure b/configure index 958846b142..22da3f94ac 100755 --- a/configure +++ b/configure @@ -1218,7 +1218,6 @@ enable_logdialog enable_mdi enable_mdidoc enable_mediactrl -enable_gstreamer8 enable_richtext enable_postscript enable_printarch @@ -2147,7 +2146,6 @@ Optional Features: --enable-mdi use multiple document interface architecture --enable-mdidoc use docview architecture with MDI --enable-mediactrl use wxMediaCtrl class - --enable-gstreamer8 force GStreamer 0.8 instead of 0.10 with the wxMediaCtrl class on unix --enable-richtext use wxRichTextCtrl --enable-postscript use wxPostscriptDC device context (default for gtk+) --enable-printarch use printing architecture @@ -3930,7 +3928,6 @@ DEFAULT_wxUSE_LIBSDL=no DEFAULT_wxUSE_ACCESSIBILITY=no DEFAULT_wxUSE_IPV6=no -DEFAULT_wxUSE_GSTREAMER8=no DEFAULT_wxUSE_UNICODE_UTF8=no DEFAULT_wxUSE_UNICODE_UTF8_LOCALE=no @@ -10430,50 +10427,6 @@ fi $as_echo "$result" >&6; } - enablestring= - defaultval=$wxUSE_ALL_FEATURES - if test -z "$defaultval"; then - if test x"$enablestring" = xdisable; then - defaultval=yes - else - defaultval=no - fi - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --${enablestring:-enable}-gstreamer8" >&5 -$as_echo_n "checking for --${enablestring:-enable}-gstreamer8... " >&6; } - # Check whether --enable-gstreamer8 was given. -if test "${enable_gstreamer8+set}" = set; then : - enableval=$enable_gstreamer8; - if test "$enableval" = yes; then - wx_cv_use_gstreamer8='wxUSE_GSTREAMER8=yes' - else - wx_cv_use_gstreamer8='wxUSE_GSTREAMER8=no' - fi - -else - - wx_cv_use_gstreamer8='wxUSE_GSTREAMER8=${'DEFAULT_wxUSE_GSTREAMER8":-$defaultval}" - -fi - - - eval "$wx_cv_use_gstreamer8" - - if test x"$enablestring" = xdisable; then - if test $wxUSE_GSTREAMER8 = no; then - result=yes - else - result=no - fi - else - result=$wxUSE_GSTREAMER8 - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5 -$as_echo "$result" >&6; } - - enablestring= defaultval=$wxUSE_ALL_FEATURES if test -z "$defaultval"; then @@ -37521,11 +37474,10 @@ if test "$wxUSE_MEDIACTRL" = "yes" -o "$wxUSE_MEDIACTRL" = "auto"; then if test "$wxUSE_GTK" = 1; then wxUSE_GSTREAMER="no" - GST_VERSION_MAJOR=0 + GST_VERSION_MAJOR=0 GST_VERSION_MINOR=10 GST_VERSION=$GST_VERSION_MAJOR.$GST_VERSION_MINOR - if test "$wxUSE_GSTREAMER8" = "no"; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GST" >&5 @@ -37586,16 +37538,14 @@ fi echo "$GST_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GStreamer 0.10 not available, falling back to 0.8" >&5 -$as_echo "$as_me: WARNING: GStreamer 0.10 not available, falling back to 0.8" >&2;} - GST_VERSION_MINOR=8 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GStreamer 0.10 not available" >&5 +$as_echo "$as_me: WARNING: GStreamer 0.10 not available" >&2;} elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GStreamer 0.10 not available, falling back to 0.8" >&5 -$as_echo "$as_me: WARNING: GStreamer 0.10 not available, falling back to 0.8" >&2;} - GST_VERSION_MINOR=8 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GStreamer 0.10 not available" >&5 +$as_echo "$as_me: WARNING: GStreamer 0.10 not available" >&2;} else @@ -37604,93 +37554,10 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - wxUSE_GSTREAMER="yes" - GST_LIBS="$GST_LIBS -lgstinterfaces-$GST_VERSION" + wxUSE_GSTREAMER="yes" + GST_LIBS="$GST_LIBS -lgstinterfaces-$GST_VERSION" fi - else - GST_VERSION_MINOR=8 - fi - - if test $GST_VERSION_MINOR = "8"; then - GST_VERSION=$GST_VERSION_MAJOR.$GST_VERSION_MINOR - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GST" >&5 -$as_echo_n "checking for GST... " >&6; } - -if test -n "$PKG_CONFIG"; then - if test -n "$GST_CFLAGS"; then - pkg_cv_GST_CFLAGS="$GST_CFLAGS" - else - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-\$GST_VERSION gstreamer-interfaces-\$GST_VERSION gstreamer-gconf-\$GST_VERSION\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gstreamer-$GST_VERSION gstreamer-interfaces-$GST_VERSION gstreamer-gconf-$GST_VERSION") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_GST_CFLAGS=`$PKG_CONFIG --cflags "gstreamer-$GST_VERSION gstreamer-interfaces-$GST_VERSION gstreamer-gconf-$GST_VERSION" 2>/dev/null` -else - pkg_failed=yes -fi - fi -else - pkg_failed=untried -fi -if test -n "$PKG_CONFIG"; then - if test -n "$GST_LIBS"; then - pkg_cv_GST_LIBS="$GST_LIBS" - else - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-\$GST_VERSION gstreamer-interfaces-\$GST_VERSION gstreamer-gconf-\$GST_VERSION\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gstreamer-$GST_VERSION gstreamer-interfaces-$GST_VERSION gstreamer-gconf-$GST_VERSION") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_GST_LIBS=`$PKG_CONFIG --libs "gstreamer-$GST_VERSION gstreamer-interfaces-$GST_VERSION gstreamer-gconf-$GST_VERSION" 2>/dev/null` -else - pkg_failed=yes -fi - fi -else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - GST_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "gstreamer-$GST_VERSION gstreamer-interfaces-$GST_VERSION gstreamer-gconf-$GST_VERSION"` - else - GST_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gstreamer-$GST_VERSION gstreamer-interfaces-$GST_VERSION gstreamer-gconf-$GST_VERSION"` - fi - # Put the nasty error message in config.log where it belongs - echo "$GST_PKG_ERRORS" >&5 - - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GStreamer 0.8/0.10 not available." >&5 -$as_echo "$as_me: WARNING: GStreamer 0.8/0.10 not available." >&2;} - -elif test $pkg_failed = untried; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GStreamer 0.8/0.10 not available." >&5 -$as_echo "$as_me: WARNING: GStreamer 0.8/0.10 not available." >&2;} - -else - GST_CFLAGS=$pkg_cv_GST_CFLAGS - GST_LIBS=$pkg_cv_GST_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - wxUSE_GSTREAMER="yes" -fi - fi - if test "$wxUSE_GSTREAMER" = "yes"; then CPPFLAGS="$GST_CFLAGS $CPPFLAGS" @@ -42684,3 +42551,4 @@ echo " libmspack ${wxUSE_LIBMSPAC echo " sdl ${wxUSE_LIBSDL}" echo "" +