Add GStreamer 1.0 support

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 8 years ago
parent b5b66caff4
commit 53978f4770

@ -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

@ -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"])

@ -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)

@ -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" )

@ -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;

@ -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;

Loading…
Cancel
Save