summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2016-03-10 00:52:06 +0100
committerSlávek Banko <[email protected]>2016-03-10 00:52:20 +0100
commitd943a1cf86dfa179af54fc9dbbbd9c231a01fa6b (patch)
tree41cd0a3499e57772f59df9c66a00c99e52813232
parentb299b85507368cc288c5f08737d4b0d3ca3b2aad (diff)
downloadkaffeine-d943a1cf86dfa179af54fc9dbbbd9c231a01fa6b.tar.gz
kaffeine-d943a1cf86dfa179af54fc9dbbbd9c231a01fa6b.zip
Add GStreamer 1.0 support
Signed-off-by: Slávek Banko <[email protected]> (cherry picked from commit 53978f47703d734a7838997033e4aedd9f920a82)
-rw-r--r--config.h.in3
-rw-r--r--kaffeine/configure.in.in21
-rw-r--r--kaffeine/src/player-parts/gstreamer-part/Makefile.am2
-rw-r--r--kaffeine/src/player-parts/gstreamer-part/gstreamer_part.cpp13
-rw-r--r--kaffeine/src/player-parts/gstreamer-part/timer.cpp16
-rw-r--r--kaffeine/src/player-parts/gstreamer-part/video.cpp25
6 files changed, 70 insertions, 10 deletions
diff --git a/config.h.in b/config.h.in
index 88dc36a..1afeb9a 100644
--- a/config.h.in
+++ b/config.h.in
@@ -24,6 +24,9 @@
/* DVB headers installed */
#undef HAVE_DVB
+/* Defined if GStreamer is 1.x */
+#undef HAVE_GSTREAMER_1
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
diff --git a/kaffeine/configure.in.in b/kaffeine/configure.in.in
index 1d84afe..fab9603 100644
--- a/kaffeine/configure.in.in
+++ b/kaffeine/configure.in.in
@@ -200,19 +200,30 @@ LIB_GSTREAMER=""
if test "$with_gstreamer" != "no" ; then
AC_MSG_CHECKING([for GStreamer])
- if "$PKG_CONFIG" --exists "gstreamer-0.10 gstreamer-plugins-base-0.10"; then
+ if "$PKG_CONFIG" --exists "gstreamer-1.0 gstreamer-plugins-base-1.0"; then
with_gstreamer=yes
- CFLAGS_GSTREAMER=`"$PKG_CONFIG" --cflags gstreamer-0.10 gstreamer-plugins-base-0.10`
- LIB_GSTREAMER=`"$PKG_CONFIG" --libs gstreamer-0.10 gstreamer-plugins-base-0.10`
+ CFLAGS_GSTREAMER=`"$PKG_CONFIG" --cflags gstreamer-1.0 gstreamer-plugins-base-1.0`
+ LIB_GSTREAMER=`"$PKG_CONFIG" --libs gstreamer-1.0 gstreamer-plugins-base-1.0`
+ LIB_GSTOVERLAY='-lgstvideo-1.0'
+ AC_DEFINE(HAVE_GSTREAMER_1, 1, [Defined if GStreamer is 1.x])
AC_MSG_RESULT([yes])
else
- with_gstreamer=no
- AC_MSG_RESULT([no])
+ if "$PKG_CONFIG" --exists "gstreamer-0.10 gstreamer-plugins-base-0.10"; then
+ with_gstreamer=yes
+ CFLAGS_GSTREAMER=`"$PKG_CONFIG" --cflags gstreamer-0.10 gstreamer-plugins-base-0.10`
+ LIB_GSTREAMER=`"$PKG_CONFIG" --libs gstreamer-0.10 gstreamer-plugins-base-0.10`
+ LIB_GSTOVERLAY='-lgstinterfaces-0.10'
+ AC_MSG_RESULT([yes])
+ else
+ with_gstreamer=no
+ AC_MSG_RESULT([no])
+ fi
fi
fi
AC_SUBST([CFLAGS_GSTREAMER])
AC_SUBST([LIB_GSTREAMER])
+AC_SUBST([LIB_GSTOVERLAY])
AM_CONDITIONAL([with_gstreamer], [test "$with_gstreamer" = "yes"])
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;