[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [phonon-gstreamer/1.0-porting-for-merge] gstreamer: Remove gstreamer-0.10 support
From: Dan_Vrátil <dvratil () redhat ! com>
Date: 2014-08-12 14:39:05
Message-ID: E1XHDE9-00073J-K8 () scm ! kde ! org
[Download RAW message or body]
Git commit 719517f4521a875a3f0036b5b271171107961c0c by Dan Vrátil.
Committed on 12/08/2014 at 08:32.
Pushed by dvratil into branch '1.0-porting-for-merge'.
Remove gstreamer-0.10 support
We don't want to support both gstreamer-0.10 and 1.0, so let's get rid of lots and \
lots of #ifdefs by only supporting gstreamer-1.0.
M +2 -6 gstreamer/ConfigureChecks.cmake
M +1 -26 gstreamer/audiodataoutput.cpp
M +0 -9 gstreamer/audiooutput.cpp
M +3 -12 gstreamer/backend.cpp
M +1 -6 gstreamer/devicemanager.cpp
M +0 -4 gstreamer/effect.cpp
M +1 -4 gstreamer/effectmanager.cpp
M +0 -4 gstreamer/glrenderer.cpp
M +5 -25 gstreamer/gsthelper.cpp
M +0 -12 gstreamer/medianode.cpp
M +3 -8 gstreamer/mediaobject.cpp
M +17 -100 gstreamer/pipeline.cpp
M +1 -7 gstreamer/plugininstaller.cpp
M +0 -2 gstreamer/plugininstaller.h
M +4 -24 gstreamer/qwidgetvideosink.cpp
M +7 -20 gstreamer/streamreader.cpp
M +6 -41 gstreamer/videodataoutput.cpp
M +1 -4 gstreamer/videographicsobject.cpp
M +7 -30 gstreamer/videosink.c
M +14 -75 gstreamer/videowidget.cpp
M +0 -4 gstreamer/widgetrenderer.cpp
M +3 -34 gstreamer/x11renderer.cpp
http://commits.kde.org/phonon-gstreamer/719517f4521a875a3f0036b5b271171107961c0c
diff --git a/gstreamer/ConfigureChecks.cmake b/gstreamer/ConfigureChecks.cmake
index 11b48ca..41990e4 100644
--- a/gstreamer/ConfigureChecks.cmake
+++ b/gstreamer/ConfigureChecks.cmake
@@ -17,10 +17,6 @@ find_package(GStreamer)
if (GSTREAMER_FOUND)
macro_log_feature(GSTREAMER_FOUND "GStreamer" "gstreamer 1.0 is required for the \
multimedia backend" "http://gstreamer.freedesktop.org/modules/" TRUE "1.0") \
find_package(GStreamerPlugins REQUIRED)
-else()
- find_package(GStreamer0.10 REQUIRED)
- macro_log_feature(GSTREAMER_FOUND "GStreamer" "gstreamer 0.10 is required for \
the multimedia backend" "http://gstreamer.freedesktop.org/modules/" \
TRUE "0.10")
- find_package(GStreamerPlugins0.10 REQUIRED)
endif (GSTREAMER_FOUND)
macro_log_feature(GSTREAMER_PLUGIN_VIDEO_FOUND "GStreamer video plugin" "The \
gstreamer video plugin (part of gstreamer-plugins-base 0.10) is required for the \
multimedia gstreamer backend" "http://gstreamer.freedesktop.org/modules/" TRUE \
"0.10") @@ -47,6 +43,6 @@ endif()
if (GSTREAMER_FOUND AND GSTREAMER_PLUGIN_VIDEO_FOUND AND \
GSTREAMER_PLUGIN_AUDIO_FOUND AND GSTREAMER_PLUGIN_PBUTILS_FOUND AND GLIB2_FOUND AND \
GOBJECT_FOUND AND LIBXML2_FOUND) set(BUILD_PHONON_GSTREAMER TRUE)
-else (GSTREAMER_FOUND AND GSTREAMER_PLUGIN_VIDEO_FOUND AND \
GSTREAMER_PLUGIN_AUDIO_FOUND AND GSTREAMER_PLUGIN_PBUTILS_FOUND AND GLIB2_FOUND AND \
GOBJECT_FOUND AND LIBXML2_FOUND) +else ()
set(BUILD_PHONON_GSTREAMER FALSE)
-endif (GSTREAMER_FOUND AND GSTREAMER_PLUGIN_VIDEO_FOUND AND \
GSTREAMER_PLUGIN_AUDIO_FOUND AND GSTREAMER_PLUGIN_PBUTILS_FOUND AND GLIB2_FOUND AND \
GOBJECT_FOUND AND LIBXML2_FOUND) +endif ()
diff --git a/gstreamer/audiodataoutput.cpp b/gstreamer/audiodataoutput.cpp
index 88586b7..196e525 100644
--- a/gstreamer/audiodataoutput.cpp
+++ b/gstreamer/audiodataoutput.cpp
@@ -33,10 +33,7 @@
#include <gst/gstghostpad.h>
#include <gst/gstutils.h>
#include <gst/gst.h>
-
-#if GST_VERSION > GST_VERSION_CHECK (1,0,0,0)
#include <gst/audio/audio-format.h>
-#endif
namespace Phonon
{
@@ -52,11 +49,7 @@ AudioDataOutput::AudioDataOutput(Backend *backend, QObject \
*parent)
m_queue = gst_bin_new(NULL);
gst_object_ref(GST_OBJECT(m_queue));
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_object_sink(GST_OBJECT(m_queue));
-#else
gst_object_ref_sink(GST_OBJECT(m_queue));
-#endif
GstElement* sink = gst_element_factory_make("fakesink", NULL);
GstElement* queue = gst_element_factory_make("queue", NULL);
GstElement* convert = gst_element_factory_make("audioconvert", NULL);
@@ -65,18 +58,9 @@ AudioDataOutput::AudioDataOutput(Backend *backend, QObject \
*parent) g_object_set(G_OBJECT(sink), "signal-handoffs", true, NULL);
//G_BYTE_ORDER is the host machine's endianess
- GstCaps *caps =
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_caps_new_simple("audio/x-raw-int",
- "endianess", G_TYPE_INT, G_BYTE_ORDER,
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- NULL);
- #else
- gst_caps_new_simple("audio/x-raw",
+ GstCaps *caps = gst_caps_new_simple("audio/x-raw",
"format", G_TYPE_STRING, GST_AUDIO_NE (S16),
NULL);
- #endif
gst_bin_add_many(GST_BIN(m_queue), sink, convert, queue, NULL);
gst_element_link(queue, convert);
@@ -137,27 +121,18 @@ void AudioDataOutput::processBuffer(GstElement*, GstBuffer* \
buffer, GstPad* pad,
// determine the number of channels
GstStructure *structure;
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- structure = gst_caps_get_structure(GST_BUFFER_CAPS(buffer), 0);
-#else
const GstCaps *caps = gst_pad_get_current_caps(GST_PAD(pad));
structure = gst_caps_get_structure(caps, 0);
-#endif
gst_structure_get_int(structure, "channels", &that->m_channels);
// Let's get the buffers
gint16 *gstBufferData;
guint gstBufferSize;
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gstBufferData = reinterpret_cast<gint16 *>(GST_BUFFER_DATA(buffer));
- gstBufferSize = GST_BUFFER_SIZE(buffer) / sizeof(gint16);
-#else
GstMapInfo info;
gst_buffer_map(buffer, &info, GST_MAP_READ);
gstBufferData = reinterpret_cast<gint16 *>(info.data);
gstBufferSize = info.size / sizeof(gint16);
gst_buffer_unmap(buffer,&info);
-#endif
if (gstBufferSize == 0) {
qWarning() << Q_FUNC_INFO << ": received a buffer of 0 size ... doing \
nothing";
diff --git a/gstreamer/audiooutput.cpp b/gstreamer/audiooutput.cpp
index 6d58153..a6d228a 100644
--- a/gstreamer/audiooutput.cpp
+++ b/gstreamer/audiooutput.cpp
@@ -52,11 +52,7 @@ AudioOutput::AudioOutput(Backend *backend, QObject *parent)
m_audioBin = gst_bin_new (NULL);
gst_object_ref (GST_OBJECT (m_audioBin));
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_object_sink (GST_OBJECT (m_audioBin));
-#else
gst_object_ref_sink (GST_OBJECT (m_audioBin));
-#endif
m_conv = gst_element_factory_make ("audioconvert", NULL);
@@ -223,12 +219,7 @@ void AudioOutput::setStreamUuid(QString uuid)
#warning this really needs a check for pulsesink as well
if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_audioSink), \
"stream-properties")) {
const QHash<QString, QString> streamProperties = \
PulseSupport::getInstance()->streamProperties(uuid);
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GstStructure *properties = gst_structure_empty_new("props");
-#else
GstStructure *properties = gst_structure_new_empty("props");
-#endif
-
QHashIterator<QString, QString> it(streamProperties);
while (it.hasNext()) {
it.next();
diff --git a/gstreamer/backend.cpp b/gstreamer/backend.cpp
index ee43910..0f47262 100644
--- a/gstreamer/backend.cpp
+++ b/gstreamer/backend.cpp
@@ -36,9 +36,6 @@
#include <gst/gst.h>
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
-#include <gst/interfaces/propertyprobe.h>
-#endif
#include <phonon/pulsesupport.h>
#include <phonon/GlobalDescriptionContainer>
@@ -175,11 +172,8 @@ QObject *Backend::createObject(BackendInterface::Class c, \
QObject *parent, const }
#ifndef PHONON_NO_GRAPHICSVIEW
-#warning FIXME: Enable this once we port VGO to GStreamer 1.0
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
case VideoGraphicsObjectClass:
return new VideoGraphicsObject(this, parent);
-#endif
#endif //PHONON_NO_GRAPHICSVIEW
#endif //QT_NO_PHONON_VIDEO
#ifndef QT_NO_PHONON_VOLUMEFADEREFFECT
@@ -259,11 +253,7 @@ QStringList Backend::availableMimeTypes() const
// Iterate over all audio and video decoders and extract mime types from sink \
caps GList* factoryList;
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- factoryList = gst_registry_get_feature_list(gst_registry_get_default (), \
GST_TYPE_ELEMENT_FACTORY);
-#else
factoryList = gst_registry_get_feature_list(gst_registry_get(), \
GST_TYPE_ELEMENT_FACTORY);
-#endif
for (GList* iter = g_list_first(factoryList) ; iter != NULL ; iter = \
g_list_next(iter)) { GstPluginFeature *feature = GST_PLUGIN_FEATURE(iter->data);
QString klass = gst_element_factory_get_klass(GST_ELEMENT_FACTORY(feature));
@@ -374,8 +364,9 @@ QHash<QByteArray, QVariant> \
Backend::objectDescriptionProperties(ObjectDescripti ret.insert("name", \
effect->name()); ret.insert("description", effect->description());
ret.insert("author", effect->author());
- } else
- Q_ASSERT(1); // Since we use list position as ID, this should not \
happen + } else {
+ Q_ASSERT(0); // Since we use list position as ID, this should not \
happen + }
}
break;
diff --git a/gstreamer/devicemanager.cpp b/gstreamer/devicemanager.cpp
index 2cba930..0c61d41 100644
--- a/gstreamer/devicemanager.cpp
+++ b/gstreamer/devicemanager.cpp
@@ -99,12 +99,7 @@ void DeviceInfo::useGstElement(GstElement *element, const \
QByteArray &deviceId) if (m_description.isEmpty()) {
// Construct a description by using the factory name and the device id
GstElementFactory *factory = gst_element_get_factory(element);
- const gchar *factoryName =
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_element_factory_get_longname(factory);
- #else
- gst_element_factory_get_metadata(factory, "Long-name");
- #endif
+ const gchar *factoryName = gst_element_factory_get_metadata(factory, \
"Long-name"); m_description = QString(factoryName) + ": " + deviceId;
}
diff --git a/gstreamer/effect.cpp b/gstreamer/effect.cpp
index 5994844..e791a1c 100644
--- a/gstreamer/effect.cpp
+++ b/gstreamer/effect.cpp
@@ -43,11 +43,7 @@ void Effect::init()
if (m_effectBin) {
setupEffectParams();
gst_object_ref (GST_OBJECT (m_effectBin)); // Take ownership
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_object_sink (GST_OBJECT (m_effectBin));
-#else
gst_object_ref_sink (GST_OBJECT (m_effectBin));
-#endif
m_isValid = true;
}
}
diff --git a/gstreamer/effectmanager.cpp b/gstreamer/effectmanager.cpp
index a8f061f..eefed06 100644
--- a/gstreamer/effectmanager.cpp
+++ b/gstreamer/effectmanager.cpp
@@ -43,11 +43,8 @@ EffectManager::EffectManager(Backend *backend)
, m_backend(backend)
{
GList *factoryList =
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_registry_get_feature_list(gst_registry_get_default (), \
GST_TYPE_ELEMENT_FACTORY);
- #else
gst_registry_get_feature_list(gst_registry_get (), \
GST_TYPE_ELEMENT_FACTORY);
- #endif
+
QString name;
QString klass;
QString description;
diff --git a/gstreamer/glrenderer.cpp b/gstreamer/glrenderer.cpp
index 1c5f110..e31adc7 100644
--- a/gstreamer/glrenderer.cpp
+++ b/gstreamer/glrenderer.cpp
@@ -81,11 +81,7 @@ GLRenderer::GLRenderer(VideoWidget* videoWidget) :
if ((m_videoSink = m_glWindow->createVideoSink())) { //if ((m_videoSink = \
m_glWindow->createVideoSink())) { gst_object_ref (GST_OBJECT (m_videoSink)); //Take \
ownership
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_object_sink (GST_OBJECT (m_videoSink));
-#else
gst_object_ref_sink (GST_OBJECT (m_videoSink));
-#endif
QWidgetVideoSinkBase* sink = \
reinterpret_cast<QWidgetVideoSinkBase*>(m_videoSink); // Let the videosink know \
which widget to direct frame updates to
diff --git a/gstreamer/gsthelper.cpp b/gstreamer/gsthelper.cpp
index c1026bd..b00a130 100644
--- a/gstreamer/gsthelper.cpp
+++ b/gstreamer/gsthelper.cpp
@@ -21,9 +21,6 @@
#include <gst/gst.h>
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
-#include <gst/interfaces/propertyprobe.h>
-#endif
#include "mediaobject.h"
#include "backend.h"
@@ -43,29 +40,12 @@ namespace Gstreamer
QList<QByteArray> GstHelper::extractProperties(GstElement *elem, const QByteArray \
&value) {
Q_ASSERT(elem);
- QList<QByteArray> list;
-
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- if (GST_IS_PROPERTY_PROBE(elem)) {
- GstPropertyProbe *probe = GST_PROPERTY_PROBE(elem);
- const GParamSpec *devspec = 0;
- GValueArray *array = NULL;
-
- if ((devspec = gst_property_probe_get_property (probe, value))) {
- if ((array = gst_property_probe_probe_and_get_values (probe, devspec))) \
{
- for (unsigned int device = 0; device < array->n_values; device++) {
- GValue *deviceId = g_value_array_get_nth (array, device);
- list.append(g_value_get_string(deviceId));
- }
- }
- if (array)
- g_value_array_free (array);
- }
- }
-#else
Q_UNUSED(value);
-#endif
- return list;
+
+ #warning Implement this for GStreamer 1.3.1
+
+
+ return QList<QByteArray>();
}
/**
diff --git a/gstreamer/medianode.cpp b/gstreamer/medianode.cpp
index b7f459a..25635f7 100644
--- a/gstreamer/medianode.cpp
+++ b/gstreamer/medianode.cpp
@@ -47,22 +47,14 @@ MediaNode::MediaNode(Backend *backend, NodeDescription \
description) : m_audioTee = gst_element_factory_make("tee", NULL);
Q_ASSERT(m_audioTee); // Must not ever be null.
gst_object_ref (GST_OBJECT (m_audioTee));
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_object_sink (GST_OBJECT (m_audioTee));
-#else
gst_object_ref_sink (GST_OBJECT (m_audioTee));
-#endif
}
if (description & VideoSource) {
m_videoTee = gst_element_factory_make("tee", NULL);
Q_ASSERT(m_videoTee); // Must not ever be null.
gst_object_ref (GST_OBJECT (m_videoTee));
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_object_sink (GST_OBJECT (m_videoTee));
-#else
gst_object_ref_sink (GST_OBJECT (m_videoTee));
-#endif
}
}
@@ -260,12 +252,8 @@ bool MediaNode::addOutput(MediaNode *output, GstElement *tee)
GstState state = root()->pipeline()->state();
GstPad *srcPad;
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- srcPad = gst_element_get_request_pad (tee,"src%d");
-#else
GstPadTemplate* tee_src_pad_template = gst_element_class_get_pad_template \
(GST_ELEMENT_GET_CLASS (tee), "src_%u");
srcPad = gst_element_request_pad (tee, tee_src_pad_template, NULL, NULL);
-#endif
GstPad *sinkPad = gst_element_get_static_pad (sinkElement, "sink");
if (!sinkPad) {
diff --git a/gstreamer/mediaobject.cpp b/gstreamer/mediaobject.cpp
index 458778b..f506b21 100644
--- a/gstreamer/mediaobject.cpp
+++ b/gstreamer/mediaobject.cpp
@@ -22,12 +22,8 @@
#include "phonon-config-gstreamer.h"
#include <gst/gst.h>
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
-#include <gst/interfaces/navigation.h>
-#include <gst/interfaces/propertyprobe.h>
-#else
#include <gst/video/navigation.h>
-#endif
+
#include "backend.h"
#include "streamreader.h"
#include "debug.h"
@@ -729,7 +725,6 @@ QList<MediaController::NavigationMenu> \
MediaObject::_iface_availableMenus() cons
void MediaObject::_iface_jumpToMenu(MediaController::NavigationMenu menu)
{
-#if GST_VERSION >= GST_VERSION_CHECK(0,10,23,0)
GstNavigationCommand command;
switch(menu) {
case MediaController::RootMenu:
@@ -755,9 +750,9 @@ void \
MediaObject::_iface_jumpToMenu(MediaController::NavigationMenu menu) }
GstElement *target = gst_bin_get_by_interface(GST_BIN(m_pipeline->element()), \
GST_TYPE_NAVIGATION);
- if (target)
+ if (target) {
gst_navigation_send_command(GST_NAVIGATION(target), command);
-#endif
+ }
}
void MediaObject::handleTrackCountChange(int tracks)
diff --git a/gstreamer/pipeline.cpp b/gstreamer/pipeline.cpp
index 7deceda..8d9c2fd 100644
--- a/gstreamer/pipeline.cpp
+++ b/gstreamer/pipeline.cpp
@@ -28,11 +28,7 @@
#include "phonon-config-gstreamer.h"
#include <gst/pbutils/missing-plugins.h>
#include <gst/gst.h>
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
-#include <gst/interfaces/navigation.h>
-#else
#include <gst/video/navigation.h>
-#endif
#include <gst/app/gstappsrc.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QMutexLocker>
@@ -55,13 +51,8 @@ Pipeline::Pipeline(QObject *parent)
, m_posAtReset(0)
{
qRegisterMetaType<GstState>("GstState");
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- m_pipeline = GST_PIPELINE(gst_element_factory_make("playbin2", NULL));
- gst_object_ref(m_pipeline);
-#else
m_pipeline = GST_PIPELINE(gst_element_factory_make("playbin", NULL));
gst_object_ref(m_pipeline);
-#endif
gst_object_ref_sink (m_pipeline);
g_signal_connect(m_pipeline, "video-changed", G_CALLBACK(cb_videoChanged), \
this);
g_signal_connect(m_pipeline, "text-tags-changed", \
G_CALLBACK(cb_textTagsChanged), this); @@ -70,38 +61,22 @@ Pipeline::Pipeline(QObject \
*parent)
g_signal_connect(m_pipeline, "about-to-finish", G_CALLBACK(cb_aboutToFinish), \
this);
GstBus *bus = gst_pipeline_get_bus(m_pipeline);
- gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, NULL
- #if GST_VERSION >= GST_VERSION_CHECK (1,0,0,0)
- ,NULL
- #endif
- );
+ gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, NULL, NULL);
g_signal_connect(bus, "sync-message::eos", G_CALLBACK(cb_eos), this);
g_signal_connect(bus, "sync-message::warning", G_CALLBACK(cb_warning), this);
-
-#if GST_VERSION >= GST_VERSION_CHECK (1,0,0,0)
g_signal_connect(bus, "sync-message::duration-changed", G_CALLBACK(cb_duration), \
this);
-#else
- g_signal_connect(bus, "sync-message::duration", G_CALLBACK(cb_duration), this);
-#endif
-
g_signal_connect(bus, "sync-message::buffering", G_CALLBACK(cb_buffering), \
this);
g_signal_connect(bus, "sync-message::state-changed", G_CALLBACK(cb_state), \
this);
g_signal_connect(bus, "sync-message::element", G_CALLBACK(cb_element), this);
g_signal_connect(bus, "sync-message::error", G_CALLBACK(cb_error), this);
-#if GST_VERSION >= GST_VERSION_CHECK (1,0,0,0)
g_signal_connect(bus, "sync-message::stream-start", G_CALLBACK(cb_streamStart), \
this);
-#endif
g_signal_connect(bus, "sync-message::tag", G_CALLBACK(cb_tag), this);
gst_object_unref(bus);
// Set up audio graph
m_audioGraph = gst_bin_new("audioGraph");
gst_object_ref (GST_OBJECT (m_audioGraph));
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_object_sink (GST_OBJECT (m_audioGraph));
-#else
gst_object_ref_sink (GST_OBJECT (m_audioGraph));
-#endif
// Note that these queues are only required for streaming content
// And should ideally be created on demand as they will disable
@@ -127,11 +102,7 @@ Pipeline::Pipeline(QObject *parent)
// Set up video graph
m_videoGraph = gst_bin_new("videoGraph");
gst_object_ref (GST_OBJECT (m_videoGraph));
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_object_sink (GST_OBJECT (m_videoGraph));
-#else
gst_object_ref_sink (GST_OBJECT (m_videoGraph));
-#endif
m_videoPipe = gst_element_factory_make("queue", "videoPipe");
gst_bin_add(GST_BIN(m_videoGraph), m_videoPipe);
@@ -285,13 +256,9 @@ void Pipeline::writeToDot(MediaObject *media, const QString \
&type)
bool Pipeline::queryDuration(GstFormat *format, gint64 *duration) const
{
- return gst_element_query_duration(GST_ELEMENT(m_pipeline),
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- format
- #else
- *format
- #endif
- , duration);
+#warning Remove this method, use gst directly
+
+ return gst_element_query_duration(GST_ELEMENT(m_pipeline), *format, duration);
}
GstState Pipeline::state() const
@@ -329,21 +296,12 @@ gboolean Pipeline::cb_duration(GstBus *bus, GstMessage \
*gstMessage, gpointer dat {
DEBUG_BLOCK;
Q_UNUSED(bus)
+ Q_UNUSED(gstMessage)
Pipeline *that = static_cast<Pipeline*>(data);
if (that->m_resetting)
return true;
-#if GST_VERSION >= GST_VERSION_CHECK (1,0,0,0)
- Q_UNUSED(gstMessage)
+
emit that->durationChanged(that->totalDuration());
-#else
- GstFormat format = GST_FORMAT_TIME;
- gint64 duration = 0;
- gst_message_parse_duration(gstMessage, &format, &duration);
- if (format == GST_FORMAT_TIME) {
- debug() << "duration" << duration/GST_MSECOND;
- emit that->durationChanged(duration/GST_MSECOND);
- }
-#endif
return true;
}
@@ -487,7 +445,6 @@ gboolean Pipeline::cb_element(GstBus *bus, GstMessage \
*gstMessage, gpointer data if (gst_is_missing_plugin_message(gstMessage)) {
that->m_installer->addPlugin(gstMessage);
} else {
-#if GST_VERSION >= GST_VERSION_CHECK(0,10,23,0)
switch (gst_navigation_message_get_type(gstMessage)) {
case GST_NAVIGATION_MESSAGE_MOUSE_OVER: {
gboolean active;
@@ -503,28 +460,8 @@ gboolean Pipeline::cb_element(GstBus *bus, GstMessage \
*gstMessage, gpointer data default:
break;
}
-#endif // GST_VERSION
}
- // GStraemer 1.0 actually has a proper signal for this, see stream-started.
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- // Currently undocumented, but discovered via gst-plugins-base commit 7e674d
- // gst 0.10.25.1
- if (gst_structure_has_name(str,
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- "playbin2-stream-changed"
- #else
- "playbin-stream-changed"
- #endif
- )) {
-
- gchar *uri;
- g_object_get(that->m_pipeline, "uri", &uri, NULL);
- debug() << "Stream changed to" << uri;
- g_free(uri);
- if (!that->m_resetting)
- emit that->streamChanged();
- }
-#endif
+
if (gst_structure_has_name(str, "prepare-xwindow-id") || \
gst_structure_has_name(str, "prepare-window-handle")) emit that->windowIDNeeded();
return true;
@@ -775,7 +712,6 @@ void Pipeline::setMetaData(const QMultiMap<QString, QString> \
&newData) void Pipeline::updateNavigation()
{
QList<MediaController::NavigationMenu> ret;
-#if GST_VERSION >= GST_VERSION_CHECK(0,10,23,0)
GstElement *target = gst_bin_get_by_interface(GST_BIN(m_pipeline), \
GST_TYPE_NAVIGATION); if (target) {
GstQuery *query = gst_navigation_query_new_commands();
@@ -811,7 +747,7 @@ void Pipeline::updateNavigation()
}
}
}
-#endif
+
if (ret != m_menus) {
m_menus = ret;
emit availableMenusChanged(m_menus);
@@ -876,30 +812,16 @@ static void cb_feedAppSrc(GstAppSrc *appSrc, guint buffsize, \
gpointer data) DEBUG_BLOCK;
StreamReader *reader = static_cast<StreamReader*>(data);
GstBuffer *buf = gst_buffer_new_and_alloc(buffsize);
-#warning ret not used!!! WHOOPWHOOPWHOOP
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- reader->read(reader->currentPos(), buffsize, (char*)GST_BUFFER_DATA(buf));
-#else
GstMapInfo info;
gst_buffer_map(buf, &info, GST_MAP_WRITE);
+ #warning return value not used!!! WHOOPWHOOPWHOOP
reader->read(reader->currentPos(), info.size, (char*)info.data);
-#endif
-
-#if GST_VERSION > GST_VERSION_CHECK (1,0,0,0)
- gst_buffer_unmap(buf, &info);
-#endif
-
+ gst_buffer_unmap(buf, &info);
gst_app_src_push_buffer(appSrc, buf);
- if (
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GST_BUFFER_SIZE(buf) > 0
- #else
- info.size > 0
- #endif
- && reader->atEnd())
+ if (info.size > 0 && reader->atEnd()) {
gst_app_src_end_of_stream(appSrc);
-
+ }
}
static void cb_seekAppSrc(GstAppSrc *appSrc, guint64 pos, gpointer data)
@@ -975,17 +897,12 @@ Phonon::MediaSource Pipeline::currentSource() const
qint64 Pipeline::position() const
{
- gint64 pos = 0;
- GstFormat format = GST_FORMAT_TIME;
- if (m_resetting)
+ if (m_resetting) {
return m_posAtReset;
- gst_element_query_position (GST_ELEMENT(m_pipeline),
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- &format
- #else
- format
- #endif
- , &pos);
+ }
+
+ gint64 pos = 0;
+ gst_element_query_position (GST_ELEMENT(m_pipeline), GST_FORMAT_TIME, &pos);
return (pos / GST_MSECOND);
}
diff --git a/gstreamer/plugininstaller.cpp b/gstreamer/plugininstaller.cpp
index 0fc2586..69f39f6 100644
--- a/gstreamer/plugininstaller.cpp
+++ b/gstreamer/plugininstaller.cpp
@@ -251,13 +251,7 @@ PluginInstaller::InstallStatus \
PluginInstaller::checkInstalledPlugins() return m_state;
bool allFound = true;
foreach (const QString &plugin, m_pluginList.keys()) {
- if (
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- !gst_default_registry_check_feature_version(plugin.toLocal8Bit().data(), \
0, 10, 0)
- #else
- !gst_registry_check_feature_version(gst_registry_get(), \
plugin.toLocal8Bit().data(), 1, 0, 0)
- #endif
- ) {
+ if (!gst_registry_check_feature_version(gst_registry_get(), \
plugin.toLocal8Bit().data(), 1, 0, 0)) { allFound = false;
break;
}
diff --git a/gstreamer/plugininstaller.h b/gstreamer/plugininstaller.h
index 65f759d..6a08b42 100644
--- a/gstreamer/plugininstaller.h
+++ b/gstreamer/plugininstaller.h
@@ -27,9 +27,7 @@
*/
#include "phonon-config-gstreamer.h" // krazy:exclude=includes
#include <gst/gst.h>
-#if GST_VERSION > GST_VERSION_CHECK (1,0,0,0)
#include <gst/gsttoc.h>
-#endif
#include <gst/gstmessage.h>
#include <gst/pbutils/install-plugins.h>
diff --git a/gstreamer/qwidgetvideosink.cpp b/gstreamer/qwidgetvideosink.cpp
index 205334c..19c9fb3 100644
--- a/gstreamer/qwidgetvideosink.cpp
+++ b/gstreamer/qwidgetvideosink.cpp
@@ -87,16 +87,11 @@ GstFlowReturn QWidgetVideoSink<FMT>::render(GstBaseSink* sink, \
GstBuffer* buf) {
QWidgetVideoSink<FMT> *self = G_TYPE_CHECK_INSTANCE_CAST(sink, \
QWidgetVideoSinkClass<FMT>::get_type(), QWidgetVideoSink<FMT>); QByteArray frame;
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- frame.resize(buf->size);
- memcpy(frame.data(), buf->data, buf->size);
-#else
GstMapInfo info;
gst_buffer_map(buf, &info, GST_MAP_READ);
frame.resize(info.size);
memcpy(frame.data(), info.data, info.size);
gst_buffer_unmap(buf, &info);
-#endif
NewFrameEvent *frameEvent = new NewFrameEvent(frame, self->width, \
self->height); QApplication::postEvent(self->renderWidget, frameEvent);
}
@@ -110,31 +105,16 @@ static GstStaticPadTemplate template_factory_yuv =
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS(
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- "video/x-raw-yuv, "
- "framerate = (fraction) [ 0, MAX ], "
- "width = (int) [ 1, MAX ], "
- "height = (int) [ 1, MAX ],"
- "bpp = (int) 32"
- #else
"video/x-raw, "
- "format = (string) {YUY2, YVYU, UYVY, Y41P, \
IYU2, Y42B, YV12, I420, Y41B, YUV9, YVU9, Y800}"
- #endif
- )
-);
+ "format = (string) {YUY2, YVYU, UYVY, Y41P, \
IYU2, Y42B, YV12, I420, Y41B, YUV9, YVU9, Y800}") + );
static GstStaticPadTemplate template_factory_rgb =
GST_STATIC_PAD_TEMPLATE("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS(
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GST_VIDEO_CAPS_xRGB_HOST_ENDIAN
- #else
- GST_VIDEO_CAPS_MAKE("xRGB")
- #endif
- )
- );
+ GST_STATIC_CAPS(GST_VIDEO_CAPS_MAKE("xRGB"))
+ );
template <VideoFormat FMT>
struct template_factory;
diff --git a/gstreamer/streamreader.cpp b/gstreamer/streamreader.cpp
index a4ab348..690e686 100644
--- a/gstreamer/streamreader.cpp
+++ b/gstreamer/streamreader.cpp
@@ -97,13 +97,9 @@ GstFlowReturn StreamReader::read(quint64 pos, int length, char \
*buffer) DEBUG_BLOCK;
// If we got unlocked before grabbing the mutex -> return
- if (!m_locked)
- return
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GST_FLOW_UNEXPECTED;
- #else
- GST_FLOW_EOS;
- #endif
+ if (!m_locked) {
+ return GST_FLOW_EOS;
+ }
if (currentPos() != pos) {
if (!streamSeekable()) {
@@ -123,23 +119,14 @@ GstFlowReturn StreamReader::read(quint64 pos, int length, char \
*buffer)
// Abort instantly if we got unlocked, whether we got sufficient data or not
// is absolutely unimportant at this point.
- if (!m_locked)
- return
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GST_FLOW_UNEXPECTED;
- #else
- GST_FLOW_EOS;
- #endif
+ if (!m_locked) {
+ return GST_FLOW_EOS;
+ }
if (oldSize == currentBufferSize()) {
// We didn't get any data, check if we are at the end of stream already.
if (m_eos) {
- return
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GST_FLOW_UNEXPECTED;
- #else
- GST_FLOW_EOS;
- #endif
+ return GST_FLOW_EOS;
}
}
}
diff --git a/gstreamer/videodataoutput.cpp b/gstreamer/videodataoutput.cpp
index ed14249..eebb546 100644
--- a/gstreamer/videodataoutput.cpp
+++ b/gstreamer/videodataoutput.cpp
@@ -28,10 +28,7 @@
#include <gst/gstbin.h>
#include <gst/gstghostpad.h>
#include <gst/gstutils.h>
-
-#if GST_VERSION > GST_VERSION_CHECK (1,0,0,0)
#include <gst/video/video-format.h>
-#endif
namespace Phonon
{
@@ -48,38 +45,20 @@ VideoDataOutput::VideoDataOutput(Backend *backend, QObject \
*parent)
m_queue = gst_bin_new(NULL);
gst_object_ref(GST_OBJECT(m_queue));
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_object_sink(GST_OBJECT(m_queue));
-#else
gst_object_ref_sink(GST_OBJECT(m_queue));
-#endif
GstElement* sink = gst_element_factory_make("fakesink", NULL);
GstElement* queue = gst_element_factory_make("queue", NULL);
- GstElement* convert =
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_element_factory_make("ffmpegcolorspace", NULL);
-#else
- gst_element_factory_make("videoconvert", NULL);
-#endif
+ GstElement* convert = gst_element_factory_make("videoconvert", NULL);
g_signal_connect(sink, "handoff", G_CALLBACK(processBuffer), this);
g_object_set(G_OBJECT(sink), "signal-handoffs", true, NULL);
// Save ourselves a metric crapton of work by simply requesting
// a format native to Qt.
- GstCaps *caps =
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_caps_new_simple("video/x-raw-rgb",
- "bpp", G_TYPE_INT, 24,
- "depth", G_TYPE_INT, 24,
- "endianess", G_TYPE_INT, G_BYTE_ORDER,
- NULL);
-#else
- gst_caps_new_simple("video/x-raw",
+ GstCaps *caps = gst_caps_new_simple("video/x-raw",
"format = (string)", G_TYPE_STRING, \
GST_VIDEO_NE(RGB), NULL);
-#endif
gst_bin_add_many(GST_BIN(m_queue), sink, convert, queue, NULL);
gst_element_link(queue, convert);
@@ -105,12 +84,7 @@ void VideoDataOutput::processBuffer(GstElement*, GstBuffer* \
buffer, GstPad* pad, {
VideoDataOutput *that = reinterpret_cast<VideoDataOutput*>(gThat);
- GstStructure* structure =
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_caps_get_structure(GST_BUFFER_CAPS(buffer), 0);
- #else
- gst_caps_get_structure(gst_pad_get_current_caps(pad), 0);
- #endif
+ GstStructure* structure = gst_caps_get_structure(gst_pad_get_current_caps(pad), \
0); int width;
int height;
double aspect;
@@ -118,31 +92,22 @@ void VideoDataOutput::processBuffer(GstElement*, GstBuffer* \
buffer, GstPad* pad, gst_structure_get_int(structure, "width", &width);
gst_structure_get_int(structure, "height", &height);
aspect = (double)width/height;
-#if GST_VERSION > GST_VERSION_CHECK (1,0,0,0)
GstMapInfo info;
gst_buffer_map(buffer, &info, GST_MAP_READ);
-#endif
const Experimental::VideoFrame2 f = {
width,
height,
aspect,
Experimental::VideoFrame2::Format_RGB888,
// RGB888 Means the data is 8 bits o' red, 8 bits o' green, and 8 \
bits o' blue per pixel.
- QByteArray::fromRawData(reinterpret_cast<const char*>(
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GST_BUFFER_DATA(buffer)
-#else
- info.data
-#endif
- ), 3*width*height),
+ QByteArray::fromRawData(reinterpret_cast<const char*>(info.data), 3 * width \
* height), 0,
0
};
- if (that->m_frontend)
+ if (that->m_frontend) {
that->m_frontend->frameReady(f);
-#if GST_VERSION > GST_VERSION_CHECK (1,0,0,0)
+ }
gst_buffer_unmap(buffer, &info);
-#endif
}
}} // namespace Phonon::Gstreamer
diff --git a/gstreamer/videographicsobject.cpp b/gstreamer/videographicsobject.cpp
index 095fa5d..37bb4fc 100644
--- a/gstreamer/videographicsobject.cpp
+++ b/gstreamer/videographicsobject.cpp
@@ -40,11 +40,7 @@ VideoGraphicsObject::VideoGraphicsObject(Backend *backend, QObject \
*parent) :
m_bin = gst_bin_new(0);
gst_object_ref(GST_OBJECT(m_bin));
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_object_sink(GST_OBJECT(m_bin));
-#else
gst_object_ref_sink(GST_OBJECT(m_bin));
-#endif
m_sink = P_GST_VIDEO_SINK(g_object_new(P_GST_TYPE_VIDEO_SINK, 0));
m_sink->userData = this;
@@ -107,6 +103,7 @@ void VideoGraphicsObject::renderCallback(GstBuffer *buffer, void \
*userData) frame->format = VideoFrame::Format_RGB32;
frame->planeCount = 1;
// RGB888 Means the data is 8 bits o' red, 8 bits o' green, and 8 bits o' blue \
per pixel. +#warn GST1
frame->plane[0] =
QByteArray::fromRawData(
reinterpret_cast<const char*>(GST_BUFFER_DATA(buffer)),
diff --git a/gstreamer/videosink.c b/gstreamer/videosink.c
index 1763e11..7f33f7d 100644
--- a/gstreamer/videosink.c
+++ b/gstreamer/videosink.c
@@ -26,10 +26,7 @@
#include "videosink.h"
#include "phonon-config-gstreamer.h"
-
-#if GST_VERSION > GST_VERSION_CHECK (1,0,0,0)
#include <gst/video/video-format.h>
-#endif
#define UNUSED(x) (void)x
#define dbg(x) fprintf(stderr, "%s\n", x)
@@ -38,37 +35,22 @@ static GstStaticPadTemplate s_sinktemplate =
GST_STATIC_PAD_TEMPLATE("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GST_VIDEO_CAPS_xRGB_HOST_ENDIAN)
- #else
- GST_VIDEO_NE(RGB)
- #endif
- ));
+ GST_STATIC_CAPS (GST_VIDEO_NE(RGB))
+ );
static GstStaticPadTemplate s_rgbPadTemplate =
GST_STATIC_PAD_TEMPLATE("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS(
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GST_VIDEO_CAPS_xRGB_HOST_ENDIAN)
- #else
- GST_VIDEO_NE(RGB)
- #endif
- ));
+ GST_STATIC_CAPS(GST_VIDEO_NE(RGB))
+ );
static GstStaticPadTemplate s_yuvPadTemplate =
GST_STATIC_PAD_TEMPLATE("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS(
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GST_VIDEO_CAPS_YUV (
- #else
- GST_VIDEO_CAPS_MAKE (
- #endif
- "{ IYUV, I420, YV12 }")));
+ GST_STATIC_CAPS(GST_VIDEO_CAPS_MAKE("{ IYUV, I420, \
YV12 }")) + );
G_DEFINE_TYPE(PGstVideoSink, p_gst_video_sink, GST_TYPE_VIDEO_SINK)
@@ -98,12 +80,7 @@ static GstFlowReturn p_gst_video_sink_render(GstBaseSink \
*baseSink, PGstVideoSink *sink = P_GST_VIDEO_SINK(baseSink);
if (buffer == NULL || G_UNLIKELY(!GST_IS_BUFFER (buffer))) {
#warning sounds bogus?
- return
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GST_FLOW_RESEND;
- #else
- GST_FLOW_EOS;
- #endif
+ return GST_FLOW_EOS;
}
sink->renderCallback(buffer, sink->userData);
diff --git a/gstreamer/videowidget.cpp b/gstreamer/videowidget.cpp
index 3fc6968..1023654 100644
--- a/gstreamer/videowidget.cpp
+++ b/gstreamer/videowidget.cpp
@@ -36,14 +36,8 @@
#include "x11renderer.h"
#include "phonon-config-gstreamer.h"
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
-#include <gst/interfaces/navigation.h>
-#include <gst/interfaces/propertyprobe.h>
-#else
#include <gst/video/navigation.h>
#include <gst/video/video-format.h>
-#endif
-
#include "widgetrenderer.h"
@@ -124,24 +118,14 @@ void VideoWidget::setupVideoBin()
m_videoBin = gst_bin_new (NULL);
Q_ASSERT(m_videoBin);
gst_object_ref (GST_OBJECT (m_videoBin)); //Take ownership
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_object_sink (GST_OBJECT (m_videoBin));
-#else
gst_object_ref_sink (GST_OBJECT (m_videoBin));
-#endif
QByteArray tegraEnv = qgetenv("TEGRA_GST_OPENMAX");
if (tegraEnv.isEmpty()) {
//The videoplug element is the final element before the pluggable videosink
m_videoplug = gst_element_factory_make ("identity", NULL);
//Colorspace ensures that the output of the stream matches the input format \
accepted by our video sink
- m_colorspace = gst_element_factory_make (
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- "ffmpegcolorspace"
- #else
- "videoconvert"
- #endif
- , NULL);
+ m_colorspace = gst_element_factory_make ("videoconvert", NULL);
//Video scale is used to prepare the correct aspect ratio and scale.
GstElement *videoScale = gst_element_factory_make ("videoscale", NULL);
@@ -159,13 +143,7 @@ void VideoWidget::setupVideoBin()
// For video balance to work we have to first ensure that the video \
is in YUV colorspace,
// then hand it off to the videobalance filter before finally \
converting it back to RGB.
// Hence we nede a videoFilter to convert the colorspace before and \
after videobalance
- GstElement *m_colorspace2 = gst_element_factory_make (
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- "ffmpegcolorspace"
- #else
- "videoconvert"
- #endif
- , NULL);
+ GstElement *m_colorspace2 = gst_element_factory_make \
("videoconvert", NULL);
gst_bin_add_many(GST_BIN(m_videoBin), m_videoBalance, m_colorspace2, \
NULL);
success = gst_element_link_many(queue, m_colorspace, m_videoBalance, \
m_colorspace2, videoScale, m_videoplug, videoSink, NULL); } else {
@@ -333,7 +311,6 @@ QRect VideoWidget::calculateDrawFrameRect() const
QImage VideoWidget::snapshot() const
{
// for gst_video_convert_frame()
-#if GST_CHECK_PLUGINS_BASE_VERSION(0,10,31)
GstElement *videosink = m_renderer->videoSink();
// in case we get called just after a flush (e.g. seeking), wait for the
@@ -341,55 +318,26 @@ QImage VideoWidget::snapshot() const
// last-buffer will be populated
gst_element_get_state(videosink, NULL, NULL, GST_SECOND);
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GstBuffer *videobuffer = NULL;
- g_object_get(G_OBJECT(videosink), "last-buffer", &videobuffer, NULL);
-#else
GstSample *videobuffer = NULL;
g_object_get(G_OBJECT(videosink), "last-sample", &videobuffer, NULL);
-#endif
if (videobuffer) {
- GstCaps *snapcaps =
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_caps_new_simple("video/x-raw-rgb",
- "bpp", G_TYPE_INT, 24,
- "depth", G_TYPE_INT, 24,
- "endianness", G_TYPE_INT, G_BIG_ENDIAN,
- "red_mask", G_TYPE_INT, 0xff0000,
- "green_mask", G_TYPE_INT, 0x00ff00,
- "blue_mask", G_TYPE_INT, 0x0000ff,
- NULL);
-#else
- gst_caps_new_simple("video/x-raw",
- "format = (string)", G_TYPE_STRING, \
GST_VIDEO_NE(RGB),
- NULL);
-#endif
+ GstCaps *snapcaps = gst_caps_new_simple("video/x-raw",
+ "format = (string)", G_TYPE_STRING, \
GST_VIDEO_NE(RGB), + NULL);
GstBuffer *snapbuffer;
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- snapbuffer = gst_video_convert_frame(videobuffer, snapcaps, GST_SECOND, \
NULL);
- gst_buffer_unref(videobuffer);
-#else
GstSample *sample = gst_video_convert_sample(videobuffer, snapcaps, \
GST_SECOND, NULL); snapbuffer = gst_sample_get_buffer(sample);
GstMapInfo info;
gst_buffer_map(snapbuffer, &info, GST_MAP_READ);
gst_sample_unref(videobuffer);
-#endif
-
gst_caps_unref(snapcaps);
if (snapbuffer) {
gint width, height;
gboolean ret;
- GstStructure *s =
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_caps_get_structure(GST_BUFFER_CAPS(snapbuffer), 0);
-#else
- gst_caps_get_structure(gst_sample_get_caps(sample), 0);
-#endif
-
+ GstStructure *s = gst_caps_get_structure(gst_sample_get_caps(sample), \
0); ret = gst_structure_get_int(s, "width", &width);
ret &= gst_structure_get_int(s, "height", &height);
@@ -397,18 +345,10 @@ QImage VideoWidget::snapshot() const
QImage snapimage(width, height, QImage::Format_RGB888);
for (int i = 0; i < height; ++i)
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- memcpy(snapimage.scanLine(i),
- GST_BUFFER_DATA(snapbuffer) + i * GST_ROUND_UP_4(width * \
3),
- width * 3);
-#else
memcpy(snapimage.scanLine(i),
info.data + i * GST_ROUND_UP_4(width * 3),
width * 3);
-#endif
-#if GST_VERSION > GST_VERSION_CHECK (1,0,0,0)
gst_buffer_unmap(snapbuffer, &info);
-#endif
gst_buffer_unref(snapbuffer);
return snapimage;
}
@@ -416,15 +356,16 @@ QImage VideoWidget::snapshot() const
gst_buffer_unref(snapbuffer);
}
}
-#endif // gst_video_convert_frame()
+
return QImage();
}
void VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode)
{
m_scaleMode = scaleMode;
- if (m_renderer)
+ if (m_renderer) {
m_renderer->scaleModeChanged(scaleMode);
+ }
}
qreal VideoWidget::brightness() const
@@ -434,11 +375,13 @@ qreal VideoWidget::brightness() const
qreal clampedValue(qreal val)
{
- if (val > 1.0 )
+ if (val > 1.0) {
return 1.0;
- else if (val < -1.0)
+ } else if (val < -1.0) {
return -1.0;
- else return val;
+ } else {
+ return val;
+ }
}
void VideoWidget::setBrightness(qreal newValue)
@@ -641,14 +584,10 @@ void VideoWidget::cb_capsChanged(GstPad *pad, GParamSpec *spec, \
gpointer data) gint height;
//FIXME: This sometimes gives a gstreamer warning. Feels like GStreamer \
shouldn't, and instead //just quietly return false, probably a bug.
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- if (gst_video_get_size(pad, &width, &height)) {
-#else
GstVideoInfo info;
if (gst_video_info_from_caps(&info, gst_pad_get_current_caps(pad))) {
width = info.width;
height = info.height;
-#endif
QMetaObject::invokeMethod(that, "setMovieSize", Q_ARG(QSize, QSize(width, \
height))); }
}
diff --git a/gstreamer/widgetrenderer.cpp b/gstreamer/widgetrenderer.cpp
index 1a0f584..1edffc3 100644
--- a/gstreamer/widgetrenderer.cpp
+++ b/gstreamer/widgetrenderer.cpp
@@ -70,11 +70,7 @@ WidgetRenderer::WidgetRenderer(VideoWidget *videoWidget)
debug() << "Creating QWidget renderer";
if ((m_videoSink = GST_ELEMENT(g_object_new(get_type_RGB(), NULL)))) {
gst_object_ref (GST_OBJECT (m_videoSink)); //Take ownership
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_object_sink (GST_OBJECT (m_videoSink));
-#else
gst_object_ref_sink (GST_OBJECT (m_videoSink));
-#endif
QWidgetVideoSinkBase* sink = \
reinterpret_cast<QWidgetVideoSinkBase*>(m_videoSink); // Let the videosink know \
which widget to direct frame updates to
diff --git a/gstreamer/x11renderer.cpp b/gstreamer/x11renderer.cpp
index bc9107a..7460247 100644
--- a/gstreamer/x11renderer.cpp
+++ b/gstreamer/x11renderer.cpp
@@ -29,12 +29,7 @@
#include <QtGui/QPainter>
#include <X11/Xlib.h>
#include <gst/gst.h>
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
-#include <gst/interfaces/xoverlay.h>
-#include <gst/interfaces/propertyprobe.h>
-#else
#include <gst/video/videooverlay.h>
-#endif
namespace Phonon
{
@@ -111,11 +106,7 @@ GstElement* X11Renderer::createVideoSink()
}
gst_object_ref (GST_OBJECT (videoSink)); //Take ownership
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_object_sink (GST_OBJECT (videoSink));
-#else
gst_object_ref_sink (GST_OBJECT (videoSink));
-#endif
return videoSink;
}
@@ -168,22 +159,9 @@ void X11Renderer::handlePaint(QPaintEvent *)
void X11Renderer::setOverlay()
{
- if (m_videoSink &&
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GST_IS_X_OVERLAY(m_videoSink)
- #else
- GST_IS_VIDEO_OVERLAY(m_videoSink)
- #endif
- ) {
+ if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
WId windowId = m_renderWidget->winId();
-
-#if GST_VERSION >= GST_VERSION_CHECK (1,0,0,0)
gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink), \
windowId);
-#elif GST_VERSION >= GST_VERSION_CHECK(0,10,31,0)
- gst_x_overlay_set_window_handle(GST_X_OVERLAY(m_videoSink), windowId);
-#elif GST_VERSION <= GST_VERSION_CHECK(0,10,31,0)
- gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), windowId);
-#endif // GST_VERSION
}
windowExposed();
m_overlaySet = true;
@@ -196,18 +174,9 @@ void X11Renderer::windowExposed()
QMetaObject::invokeMethod(m_videoWidget, "syncX",
Qt::QueuedConnection);
- if (m_videoSink &&
- #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- GST_IS_X_OVERLAY(m_videoSink)
- #else
- GST_IS_VIDEO_OVERLAY(m_videoSink)
- #endif
- )
-#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
- gst_x_overlay_expose(GST_X_OVERLAY(m_videoSink));
-#else
+ if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
gst_video_overlay_expose(GST_VIDEO_OVERLAY(m_videoSink));
-#endif
+ }
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic