[gstreamermm] plugins: add deprecated ifdef to configuration file
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] plugins: add deprecated ifdef to configuration file
- Date: Tue, 15 Nov 2016 20:16:07 +0000 (UTC)
commit 0dca7a1fc92a1407c9b0a9e4988b81155e82452d
Author: Marcin Kolny <marcin kolny gmail com>
Date: Tue Nov 15 21:15:53 2016 +0100
plugins: add deprecated ifdef to configuration file
configure.ac | 6 ++
examples/all_media_player/main.cc | 17 ++++++
examples/audio_video_muxer/main.cc | 17 ++++++-
examples/hello_world/main.cc | 10 +++-
examples/media_player_gtkmm/main.cc | 6 ++-
examples/media_player_gtkmm/player_window.cc | 33 +++++++++++--
examples/media_player_gtkmm/player_window.h | 14 +++++-
examples/ogg_player_gtkmm/main.cc | 28 ++++++++++
examples/ogg_player_gtkmm/player_window.cc | 4 +-
examples/ogg_player_gtkmm/player_window.h | 10 +++-
examples/ogg_rewriter/main.cc | 20 ++++++--
examples/typefind/main.cc | 53 ++++++++++++++++++--
gstreamer/gstreamermm.h | 2 +
gstreamer/gstreamermmconfig.h.in | 3 +
tests/integration/pluginbin.h | 6 +--
.../integration/test-integration-bininpipeline.cc | 17 +++---
tests/integration/test-integration-binplugin.cc | 4 +-
tests/integration/test-integration-rewritefile.cc | 8 ++--
.../integration/test-integration-videoduration.cc | 5 +-
tests/integration/utils.cc | 8 ++--
tests/plugins/test-plugin-appsink.cc | 5 ++
tests/plugins/test-plugin-appsrc.cc | 5 ++
tests/plugins/test-plugin-derivedfromappsink.cc | 7 ++-
tests/plugins/test-plugin-derivedfromappsrc.cc | 5 ++
.../test-plugin-derivedfrombasetransform.cc | 6 ++
tests/plugins/test-plugin-pushsrc.cc | 6 ++
tests/plugins/test-plugin-register.cc | 6 ++
tests/test-caps.cc | 6 +-
tests/test-element.cc | 7 +--
.../extra_defs_gen/generate_plugin_gmmproc_file.cc | 3 +
30 files changed, 266 insertions(+), 61 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0b1ddd0..5d354f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -207,6 +207,10 @@ MM_ARG_ENABLE_WARNINGS([GSTREAMERMM_WXXFLAGS],
[-Wall], [-Wall -Wextra],
[G GSTREAMER])
+# Offer the ability to omit some API from the library,
+# to reduce the code size:
+MM_ARG_DISABLE_DEPRECATED_API([GSTREAMERMM])
+
AC_CONFIG_FILES([Makefile
tools/Makefile
gstreamer/${GSTREAMERMM_MODULE_NAME}.pc:gstreamer/gstreamermm.pc.in
@@ -235,7 +239,9 @@ ${PACKAGE}-${VERSION}
gstreamer-plugins-bad: ${gstmm_enable_plugins_bad} ${gstmm_plugins_bad_version}
gstreamer-gl: ${gstmm_enable_gl}
+
Extra features
+ Use deprecated API: ${mm_enable_deprecated_api}
GUI Examples: ${gstmm_enable_gui_examples}
Unit Tests: ${enable_unittests}
diff --git a/examples/all_media_player/main.cc b/examples/all_media_player/main.cc
index 1d324ea..3df9070 100644
--- a/examples/all_media_player/main.cc
+++ b/examples/all_media_player/main.cc
@@ -18,7 +18,13 @@ class AllMediaPlayer
private:
RefPtr<Glib::MainLoop> main_loop;
RefPtr<Pipeline> pipeline;
+
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
RefPtr<FileSrc> source;
+#else
+ RefPtr<Gst::Element> source;
+#endif
+
RefPtr<Element> decoder;
bool on_bus_message(const RefPtr<Bus>&, const RefPtr<Message>& message);
@@ -26,7 +32,12 @@ private:
void init()
{
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
source = FileSrc::create();
+#else
+ source = ElementFactory::create_element("filesrc");
+#endif
+
decoder = ElementFactory::create_element("decodebin");
if (!decoder || !source)
@@ -51,7 +62,13 @@ public:
void play_until_eos(const std::string& filename)
{
init();
+
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
source->property_location() = filename;
+#else
+ source->set_property("location", filename);
+#endif
+
pipeline->set_state(STATE_PLAYING);
main_loop->run();
pipeline->set_state(STATE_NULL);
diff --git a/examples/audio_video_muxer/main.cc b/examples/audio_video_muxer/main.cc
index 82f4eb1..525f980 100644
--- a/examples/audio_video_muxer/main.cc
+++ b/examples/audio_video_muxer/main.cc
@@ -68,8 +68,15 @@ int main(int argc, char** argv)
RefPtr<Bus> bus = pipeline->get_bus();
bus->add_watch(sigc::ptr_fun(&on_bus_message));
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
RefPtr<FileSrc> video_source = FileSrc::create(),
audio_source = FileSrc::create();
+ RefPtr<FileSink> filesink = FileSink::create();
+#else
+ RefPtr<Element> video_source = ElementFactory::create_element("filesrc"),
+ audio_source = ElementFactory::create_element("filesrc"),
+ filesink = ElementFactory::create_element("filesink");
+#endif
RefPtr<Element> ogg_demuxer = ElementFactory::create_element("oggdemux");
audio_parser = ElementFactory::create_element("mad");
@@ -78,7 +85,7 @@ int main(int argc, char** argv)
videosink = ElementFactory::create_element("autovideosink");
RefPtr<Element> muxer = ElementFactory::create_element("matroskamux");
- RefPtr<FileSink> filesink = FileSink::create();
+
video_parser = ElementFactory::create_element("theoraparse");
@@ -88,10 +95,16 @@ int main(int argc, char** argv)
return 1;
}
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
video_source->property_location() = argv[1];
audio_source->property_location() = argv[2];
filesink->property_location() = argv[3];
-
+#else
+ video_source->set_property<Glib::ustring>("location", argv[1]);
+ audio_source->set_property<Glib::ustring>("location", argv[2]);
+ filesink->set_property<Glib::ustring>("location", argv[3]);
+#endif
+
pipeline->add(video_source)->
add(ogg_demuxer)->
add(video_parser)->
diff --git a/examples/hello_world/main.cc b/examples/hello_world/main.cc
index ee6f371..350c8f0 100644
--- a/examples/hello_world/main.cc
+++ b/examples/hello_world/main.cc
@@ -75,9 +75,13 @@ int main(int argc, char** argv)
return EXIT_FAILURE;
}
- // Create a playbin2 element.
+ // Create a playbin element.
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
Glib::RefPtr<Gst::PlayBin> playbin = Gst::PlayBin::create();
-
+#else
+ Glib::RefPtr<Gst::Element> playbin = Gst::ElementFactory::create_element("playbin");
+#endif
+
if(!playbin)
{
std::cerr << "The playbin2 element could not be created." << std::endl;
@@ -93,7 +97,7 @@ int main(int argc, char** argv)
uri = Glib::filename_to_uri(argv[1]);
// Set the playbyin2's uri property.
- playbin->property_uri() = uri;
+ playbin->set_property("uri", uri);
// Create the main loop.
mainloop = Glib::MainLoop::create();
diff --git a/examples/media_player_gtkmm/main.cc b/examples/media_player_gtkmm/main.cc
index 92134c2..025a742 100644
--- a/examples/media_player_gtkmm/main.cc
+++ b/examples/media_player_gtkmm/main.cc
@@ -19,7 +19,7 @@
#include "player_window.h"
#include <gtkmm.h>
-#include <gstreamermm/init.h>
+#include <gstreamermm.h>
#include <iostream>
@@ -30,7 +30,11 @@ int main (int argc, char **argv)
// playbin plays any media type, choosing an appropriate set of elements
// and linking them together.
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
Glib::RefPtr<Gst::PlayBin> playbin = Gst::PlayBin::create("playbin");
+#else
+ Glib::RefPtr<Gst::Element> playbin = Gst::ElementFactory::create_element("playbin");
+#endif
if(!playbin)
{
diff --git a/examples/media_player_gtkmm/player_window.cc b/examples/media_player_gtkmm/player_window.cc
index 04001bb..cfd3693 100644
--- a/examples/media_player_gtkmm/player_window.cc
+++ b/examples/media_player_gtkmm/player_window.cc
@@ -18,7 +18,6 @@
#include "player_window.h"
-#include <gstreamermm.h>
#include <gstreamermm/xvimagesink.h>
#if defined (GDK_WINDOWING_X11)
@@ -30,7 +29,19 @@
#include <iostream>
#include <iomanip>
-PlayerWindow::PlayerWindow(const Glib::RefPtr<Gst::PlayBin>& playbin)
+#ifdef GSTREAMERMM_DISABLE_DEPRECATED
+
+static const Glib::SignalProxyInfo PlayBin_signal_video_changed_info =
+{
+ "video-changed",
+ (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
+ (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
+};
+
+#endif
+
+
+PlayerWindow::PlayerWindow(const Glib::RefPtr<PlayBinT>& playbin)
: m_vbox(false, 6),
m_progress_label("000:00:00.000000000 / 000:00:00.000000000"),
m_play_button("Play"),
@@ -102,10 +113,17 @@ PlayerWindow::PlayerWindow(const Glib::RefPtr<Gst::PlayBin>& playbin)
m_forward_button.set_sensitive(false);
m_playbin = playbin;
+
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
m_playbin->property_video_sink() = Gst::XvImageSink::create();
m_playbin->signal_video_changed().connect(
sigc::mem_fun(*this, &PlayerWindow::on_video_changed) );
-
+#else
+ m_playbin->set_property("video-sink", Gst::ElementFactory::create_element("xvimagesink"));
+ Glib::SignalProxy< void >(m_playbin.operator->(), &PlayBin_signal_video_changed_info).connect(
+ sigc::mem_fun(*this, &PlayerWindow::on_video_changed) );
+#endif
+
show_all_children();
m_pause_button.hide();
}
@@ -206,7 +224,14 @@ bool PlayerWindow::on_bus_message(const Glib::RefPtr<Gst::Bus>& /* bus */,
void PlayerWindow::on_video_changed()
{
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
Glib::RefPtr<Gst::Pad> pad = m_playbin->get_video_pad(0);
+#else
+ GstPad* result;
+ g_signal_emit_by_name(m_playbin->gobj(), "get-video-pad", 0, &result, static_cast<void*>(0));
+ Glib::RefPtr<Gst::Pad> pad = Glib::wrap(result);
+#endif
+
if(pad)
{
// Add a buffer probe to the video sink pad which will be removed after
@@ -384,7 +409,7 @@ void PlayerWindow::on_button_open()
working_dir = chooser.get_current_folder();
// Set uri property on the playbin.
- m_playbin->property_uri() = chooser.get_uri();
+ m_playbin->set_property("uri", chooser.get_uri());
// Resize m_video_area and window to minimum when opening a file
m_video_area.set_size_request(0, 0);
diff --git a/examples/media_player_gtkmm/player_window.h b/examples/media_player_gtkmm/player_window.h
index d029ebc..b7bb979 100644
--- a/examples/media_player_gtkmm/player_window.h
+++ b/examples/media_player_gtkmm/player_window.h
@@ -20,12 +20,17 @@
#define PLAYER_WINDOW_H_
#include <gtkmm.h>
-#include <gstreamermm/playbin.h>
+#include <gstreamermm.h>
class PlayerWindow : public Gtk::Window
{
public:
- PlayerWindow(const Glib::RefPtr<Gst::PlayBin>& playbin);
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
+ using PlayBinT = Gst::PlayBin;
+#else
+ using PlayBinT = Gst::Element;
+#endif
+ PlayerWindow(const Glib::RefPtr<PlayBinT>& playbin);
virtual ~PlayerWindow();
protected:
@@ -61,7 +66,12 @@ protected:
Gtk::Button m_forward_button;
Gtk::Button m_open_button;
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
Glib::RefPtr<Gst::PlayBin> m_playbin;
+#else
+ Glib::RefPtr<Gst::Element> m_playbin;
+#endif
+
sigc::connection m_timeout_connection;
guint m_watch_id;
gint64 m_duration;
diff --git a/examples/ogg_player_gtkmm/main.cc b/examples/ogg_player_gtkmm/main.cc
index 90a91fa..6b10886 100644
--- a/examples/ogg_player_gtkmm/main.cc
+++ b/examples/ogg_player_gtkmm/main.cc
@@ -19,6 +19,7 @@
#include <gtkmm/main.h>
#include <gstreamermm/init.h>
#include <gstreamermm/element.h>
+#include <gstreamermm/elementfactory.h>
#include <gstreamermm/pad.h>
#include <gstreamermm/pipeline.h>
@@ -33,7 +34,12 @@
#include "player_window.h"
Glib::RefPtr<Gst::Pipeline> pipeline;
+
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
Glib::RefPtr<Gst::VorbisDec> decoder;
+#else
+Glib::RefPtr<Gst::Element> decoder;
+#endif
void on_parser_pad_added(const Glib::RefPtr<Gst::Pad>& newPad)
{
@@ -58,7 +64,11 @@ int main(int argc, char** argv)
// Create the elements
// Reads file from disk
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
Glib::RefPtr<Gst::FileSrc> source = Gst::FileSrc::create();
+#else
+ Glib::RefPtr<Gst::Element> source = Gst::ElementFactory::create_element("filesrc");
+#endif
if(!source)
{
std::cerr << "filesrc element could not be created" << std::endl;
@@ -67,7 +77,11 @@ int main(int argc, char** argv)
// Parses the ogg streams into elementary streams (note that an ogg file may
// contain a video stream too)
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
Glib::RefPtr<Gst::OggDemux> parser = Gst::OggDemux::create();
+#else
+ Glib::RefPtr<Gst::Element> parser = Gst::ElementFactory::create_element("oggdemux");
+#endif
if(!parser)
{
std::cerr << "oggdemux element could not be created" << std::endl;
@@ -75,7 +89,12 @@ int main(int argc, char** argv)
}
// Decodes a vorbis stream
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
decoder = Gst::VorbisDec::create();
+#else
+ decoder = Gst::ElementFactory::create_element("vorbisdec");
+#endif
+
if(!decoder)
{
std::cerr << "vorbisdec element could not be created" << std::endl;
@@ -83,7 +102,12 @@ int main(int argc, char** argv)
}
// Converts audio to a format which can be used by the next element
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
Glib::RefPtr<Gst::AudioConvert> conv = Gst::AudioConvert::create();
+#else
+ Glib::RefPtr<Gst::Element> conv = Gst::ElementFactory::create_element("audioconvert");
+#endif
+
if(!conv)
{
std::cerr << "audioconvert element could not be created" << std::endl;
@@ -91,7 +115,11 @@ int main(int argc, char** argv)
}
// Outputs sound to an ALSA audio device
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
Glib::RefPtr<Gst::AlsaSink> sink = Gst::AlsaSink::create();
+#else
+ Glib::RefPtr<Gst::Element> sink = Gst::ElementFactory::create_element("alsasink");
+#endif
if(!sink)
{
std::cerr << "sink element could not be created" << std::endl;
diff --git a/examples/ogg_player_gtkmm/player_window.cc b/examples/ogg_player_gtkmm/player_window.cc
index 35bc808..c669f3c 100644
--- a/examples/ogg_player_gtkmm/player_window.cc
+++ b/examples/ogg_player_gtkmm/player_window.cc
@@ -30,7 +30,7 @@
#include <iomanip>
#include "player_window.h"
-PlayerWindow::PlayerWindow(const Glib::RefPtr<Gst::FileSrc>& source_element,
+PlayerWindow::PlayerWindow(const Glib::RefPtr<FileSrcT>& source_element,
const Glib::RefPtr<Gst::Pipeline>& main_pipeline)
: m_vbox(false, 5),
m_progress_label("000:00:00.000000000 / 000:00:00.000000000"),
@@ -290,7 +290,7 @@ void PlayerWindow::on_button_open()
// Set uri on the file source.
const std::string uri = chooser.get_uri();
- m_source_element->set_uri(uri);
+ m_source_element->set_property("uri", uri);
set_title(uri);
m_play_button.set_sensitive();
diff --git a/examples/ogg_player_gtkmm/player_window.h b/examples/ogg_player_gtkmm/player_window.h
index 740f9e1..ae90cf3 100644
--- a/examples/ogg_player_gtkmm/player_window.h
+++ b/examples/ogg_player_gtkmm/player_window.h
@@ -25,6 +25,7 @@
#include <gtkmm/label.h>
#include <gtkmm/button.h>
#include <gtkmm/scale.h>
+#include <gstreamermmconfig.h>
#include <gstreamermm/element.h>
#include <gstreamermm/pipeline.h>
#include <gstreamermm/filesrc.h>
@@ -32,7 +33,12 @@
class PlayerWindow : public Gtk::Window
{
public:
- PlayerWindow(const Glib::RefPtr<Gst::FileSrc>& sourceElement,
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
+ using FileSrcT = Gst::FileSrc;
+#else
+ using FileSrcT = Gst::Element;
+#endif
+ PlayerWindow(const Glib::RefPtr<FileSrcT>& sourceElement,
const Glib::RefPtr<Gst::Pipeline>& mainPipeline);
virtual ~PlayerWindow();
@@ -65,7 +71,7 @@ protected:
Gtk::Button m_forward_button;
Gtk::Button m_open_button;
- Glib::RefPtr<Gst::FileSrc> m_source_element;
+ Glib::RefPtr<FileSrcT> m_source_element;
Glib::RefPtr<Gst::Pipeline> m_main_pipeline;
sigc::connection m_progress_connection;
unsigned int m_watch_id;
diff --git a/examples/ogg_rewriter/main.cc b/examples/ogg_rewriter/main.cc
index f1a8976..277404f 100644
--- a/examples/ogg_rewriter/main.cc
+++ b/examples/ogg_rewriter/main.cc
@@ -37,20 +37,30 @@ int main(int argc, char** argv)
return EXIT_FAILURE;
}
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
Glib::RefPtr<Gst::FileSrc> filesrc = Gst::FileSrc::create();
+ Glib::RefPtr<Gst::FileSink> filesink = Gst::FileSink::create();
+#else
+ Glib::RefPtr<Gst::Element> filesrc = Gst::ElementFactory::create_element("filesrc");
+ Glib::RefPtr<Gst::Element> filesink = Gst::ElementFactory::create_element("filesink");
+#endif
- if(!filesrc)
+ if(!filesrc || !filesink)
{
- std::cerr << "The FileSrc element could not be created." << std::endl;
+ std::cerr << "The FileSrc or FileSink element could not be created." << std::endl;
return EXIT_FAILURE;
}
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
filesrc->property_location() = argv[1];
-
+ filesink->property_location() = argv[2];
+#else
+ filesrc->set_property<Glib::ustring>("location", argv[1]);
+ filesink->set_property<Glib::ustring>("location", argv[2]);
+#endif
+
mainloop = Glib::MainLoop::create();
pipeline = Gst::Pipeline::create("rewriter");
- Glib::RefPtr<Gst::FileSink> filesink = Gst::FileSink::create();
- filesink->property_location() = argv[2];
Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
bus->add_watch(sigc::ptr_fun(&on_bus_message));
diff --git a/examples/typefind/main.cc b/examples/typefind/main.cc
index 6837022..756b6e6 100644
--- a/examples/typefind/main.cc
+++ b/examples/typefind/main.cc
@@ -18,6 +18,7 @@
#include <gstreamermm.h>
#include <glibmm/main.h>
+#include <glibmm/exceptionhandler.h>
#include <iostream>
Glib::RefPtr<Glib::MainLoop> mainloop;
@@ -63,6 +64,38 @@ static void on_typefind_have_type(guint probability, const Glib::RefPtr<Gst::Cap
std::cerr << "on_typefind_have_type(): mainloop is null" << std::endl;
}
+#ifdef GSTREAMERMM_DISABLE_DEPRECATED
+
+#include <gst/gsttypefind.h>
+
+static void TypeFindElement_signal_have_type_callback(struct _GstTypeFindElement* self, guint p0,GstCaps*
p1,void* data)
+{
+ using SlotType = sigc::slot< void,guint,const Glib::RefPtr<Gst::Caps>& >;
+
+ auto obj = dynamic_cast<Gst::Element*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
+ if(obj)
+ {
+ try
+ {
+ if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
+ (*static_cast<SlotType*>(slot))(p0, Glib::wrap(p1, true));
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ }
+}
+
+
+static const Glib::SignalProxyInfo TypeFindElement_signal_have_type_info =
+{
+ "have-type",
+ (GCallback) &TypeFindElement_signal_have_type_callback,
+ (GCallback) &TypeFindElement_signal_have_type_callback
+};
+#endif
+
int main(int argc, char** argv)
{
// Initialize Gstreamermm:
@@ -81,18 +114,28 @@ int main(int argc, char** argv)
Glib::RefPtr<Gst::Pipeline> pipeline = Gst::Pipeline::create("my-pipeline");
// Create elements:
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
Glib::RefPtr<Gst::FileSrc> element_source = Gst::FileSrc::create();
element_source->property_location() = filename;
+ Glib::RefPtr<Gst::FakeSink> element_sink = Gst::FakeSink::create();
+ Glib::RefPtr<Gst::TypeFindElement> element_typefind = Gst::TypeFindElement::create();
+ element_typefind->signal_have_type().connect(
+ sigc::ptr_fun(&on_typefind_have_type) );
+
+#else
+ Glib::RefPtr<Gst::Element> element_source = Gst::ElementFactory::create_element("filesrc");
+ element_source->set_property("location", filename);
+ Glib::RefPtr<Gst::Element> element_sink = Gst::ElementFactory::create_element("fakesink");
+ Glib::RefPtr<Gst::Element> element_typefind = Gst::ElementFactory::create_element("typefind");
+
+ Glib::SignalProxy< void,guint,const Glib::RefPtr<Gst::Caps>& > proxy(element_typefind.operator->(),
&TypeFindElement_signal_have_type_info);
+ proxy.connect(sigc::ptr_fun(&on_typefind_have_type));
+#endif
//If using an MP3 file, this should provide more Caps information from typefind.
//Glib::RefPtr<Gst::Element> element_id3demux = Gst::ElementFactory::create_element("id3demux");
//g_assert(element_id3demux);
- Glib::RefPtr<Gst::TypeFindElement> element_typefind = Gst::TypeFindElement::create();
- element_typefind->signal_have_type().connect(
- sigc::ptr_fun(&on_typefind_have_type) );
- Glib::RefPtr<Gst::Element> element_sink = Gst::FakeSink::create();
-
// We must add the elements to the pipeline before linking them:
try
{
diff --git a/gstreamer/gstreamermm.h b/gstreamer/gstreamermm.h
index 39451b7..e58c8be 100644
--- a/gstreamer/gstreamermm.h
+++ b/gstreamer/gstreamermm.h
@@ -58,6 +58,8 @@
* @endcode
*/
+#include <gstreamermmconfig.h>
+
#include <gstreamermm/check.h>
#include <gstreamermm/init.h>
#include <gstreamermm/version.h>
diff --git a/gstreamer/gstreamermmconfig.h.in b/gstreamer/gstreamermmconfig.h.in
index c3b4db2..be2c55e 100644
--- a/gstreamer/gstreamermmconfig.h.in
+++ b/gstreamer/gstreamermmconfig.h.in
@@ -5,6 +5,9 @@
#include "glibmmconfig.h"
+/* Define to omit deprecated API from the library. */
+#undef GSTREAMERMM_DISABLE_DEPRECATED
+
/* Major version of gstreamermm */
#undef GSTREAMERMM_MAJOR_VERSION
diff --git a/tests/integration/pluginbin.h b/tests/integration/pluginbin.h
index 743f5e1..8757bdd 100644
--- a/tests/integration/pluginbin.h
+++ b/tests/integration/pluginbin.h
@@ -10,8 +10,6 @@
#include <gstreamermm.h>
#include <gstreamermm/private/bin_p.h>
-#include <gstreamermm/filesrc.h>
-#include <gstreamermm/filesink.h>
#include <cstdio>
#include <sys/stat.h>
@@ -50,10 +48,10 @@ public:
{
if (transition == Gst::STATE_CHANGE_NULL_TO_READY)
{
- Glib::RefPtr<Gst::FileSrc> source_file = Gst::FileSrc::create("source-file");
+ Glib::RefPtr<Gst::Element> source_file = Gst::ElementFactory::create_element("filesrc", "source-file");
Glib::RefPtr<Gst::Element> png_decoder = Gst::ElementFactory::create_element("pngdec");
Glib::ustring str = "resources/input-image.png";
- source_file->property_location() = location.get_value();
+ source_file->set_property("location", location.get_value());
add(source_file);
add(png_decoder);
diff --git a/tests/integration/test-integration-bininpipeline.cc
b/tests/integration/test-integration-bininpipeline.cc
index 820d436..944b32c 100644
--- a/tests/integration/test-integration-bininpipeline.cc
+++ b/tests/integration/test-integration-bininpipeline.cc
@@ -7,8 +7,6 @@
#include "mmtest.h"
#include <gstreamermm.h>
-#include <gstreamermm/filesrc.h>
-#include <gstreamermm/filesink.h>
#include <glibmm/main.h>
using namespace Gst;
@@ -17,14 +15,14 @@ using Glib::RefPtr;
class CustomBin : public Bin
{
private:
- RefPtr<FileSrc> source_file;
+ RefPtr<Element> source_file;
RefPtr<Element> queue;
RefPtr<GhostPad> src_pad;
protected:
explicit CustomBin(const Glib::ustring& name)
: Bin(name)
{
- source_file = FileSrc::create("source-file");
+ source_file = ElementFactory::create_element("filesrc", "source-file");
queue = ElementFactory::create_element("queue");
add(source_file);
@@ -44,7 +42,7 @@ public:
void set_location(const Glib::ustring& filename)
{
- source_file->property_location() = filename;
+ source_file->set_property("location", filename);
}
};
@@ -69,8 +67,8 @@ bool on_bus_message(const RefPtr<Bus>&, const Glib::RefPtr<Message>& message)
TEST(IntegrationBinInPipelineTest, CustomBinShouldCorrectPassThroughImage)
{
- Glib::ustring input_png = "resources/input-image.png",
- output_jpg = "resources/test-integration-bininpipeline-output-image.jpg";
+ Glib::ustring input_png = "/home/loganek/repos/gstreamermm/tests/resources/input-image.png",
+ output_jpg = "test-integration-bininpipeline-output-image.jpg";
mainloop = Glib::MainLoop::create();
MM_ASSERT_TRUE(mainloop);
@@ -78,7 +76,7 @@ TEST(IntegrationBinInPipelineTest, CustomBinShouldCorrectPassThroughImage)
MM_ASSERT_TRUE(custom_bin);
RefPtr<Element> queue = ElementFactory::create_element("queue");
MM_ASSERT_TRUE(queue);
- RefPtr<FileSink> file_sink = FileSink::create("file-sink");
+ RefPtr<Element> file_sink = ElementFactory::create_element("filesink", "file-sink");
MM_ASSERT_TRUE(file_sink);
RefPtr<Pipeline> pipeline = Pipeline::create("image-converter-pipeline");
MM_ASSERT_TRUE(custom_bin);
@@ -92,9 +90,10 @@ TEST(IntegrationBinInPipelineTest, CustomBinShouldCorrectPassThroughImage)
custom_bin->set_location(input_png);
- file_sink->property_location() = output_jpg;
+ file_sink->set_property("location", output_jpg);
pipeline->set_state(STATE_PLAYING);
+
mainloop->run();
pipeline->set_state(Gst::STATE_NULL);
diff --git a/tests/integration/test-integration-binplugin.cc b/tests/integration/test-integration-binplugin.cc
index 0e955b5..c363458 100644
--- a/tests/integration/test-integration-binplugin.cc
+++ b/tests/integration/test-integration-binplugin.cc
@@ -48,7 +48,7 @@ TEST(IntegrationBinPluginTest, DISABLED_ShouldDecodeAndEncodeFile)
MM_ASSERT_TRUE(pluginbin);
RefPtr<Element> jpg_encoder = ElementFactory::create_element("queue");
MM_ASSERT_TRUE(jpg_encoder);
- RefPtr<FileSink> file_sink = FileSink::create("file-sink");
+ RefPtr<Element> file_sink = ElementFactory::create_element("filesink", "file-sink");
MM_ASSERT_TRUE(file_sink);
RefPtr<Pipeline> pipeline = Pipeline::create("image-converter-pipeline");
MM_ASSERT_TRUE(pipeline);
@@ -61,7 +61,7 @@ TEST(IntegrationBinPluginTest, DISABLED_ShouldDecodeAndEncodeFile)
bus->add_watch(sigc::ptr_fun(&on_bus_message));
pluginbin->set_property("location", input_png);
- file_sink->property_location() = output_jpg;
+ file_sink->set_property("location", output_jpg);
pipeline->set_state(STATE_PLAYING);
mainloop->run();
diff --git a/tests/integration/test-integration-rewritefile.cc
b/tests/integration/test-integration-rewritefile.cc
index e35106b..1abc8ab 100644
--- a/tests/integration/test-integration-rewritefile.cc
+++ b/tests/integration/test-integration-rewritefile.cc
@@ -41,17 +41,17 @@ TEST(IntegrationRewriteFileTest, CreateAndRewriteFile)
GenerateSampleOggFile(20, input_filename);
Glib::RefPtr<Gst::Pipeline> pipeline;
- RefPtr<FileSrc> filesrc = Gst::FileSrc::create();
+ RefPtr<Element> filesrc = Gst::ElementFactory::create_element("filesrc");
MM_ASSERT_TRUE(filesrc);
- filesrc->property_location() = input_filename;
+ filesrc->set_property("location", input_filename);
mainloop = Glib::MainLoop::create();
pipeline = Gst::Pipeline::create("rewriter");
- Glib::RefPtr<Gst::FileSink> filesink = Gst::FileSink::create();
+ Glib::RefPtr<Gst::Element> filesink = Gst::ElementFactory::create_element("filesink");
MM_ASSERT_TRUE(filesink);
- filesink->property_location() = output_filename;
+ filesink->set_property("location", output_filename);
Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
bus->add_watch(sigc::ptr_fun(&on_bus_message));
diff --git a/tests/integration/test-integration-videoduration.cc
b/tests/integration/test-integration-videoduration.cc
index 2971be9..7db3d25 100644
--- a/tests/integration/test-integration-videoduration.cc
+++ b/tests/integration/test-integration-videoduration.cc
@@ -7,7 +7,6 @@
#include "mmtest.h"
#include <gstreamermm.h>
-#include <gstreamermm/fakesink.h>
#include <glibmm/main.h>
#include "utils.h"
@@ -63,10 +62,10 @@ TEST(IntegrationVideodurationTest, CreateVideoAndCheckDuration)
GenerateSampleOggFile(10, input_filename);
- RefPtr<FileSrc> filesrc = Gst::FileSrc::create();
+ RefPtr<Element> filesrc = Gst::ElementFactory::create_element("filesrc");
MM_ASSERT_TRUE(filesrc);
- filesrc->property_location() = input_filename;
+ filesrc->set_property("location", input_filename);
mainloop = Glib::MainLoop::create();
pipeline = Pipeline::create("rewriter");
diff --git a/tests/integration/utils.cc b/tests/integration/utils.cc
index 8a56ee1..80aec94 100644
--- a/tests/integration/utils.cc
+++ b/tests/integration/utils.cc
@@ -37,10 +37,10 @@ bool utils_on_bus_message(const RefPtr<Bus>&, const Glib::RefPtr<Message>& messa
void GenerateSampleOggFile(int num_buffers, const Glib::ustring& filename)
{
RefPtr<Pipeline> pipeline = Pipeline::create("create-ogg");
- RefPtr<VideoTestSrc> source = VideoTestSrc::create("testsource");
+ RefPtr<Element> source = ElementFactory::create_element("videotestsrc", "testsource");
RefPtr<Element> encoder = ElementFactory::create_element("theoraenc"),
muxer = ElementFactory::create_element("oggmux");
- RefPtr<FileSink> sink = FileSink::create("fsink");
+ RefPtr<Element> sink = ElementFactory::create_element("filesink", "fsink");
//RefPtr<Element> sink = ElementFactory::create_element("xvimagesink");
Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
@@ -50,8 +50,8 @@ void GenerateSampleOggFile(int num_buffers, const Glib::ustring& filename)
pipeline->add(source)->add(encoder)->add(muxer)->add(sink);
- source->property_num_buffers() = num_buffers;
- sink->property_location() = filename;
+ source->set_property("num_buffers", num_buffers);
+ sink->set_property("location", filename);
muxer->link(sink);
source->link(encoder);
diff --git a/tests/plugins/test-plugin-appsink.cc b/tests/plugins/test-plugin-appsink.cc
index 34c97bf..0eb91ee 100644
--- a/tests/plugins/test-plugin-appsink.cc
+++ b/tests/plugins/test-plugin-appsink.cc
@@ -7,6 +7,9 @@
#include "mmtest.h"
#include <gstreamermm.h>
+
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
+
#include <gstreamermm/appsink.h>
#include <gstreamermm/appsrc.h>
@@ -120,3 +123,5 @@ TEST_F(AppSinkPluginTest, UseAppSinkDuringDataFlowInPipeline)
EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
}
+
+#endif
diff --git a/tests/plugins/test-plugin-appsrc.cc b/tests/plugins/test-plugin-appsrc.cc
index 8adc4c3..55a4f49 100644
--- a/tests/plugins/test-plugin-appsrc.cc
+++ b/tests/plugins/test-plugin-appsrc.cc
@@ -7,6 +7,9 @@
#include "mmtest.h"
#include <gstreamermm.h>
+
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
+
#include <gstreamermm/appsrc.h>
using namespace Gst;
@@ -118,3 +121,5 @@ TEST_F(AppSrcPluginTest, SimpleDataFlowInPipelineWithAppSrcElement)
EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
}
+
+#endif
diff --git a/tests/plugins/test-plugin-derivedfromappsink.cc b/tests/plugins/test-plugin-derivedfromappsink.cc
index a6706af..b3fab86 100644
--- a/tests/plugins/test-plugin-derivedfromappsink.cc
+++ b/tests/plugins/test-plugin-derivedfromappsink.cc
@@ -1,5 +1,8 @@
-#include "mmtest.h"
#include <gstreamermm.h>
+
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
+
+#include "mmtest.h"
#include <gstreamermm/appsrc.h>
#include <gstreamermm/appsink.h>
@@ -118,3 +121,5 @@ TEST_F(DerivedFromAppSinkPluginTest, UseAppSinkDuringDataFlowInPipeline)
EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
}
+
+#endif
diff --git a/tests/plugins/test-plugin-derivedfromappsrc.cc b/tests/plugins/test-plugin-derivedfromappsrc.cc
index 00fc159..6fcb6cb 100644
--- a/tests/plugins/test-plugin-derivedfromappsrc.cc
+++ b/tests/plugins/test-plugin-derivedfromappsrc.cc
@@ -1,5 +1,8 @@
#include "mmtest.h"
#include <gstreamermm.h>
+
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
+
#include <gstreamermm/appsrc.h>
#include "derivedfromappsrc.h"
@@ -116,3 +119,5 @@ TEST_F(DerivedFromAppSrcPluginTest, SimpleDataFlowInPipelineWithAppSrcElement)
EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
}
+
+#endif
diff --git a/tests/plugins/test-plugin-derivedfrombasetransform.cc
b/tests/plugins/test-plugin-derivedfrombasetransform.cc
index 57b5df2..e3ce7b3 100644
--- a/tests/plugins/test-plugin-derivedfrombasetransform.cc
+++ b/tests/plugins/test-plugin-derivedfrombasetransform.cc
@@ -1,5 +1,9 @@
#include "mmtest.h"
#include <gstreamermm.h>
+
+// TODO re-write this tests to not use AppSrc/AppSink
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
+
#include <gstreamermm/appsink.h>
#include <gstreamermm/appsrc.h>
#include <vector>
@@ -113,3 +117,5 @@ TEST_F(DerivedFromBaseTransformPluginTest, CheckDataFlowThroughCreatedElement)
EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(Gst::STATE_NULL));
}
+
+#endif
diff --git a/tests/plugins/test-plugin-pushsrc.cc b/tests/plugins/test-plugin-pushsrc.cc
index bd057ae..97faff0 100644
--- a/tests/plugins/test-plugin-pushsrc.cc
+++ b/tests/plugins/test-plugin-pushsrc.cc
@@ -7,6 +7,10 @@
#include "mmtest.h"
#include <gstreamermm.h>
+
+// TODO re-write this tests to not use AppSrc/AppSink
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
+
#include <string>
#include <gstreamermm/appsink.h>
#include <gstreamermm/private/pushsrc_p.h>
@@ -109,3 +113,5 @@ TEST_F(PushSrcPluginTest, DISABLED_CreatePipelineWithRegisteredElement)
{
CreatePipeline();
}
+
+#endif
diff --git a/tests/plugins/test-plugin-register.cc b/tests/plugins/test-plugin-register.cc
index a912dc2..9ab0756 100644
--- a/tests/plugins/test-plugin-register.cc
+++ b/tests/plugins/test-plugin-register.cc
@@ -7,6 +7,10 @@
#include "mmtest.h"
#include <gstreamermm.h>
+
+// TODO re-write this tests to not use AppSrc/AppSink
+#ifndef GSTREAMERMM_DISABLE_DEPRECATED
+
#include <gstreamermm/appsink.h>
#include <gstreamermm/appsrc.h>
#include <vector>
@@ -105,3 +109,5 @@ TEST_F(RegisterPluginTest, CheckDataFlowThroughCreatedElement)
EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(Gst::STATE_NULL));
}
+
+#endif
diff --git a/tests/test-caps.cc b/tests/test-caps.cc
index b70ea67..e4bbdb8 100644
--- a/tests/test-caps.cc
+++ b/tests/test-caps.cc
@@ -124,13 +124,13 @@ TEST_F(CapsTest, MergeCaps)
TEST_F(CapsTest, CapsBoxedType)
{
- Glib::RefPtr<Gst::CapsFilter> filter = Gst::CapsFilter::create();
+ Glib::RefPtr<Gst::Element> filter = Gst::ElementFactory::create_element("capsfilter");
Glib::RefPtr<Gst::Caps> any_caps = Gst::Caps::create_any();
Glib::RefPtr<Gst::Caps> any_caps2 = Gst::Caps::create_any();
ASSERT_EQ(1, any_caps->get_refcount());
- filter->property_caps() = any_caps;
+ filter->set_property("caps", any_caps);
ASSERT_EQ(2, any_caps->get_refcount());
- filter->property_caps() = any_caps2;
+ filter->set_property("caps", any_caps2);
ASSERT_EQ(1, any_caps->get_refcount());
ASSERT_EQ(2, any_caps2->get_refcount());
}
diff --git a/tests/test-element.cc b/tests/test-element.cc
index d3fc8d6..13c2ced 100644
--- a/tests/test-element.cc
+++ b/tests/test-element.cc
@@ -1,8 +1,5 @@
#include "mmtest.h"
-#include <glibmm/threads.h>
-#include <gstreamermm/identity.h>
-#include <gstreamermm/iterator.h>
-#include <gstreamermm/bus.h>
+#include <gstreamermm.h>
using namespace Gst;
using namespace Glib;
@@ -11,7 +8,7 @@ TEST(ElementTest, PostMessageShouldProperlyRefcountGivenMessage)
{
RefPtr<Bus> bus = Bus::create();
MM_ASSERT_TRUE(bus);
- RefPtr<Element> element = Identity::create();
+ RefPtr<Element> element = ElementFactory::create_element("identity");
MM_ASSERT_TRUE(element);
element->set_bus(bus);
MM_ASSERT_TRUE(element->post_message(MessageStateDirty::create(element)));
diff --git a/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
b/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
index 1255d4f..c9d55ae 100644
--- a/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
+++ b/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
@@ -639,6 +639,9 @@ static void generate_hg_file(const std::string& includeMacroCalls,
std::cout << "_DEFS(" << target << ',' << defsFile << ')' << std::endl <<
std::endl;
+ std::cout << "_CONFIGINCLUDE(gstreamermmconfig.h)" << std::endl;
+ std::cout << "_IS_DEPRECATED" << std::endl << std::endl;
+
if(!cEnumDefinitions.empty())
{
std::cout << "// Plug-in C enums used in signals:" << std::endl;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]