diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2016-03-10 00:52:06 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2016-03-10 00:52:20 +0100 |
commit | d943a1cf86dfa179af54fc9dbbbd9c231a01fa6b (patch) | |
tree | 41cd0a3499e57772f59df9c66a00c99e52813232 /kaffeine/src | |
parent | b299b85507368cc288c5f08737d4b0d3ca3b2aad (diff) | |
download | kaffeine-d943a1cf86dfa179af54fc9dbbbd9c231a01fa6b.tar.gz kaffeine-d943a1cf86dfa179af54fc9dbbbd9c231a01fa6b.zip |
Add GStreamer 1.0 support
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 53978f47703d734a7838997033e4aedd9f920a82)
Diffstat (limited to 'kaffeine/src')
4 files changed, 51 insertions, 5 deletions
diff --git a/kaffeine/src/player-parts/gstreamer-part/Makefile.am b/kaffeine/src/player-parts/gstreamer-part/Makefile.am index d10ddca..16cbbbd 100644 --- a/kaffeine/src/player-parts/gstreamer-part/Makefile.am +++ b/kaffeine/src/player-parts/gstreamer-part/Makefile.am @@ -8,7 +8,7 @@ noinst_HEADERS = gstreamer_part.h timer.h video.h videosettings.h gstreamerconf libgstreamerpart_la_SOURCES = gstreamer_part.cpp video.cpp timer.cpp videosettings.cpp gstreamerconfig.cpp libgstreamerpart_la_LIBADD = $(LIB_TDEPARTS) $(LIB_TDEFILE) ../kaffeine-part/libkaffeinepart.la -libgstreamerpart_la_LDFLAGS = -module $(KDE_PLUGIN) $(LIB_QT) -lDCOP $(KDE_PLUGIN) $(LIB_TDEPARTS) $(LIB_TDECORE) $(LIB_TDEUI) $(LIB_TDEIO) $(LIB_GSTREAMER) -lgstinterfaces-0.10 $(all_libraries) -avoid-version -no-undefined +libgstreamerpart_la_LDFLAGS = -module $(KDE_PLUGIN) $(LIB_QT) -lDCOP $(KDE_PLUGIN) $(LIB_TDEPARTS) $(LIB_TDECORE) $(LIB_TDEUI) $(LIB_TDEIO) $(LIB_GSTREAMER) $(LIB_GSTOVERLAY) $(all_libraries) -avoid-version -no-undefined # this is where the desktop file will go partdesktopdir = $(kde_servicesdir) diff --git a/kaffeine/src/player-parts/gstreamer-part/gstreamer_part.cpp b/kaffeine/src/player-parts/gstreamer-part/gstreamer_part.cpp index b76e363..f9ed207 100644 --- a/kaffeine/src/player-parts/gstreamer-part/gstreamer_part.cpp +++ b/kaffeine/src/player-parts/gstreamer-part/gstreamer_part.cpp @@ -38,6 +38,7 @@ #include <tqfile.h> #include <tqtooltip.h> +#include "config.h" #include "gstreamer_part.h" #include "gstreamer_part.moc" #include "playlistimport.h" @@ -764,10 +765,20 @@ bool GStreamerPart::initGStreamer() kdDebug() << "GStreamerPart: Found GStreamer version "<<maj<<"."<<min<<"."<<mic<<"."<< nan <<endl<<endl; /* check for visualization plugins */ - GList* factories = gst_registry_get_feature_list(gst_registry_get_default (), GST_TYPE_ELEMENT_FACTORY); + GList* factories = gst_registry_get_feature_list( +#ifdef HAVE_GSTREAMER_1 + gst_registry_get (), +#else + gst_registry_get_default (), +#endif + GST_TYPE_ELEMENT_FACTORY); TQString name, cat; while ( factories ) { +#ifdef HAVE_GSTREAMER_1 + name = GST_OBJECT_NAME(factories->data); +#else name = GST_PLUGIN_FEATURE_NAME(factories->data); +#endif cat = gst_element_factory_get_klass(GST_ELEMENT_FACTORY(factories->data)); // kdDebug() << "GStreamerPart: Found plugin: " << name << " - Category: " << cat << endl; if ( cat == "Visualization" ) diff --git a/kaffeine/src/player-parts/gstreamer-part/timer.cpp b/kaffeine/src/player-parts/gstreamer-part/timer.cpp index 04be9b7..7ef268d 100644 --- a/kaffeine/src/player-parts/gstreamer-part/timer.cpp +++ b/kaffeine/src/player-parts/gstreamer-part/timer.cpp @@ -132,12 +132,24 @@ void Timer::slotUpdate() if ( !m_play ) return; - if ( gst_element_query_duration( m_play, &fmt, &t ) ) { + if ( gst_element_query_duration( m_play, +#ifdef HAVE_GSTREAMER_1 + fmt, +#else + &fmt, +#endif + &t ) ) { m_len = t; m_slider->setMaxValue( m_len / GST_SECOND ); } - if ( !gst_element_query_position( m_play, &fmt, &t ) ) + if ( !gst_element_query_position( m_play, +#ifdef HAVE_GSTREAMER_1 + fmt, +#else + &fmt, +#endif + &t ) ) return; m_pos = t; diff --git a/kaffeine/src/player-parts/gstreamer-part/video.cpp b/kaffeine/src/player-parts/gstreamer-part/video.cpp index ecca253..dee1d14 100644 --- a/kaffeine/src/player-parts/gstreamer-part/video.cpp +++ b/kaffeine/src/player-parts/gstreamer-part/video.cpp @@ -34,7 +34,11 @@ #include <tdemenubar.h> #include <kdebug.h> +#ifdef HAVE_GSTREAMER_1 +#include <gst/video/videooverlay.h> +#else #include <gst/interfaces/xoverlay.h> +#endif #include "video.h" @@ -67,9 +71,15 @@ void VideoWindow::setPlaybin( GstElement *play ) VideoWindow::~VideoWindow() { +#ifdef HAVE_GSTREAMER_1 + if ( m_element && GST_IS_VIDEO_OVERLAY(m_element) ) { + gst_video_overlay_set_window_handle( GST_VIDEO_OVERLAY(m_element), 0 ); + } +#else if ( m_element && GST_IS_X_OVERLAY(m_element) ) { gst_x_overlay_set_xwindow_id( GST_X_OVERLAY(m_element), 0 ); } +#endif gst_object_unref( GST_OBJECT(m_element) ); kdDebug() << "VideoWindow: destructed" << endl; @@ -80,10 +90,17 @@ VideoWindow::~VideoWindow() void VideoWindow::refresh() { /* expose overlay */ +#ifdef HAVE_GSTREAMER_1 + if ( m_element && GST_IS_VIDEO_OVERLAY(m_element) ) { + gst_video_overlay_set_window_handle( GST_VIDEO_OVERLAY (m_element), winId() ); + gst_video_overlay_expose( GST_VIDEO_OVERLAY (m_element) ); + } +#else if ( m_element && GST_IS_X_OVERLAY(m_element) ) { gst_x_overlay_set_xwindow_id( GST_X_OVERLAY (m_element), winId() ); gst_x_overlay_expose( GST_X_OVERLAY (m_element) ); } +#endif } @@ -165,7 +182,13 @@ void VideoWindow::newState() if ( !g_strcasecmp(val->value_nick, "video") ) { GstCaps *caps; g_object_get( info, "object", &pad, NULL ); - if ( (caps=gst_pad_get_negotiated_caps(pad)) ) { + if ( +#ifdef HAVE_GSTREAMER_1 + (caps=gst_pad_get_current_caps(pad)) +#else + (caps=gst_pad_get_negotiated_caps(pad)) +#endif + ) { newCapsset( caps ); gst_caps_unref (caps); return; |