[gstreamermm] tests: fix indentatinos
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] tests: fix indentatinos
- Date: Sat, 22 Aug 2015 15:51:21 +0000 (UTC)
commit 11790583ce92f56984699d9061e3a2ce9a21fae6
Author: Marcin Kolny <marcin kolny gmail com>
Date: Sat Aug 22 15:49:44 2015 +0000
tests: fix indentatinos
* tests/main.cc:
* tests/plugins/derivedfromappsink.h:
* tests/plugins/derivedfromappsrc.h:
* tests/plugins/derivedfrombasetransform.h:
* tests/plugins/foo.h:
* tests/plugins/test-plugin-appsink.cc:
* tests/plugins/test-plugin-appsrc.cc:
* tests/plugins/test-plugin-derivedfromappsink.cc:
* tests/plugins/test-plugin-derivedfromappsrc.cc:
* tests/plugins/test-plugin-derivedfrombasetransform.cc:
* tests/plugins/test-plugin-pushsrc.cc:
* tests/plugins/test-plugin-register.cc:
* tests/regression/pluginbin.h:
* tests/regression/test-regression-bininpipeline.cc:
* tests/regression/test-regression-binplugin.cc:
* tests/regression/test-regression-rewritefile.cc:
* tests/regression/test-regression-seekonstartup.cc:
* tests/regression/test-regression-videoduration.cc:
* tests/regression/utils.cc:
* tests/test-allocator.cc:
* tests/test-atomicqueue.cc:
* tests/test-buffer.cc:
* tests/test-bus.cc:
* tests/test-caps.cc:
* tests/test-capsfeatures.cc:
* tests/test-ghostpad.cc:
* tests/test-pad.cc:
* tests/test-query.cc:
* tests/test-structure.cc:
* tests/test-taglist.cc:
* tests/test-urihandler.cc: use the same indentations in test files.
tests/main.cc | 6 +-
tests/plugins/derivedfromappsink.h | 28 ++--
tests/plugins/derivedfromappsrc.h | 28 ++--
tests/plugins/derivedfrombasetransform.h | 34 ++--
tests/plugins/foo.h | 74 +++++-----
tests/plugins/test-plugin-appsink.cc | 146 +++++++++---------
tests/plugins/test-plugin-appsrc.cc | 146 +++++++++---------
tests/plugins/test-plugin-derivedfromappsink.cc | 162 ++++++++++----------
tests/plugins/test-plugin-derivedfromappsrc.cc | 163 ++++++++++----------
.../test-plugin-derivedfrombasetransform.cc | 156 ++++++++++----------
tests/plugins/test-plugin-pushsrc.cc | 126 ++++++++--------
tests/plugins/test-plugin-register.cc | 120 +++++++-------
tests/regression/pluginbin.h | 81 +++++-----
tests/regression/test-regression-bininpipeline.cc | 122 +++++++--------
tests/regression/test-regression-binplugin.cc | 82 +++++-----
tests/regression/test-regression-rewritefile.cc | 72 ++++-----
tests/regression/test-regression-seekonstartup.cc | 157 +++++++++----------
tests/regression/test-regression-videoduration.cc | 98 ++++++------
tests/regression/utils.cc | 67 ++++----
tests/test-allocator.cc | 50 +++---
tests/test-atomicqueue.cc | 58 ++++----
tests/test-buffer.cc | 26 ++--
tests/test-bus.cc | 56 ++++----
tests/test-caps.cc | 144 +++++++++---------
tests/test-capsfeatures.cc | 14 +-
tests/test-ghostpad.cc | 26 ++--
tests/test-pad.cc | 50 +++---
tests/test-query.cc | 44 +++---
tests/test-structure.cc | 62 ++++----
tests/test-taglist.cc | 63 ++++----
tests/test-urihandler.cc | 85 +++++-----
31 files changed, 1259 insertions(+), 1287 deletions(-)
---
diff --git a/tests/main.cc b/tests/main.cc
index 6b5b5ef..0528a63 100644
--- a/tests/main.cc
+++ b/tests/main.cc
@@ -3,8 +3,8 @@
int main(int argc, char** argv)
{
- ::testing::InitGoogleTest(&argc, argv);
- Gst::init(argc, argv);
+ ::testing::InitGoogleTest(&argc, argv);
+ Gst::init(argc, argv);
- return RUN_ALL_TESTS();
+ return RUN_ALL_TESTS();
}
diff --git a/tests/plugins/derivedfromappsink.h b/tests/plugins/derivedfromappsink.h
index 0941cdd..178adc6 100644
--- a/tests/plugins/derivedfromappsink.h
+++ b/tests/plugins/derivedfromappsink.h
@@ -9,22 +9,22 @@
class DerivedFromAppSink : public Gst::AppSink
{
public:
- static void base_init(Gst::ElementClass<DerivedFromAppSink> *klass)
- {
- klass->set_metadata("derivedfromappsink_longname",
- "derivedfromappsink_classification", "derivedfromappsink_detail_description",
"derivedfromappsink_detail_author");
- }
+ static void base_init(Gst::ElementClass<DerivedFromAppSink> *klass)
+ {
+ klass->set_metadata("derivedfromappsink_longname",
+ "derivedfromappsink_classification", "derivedfromappsink_detail_description",
"derivedfromappsink_detail_author");
+ }
- explicit DerivedFromAppSink(GstAppSink *gobj)
- : Glib::ObjectBase(typeid (DerivedFromAppSink)), // type must be registered before use
- Gst::AppSink(gobj)
- {
- }
+ explicit DerivedFromAppSink(GstAppSink *gobj)
+ : Glib::ObjectBase(typeid (DerivedFromAppSink)), // type must be registered before use
+ Gst::AppSink(gobj)
+ {
+ }
- static bool register_element(Glib::RefPtr<Gst::Plugin> plugin)
- {
- return Gst::ElementFactory::register_element(plugin, "derivedfromappsink", 10,
Gst::register_mm_type<DerivedFromAppSink>("derivedfromappsink"));
- }
+ static bool register_element(Glib::RefPtr<Gst::Plugin> plugin)
+ {
+ return Gst::ElementFactory::register_element(plugin, "derivedfromappsink", 10,
Gst::register_mm_type<DerivedFromAppSink>("derivedfromappsink"));
+ }
};
#endif /* TEST_DERIVEDFROMAPPSINK_H_ */
diff --git a/tests/plugins/derivedfromappsrc.h b/tests/plugins/derivedfromappsrc.h
index aca87ad..d76f9b4 100644
--- a/tests/plugins/derivedfromappsrc.h
+++ b/tests/plugins/derivedfromappsrc.h
@@ -9,22 +9,22 @@
class DerivedFromAppSrc : public Gst::AppSrc
{
public:
- static void base_init(Gst::ElementClass<DerivedFromAppSrc> *klass)
- {
- klass->set_metadata("derivedfromappsrc_longname",
- "derivedfromappsrc_classification", "derivedfromappsrc_detail_description",
"derivedfromappsrc_detail_author");
- }
+ static void base_init(Gst::ElementClass<DerivedFromAppSrc> *klass)
+ {
+ klass->set_metadata("derivedfromappsrc_longname",
+ "derivedfromappsrc_classification", "derivedfromappsrc_detail_description",
"derivedfromappsrc_detail_author");
+ }
- explicit DerivedFromAppSrc(GstAppSrc *gobj)
- : Glib::ObjectBase(typeid (DerivedFromAppSrc)), // type must be registered before use
- Gst::AppSrc(gobj)
- {
- }
+ explicit DerivedFromAppSrc(GstAppSrc *gobj)
+ : Glib::ObjectBase(typeid (DerivedFromAppSrc)), // type must be registered before use
+ Gst::AppSrc(gobj)
+ {
+ }
- static bool register_element(Glib::RefPtr<Gst::Plugin> plugin)
- {
- return Gst::ElementFactory::register_element(plugin, "derivedfromappsrc", 10,
Gst::register_mm_type<DerivedFromAppSrc>("derivedfromappsrc"));
- }
+ static bool register_element(Glib::RefPtr<Gst::Plugin> plugin)
+ {
+ return Gst::ElementFactory::register_element(plugin, "derivedfromappsrc", 10,
Gst::register_mm_type<DerivedFromAppSrc>("derivedfromappsrc"));
+ }
};
#endif /* TESTS_PLUGINS_DERIVEDFROMAPPSRC_H_ */
diff --git a/tests/plugins/derivedfrombasetransform.h b/tests/plugins/derivedfrombasetransform.h
index 82eb8f5..9319f7b 100644
--- a/tests/plugins/derivedfrombasetransform.h
+++ b/tests/plugins/derivedfrombasetransform.h
@@ -8,26 +8,26 @@
class DerivedFromBaseTransform : public Gst::BaseTransform
{
public:
- static void base_init(Gst::ElementClass<DerivedFromBaseTransform> *klass)
- {
- klass->set_metadata("derivedfrombasetransform_longname",
- "derivedfrombasetransform_classification", "derivedfrombasetransform_detail_description",
"derivedfrombasetransform_detail_author");
+ static void base_init(Gst::ElementClass<DerivedFromBaseTransform> *klass)
+ {
+ klass->set_metadata("derivedfrombasetransform_longname",
+ "derivedfrombasetransform_classification", "derivedfrombasetransform_detail_description",
"derivedfrombasetransform_detail_author");
- klass->add_pad_template(Gst::PadTemplate::create("sink", Gst::PAD_SINK, Gst::PAD_ALWAYS,
Gst::Caps::create_any()));
- klass->add_pad_template(Gst::PadTemplate::create("src", Gst::PAD_SRC, Gst::PAD_ALWAYS,
Gst::Caps::create_any()));
- }
+ klass->add_pad_template(Gst::PadTemplate::create("sink", Gst::PAD_SINK, Gst::PAD_ALWAYS,
Gst::Caps::create_any()));
+ klass->add_pad_template(Gst::PadTemplate::create("src", Gst::PAD_SRC, Gst::PAD_ALWAYS,
Gst::Caps::create_any()));
+ }
- explicit DerivedFromBaseTransform(GstBaseTransform *gobj)
- : Glib::ObjectBase(typeid (DerivedFromBaseTransform)), // type must be registered before use
- Gst::BaseTransform(gobj)
- {
- set_passthrough(true);
- }
+ explicit DerivedFromBaseTransform(GstBaseTransform *gobj)
+ : Glib::ObjectBase(typeid (DerivedFromBaseTransform)), // type must be registered before use
+ Gst::BaseTransform(gobj)
+ {
+ set_passthrough(true);
+ }
- static bool register_element(Glib::RefPtr<Gst::Plugin> plugin)
- {
- return Gst::ElementFactory::register_element(plugin, "derivedfrombasetransform", 10,
Gst::register_mm_type<DerivedFromBaseTransform>("derivedfrombasetransform"));
- }
+ static bool register_element(Glib::RefPtr<Gst::Plugin> plugin)
+ {
+ return Gst::ElementFactory::register_element(plugin, "derivedfrombasetransform", 10,
Gst::register_mm_type<DerivedFromBaseTransform>("derivedfrombasetransform"));
+ }
};
#endif /* TESTS_PLUGINS_DERIVEDFROMBASETRANSFORM_H_ */
diff --git a/tests/plugins/foo.h b/tests/plugins/foo.h
index 250cba5..b83f124 100644
--- a/tests/plugins/foo.h
+++ b/tests/plugins/foo.h
@@ -14,51 +14,51 @@
class Foo : public Gst::Element
{
- Glib::RefPtr<Gst::Pad> sinkpad;
- Glib::RefPtr<Gst::Pad> srcpad;
- Glib::Property<Glib::ustring> sample_property;
+ Glib::RefPtr<Gst::Pad> sinkpad;
+ Glib::RefPtr<Gst::Pad> srcpad;
+ Glib::Property<Glib::ustring> sample_property;
public:
- static void base_init(Gst::ElementClass<Foo> *klass)
- {
- klass->set_metadata("foo_longname",
- "foo_classification", "foo_detail_description", "foo_detail_author");
+ static void base_init(Gst::ElementClass<Foo> *klass)
+ {
+ klass->set_metadata("foo_longname",
+ "foo_classification", "foo_detail_description", "foo_detail_author");
- klass->add_pad_template(Gst::PadTemplate::create("sink", Gst::PAD_SINK, Gst::PAD_ALWAYS,
- Gst::Caps::create_any()));
- klass->add_pad_template(Gst::PadTemplate::create("src", Gst::PAD_SRC, Gst::PAD_ALWAYS,
- Gst::Caps::create_any()));
- }
+ klass->add_pad_template(Gst::PadTemplate::create("sink", Gst::PAD_SINK, Gst::PAD_ALWAYS,
+ Gst::Caps::create_any()));
+ klass->add_pad_template(Gst::PadTemplate::create("src", Gst::PAD_SRC, Gst::PAD_ALWAYS,
+ Gst::Caps::create_any()));
+ }
- Gst::FlowReturn chain(const Glib::RefPtr<Gst::Pad> & /* pad */, Glib::RefPtr<Gst::Buffer> &buf)
- {
- buf = buf->create_writable();
- assert(buf->gobj()->mini_object.refcount==1);
- Glib::RefPtr<Gst::MapInfo> mapinfo(new Gst::MapInfo());
- buf->map(mapinfo, Gst::MAP_WRITE);
- std::sort(mapinfo->get_data(), mapinfo->get_data() + mapinfo->get_size());
- buf->unmap(mapinfo);
- assert(buf->gobj()->mini_object.refcount==1);
- return srcpad->push(std::move(buf));
- }
+ Gst::FlowReturn chain(const Glib::RefPtr<Gst::Pad> & /* pad */, Glib::RefPtr<Gst::Buffer> &buf)
+ {
+ buf = buf->create_writable();
+ assert(buf->gobj()->mini_object.refcount==1);
+ Glib::RefPtr<Gst::MapInfo> mapinfo(new Gst::MapInfo());
+ buf->map(mapinfo, Gst::MAP_WRITE);
+ std::sort(mapinfo->get_data(), mapinfo->get_data() + mapinfo->get_size());
+ buf->unmap(mapinfo);
+ assert(buf->gobj()->mini_object.refcount==1);
+ return srcpad->push(std::move(buf));
+ }
- explicit Foo(GstElement *gobj)
- : Glib::ObjectBase(typeid (Foo)), // type must be registered before use
- Gst::Element(gobj),
- sample_property(*this, "sample_property", "def_val")
+ explicit Foo(GstElement *gobj)
+ : Glib::ObjectBase(typeid (Foo)), // type must be registered before use
+ Gst::Element(gobj),
+ sample_property(*this, "sample_property", "def_val")
- {
- add_pad(sinkpad = Gst::Pad::create(get_pad_template("sink"), "sink"));
- add_pad(srcpad = Gst::Pad::create(get_pad_template("src"), "src"));
- sinkpad->set_chain_function(sigc::mem_fun(*this, &Foo::chain));
- }
+ {
+ add_pad(sinkpad = Gst::Pad::create(get_pad_template("sink"), "sink"));
+ add_pad(srcpad = Gst::Pad::create(get_pad_template("src"), "src"));
+ sinkpad->set_chain_function(sigc::mem_fun(*this, &Foo::chain));
+ }
- static bool register_foo(Glib::RefPtr<Gst::Plugin> plugin)
- {
- Gst::ElementFactory::register_element(plugin, "foomm", 10, Gst::register_mm_type<Foo>("foo"));
+ static bool register_foo(Glib::RefPtr<Gst::Plugin> plugin)
+ {
+ Gst::ElementFactory::register_element(plugin, "foomm", 10, Gst::register_mm_type<Foo>("foo"));
- return true;
- }
+ return true;
+ }
};
#endif /* TESTS_PLUGINS_FOO_H_ */
diff --git a/tests/plugins/test-plugin-appsink.cc b/tests/plugins/test-plugin-appsink.cc
index eb0c0dc..50ec37b 100644
--- a/tests/plugins/test-plugin-appsink.cc
+++ b/tests/plugins/test-plugin-appsink.cc
@@ -16,107 +16,107 @@ using Glib::RefPtr;
class AppSinkPluginTest : public ::testing::Test
{
protected:
- RefPtr<Element> source;
- RefPtr<Element> sink;
- RefPtr<Pipeline> pipeline;
+ RefPtr<Element> source;
+ RefPtr<Element> sink;
+ RefPtr<Pipeline> pipeline;
- void CreatePipelineWithElements()
- {
- pipeline = Gst::Pipeline::create();
+ void CreatePipelineWithElements()
+ {
+ pipeline = Gst::Pipeline::create();
- sink = ElementFactory::create_element("appsink", "sink");
- source = ElementFactory::create_element("appsrc", "source");
+ sink = ElementFactory::create_element("appsink", "sink");
+ source = ElementFactory::create_element("appsrc", "source");
- ASSERT_TRUE(sink);
- ASSERT_TRUE(source);
+ ASSERT_TRUE(sink);
+ ASSERT_TRUE(source);
- ASSERT_NO_THROW(pipeline->add(source)->add(sink));
- ASSERT_NO_THROW(source->link(sink));
- }
+ ASSERT_NO_THROW(pipeline->add(source)->add(sink));
+ ASSERT_NO_THROW(source->link(sink));
+ }
};
TEST_F(AppSinkPluginTest, CorrectCreatedAppSinkElement)
{
- RefPtr<AppSink> source = AppSink::create("sink");
- ASSERT_TRUE(source);
+ RefPtr<AppSink> source = AppSink::create("sink");
+ ASSERT_TRUE(source);
- RefPtr<Element> source_element = ElementFactory::create_element("appsink", "source");
- ASSERT_TRUE(source_element);
+ RefPtr<Element> source_element = ElementFactory::create_element("appsink", "source");
+ ASSERT_TRUE(source_element);
- source = source.cast_dynamic(source_element);
- ASSERT_TRUE(source);
+ source = source.cast_dynamic(source_element);
+ ASSERT_TRUE(source);
}
TEST_F(AppSinkPluginTest, CreatePipelineWithAppsink)
{
- CreatePipelineWithElements();
+ CreatePipelineWithElements();
}
TEST_F(AppSinkPluginTest, SinkPadQueryCapsShouldReturnProperCapsObjects)
{
- CreatePipelineWithElements();
-
- RefPtr<BaseSink> basesink;
- basesink = basesink.cast_dynamic(sink);
- ASSERT_TRUE(basesink);
-
- RefPtr<Pad> sink_pad = basesink->get_sink_pad();
- ASSERT_TRUE(sink_pad);
- ASSERT_TRUE(GST_IS_PAD(sink_pad->gobj()));
- RefPtr<Caps> caps = sink_pad->query_caps(Caps::create_any());
- ASSERT_TRUE(caps);
- ASSERT_TRUE(caps->gobj());
- ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
- RefPtr<Caps> template_caps = Glib::wrap(gst_pad_get_pad_template_caps(sink_pad->gobj()), false);
-
- sink_pad.reset();
- basesink.reset();
- sink.reset();
- pipeline.reset();
-
- // query_caps may return just another ref to template_caps
- if (caps == template_caps)
- {
- // ...but template_caps might be just another ref to static caps with some higher unknown refcount
- //EXPECT_EQ(2, caps->get_refcount());
- }
- else
- {
- EXPECT_EQ(1, caps->get_refcount());
- }
+ CreatePipelineWithElements();
+
+ RefPtr<BaseSink> basesink;
+ basesink = basesink.cast_dynamic(sink);
+ ASSERT_TRUE(basesink);
+
+ RefPtr<Pad> sink_pad = basesink->get_sink_pad();
+ ASSERT_TRUE(sink_pad);
+ ASSERT_TRUE(GST_IS_PAD(sink_pad->gobj()));
+ RefPtr<Caps> caps = sink_pad->query_caps(Caps::create_any());
+ ASSERT_TRUE(caps);
+ ASSERT_TRUE(caps->gobj());
+ ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
+ RefPtr<Caps> template_caps = Glib::wrap(gst_pad_get_pad_template_caps(sink_pad->gobj()), false);
+
+ sink_pad.reset();
+ basesink.reset();
+ sink.reset();
+ pipeline.reset();
+
+ // query_caps may return just another ref to template_caps
+ if (caps == template_caps)
+ {
+ // ...but template_caps might be just another ref to static caps with some higher unknown refcount
+ //EXPECT_EQ(2, caps->get_refcount());
+ }
+ else
+ {
+ EXPECT_EQ(1, caps->get_refcount());
+ }
}
TEST_F(AppSinkPluginTest, UseAppSinkDuringDataFlowInPipeline)
{
- CreatePipelineWithElements();
+ CreatePipelineWithElements();
- RefPtr<AppSink> appsink = appsink.cast_static(sink);
- RefPtr<AppSrc> appsrc = appsrc.cast_static(source);
+ RefPtr<AppSink> appsink = appsink.cast_static(sink);
+ RefPtr<AppSrc> appsrc = appsrc.cast_static(source);
- EXPECT_EQ(STATE_CHANGE_ASYNC, pipeline->set_state(STATE_PLAYING));
+ EXPECT_EQ(STATE_CHANGE_ASYNC, pipeline->set_state(STATE_PLAYING));
- std::string data = "hello world";
- RefPtr<Buffer> buf = Buffer::create(data.length() + 1);
- ASSERT_TRUE(buf);
- RefPtr<MapInfo> map_info(new MapInfo());
- ASSERT_TRUE(buf->map(map_info, MAP_WRITE));
- strcpy((char *)map_info->get_data(), data.c_str());
- buf->unmap(map_info);
+ std::string data = "hello world";
+ RefPtr<Buffer> buf = Buffer::create(data.length() + 1);
+ ASSERT_TRUE(buf);
+ RefPtr<MapInfo> map_info(new MapInfo());
+ ASSERT_TRUE(buf->map(map_info, MAP_WRITE));
+ strcpy((char *)map_info->get_data(), data.c_str());
+ buf->unmap(map_info);
- EXPECT_EQ(FLOW_OK, appsrc->push_buffer(buf));
+ EXPECT_EQ(FLOW_OK, appsrc->push_buffer(buf));
- RefPtr<Buffer> buf_out;
- RefPtr<Sample> sample = appsink->pull_sample();
- ASSERT_TRUE(sample);
- buf_out = sample->get_buffer();
- ASSERT_TRUE(buf_out);
+ RefPtr<Buffer> buf_out;
+ RefPtr<Sample> sample = appsink->pull_sample();
+ ASSERT_TRUE(sample);
+ buf_out = sample->get_buffer();
+ ASSERT_TRUE(buf_out);
- EXPECT_TRUE(buf_out->memcmp(0, data.c_str(), data.length()) == 0);
+ EXPECT_TRUE(buf_out->memcmp(0, data.c_str(), data.length()) == 0);
- EXPECT_EQ(FLOW_OK, appsrc->end_of_stream());
+ EXPECT_EQ(FLOW_OK, appsrc->end_of_stream());
- RefPtr<Message> msg = pipeline->get_bus()->poll((MessageType)(MESSAGE_EOS | MESSAGE_ERROR) , 1*SECOND);
- ASSERT_TRUE(msg);
- EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
- EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
+ RefPtr<Message> msg = pipeline->get_bus()->poll((MessageType)(MESSAGE_EOS | MESSAGE_ERROR) , 1*SECOND);
+ ASSERT_TRUE(msg);
+ EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
+ EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
}
diff --git a/tests/plugins/test-plugin-appsrc.cc b/tests/plugins/test-plugin-appsrc.cc
index b12e3e7..82f8294 100644
--- a/tests/plugins/test-plugin-appsrc.cc
+++ b/tests/plugins/test-plugin-appsrc.cc
@@ -15,106 +15,106 @@ using Glib::RefPtr;
class AppSrcPluginTest : public ::testing::Test
{
protected:
- RefPtr<Element> source;
- RefPtr<Element> sink;
- RefPtr<Pipeline> pipeline;
+ RefPtr<Element> source;
+ RefPtr<Element> sink;
+ RefPtr<Pipeline> pipeline;
- void CreatePipelineWithElements()
- {
- pipeline = Gst::Pipeline::create();
+ void CreatePipelineWithElements()
+ {
+ pipeline = Gst::Pipeline::create();
- sink = ElementFactory::create_element("fakesink", "sink");
- source = ElementFactory::create_element("appsrc", "source");
+ sink = ElementFactory::create_element("fakesink", "sink");
+ source = ElementFactory::create_element("appsrc", "source");
- ASSERT_TRUE(sink);
- ASSERT_TRUE(source);
+ ASSERT_TRUE(sink);
+ ASSERT_TRUE(source);
- ASSERT_NO_THROW(pipeline->add(source)->add(sink));
- ASSERT_NO_THROW(source->link(sink));
- }
+ ASSERT_NO_THROW(pipeline->add(source)->add(sink));
+ ASSERT_NO_THROW(source->link(sink));
+ }
};
TEST_F(AppSrcPluginTest, CorrectCreatedAppSrcElement)
{
- RefPtr<AppSrc> source = AppSrc::create("source");
- ASSERT_TRUE(source);
+ RefPtr<AppSrc> source = AppSrc::create("source");
+ ASSERT_TRUE(source);
- RefPtr<Element> source_element = ElementFactory::create_element("appsrc", "source");
- ASSERT_TRUE(source_element);
+ RefPtr<Element> source_element = ElementFactory::create_element("appsrc", "source");
+ ASSERT_TRUE(source_element);
- source = source.cast_dynamic(source_element);
- ASSERT_TRUE(source);
+ source = source.cast_dynamic(source_element);
+ ASSERT_TRUE(source);
}
TEST_F(AppSrcPluginTest, CreatePipelineWithAppSrcElement)
{
- CreatePipelineWithElements();
+ CreatePipelineWithElements();
}
TEST_F(AppSrcPluginTest, SrcPadQueryCapsShouldReturnProperCapsObjects)
{
- CreatePipelineWithElements();
-
- RefPtr<BaseSrc> basesrc;
- basesrc = basesrc.cast_dynamic(source);
- ASSERT_TRUE(basesrc);
-
- RefPtr<Pad> src_pad = basesrc->get_src_pad();
- ASSERT_TRUE(src_pad);
- ASSERT_TRUE(GST_IS_PAD(src_pad->gobj()));
- RefPtr<Caps> caps = src_pad->query_caps(Caps::create_any());
- ASSERT_TRUE(caps);
- ASSERT_TRUE(caps->gobj());
- ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
- RefPtr<Caps> template_caps = Glib::wrap(gst_pad_get_pad_template_caps(src_pad->gobj()), false);
-
- src_pad.reset();
- basesrc.reset();
- sink.reset();
- pipeline.reset();
-
- // query_caps may return just another ref to template_caps
- if (caps == template_caps)
- {
- // ...but template_caps might be just another ref to static caps with some higher unknown refcount
- //EXPECT_EQ(2, caps->get_refcount());
- }
- else
- {
- EXPECT_EQ(1, caps->get_refcount());
- }
+ CreatePipelineWithElements();
+
+ RefPtr<BaseSrc> basesrc;
+ basesrc = basesrc.cast_dynamic(source);
+ ASSERT_TRUE(basesrc);
+
+ RefPtr<Pad> src_pad = basesrc->get_src_pad();
+ ASSERT_TRUE(src_pad);
+ ASSERT_TRUE(GST_IS_PAD(src_pad->gobj()));
+ RefPtr<Caps> caps = src_pad->query_caps(Caps::create_any());
+ ASSERT_TRUE(caps);
+ ASSERT_TRUE(caps->gobj());
+ ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
+ RefPtr<Caps> template_caps = Glib::wrap(gst_pad_get_pad_template_caps(src_pad->gobj()), false);
+
+ src_pad.reset();
+ basesrc.reset();
+ sink.reset();
+ pipeline.reset();
+
+ // query_caps may return just another ref to template_caps
+ if (caps == template_caps)
+ {
+ // ...but template_caps might be just another ref to static caps with some higher unknown refcount
+ //EXPECT_EQ(2, caps->get_refcount());
+ }
+ else
+ {
+ EXPECT_EQ(1, caps->get_refcount());
+ }
}
TEST_F(AppSrcPluginTest, SimpleDataFlowInPipelineWithAppSrcElement)
{
- CreatePipelineWithElements();
+ CreatePipelineWithElements();
- EXPECT_EQ(STATE_CHANGE_ASYNC, pipeline->set_state(STATE_PLAYING));
+ EXPECT_EQ(STATE_CHANGE_ASYNC, pipeline->set_state(STATE_PLAYING));
- std::string data = "hello world";
- RefPtr<Buffer> buf = Buffer::create(data.length() + 1);
- ASSERT_TRUE(buf);
- RefPtr<MapInfo> mapinfo(new MapInfo());
- ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
- strcpy((char *)mapinfo->get_data(), data.c_str());
+ std::string data = "hello world";
+ RefPtr<Buffer> buf = Buffer::create(data.length() + 1);
+ ASSERT_TRUE(buf);
+ RefPtr<MapInfo> mapinfo(new MapInfo());
+ ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
+ strcpy((char *)mapinfo->get_data(), data.c_str());
- RefPtr<AppSrc> appsrc;
- appsrc = appsrc.cast_dynamic(source);
- ASSERT_TRUE(appsrc);
+ RefPtr<AppSrc> appsrc;
+ appsrc = appsrc.cast_dynamic(source);
+ ASSERT_TRUE(appsrc);
- EXPECT_EQ(FLOW_OK, appsrc->push_buffer(buf));
+ EXPECT_EQ(FLOW_OK, appsrc->push_buffer(buf));
- {
- State state, pending;
- StateChangeReturn ret = pipeline->get_state(state, pending, 1*SECOND);
- EXPECT_EQ(STATE_CHANGE_SUCCESS, ret);
- EXPECT_EQ(STATE_PLAYING, state);
- }
+ {
+ State state, pending;
+ StateChangeReturn ret = pipeline->get_state(state, pending, 1*SECOND);
+ EXPECT_EQ(STATE_CHANGE_SUCCESS, ret);
+ EXPECT_EQ(STATE_PLAYING, state);
+ }
- EXPECT_EQ(FLOW_OK, appsrc->end_of_stream());
+ EXPECT_EQ(FLOW_OK, appsrc->end_of_stream());
- RefPtr<Message> msg = pipeline->get_bus()->poll((MessageType)(MESSAGE_EOS | MESSAGE_ERROR) , 1*SECOND);
- ASSERT_TRUE(msg);
- EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
- EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
+ RefPtr<Message> msg = pipeline->get_bus()->poll((MessageType)(MESSAGE_EOS | MESSAGE_ERROR) , 1*SECOND);
+ ASSERT_TRUE(msg);
+ EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
+ EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
}
diff --git a/tests/plugins/test-plugin-derivedfromappsink.cc b/tests/plugins/test-plugin-derivedfromappsink.cc
index 87263ca..cd3ba92 100644
--- a/tests/plugins/test-plugin-derivedfromappsink.cc
+++ b/tests/plugins/test-plugin-derivedfromappsink.cc
@@ -11,110 +11,110 @@ using Glib::RefPtr;
class DerivedFromAppSinkPluginTest : public ::testing::Test
{
protected:
- RefPtr<Element> source;
- RefPtr<Element> sink;
- RefPtr<Pipeline> pipeline;
-
- void CreatePipelineWithElements()
- {
- pipeline = Gst::Pipeline::create();
-
- sink = ElementFactory::create_element("derivedfromappsink", "sink");
- source = ElementFactory::create_element("appsrc", "source");
-
- ASSERT_TRUE(sink);
- ASSERT_TRUE(source);
-
- ASSERT_NO_THROW(pipeline->add(source)->add(sink));
- ASSERT_NO_THROW(source->link(sink));
- }
-
- virtual void SetUp()
- {
- Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "derivedfromappsink",
- "derivedfromappsink is an example of C++ element derived from Gst::AppSink",
- sigc::ptr_fun(&DerivedFromAppSink::register_element), "0.123",
- "LGPL", "source?", "package?", "http://example.com");
- }
+ RefPtr<Element> source;
+ RefPtr<Element> sink;
+ RefPtr<Pipeline> pipeline;
+
+ void CreatePipelineWithElements()
+ {
+ pipeline = Gst::Pipeline::create();
+
+ sink = ElementFactory::create_element("derivedfromappsink", "sink");
+ source = ElementFactory::create_element("appsrc", "source");
+
+ ASSERT_TRUE(sink);
+ ASSERT_TRUE(source);
+
+ ASSERT_NO_THROW(pipeline->add(source)->add(sink));
+ ASSERT_NO_THROW(source->link(sink));
+ }
+
+ virtual void SetUp()
+ {
+ Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "derivedfromappsink",
+ "derivedfromappsink is an example of C++ element derived from Gst::AppSink",
+ sigc::ptr_fun(&DerivedFromAppSink::register_element), "0.123",
+ "LGPL", "source?", "package?", "http://example.com");
+ }
};
TEST_F(DerivedFromAppSinkPluginTest, CreateRegisteredElement)
{
- RefPtr<Element> sink_element = ElementFactory::create_element("derivedfromappsink", "source");
+ RefPtr<Element> sink_element = ElementFactory::create_element("derivedfromappsink", "source");
- ASSERT_TRUE(sink_element);
+ ASSERT_TRUE(sink_element);
}
TEST_F(DerivedFromAppSinkPluginTest, CreatePipelineWithRegisteredElement)
{
- CreatePipelineWithElements();
+ CreatePipelineWithElements();
}
TEST_F(DerivedFromAppSinkPluginTest, SinkPadQueryCapsShouldReturnProperCapsObjects)
{
- CreatePipelineWithElements();
-
- RefPtr<BaseSink> basesink;
- basesink = basesink.cast_dynamic(sink);
- ASSERT_TRUE(basesink);
-
- RefPtr<Pad> sink_pad = basesink->get_sink_pad();
- ASSERT_TRUE(sink_pad);
- ASSERT_TRUE(GST_IS_PAD(sink_pad->gobj()));
- RefPtr<Caps> caps = sink_pad->query_caps(Caps::create_any());
- ASSERT_TRUE(caps);
- ASSERT_TRUE(caps->gobj());
- ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
- RefPtr<Caps> template_caps = Glib::wrap(gst_pad_get_pad_template_caps(sink_pad->gobj()), false);
-
- sink_pad.reset();
- basesink.reset();
- sink.reset();
- pipeline.reset();
-
- // query_caps may return just another ref to template_caps
- if (caps == template_caps)
- {
- // ...but template_caps might be just another ref to static caps with some higher unknown refcount
- //EXPECT_EQ(2, caps->get_refcount());
- }
- else
- {
- EXPECT_EQ(1, caps->get_refcount());
- }
+ CreatePipelineWithElements();
+
+ RefPtr<BaseSink> basesink;
+ basesink = basesink.cast_dynamic(sink);
+ ASSERT_TRUE(basesink);
+
+ RefPtr<Pad> sink_pad = basesink->get_sink_pad();
+ ASSERT_TRUE(sink_pad);
+ ASSERT_TRUE(GST_IS_PAD(sink_pad->gobj()));
+ RefPtr<Caps> caps = sink_pad->query_caps(Caps::create_any());
+ ASSERT_TRUE(caps);
+ ASSERT_TRUE(caps->gobj());
+ ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
+ RefPtr<Caps> template_caps = Glib::wrap(gst_pad_get_pad_template_caps(sink_pad->gobj()), false);
+
+ sink_pad.reset();
+ basesink.reset();
+ sink.reset();
+ pipeline.reset();
+
+ // query_caps may return just another ref to template_caps
+ if (caps == template_caps)
+ {
+ // ...but template_caps might be just another ref to static caps with some higher unknown refcount
+ //EXPECT_EQ(2, caps->get_refcount());
+ }
+ else
+ {
+ EXPECT_EQ(1, caps->get_refcount());
+ }
}
TEST_F(DerivedFromAppSinkPluginTest, UseAppSinkDuringDataFlowInPipeline)
{
- CreatePipelineWithElements();
+ CreatePipelineWithElements();
- RefPtr<AppSink> appsink = appsink.cast_static(sink);
- RefPtr<AppSrc> appsrc = appsrc.cast_static(source);
+ RefPtr<AppSink> appsink = appsink.cast_static(sink);
+ RefPtr<AppSrc> appsrc = appsrc.cast_static(source);
- EXPECT_EQ(STATE_CHANGE_ASYNC, pipeline->set_state(STATE_PLAYING));
+ EXPECT_EQ(STATE_CHANGE_ASYNC, pipeline->set_state(STATE_PLAYING));
- std::string data = "hello world";
- RefPtr<Buffer> buf = Buffer::create(data.length() + 1);
- ASSERT_TRUE(buf);
- RefPtr<MapInfo> map_info(new MapInfo());
- ASSERT_TRUE(buf->map(map_info, MAP_WRITE));
- strcpy((char *)map_info->get_data(), data.c_str());
- buf->unmap(map_info);
+ std::string data = "hello world";
+ RefPtr<Buffer> buf = Buffer::create(data.length() + 1);
+ ASSERT_TRUE(buf);
+ RefPtr<MapInfo> map_info(new MapInfo());
+ ASSERT_TRUE(buf->map(map_info, MAP_WRITE));
+ strcpy((char *)map_info->get_data(), data.c_str());
+ buf->unmap(map_info);
- EXPECT_EQ(FLOW_OK, appsrc->push_buffer(buf));
+ EXPECT_EQ(FLOW_OK, appsrc->push_buffer(buf));
- RefPtr<Buffer> buf_out;
- RefPtr<Sample> sample = appsink->pull_sample();
- ASSERT_TRUE(sample);
- buf_out = sample->get_buffer();
- ASSERT_TRUE(buf_out);
+ RefPtr<Buffer> buf_out;
+ RefPtr<Sample> sample = appsink->pull_sample();
+ ASSERT_TRUE(sample);
+ buf_out = sample->get_buffer();
+ ASSERT_TRUE(buf_out);
- EXPECT_TRUE(buf_out->memcmp(0, data.c_str(), data.length()) == 0);
+ EXPECT_TRUE(buf_out->memcmp(0, data.c_str(), data.length()) == 0);
- EXPECT_EQ(FLOW_OK, appsrc->end_of_stream());
+ EXPECT_EQ(FLOW_OK, appsrc->end_of_stream());
- RefPtr<Message> msg = pipeline->get_bus()->poll((MessageType)(MESSAGE_EOS | MESSAGE_ERROR) , 1*SECOND);
- ASSERT_TRUE(msg);
- EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
- EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
+ RefPtr<Message> msg = pipeline->get_bus()->poll((MessageType)(MESSAGE_EOS | MESSAGE_ERROR) , 1*SECOND);
+ ASSERT_TRUE(msg);
+ EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
+ EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
}
diff --git a/tests/plugins/test-plugin-derivedfromappsrc.cc b/tests/plugins/test-plugin-derivedfromappsrc.cc
index 8b7ab4b..78a72cf 100644
--- a/tests/plugins/test-plugin-derivedfromappsrc.cc
+++ b/tests/plugins/test-plugin-derivedfromappsrc.cc
@@ -10,110 +10,109 @@ using Glib::RefPtr;
class DerivedFromAppSrcPluginTest : public ::testing::Test
{
protected:
- RefPtr<Element> source;
- RefPtr<Element> sink;
- RefPtr<Pipeline> pipeline;
-
- void CreatePipelineWithElements()
- {
- pipeline = Pipeline::create();
-
- sink = ElementFactory::create_element("fakesink", "sink");
- source = ElementFactory::create_element("derivedfromappsrc", "source");
-
- ASSERT_TRUE(sink);
- ASSERT_TRUE(source);
-
- ASSERT_NO_THROW(pipeline->add(source)->add(sink));
- ASSERT_NO_THROW(source->link(sink));
- }
-
- virtual void SetUp()
- {
- Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "derivedfromappsrc",
- "derivedfromappsrc is an example of C++ element derived from Gst::AppSrc",
- sigc::ptr_fun(&DerivedFromAppSrc::register_element), "0.123",
- "LGPL", "source?", "package?", "http://example.com");
- }
+ RefPtr<Element> source;
+ RefPtr<Element> sink;
+ RefPtr<Pipeline> pipeline;
+
+ void CreatePipelineWithElements()
+ {
+ pipeline = Pipeline::create();
+
+ sink = ElementFactory::create_element("fakesink", "sink");
+ source = ElementFactory::create_element("derivedfromappsrc", "source");
+
+ ASSERT_TRUE(sink);
+ ASSERT_TRUE(source);
+
+ ASSERT_NO_THROW(pipeline->add(source)->add(sink));
+ ASSERT_NO_THROW(source->link(sink));
+ }
+
+ virtual void SetUp()
+ {
+ Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "derivedfromappsrc",
+ "derivedfromappsrc is an example of C++ element derived from Gst::AppSrc",
+ sigc::ptr_fun(&DerivedFromAppSrc::register_element), "0.123",
+ "LGPL", "source?", "package?", "http://example.com");
+ }
};
TEST_F(DerivedFromAppSrcPluginTest, CreateRegisteredElement)
{
- RefPtr<Element> source_element = ElementFactory::create_element("derivedfromappsrc", "source");
+ RefPtr<Element> source_element = ElementFactory::create_element("derivedfromappsrc", "source");
- ASSERT_TRUE(source_element);
+ ASSERT_TRUE(source_element);
}
TEST_F(DerivedFromAppSrcPluginTest, CreatePipelineWithRegisteredElement)
{
- CreatePipelineWithElements();
+ CreatePipelineWithElements();
}
TEST_F(DerivedFromAppSrcPluginTest, SrcPadQueryCapsShouldReturnProperCapsObjects)
{
- CreatePipelineWithElements();
-
- RefPtr<BaseSrc> basesrc;
- basesrc = basesrc.cast_dynamic(source);
- ASSERT_TRUE(basesrc);
-
- RefPtr<Pad> src_pad = basesrc->get_src_pad();
- ASSERT_TRUE(src_pad);
- ASSERT_TRUE(GST_IS_PAD(src_pad->gobj()));
- RefPtr<Caps> caps = src_pad->query_caps(Caps::create_any());
- ASSERT_TRUE(caps);
- ASSERT_TRUE(caps->gobj());
- ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
- RefPtr<Caps> template_caps = Glib::wrap(gst_pad_get_pad_template_caps(src_pad->gobj()), false);
-
- src_pad.reset();
- basesrc.reset();
- sink.reset();
- pipeline.reset();
-
- // query_caps may return just another ref to template_caps
- if (caps == template_caps)
- {
- // ...but template_caps might be just another ref to static caps with some higher unknown refcount
- //EXPECT_EQ(2, caps->get_refcount());
- }
- else
- {
- EXPECT_EQ(1, caps->get_refcount());
- }
+ CreatePipelineWithElements();
+
+ RefPtr<BaseSrc> basesrc;
+ basesrc = basesrc.cast_dynamic(source);
+ ASSERT_TRUE(basesrc);
+
+ RefPtr<Pad> src_pad = basesrc->get_src_pad();
+ ASSERT_TRUE(src_pad);
+ ASSERT_TRUE(GST_IS_PAD(src_pad->gobj()));
+ RefPtr<Caps> caps = src_pad->query_caps(Caps::create_any());
+ ASSERT_TRUE(caps);
+ ASSERT_TRUE(caps->gobj());
+ ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
+ RefPtr<Caps> template_caps = Glib::wrap(gst_pad_get_pad_template_caps(src_pad->gobj()), false);
+
+ src_pad.reset();
+ basesrc.reset();
+ sink.reset();
+ pipeline.reset();
+
+ // query_caps may return just another ref to template_caps
+ if (caps == template_caps)
+ {
+ // ...but template_caps might be just another ref to static caps with some higher unknown refcount
+ //EXPECT_EQ(2, caps->get_refcount());
+ }
+ else
+ {
+ EXPECT_EQ(1, caps->get_refcount());
+ }
}
TEST_F(DerivedFromAppSrcPluginTest, SimpleDataFlowInPipelineWithAppSrcElement)
{
- CreatePipelineWithElements();
+ CreatePipelineWithElements();
- EXPECT_EQ(STATE_CHANGE_ASYNC, pipeline->set_state(STATE_PLAYING));
+ EXPECT_EQ(STATE_CHANGE_ASYNC, pipeline->set_state(STATE_PLAYING));
- std::string data = "hello world";
- RefPtr<Buffer> buf = Buffer::create(data.length() + 1);
- ASSERT_TRUE(buf);
- RefPtr<MapInfo> mapinfo(new MapInfo());
- ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
- strcpy((char *)mapinfo->get_data(), data.c_str());
+ std::string data = "hello world";
+ RefPtr<Buffer> buf = Buffer::create(data.length() + 1);
+ ASSERT_TRUE(buf);
+ RefPtr<MapInfo> mapinfo(new MapInfo());
+ ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
+ strcpy((char *)mapinfo->get_data(), data.c_str());
- RefPtr<AppSrc> appsrc;
- appsrc = appsrc.cast_dynamic(source);
- ASSERT_TRUE(appsrc);
+ RefPtr<AppSrc> appsrc;
+ appsrc = appsrc.cast_dynamic(source);
+ ASSERT_TRUE(appsrc);
- EXPECT_EQ(FLOW_OK, appsrc->push_buffer(buf));
+ EXPECT_EQ(FLOW_OK, appsrc->push_buffer(buf));
- {
- State state, pending;
- StateChangeReturn ret = pipeline->get_state(state, pending, 1*SECOND);
- EXPECT_EQ(STATE_CHANGE_SUCCESS, ret);
- EXPECT_EQ(STATE_PLAYING, state);
- }
+ {
+ State state, pending;
+ StateChangeReturn ret = pipeline->get_state(state, pending, 1*SECOND);
+ EXPECT_EQ(STATE_CHANGE_SUCCESS, ret);
+ EXPECT_EQ(STATE_PLAYING, state);
+ }
- EXPECT_EQ(FLOW_OK, appsrc->end_of_stream());
+ EXPECT_EQ(FLOW_OK, appsrc->end_of_stream());
- RefPtr<Message> msg = pipeline->get_bus()->poll((MessageType)(MESSAGE_EOS | MESSAGE_ERROR) , 1*SECOND);
- ASSERT_TRUE(msg);
- EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
- EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
+ RefPtr<Message> msg = pipeline->get_bus()->poll((MessageType)(MESSAGE_EOS | MESSAGE_ERROR) , 1*SECOND);
+ ASSERT_TRUE(msg);
+ EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
+ EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
}
-
diff --git a/tests/plugins/test-plugin-derivedfrombasetransform.cc
b/tests/plugins/test-plugin-derivedfrombasetransform.cc
index b39e336..00ed6ea 100644
--- a/tests/plugins/test-plugin-derivedfrombasetransform.cc
+++ b/tests/plugins/test-plugin-derivedfrombasetransform.cc
@@ -11,105 +11,105 @@ using Glib::RefPtr;
class DerivedFromBaseTransformPluginTest : public ::testing::Test
{
protected:
- RefPtr<AppSrc> source;
- RefPtr<Element> filter;
- RefPtr<AppSink> sink;
- RefPtr<Gst::Pipeline> pipeline;
-
- virtual void SetUp()
- {
- Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "derivedfrombasetransform",
- "derivedfrombasetransfrom is an example of C++ element derived from Gst::BaseTransform",
- sigc::ptr_fun(&DerivedFromBaseTransform::register_element), "0.123",
- "LGPL", "source?", "package?", "http://example.com");
- }
-
- void CreatePipelineWithElements()
- {
- pipeline = Gst::Pipeline::create("my-pipeline");
-
- source = AppSrc::create("source");
- filter = ElementFactory::create_element("derivedfrombasetransform", "filter");
- sink = AppSink::create("sink");
-
- ASSERT_TRUE(source);
- ASSERT_TRUE(filter);
- ASSERT_TRUE(sink);
-
- EXPECT_NO_THROW(pipeline->add(source)->add(filter)->add(sink));
- EXPECT_NO_THROW(source->link(filter)->link(sink));
- }
+ RefPtr<AppSrc> source;
+ RefPtr<Element> filter;
+ RefPtr<AppSink> sink;
+ RefPtr<Gst::Pipeline> pipeline;
+
+ virtual void SetUp()
+ {
+ Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "derivedfrombasetransform",
+ "derivedfrombasetransfrom is an example of C++ element derived from Gst::BaseTransform",
+ sigc::ptr_fun(&DerivedFromBaseTransform::register_element), "0.123",
+ "LGPL", "source?", "package?", "http://example.com");
+ }
+
+ void CreatePipelineWithElements()
+ {
+ pipeline = Gst::Pipeline::create("my-pipeline");
+
+ source = AppSrc::create("source");
+ filter = ElementFactory::create_element("derivedfrombasetransform", "filter");
+ sink = AppSink::create("sink");
+
+ ASSERT_TRUE(source);
+ ASSERT_TRUE(filter);
+ ASSERT_TRUE(sink);
+
+ EXPECT_NO_THROW(pipeline->add(source)->add(filter)->add(sink));
+ EXPECT_NO_THROW(source->link(filter)->link(sink));
+ }
};
TEST_F(DerivedFromBaseTransformPluginTest, CreateRegisteredElement)
{
- RefPtr<Element> filter_element = Gst::ElementFactory::create_element("derivedfrombasetransform",
"filter");
+ RefPtr<Element> filter_element = Gst::ElementFactory::create_element("derivedfrombasetransform", "filter");
- ASSERT_TRUE(filter_element);
+ ASSERT_TRUE(filter_element);
}
TEST_F(DerivedFromBaseTransformPluginTest, CreatePipelineWithRegisteredElement)
{
- CreatePipelineWithElements();
+ CreatePipelineWithElements();
}
TEST_F(DerivedFromBaseTransformPluginTest, VFuncsShouldReturnProperlyRefcountedGobjs)
{
- bool plugin_registered = Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR,
"derivedfrombasetransform", "exemplary element C++-derived from Gst::BaseTransform",
- sigc::ptr_fun(&DerivedFromBaseTransform::register_element), "0.123", "LGPL", "source?",
"package?",
- "http://example.com");
- ASSERT_TRUE(plugin_registered);
-
- Glib::RefPtr<Gst::Element> element = Gst::ElementFactory::create_element("derivedfrombasetransform");
- ASSERT_TRUE(element);
-
- Glib::RefPtr<DerivedFromBaseTransform> derived_from_base_transform =
Glib::RefPtr<DerivedFromBaseTransform>::cast_dynamic(element);
- ASSERT_TRUE(derived_from_base_transform);
-
- {
- Glib::RefPtr<Caps> caps = derived_from_base_transform->transform_caps_vfunc(PAD_SINK,
Caps::create_any(), Glib::RefPtr<Caps>());
- ASSERT_TRUE(caps);
- ASSERT_TRUE(caps->gobj());
- ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
- ASSERT_EQ(1, caps->gobj()->mini_object.refcount);
- }
-
- {
- GstBaseTransform *gobj = derived_from_base_transform->gobj();
- Glib::RefPtr<Caps> caps = Glib::wrap(GST_BASE_TRANSFORM_GET_CLASS(gobj)->transform_caps(gobj,
GST_PAD_SINK, Glib::unwrap(Caps::create_any()), NULL));
- ASSERT_TRUE(caps);
- ASSERT_TRUE(caps->gobj());
- ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
- ASSERT_EQ(1, caps->get_refcount());
- }
+ bool plugin_registered = Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR,
"derivedfrombasetransform", "exemplary element C++-derived from Gst::BaseTransform",
+ sigc::ptr_fun(&DerivedFromBaseTransform::register_element), "0.123", "LGPL", "source?", "package?",
+ "http://example.com");
+ ASSERT_TRUE(plugin_registered);
+
+ Glib::RefPtr<Gst::Element> element = Gst::ElementFactory::create_element("derivedfrombasetransform");
+ ASSERT_TRUE(element);
+
+ Glib::RefPtr<DerivedFromBaseTransform> derived_from_base_transform =
Glib::RefPtr<DerivedFromBaseTransform>::cast_dynamic(element);
+ ASSERT_TRUE(derived_from_base_transform);
+
+ {
+ Glib::RefPtr<Caps> caps = derived_from_base_transform->transform_caps_vfunc(PAD_SINK,
Caps::create_any(), Glib::RefPtr<Caps>());
+ ASSERT_TRUE(caps);
+ ASSERT_TRUE(caps->gobj());
+ ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
+ ASSERT_EQ(1, caps->gobj()->mini_object.refcount);
+ }
+
+ {
+ GstBaseTransform *gobj = derived_from_base_transform->gobj();
+ Glib::RefPtr<Caps> caps = Glib::wrap(GST_BASE_TRANSFORM_GET_CLASS(gobj)->transform_caps(gobj,
GST_PAD_SINK, Glib::unwrap(Caps::create_any()), NULL));
+ ASSERT_TRUE(caps);
+ ASSERT_TRUE(caps->gobj());
+ ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
+ ASSERT_EQ(1, caps->get_refcount());
+ }
}
TEST_F(DerivedFromBaseTransformPluginTest, CheckDataFlowThroughCreatedElement)
{
- CreatePipelineWithElements();
+ CreatePipelineWithElements();
- EXPECT_EQ(STATE_CHANGE_ASYNC, pipeline->set_state(STATE_PLAYING));
+ EXPECT_EQ(STATE_CHANGE_ASYNC, pipeline->set_state(STATE_PLAYING));
- std::vector<guint8> data = {4, 5, 2, 7, 1};
- RefPtr<Buffer> buf = Buffer::create(data.size());
- ASSERT_TRUE(buf);
- RefPtr<Gst::MapInfo> mapinfo(new Gst::MapInfo());
+ std::vector<guint8> data = {4, 5, 2, 7, 1};
+ RefPtr<Buffer> buf = Buffer::create(data.size());
+ ASSERT_TRUE(buf);
+ RefPtr<Gst::MapInfo> mapinfo(new Gst::MapInfo());
- ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
- std::copy(data.begin(), data.end(), mapinfo->get_data());
- EXPECT_EQ(FLOW_OK, source->push_buffer(buf));
- buf->unmap(mapinfo);
+ ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
+ std::copy(data.begin(), data.end(), mapinfo->get_data());
+ EXPECT_EQ(FLOW_OK, source->push_buffer(buf));
+ buf->unmap(mapinfo);
- RefPtr<Gst::Buffer> buf_out;
- RefPtr<Gst::Sample> samp = sink->pull_preroll();
+ RefPtr<Gst::Buffer> buf_out;
+ RefPtr<Gst::Sample> samp = sink->pull_preroll();
- ASSERT_TRUE(samp);
- buf_out = samp->get_buffer();
- ASSERT_TRUE(buf_out->map(mapinfo, MAP_READ));
- ASSERT_TRUE(mapinfo->get_data());
- ASSERT_TRUE(std::equal(data.begin(), data.end(), mapinfo->get_data()));
- buf_out->unmap(mapinfo);
- EXPECT_EQ(FLOW_OK, source->end_of_stream());
+ ASSERT_TRUE(samp);
+ buf_out = samp->get_buffer();
+ ASSERT_TRUE(buf_out->map(mapinfo, MAP_READ));
+ ASSERT_TRUE(mapinfo->get_data());
+ ASSERT_TRUE(std::equal(data.begin(), data.end(), mapinfo->get_data()));
+ buf_out->unmap(mapinfo);
+ EXPECT_EQ(FLOW_OK, source->end_of_stream());
- EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(Gst::STATE_NULL));
+ EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(Gst::STATE_NULL));
}
diff --git a/tests/plugins/test-plugin-pushsrc.cc b/tests/plugins/test-plugin-pushsrc.cc
index db756b8..d05288a 100644
--- a/tests/plugins/test-plugin-pushsrc.cc
+++ b/tests/plugins/test-plugin-pushsrc.cc
@@ -19,93 +19,93 @@ class FooSrc : public Gst::PushSrc
int count_left;
public:
- static const int COUNT = 5;
- static void base_init(Gst::ElementClass<FooSrc> *klass)
- {
- klass->set_metadata("foosrc_longname",
- "foosrc_classification", "foosrc_detail_description", "foosrc_detail_author");
+ static const int COUNT = 5;
+ static void base_init(Gst::ElementClass<FooSrc> *klass)
+ {
+ klass->set_metadata("foosrc_longname",
+ "foosrc_classification", "foosrc_detail_description", "foosrc_detail_author");
- klass->add_pad_template(Gst::PadTemplate::create("src", Gst::PAD_SRC, Gst::PAD_ALWAYS,
+ klass->add_pad_template(Gst::PadTemplate::create("src", Gst::PAD_SRC, Gst::PAD_ALWAYS,
Gst::Caps::create_from_string("x-application/x-foo1")));
- }
-
- explicit FooSrc(GstPushSrc *gobj)
- : Gst::PushSrc(gobj),
- count_left(COUNT)
- {
- set_format(Gst::FORMAT_TIME);
- }
-
- Gst::FlowReturn create_vfunc(guint64 /* offset */, guint /* size */, Glib::RefPtr<Gst::Buffer>& buffer)
- {
- if (count_left-- <= 0)
- return Gst::FLOW_EOS;
-
- std::string s = std::to_string(COUNT - count_left);
- buffer = Gst::Buffer::create(s.size());
-
- RefPtr<MapInfo> info(new MapInfo());
- buffer->map(info, MAP_WRITE);
-
- std::copy(s.begin(), s.end(), info->get_data());
- return Gst::FLOW_OK;
- }
-
- virtual bool negotiate_vfunc()
- {
- return true;
- }
- virtual bool start_vfunc()
- {
- count_left = COUNT;
- return true;
- }
+ }
+
+ explicit FooSrc(GstPushSrc *gobj)
+ : Gst::PushSrc(gobj),
+ count_left(COUNT)
+ {
+ set_format(Gst::FORMAT_TIME);
+ }
+
+ Gst::FlowReturn create_vfunc(guint64 /* offset */, guint /* size */, Glib::RefPtr<Gst::Buffer>& buffer)
+ {
+ if (count_left-- <= 0)
+ return Gst::FLOW_EOS;
+
+ std::string s = std::to_string(COUNT - count_left);
+ buffer = Gst::Buffer::create(s.size());
+
+ RefPtr<MapInfo> info(new MapInfo());
+ buffer->map(info, MAP_WRITE);
+
+ std::copy(s.begin(), s.end(), info->get_data());
+ return Gst::FLOW_OK;
+ }
+
+ virtual bool negotiate_vfunc()
+ {
+ return true;
+ }
+
+ virtual bool start_vfunc()
+ {
+ count_left = COUNT;
+ return true;
+ }
};
bool register_foo(Glib::RefPtr<Gst::Plugin> plugin)
{
- Gst::ElementFactory::register_element(plugin, "foosrcmm", 10, Gst::register_mm_type<FooSrc>("foosrcmm"));
- return true;
-
+ Gst::ElementFactory::register_element(plugin, "foosrcmm", 10, Gst::register_mm_type<FooSrc>("foosrcmm"));
+ return true;
}
class PushSrcPluginTest : public ::testing::Test
{
protected:
- virtual void SetUp()
- {
- Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "foo",
- "foo is example of C++ element", sigc::ptr_fun(register_foo), "0.123",
- "LGPL", "source?", "package?", "http://example.com");
- }
+ virtual void SetUp()
+ {
+ Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "foo",
+ "foo is example of C++ element", sigc::ptr_fun(register_foo), "0.123",
+ "LGPL", "source?", "package?", "http://example.com");
+ }
- RefPtr<Pipeline> CreatePipeline()
- {
- RefPtr<Pipeline> pipeline = Pipeline::create("my-pipeline");
+ RefPtr<Pipeline> CreatePipeline()
+ {
+ RefPtr<Pipeline> pipeline = Pipeline::create("my-pipeline");
- EXPECT_TRUE(pipeline);
+ EXPECT_TRUE(pipeline);
- RefPtr<Element> source = ElementFactory::create_element("foosrcmm", "src");
- RefPtr<AppSink> sink = AppSink::create("sink");
+ RefPtr<Element> source = ElementFactory::create_element("foosrcmm", "src");
+ RefPtr<AppSink> sink = AppSink::create("sink");
- EXPECT_TRUE(source);
- EXPECT_TRUE(sink);
+ EXPECT_TRUE(source);
+ EXPECT_TRUE(sink);
- pipeline->add(source)->add(sink);
- source->link(sink);
+ pipeline->add(source)->add(sink);
+ source->link(sink);
- return pipeline;
- }
+ return pipeline;
+ }
};
TEST_F(PushSrcPluginTest, CreateRegisteredElement)
{
- Glib::RefPtr<Gst::Element> source = Gst::ElementFactory::create_element("foosrcmm", "src");
+ Glib::RefPtr<Gst::Element> source = Gst::ElementFactory::create_element("foosrcmm", "src");
- ASSERT_TRUE(source);
+ ASSERT_TRUE(source);
}
TEST_F(PushSrcPluginTest, DISABLED_CreatePipelineWithRegisteredElement)
{
- CreatePipeline();
+ CreatePipeline();
}
diff --git a/tests/plugins/test-plugin-register.cc b/tests/plugins/test-plugin-register.cc
index 714a87f..26901ba 100644
--- a/tests/plugins/test-plugin-register.cc
+++ b/tests/plugins/test-plugin-register.cc
@@ -18,90 +18,90 @@ using Glib::RefPtr;
class RegisterPluginTest : public ::testing::Test
{
protected:
- RefPtr<AppSrc> source;
- RefPtr<Element> filter;
- RefPtr<AppSink> sink;
- RefPtr<Gst::Pipeline> pipeline;
-
- virtual void SetUp()
- {
- Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "foo",
- "foo is example of C++ element", sigc::ptr_fun(&Foo::register_foo), "0.123",
- "LGPL", "source?", "package?", "http://example.com");
- }
-
- void CreatePipelineWithElements()
- {
- pipeline = Gst::Pipeline::create("my-pipeline");
-
- source = AppSrc::create("source");
- filter = ElementFactory::create_element("foomm", "filter");
- sink = AppSink::create("sink");
-
- ASSERT_TRUE(source);
- ASSERT_TRUE(filter);
- ASSERT_TRUE(sink);
-
- EXPECT_NO_THROW(pipeline->add(source)->add(filter)->add(sink));
- EXPECT_NO_THROW(source->link(filter)->link(sink));
- }
+ RefPtr<AppSrc> source;
+ RefPtr<Element> filter;
+ RefPtr<AppSink> sink;
+ RefPtr<Gst::Pipeline> pipeline;
+
+ virtual void SetUp()
+ {
+ Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "foo",
+ "foo is example of C++ element", sigc::ptr_fun(&Foo::register_foo), "0.123",
+ "LGPL", "source?", "package?", "http://example.com");
+ }
+
+ void CreatePipelineWithElements()
+ {
+ pipeline = Gst::Pipeline::create("my-pipeline");
+
+ source = AppSrc::create("source");
+ filter = ElementFactory::create_element("foomm", "filter");
+ sink = AppSink::create("sink");
+
+ ASSERT_TRUE(source);
+ ASSERT_TRUE(filter);
+ ASSERT_TRUE(sink);
+
+ EXPECT_NO_THROW(pipeline->add(source)->add(filter)->add(sink));
+ EXPECT_NO_THROW(source->link(filter)->link(sink));
+ }
};
TEST_F(RegisterPluginTest, CreateRegisteredElement)
{
- filter = Gst::ElementFactory::create_element("foomm", "filter");
+ filter = Gst::ElementFactory::create_element("foomm", "filter");
- ASSERT_TRUE(filter);
+ ASSERT_TRUE(filter);
}
TEST_F(RegisterPluginTest, CheckPropertyUsage)
{
- filter = Gst::ElementFactory::create_element("foomm", "filter");
+ filter = Gst::ElementFactory::create_element("foomm", "filter");
- ASSERT_TRUE(filter);
+ ASSERT_TRUE(filter);
- Glib::ustring property_value;
- filter->get_property("sample_property", property_value);
- EXPECT_STREQ("def_val", property_value.c_str());
+ Glib::ustring property_value;
+ filter->get_property("sample_property", property_value);
+ EXPECT_STREQ("def_val", property_value.c_str());
- Glib::ustring expected_property_value = "second_property_test";
- filter->set_property("sample_property", expected_property_value);
- filter->get_property("sample_property", property_value);
- EXPECT_STREQ(expected_property_value.c_str(), property_value.c_str());
+ Glib::ustring expected_property_value = "second_property_test";
+ filter->set_property("sample_property", expected_property_value);
+ filter->get_property("sample_property", property_value);
+ EXPECT_STREQ(expected_property_value.c_str(), property_value.c_str());
}
TEST_F(RegisterPluginTest, CreatePipelineWithRegisteredElement)
{
- CreatePipelineWithElements();
+ CreatePipelineWithElements();
}
TEST_F(RegisterPluginTest, CheckDataFlowThroughCreatedElement)
{
- CreatePipelineWithElements();
+ CreatePipelineWithElements();
- EXPECT_EQ(STATE_CHANGE_ASYNC, pipeline->set_state(STATE_PLAYING));
+ EXPECT_EQ(STATE_CHANGE_ASYNC, pipeline->set_state(STATE_PLAYING));
- std::vector<guint8> data = {4, 5, 2, 7, 1};
- RefPtr<Buffer> buf = Buffer::create(data.size());
- ASSERT_TRUE(buf);
- RefPtr<Gst::MapInfo> mapinfo(new Gst::MapInfo());
+ std::vector<guint8> data = {4, 5, 2, 7, 1};
+ RefPtr<Buffer> buf = Buffer::create(data.size());
+ ASSERT_TRUE(buf);
+ RefPtr<Gst::MapInfo> mapinfo(new Gst::MapInfo());
- ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
- std::copy(data.begin(), data.end(), mapinfo->get_data());
- EXPECT_EQ(FLOW_OK, source->push_buffer(buf));
- buf->unmap(mapinfo);
+ ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
+ std::copy(data.begin(), data.end(), mapinfo->get_data());
+ EXPECT_EQ(FLOW_OK, source->push_buffer(buf));
+ buf->unmap(mapinfo);
- RefPtr<Gst::Buffer> buf_out;
- RefPtr<Gst::Sample> samp = sink->pull_preroll();
+ RefPtr<Gst::Buffer> buf_out;
+ RefPtr<Gst::Sample> samp = sink->pull_preroll();
- ASSERT_TRUE(samp);
- buf_out = samp->get_buffer();
- ASSERT_TRUE(buf_out->map(mapinfo, MAP_READ));
- ASSERT_TRUE(mapinfo->get_data());
- std::sort(data.begin(), data.end());
- ASSERT_TRUE(std::equal(data.begin(), data.end(), mapinfo->get_data()));
- buf_out->unmap(mapinfo);
- EXPECT_EQ(FLOW_OK, source->end_of_stream());
+ ASSERT_TRUE(samp);
+ buf_out = samp->get_buffer();
+ ASSERT_TRUE(buf_out->map(mapinfo, MAP_READ));
+ ASSERT_TRUE(mapinfo->get_data());
+ std::sort(data.begin(), data.end());
+ ASSERT_TRUE(std::equal(data.begin(), data.end(), mapinfo->get_data()));
+ buf_out->unmap(mapinfo);
+ EXPECT_EQ(FLOW_OK, source->end_of_stream());
- EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(Gst::STATE_NULL));
+ EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(Gst::STATE_NULL));
}
diff --git a/tests/regression/pluginbin.h b/tests/regression/pluginbin.h
index eab4b4f..bb973ee 100644
--- a/tests/regression/pluginbin.h
+++ b/tests/regression/pluginbin.h
@@ -19,55 +19,52 @@
class PluginBin: public Gst::Bin
{
private:
- Glib::RefPtr<Gst::GhostPad> srcpad;
- Glib::Property<Glib::ustring> location;
+ Glib::RefPtr<Gst::GhostPad> srcpad;
+ Glib::Property<Glib::ustring> location;
public:
- static void base_init(Gst::ElementClass<PluginBin> *klass)
+ static void base_init(Gst::ElementClass<PluginBin> *klass)
+ {
+ klass->set_metadata("Custom test bin", "test/bins", "test bin", "author");
+ }
+
+ explicit PluginBin(GstBin *gobj)
+ : Glib::ObjectBase(typeid (PluginBin)),
+ Gst::Bin(gobj),
+ location(*this, "location")
+ {
+ add_pad(srcpad = Gst::GhostPad::create( Gst::PadTemplate::create("src", Gst::PAD_SRC, Gst::PAD_ALWAYS,
+ Gst::Caps::create_any()), "src"));
+ }
+
+ static bool register_pluginbin(Glib::RefPtr<Gst::Plugin> plugin)
+ {
+ Gst::ElementFactory::register_element(plugin, "pluginbin", 10,
+ Gst::register_mm_type<PluginBin>("pluginbin"));
+
+ return true;
+ }
+
+ virtual ~PluginBin() { }
+
+ virtual Gst::StateChangeReturn change_state_vfunc(Gst::StateChange transition)
+ {
+ if (transition == Gst::STATE_CHANGE_NULL_TO_READY)
{
- klass->set_metadata("Custom test bin", "test/bins", "test bin", "author");
- }
-
- explicit PluginBin(GstBin *gobj)
- : Glib::ObjectBase(typeid (PluginBin)),
- Gst::Bin(gobj),
- location(*this, "location")
- {
- add_pad(srcpad = Gst::GhostPad::create( Gst::PadTemplate::create("src", Gst::PAD_SRC,
Gst::PAD_ALWAYS,
- Gst::Caps::create_any()), "src"));
- }
-
- static bool register_pluginbin(Glib::RefPtr<Gst::Plugin> plugin)
- {
- Gst::ElementFactory::register_element(plugin, "pluginbin", 10,
- Gst::register_mm_type<PluginBin>("pluginbin"));
-
- return true;
- }
-
- virtual ~PluginBin() { }
-
- virtual Gst::StateChangeReturn change_state_vfunc(Gst::StateChange transition)
- {
- if (transition == Gst::STATE_CHANGE_NULL_TO_READY)
- {
- Glib::RefPtr<Gst::FileSrc> source_file = Gst::FileSrc::create("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();
+ Glib::RefPtr<Gst::FileSrc> source_file = Gst::FileSrc::create("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();
- add(source_file);
- add(png_decoder);
- source_file->link(png_decoder);
+ add(source_file);
+ add(png_decoder);
+ source_file->link(png_decoder);
- srcpad->set_target(png_decoder->get_static_pad("src"));
- }
-
- return Bin::change_state_vfunc(transition);
+ srcpad->set_target(png_decoder->get_static_pad("src"));
}
+ return Bin::change_state_vfunc(transition);
+ }
};
-
-
#endif /* TESTS_REGRESSION_PLUGINBIN_H_ */
diff --git a/tests/regression/test-regression-bininpipeline.cc
b/tests/regression/test-regression-bininpipeline.cc
index 2f2dcea..c6fadb6 100644
--- a/tests/regression/test-regression-bininpipeline.cc
+++ b/tests/regression/test-regression-bininpipeline.cc
@@ -17,87 +17,85 @@ using Glib::RefPtr;
class CustomBin : public Bin
{
private:
- RefPtr<FileSrc> source_file;
- RefPtr<Element> queue;
- RefPtr<GhostPad> src_pad;
+ RefPtr<FileSrc> source_file;
+ RefPtr<Element> queue;
+ RefPtr<GhostPad> src_pad;
protected:
- explicit CustomBin(const Glib::ustring& name)
- : Bin(name)
- {
- source_file = FileSrc::create("source-file");
- queue = ElementFactory::create_element("queue");
-
- add(source_file);
- add(queue);
- source_file->link(queue);
-
- src_pad = add_ghost_pad(queue, "src", "src");
- src_pad->set_active(true);
- }
+ explicit CustomBin(const Glib::ustring& name)
+ : Bin(name)
+ {
+ source_file = FileSrc::create("source-file");
+ queue = ElementFactory::create_element("queue");
+
+ add(source_file);
+ add(queue);
+ source_file->link(queue);
+
+ src_pad = add_ghost_pad(queue, "src", "src");
+ src_pad->set_active(true);
+ }
public:
- virtual ~CustomBin() {}
+ virtual ~CustomBin() {}
- static RefPtr<CustomBin> create(const Glib::ustring& name)
- {
- return RefPtr<CustomBin>(new CustomBin(name));
- }
+ static RefPtr<CustomBin> create(const Glib::ustring& name)
+ {
+ return RefPtr<CustomBin>(new CustomBin(name));
+ }
- void set_location(const Glib::ustring& filename)
- {
- source_file->property_location() = filename;
- }
+ void set_location(const Glib::ustring& filename)
+ {
+ source_file->property_location() = filename;
+ }
};
RefPtr<Glib::MainLoop> mainloop;
bool on_bus_message(const RefPtr<Bus>&, const Glib::RefPtr<Message>& message)
{
- switch(message->get_message_type())
- {
- case MESSAGE_EOS:
- mainloop->quit();
- return false;
- case MESSAGE_ERROR:
- {
- mainloop->quit();
- return false;
- }
- default:
- break;
- }
-
- return true;
+ switch(message->get_message_type())
+ {
+ case MESSAGE_EOS:
+ mainloop->quit();
+ return false;
+ case MESSAGE_ERROR:
+ mainloop->quit();
+ return false;
+ default:
+ break;
+ }
+
+ return true;
}
TEST(BinInPipelineRegressionTest, CustomBinShouldCorrectPassThroughImage)
{
- Glib::ustring input_png = "resources/input-image.png",
- output_jpg = "resources/test-regression-bininpipeline-output-image.jpg";
+ Glib::ustring input_png = "resources/input-image.png",
+ output_jpg = "resources/test-regression-bininpipeline-output-image.jpg";
- mainloop = Glib::MainLoop::create();
- ASSERT_TRUE(mainloop);
- RefPtr<CustomBin> custom_bin = CustomBin::create("file-png-decoder");
- ASSERT_TRUE(custom_bin);
- RefPtr<Element> queue = ElementFactory::create_element("queue");
- ASSERT_TRUE(queue);
- RefPtr<FileSink> file_sink = FileSink::create("file-sink");
- ASSERT_TRUE(file_sink);
- RefPtr<Pipeline> pipeline = Pipeline::create("image-converter-pipeline");
- ASSERT_TRUE(custom_bin);
+ mainloop = Glib::MainLoop::create();
+ ASSERT_TRUE(mainloop);
+ RefPtr<CustomBin> custom_bin = CustomBin::create("file-png-decoder");
+ ASSERT_TRUE(custom_bin);
+ RefPtr<Element> queue = ElementFactory::create_element("queue");
+ ASSERT_TRUE(queue);
+ RefPtr<FileSink> file_sink = FileSink::create("file-sink");
+ ASSERT_TRUE(file_sink);
+ RefPtr<Pipeline> pipeline = Pipeline::create("image-converter-pipeline");
+ ASSERT_TRUE(custom_bin);
- ASSERT_NO_THROW(pipeline->add(custom_bin)->add(queue)->add(file_sink));
- ASSERT_NO_THROW(custom_bin->link(queue)->link(file_sink));
+ ASSERT_NO_THROW(pipeline->add(custom_bin)->add(queue)->add(file_sink));
+ ASSERT_NO_THROW(custom_bin->link(queue)->link(file_sink));
- Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
- ASSERT_TRUE(bus);
- bus->add_watch(sigc::ptr_fun(&on_bus_message));
+ Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
+ ASSERT_TRUE(bus);
+ bus->add_watch(sigc::ptr_fun(&on_bus_message));
- custom_bin->set_location(input_png);
+ custom_bin->set_location(input_png);
- file_sink->property_location() = output_jpg;
+ file_sink->property_location() = output_jpg;
- pipeline->set_state(STATE_PLAYING);
- mainloop->run();
+ pipeline->set_state(STATE_PLAYING);
+ mainloop->run();
- pipeline->set_state(Gst::STATE_NULL);
+ pipeline->set_state(Gst::STATE_NULL);
}
diff --git a/tests/regression/test-regression-binplugin.cc b/tests/regression/test-regression-binplugin.cc
index 5a25f68..160dfd7 100644
--- a/tests/regression/test-regression-binplugin.cc
+++ b/tests/regression/test-regression-binplugin.cc
@@ -18,59 +18,57 @@ RefPtr<Glib::MainLoop> mainloop;
bool on_bus_message(const RefPtr<Bus>&, const Glib::RefPtr<Message>& message)
{
- switch(message->get_message_type())
- {
- case MESSAGE_EOS:
- mainloop->quit();
- return false;
- case MESSAGE_ERROR:
- {
- mainloop->quit();
- return false;
- }
- default:
- break;
- }
+ switch(message->get_message_type())
+ {
+ case MESSAGE_EOS:
+ mainloop->quit();
+ return false;
+ case MESSAGE_ERROR:
+ mainloop->quit();
+ return false;
+ default:
+ break;
+ }
- return true;
+ return true;
}
TEST(BinPluginRegressionTest, DISABLED_ShouldDecodeAndEncodeFile)
{
- Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "pluginbin",
- "pluginbin is example of C++ element", sigc::ptr_fun(&PluginBin::register_pluginbin), "0.1",
- "LGPL", "source?", "package?", "http://example.com");
+ Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "pluginbin",
+ "pluginbin is example of C++ element", sigc::ptr_fun(&PluginBin::register_pluginbin), "0.1",
+ "LGPL", "source?", "package?", "http://example.com");
- Glib::ustring input_png = "resources/input-image.png",
- output_jpg = "resources/test-regression-binplugin-output-image.jpg";
+ Glib::ustring input_png = "resources/input-image.png",
+ output_jpg = "resources/test-regression-binplugin-output-image.jpg";
- mainloop = Glib::MainLoop::create();
- ASSERT_TRUE(mainloop);
- RefPtr<Element> pluginbin = Gst::ElementFactory::create_element("pluginbin", "sample-pluginbin");
- ASSERT_TRUE(pluginbin);
- RefPtr<Element> jpg_encoder = ElementFactory::create_element("queue");
- ASSERT_TRUE(jpg_encoder);
- RefPtr<FileSink> file_sink = FileSink::create("file-sink");
- ASSERT_TRUE(file_sink);
- RefPtr<Pipeline> pipeline = Pipeline::create("image-converter-pipeline");
- ASSERT_TRUE(pipeline);
+ mainloop = Glib::MainLoop::create();
+ ASSERT_TRUE(mainloop);
+ RefPtr<Element> pluginbin = Gst::ElementFactory::create_element("pluginbin", "sample-pluginbin");
+ ASSERT_TRUE(pluginbin);
+ RefPtr<Element> jpg_encoder = ElementFactory::create_element("queue");
+ ASSERT_TRUE(jpg_encoder);
+ RefPtr<FileSink> file_sink = FileSink::create("file-sink");
+ ASSERT_TRUE(file_sink);
+ RefPtr<Pipeline> pipeline = Pipeline::create("image-converter-pipeline");
+ ASSERT_TRUE(pipeline);
- ASSERT_NO_THROW(pipeline->add(pluginbin)->add(jpg_encoder)->add(file_sink));
- ASSERT_NO_THROW(pluginbin->link(jpg_encoder)->link(file_sink));
+ ASSERT_NO_THROW(pipeline->add(pluginbin)->add(jpg_encoder)->add(file_sink));
+ ASSERT_NO_THROW(pluginbin->link(jpg_encoder)->link(file_sink));
- Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
- ASSERT_TRUE(bus);
- bus->add_watch(sigc::ptr_fun(&on_bus_message));
+ Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
+ ASSERT_TRUE(bus);
+ bus->add_watch(sigc::ptr_fun(&on_bus_message));
- pluginbin->set_property("location", input_png);
- file_sink->property_location() = output_jpg;
+ pluginbin->set_property("location", input_png);
+ file_sink->property_location() = output_jpg;
- pipeline->set_state(STATE_PLAYING);
- mainloop->run();
+ pipeline->set_state(STATE_PLAYING);
+ mainloop->run();
- pipeline->set_state(Gst::STATE_NULL);
+ pipeline->set_state(Gst::STATE_NULL);
- struct stat st;
- stat(output_jpg.c_str(), &st);
- ASSERT_TRUE( st.st_size > 0 ); // weak checking
+ struct stat st;
+ stat(output_jpg.c_str(), &st);
+ ASSERT_TRUE( st.st_size > 0 ); // weak checking
}
diff --git a/tests/regression/test-regression-rewritefile.cc b/tests/regression/test-regression-rewritefile.cc
index 41935fa..72fff18 100644
--- a/tests/regression/test-regression-rewritefile.cc
+++ b/tests/regression/test-regression-rewritefile.cc
@@ -18,56 +18,54 @@ RefPtr<Glib::MainLoop> mainloop;
bool on_bus_message(const RefPtr<Bus>&, const Glib::RefPtr<Message>& message)
{
- switch(message->get_message_type())
- {
- case Gst::MESSAGE_EOS:
- mainloop->quit();
- return false;
- case Gst::MESSAGE_ERROR:
- {
- mainloop->quit();
- return false;
- }
- default:
- break;
- }
-
- return true;
+ switch(message->get_message_type())
+ {
+ case Gst::MESSAGE_EOS:
+ mainloop->quit();
+ return false;
+ case Gst::MESSAGE_ERROR:
+ mainloop->quit();
+ return false;
+ default:
+ break;
+ }
+
+ return true;
}
TEST(RegressionRewriteFileTest, CreateAndRewriteFile)
{
- Glib::ustring input_filename = "test.ogg",
- output_filename = "output.ogg";
+ Glib::ustring input_filename = "test.ogg",
+ output_filename = "output.ogg";
- GenerateSampleOggFile(20, input_filename);
+ GenerateSampleOggFile(20, input_filename);
- Glib::RefPtr<Gst::Pipeline> pipeline;
- RefPtr<FileSrc> filesrc = Gst::FileSrc::create();
- ASSERT_TRUE(filesrc);
+ Glib::RefPtr<Gst::Pipeline> pipeline;
+ RefPtr<FileSrc> filesrc = Gst::FileSrc::create();
+ ASSERT_TRUE(filesrc);
- filesrc->property_location() = input_filename;
+ filesrc->property_location() = input_filename;
- mainloop = Glib::MainLoop::create();
- pipeline = Gst::Pipeline::create("rewriter");
- Glib::RefPtr<Gst::FileSink> filesink = Gst::FileSink::create();
- ASSERT_TRUE(filesink);
+ mainloop = Glib::MainLoop::create();
+ pipeline = Gst::Pipeline::create("rewriter");
+ Glib::RefPtr<Gst::FileSink> filesink = Gst::FileSink::create();
+ ASSERT_TRUE(filesink);
- filesink->property_location() = output_filename;
+ filesink->property_location() = output_filename;
- Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
- bus->add_watch(sigc::ptr_fun(&on_bus_message));
+ Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
+ bus->add_watch(sigc::ptr_fun(&on_bus_message));
- pipeline->add(filesrc)->add(filesink);
+ pipeline->add(filesrc)->add(filesink);
- pipeline->set_state(Gst::STATE_PLAYING);
- filesrc->link(filesink);
- mainloop->run();
+ pipeline->set_state(Gst::STATE_PLAYING);
+ filesrc->link(filesink);
+ mainloop->run();
- pipeline->set_state(Gst::STATE_NULL);
+ pipeline->set_state(Gst::STATE_NULL);
- EXPECT_TRUE(FilesEqual(input_filename, output_filename));
+ EXPECT_TRUE(FilesEqual(input_filename, output_filename));
- remove(input_filename.c_str());
- remove(output_filename.c_str());
+ remove(input_filename.c_str());
+ remove(output_filename.c_str());
}
diff --git a/tests/regression/test-regression-seekonstartup.cc
b/tests/regression/test-regression-seekonstartup.cc
index 5e0fb82..f444639 100644
--- a/tests/regression/test-regression-seekonstartup.cc
+++ b/tests/regression/test-regression-seekonstartup.cc
@@ -24,30 +24,30 @@ gboolean was_check = 0;
bool on_timeout()
{
- gint64 pos;
+ gint64 pos;
- if (pipeline->query_position(FORMAT_TIME, pos))
- {
- EXPECT_EQ(2000000000, pos);
- g_atomic_int_set(&was_check, 1);
- was_check = true;
+ if (pipeline->query_position(FORMAT_TIME, pos))
+ {
+ EXPECT_EQ(2000000000, pos);
+ g_atomic_int_set(&was_check, 1);
+ was_check = true;
- return FALSE;
- }
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
void dec_counter()
{
- if (prerolled)
- return;
-
- if (g_atomic_int_dec_and_test (&counter))
- {
- prerolled = true;
- bus->post(MessageApplication::create(pipeline, Structure("empty")));
- }
+ if (prerolled)
+ return;
+
+ if (g_atomic_int_dec_and_test (&counter))
+ {
+ prerolled = true;
+ bus->post(MessageApplication::create(pipeline, Structure("empty")));
+ }
}
PadProbeReturn cb_blocked (const RefPtr <Pad>& /* pad */, const PadProbeInfo& /* info */)
@@ -62,100 +62,93 @@ PadProbeReturn cb_blocked (const RefPtr <Pad>& /* pad */, const PadProbeInfo& /*
bool on_bus_message(const RefPtr<Bus>&, const Glib::RefPtr<Message>& message)
{
- switch(message->get_message_type())
- {
- case MESSAGE_EOS:
- mainloop->quit();
- return false;
- case MESSAGE_ERROR:
- {
- mainloop->quit();
- return false;
- }
- case GST_MESSAGE_APPLICATION:
- {
- pipeline->seek(1.0, FORMAT_TIME,
- (SeekFlags)(SEEK_FLAG_FLUSH | SEEK_FLAG_ACCURATE),
- SEEK_TYPE_SET, 2 * SECOND,
- SEEK_TYPE_SET, 3 * SECOND);
- pipeline->set_state(STATE_PLAYING);
-
- break;
- }
- default:
- break;
- }
- return true;
+ switch(message->get_message_type())
+ {
+ case MESSAGE_EOS:
+ mainloop->quit();
+ return false;
+ case MESSAGE_ERROR:
+ mainloop->quit();
+ return false;
+ case GST_MESSAGE_APPLICATION:
+ pipeline->seek(1.0, FORMAT_TIME,
+ (SeekFlags)(SEEK_FLAG_FLUSH | SEEK_FLAG_ACCURATE),
+ SEEK_TYPE_SET, 2 * SECOND,
+ SEEK_TYPE_SET, 3 * SECOND);
+ pipeline->set_state(STATE_PLAYING);
+ break;
+ default:
+ break;
+ }
+
+ return true;
}
void on_pad_added(const RefPtr<Pad>& newPad)
{
- if (prerolled)
- return;
+ if (prerolled)
+ return;
- g_atomic_int_inc(&counter);
+ g_atomic_int_inc(&counter);
- newPad->add_probe(PAD_PROBE_TYPE_BLOCK_DOWNSTREAM, sigc::ptr_fun(&cb_blocked));
+ newPad->add_probe(PAD_PROBE_TYPE_BLOCK_DOWNSTREAM, sigc::ptr_fun(&cb_blocked));
- PadLinkReturn ret = newPad->link(sink_pad);
+ PadLinkReturn ret = newPad->link(sink_pad);
- ASSERT_TRUE(PAD_LINK_OK == ret || PAD_LINK_WAS_LINKED == ret);
+ ASSERT_TRUE(PAD_LINK_OK == ret || PAD_LINK_WAS_LINKED == ret);
}
void no_more_pads()
{
- if (prerolled)
- return;
+ if (prerolled)
+ return;
- dec_counter();
+ dec_counter();
}
TEST(RegressionSeekOnStartupTest, SeekToPositionWhenPipelineStarts)
{
- Glib::ustring input_filename = "test.ogg";
+ Glib::ustring input_filename = "test.ogg";
- GenerateSampleOggFile(100, input_filename);
+ GenerateSampleOggFile(100, input_filename);
- mainloop = Glib::MainLoop::create();
- pipeline = Pipeline::create("seekonstartup-pipeline");
- ASSERT_TRUE(pipeline);
- bus = pipeline->get_bus();
- ASSERT_TRUE(bus);
- bus->add_watch(sigc::ptr_fun(&on_bus_message));
+ mainloop = Glib::MainLoop::create();
+ pipeline = Pipeline::create("seekonstartup-pipeline");
+ ASSERT_TRUE(pipeline);
+ bus = pipeline->get_bus();
+ ASSERT_TRUE(bus);
+ bus->add_watch(sigc::ptr_fun(&on_bus_message));
- RefPtr<Element> src = ElementFactory::create_element("uridecodebin"),
- csp = ElementFactory::create_element("videoconvert"),
- vs = ElementFactory::create_element("videoscale"),
- sink = ElementFactory::create_element("ximagesink");
+ RefPtr<Element> src = ElementFactory::create_element("uridecodebin"),
+ csp = ElementFactory::create_element("videoconvert"),
+ vs = ElementFactory::create_element("videoscale"),
+ sink = ElementFactory::create_element("ximagesink");
- ASSERT_TRUE(src);
- ASSERT_TRUE(csp);
- ASSERT_TRUE(vs);
- ASSERT_TRUE(sink);
+ ASSERT_TRUE(src);
+ ASSERT_TRUE(csp);
+ ASSERT_TRUE(vs);
+ ASSERT_TRUE(sink);
- ASSERT_NO_THROW(src->set_property("uri", URIHandler::filename_to_uri(input_filename)));
+ ASSERT_NO_THROW(src->set_property("uri", URIHandler::filename_to_uri(input_filename)));
- ASSERT_NO_THROW(pipeline->add(src)->add(csp)->add(vs)->add(sink));
- ASSERT_NO_THROW(csp->link(vs)->link(sink));
+ ASSERT_NO_THROW(pipeline->add(src)->add(csp)->add(vs)->add(sink));
+ ASSERT_NO_THROW(csp->link(vs)->link(sink));
- sink_pad = csp->get_static_pad("sink");
+ sink_pad = csp->get_static_pad("sink");
- g_atomic_int_set(&counter, 1);
+ g_atomic_int_set(&counter, 1);
- src->signal_pad_added().connect(sigc::ptr_fun(&on_pad_added));
- src->signal_no_more_pads().connect(sigc::ptr_fun(&no_more_pads));
+ src->signal_pad_added().connect(sigc::ptr_fun(&on_pad_added));
+ src->signal_no_more_pads().connect(sigc::ptr_fun(&no_more_pads));
- pipeline->set_state(STATE_PAUSED);
+ pipeline->set_state(STATE_PAUSED);
- Glib::signal_timeout().connect(sigc::ptr_fun(&on_timeout), 0);
- mainloop->run();
+ Glib::signal_timeout().connect(sigc::ptr_fun(&on_timeout), 0);
+ mainloop->run();
- pipeline->set_state(Gst::STATE_NULL);
+ pipeline->set_state(Gst::STATE_NULL);
- ASSERT_TRUE(was_check);
+ ASSERT_TRUE(was_check);
- remove(input_filename.c_str());
+ remove(input_filename.c_str());
}
-
-
-
diff --git a/tests/regression/test-regression-videoduration.cc
b/tests/regression/test-regression-videoduration.cc
index b1a00b9..cb80483 100644
--- a/tests/regression/test-regression-videoduration.cc
+++ b/tests/regression/test-regression-videoduration.cc
@@ -20,81 +20,77 @@ RefPtr<Gst::Pipeline> pipeline;
bool on_bus_message(const RefPtr<Bus>&, const Glib::RefPtr<Message>& message)
{
- switch(message->get_message_type())
- {
- case Gst::MESSAGE_EOS:
- mainloop->quit();
- return false;
- case Gst::MESSAGE_ERROR:
- {
- mainloop->quit();
- return false;
- }
- default:
- break;
- }
-
- return true;
+ switch(message->get_message_type())
+ {
+ case Gst::MESSAGE_EOS:
+ mainloop->quit();
+ return false;
+ case Gst::MESSAGE_ERROR:
+ mainloop->quit();
+ return false;
+ default:
+ break;
+ }
+
+ return true;
}
void on_pad_added(const Glib::RefPtr<Gst::Pad>& newPad)
{
- RefPtr<Gst::Pad> sinkPad = decoder->get_static_pad("sink");
- PadLinkReturn ret = newPad->link(sinkPad);
+ RefPtr<Gst::Pad> sinkPad = decoder->get_static_pad("sink");
+ PadLinkReturn ret = newPad->link(sinkPad);
- ASSERT_TRUE(PAD_LINK_OK == ret || PAD_LINK_WAS_LINKED == ret);
+ ASSERT_TRUE(PAD_LINK_OK == ret || PAD_LINK_WAS_LINKED == ret);
}
bool on_timeout()
{
- gint64 len;
+ gint64 len;
- if (pipeline->query_duration(FORMAT_TIME, len))
- {
- EXPECT_EQ(333333333, len);
- return FALSE;
- }
+ if (pipeline->query_duration(FORMAT_TIME, len))
+ {
+ EXPECT_EQ(333333333, len);
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
TEST(RegressionVideodurationTest, CreateVideoAndCheckDuration)
{
- Glib::ustring input_filename = "test.ogg";
+ Glib::ustring input_filename = "test.ogg";
- GenerateSampleOggFile(10, input_filename);
+ GenerateSampleOggFile(10, input_filename);
- RefPtr<FileSrc> filesrc = Gst::FileSrc::create();
- ASSERT_TRUE(filesrc);
+ RefPtr<FileSrc> filesrc = Gst::FileSrc::create();
+ ASSERT_TRUE(filesrc);
- filesrc->property_location() = input_filename;
+ filesrc->property_location() = input_filename;
- mainloop = Glib::MainLoop::create();
- pipeline = Pipeline::create("rewriter");
- RefPtr<Element> sink = ElementFactory::create_element("fakesink"),
- demuxer = ElementFactory::create_element("oggdemux");
- decoder = ElementFactory::create_element("theoradec");
- ASSERT_TRUE(sink);
- ASSERT_TRUE(demuxer);
- ASSERT_TRUE(decoder);
+ mainloop = Glib::MainLoop::create();
+ pipeline = Pipeline::create("rewriter");
+ RefPtr<Element> sink = ElementFactory::create_element("fakesink"),
+ demuxer = ElementFactory::create_element("oggdemux");
+ decoder = ElementFactory::create_element("theoradec");
+ ASSERT_TRUE(sink);
+ ASSERT_TRUE(demuxer);
+ ASSERT_TRUE(decoder);
- RefPtr<Bus> bus = pipeline->get_bus();
- bus->add_watch(sigc::ptr_fun(&on_bus_message));
+ RefPtr<Bus> bus = pipeline->get_bus();
+ bus->add_watch(sigc::ptr_fun(&on_bus_message));
- pipeline->add(filesrc)->add(demuxer)->add(decoder)->add(sink);
- filesrc->link(demuxer);
- decoder->link(sink);
+ pipeline->add(filesrc)->add(demuxer)->add(decoder)->add(sink);
+ filesrc->link(demuxer);
+ decoder->link(sink);
- demuxer->signal_pad_added().connect(sigc::ptr_fun(&on_pad_added));
+ demuxer->signal_pad_added().connect(sigc::ptr_fun(&on_pad_added));
- pipeline->set_state(Gst::STATE_PLAYING);
- Glib::signal_timeout().connect(sigc::ptr_fun(&on_timeout), 0);
- mainloop->run();
+ pipeline->set_state(Gst::STATE_PLAYING);
+ Glib::signal_timeout().connect(sigc::ptr_fun(&on_timeout), 0);
+ mainloop->run();
- pipeline->set_state(Gst::STATE_NULL);
+ pipeline->set_state(Gst::STATE_NULL);
- remove(input_filename.c_str());
+ remove(input_filename.c_str());
}
-
-
diff --git a/tests/regression/utils.cc b/tests/regression/utils.cc
index 95308dc..69c4986 100644
--- a/tests/regression/utils.cc
+++ b/tests/regression/utils.cc
@@ -19,18 +19,16 @@ RefPtr<Glib::MainLoop> utils_mainloop;
bool utils_on_bus_message(const RefPtr<Bus>&, const Glib::RefPtr<Message>& message)
{
- switch(message->get_message_type())
- {
- case Gst::MESSAGE_EOS:
- utils_mainloop->quit();
- return false;
- case Gst::MESSAGE_ERROR:
- {
- utils_mainloop->quit();
- return false;
- }
- default:
- break;
+ switch(message->get_message_type())
+ {
+ case Gst::MESSAGE_EOS:
+ utils_mainloop->quit();
+ return false;
+ case Gst::MESSAGE_ERROR:
+ utils_mainloop->quit();
+ return false;
+ default:
+ break;
}
return true;
@@ -38,43 +36,42 @@ 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> encoder = ElementFactory::create_element("theoraenc"),
- muxer = ElementFactory::create_element("oggmux");
- RefPtr<FileSink> sink = FileSink::create("fsink");
+ RefPtr<Pipeline> pipeline = Pipeline::create("create-ogg");
+ RefPtr<VideoTestSrc> source = VideoTestSrc::create("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("xvimagesink");
- Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
- bus->add_watch(sigc::ptr_fun(&utils_on_bus_message));
+ Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
+ bus->add_watch(sigc::ptr_fun(&utils_on_bus_message));
- utils_mainloop = Glib::MainLoop::create();
+ utils_mainloop = Glib::MainLoop::create();
- pipeline->add(source)->add(encoder)->add(muxer)->add(sink);
+ pipeline->add(source)->add(encoder)->add(muxer)->add(sink);
- source->property_num_buffers() = num_buffers;
- sink->property_location() = filename;
+ source->property_num_buffers() = num_buffers;
+ sink->property_location() = filename;
- muxer->link(sink);
- source->link(encoder);
- encoder->link(muxer);
+ muxer->link(sink);
+ source->link(encoder);
+ encoder->link(muxer);
- pipeline->set_state(Gst::STATE_PLAYING);
+ pipeline->set_state(Gst::STATE_PLAYING);
- utils_mainloop->run();
- pipeline->set_state(Gst::STATE_NULL);
+ utils_mainloop->run();
+ pipeline->set_state(Gst::STATE_NULL);
}
bool FilesEqual(const string& filename1, const string& filename2)
{
- std::ifstream f1(filename1, ios::binary),
- f2(filename2, ios::binary);
+ std::ifstream f1(filename1, ios::binary),
+ f2(filename2, ios::binary);
- string buf(istreambuf_iterator<char>(f1),
- (istreambuf_iterator<char>()));
+ string buf(istreambuf_iterator<char>(f1),
+ (istreambuf_iterator<char>()));
- return equal(buf.begin(), buf.end(),
+ return equal(buf.begin(), buf.end(),
string(istreambuf_iterator<char>(f2),
(istreambuf_iterator<char>())).begin());
}
-
diff --git a/tests/test-allocator.cc b/tests/test-allocator.cc
index bbff25b..e21adcc 100644
--- a/tests/test-allocator.cc
+++ b/tests/test-allocator.cc
@@ -45,33 +45,33 @@ TEST(AllocatorTest, ShouldCorrectAllocateMemory)
class DerivedFromAllocator : public Gst::Allocator
{
- Glib::RefPtr<Gst::Allocator> the_allocator;
+ Glib::RefPtr<Gst::Allocator> the_allocator;
public:
- explicit DerivedFromAllocator(GstAllocator *gobj)
- : Glib::ObjectBase(typeid (DerivedFromAllocator)),
- Gst::Allocator(gobj),
- the_allocator(Allocator::get_default_allocator())
- {
- }
-
- virtual Glib::RefPtr<Gst::Memory> alloc_vfunc(gsize size, AllocationParams params)
- {
- Glib::RefPtr<Gst::Memory> r = the_allocator->alloc(size, params);
- r->gobj()->allocator = gobj(); // pretend that it was us who allocated this memory
- return r;
- }
-
- void free_vfunc(Glib::RefPtr<Gst::Memory>&& memory) override
- {
- memory->gobj()->allocator = the_allocator->gobj(); // pretend that it was the_allocator who allocated
this memory
- the_allocator->free(std::move(memory));
- }
-
- static Glib::RefPtr<Allocator> create()
- {
- return Glib::RefPtr<Allocator>(new
DerivedFromAllocator((GstAllocator*)g_object_new(Allocator::get_type(), NULL)));
- }
+ explicit DerivedFromAllocator(GstAllocator *gobj)
+ : Glib::ObjectBase(typeid (DerivedFromAllocator)),
+ Gst::Allocator(gobj),
+ the_allocator(Allocator::get_default_allocator())
+ {
+ }
+
+ virtual Glib::RefPtr<Gst::Memory> alloc_vfunc(gsize size, AllocationParams params)
+ {
+ Glib::RefPtr<Gst::Memory> r = the_allocator->alloc(size, params);
+ r->gobj()->allocator = gobj(); // pretend that it was us who allocated this memory
+ return r;
+ }
+
+ void free_vfunc(Glib::RefPtr<Gst::Memory>&& memory) override
+ {
+ memory->gobj()->allocator = the_allocator->gobj(); // pretend that it was the_allocator who allocated
this memory
+ the_allocator->free(std::move(memory));
+ }
+
+ static Glib::RefPtr<Allocator> create()
+ {
+ return Glib::RefPtr<Allocator>(new
DerivedFromAllocator((GstAllocator*)g_object_new(Allocator::get_type(), NULL)));
+ }
};
TEST(AllocatorTest, DerivedFromAllocatorShouldReturnProperlyRefcountedWrappedGstMemory)
diff --git a/tests/test-atomicqueue.cc b/tests/test-atomicqueue.cc
index 48b8dcc..067658f 100644
--- a/tests/test-atomicqueue.cc
+++ b/tests/test-atomicqueue.cc
@@ -14,48 +14,48 @@ using Glib::RefPtr;
TEST(AtomicQueueTest, ShouldReturnFirstElementInQueueAndNotRemoveIt)
{
- RefPtr<AtomicQueue<int> > queue = AtomicQueue<int>::create(2);
- queue->push(12);
- queue->push(5);
- queue->push(9);
+ RefPtr<AtomicQueue<int> > queue = AtomicQueue<int>::create(2);
+ queue->push(12);
+ queue->push(5);
+ queue->push(9);
- ASSERT_EQ(12, queue->peek());
- ASSERT_EQ(3u, queue->length());
+ ASSERT_EQ(12, queue->peek());
+ ASSERT_EQ(3u, queue->length());
}
TEST(AtomicQueueTest, ShouldThrowExceptionOnPeekIfQueueIsEmpty)
{
- RefPtr<AtomicQueue<int> > queue = AtomicQueue<int>::create(2);
+ RefPtr<AtomicQueue<int> > queue = AtomicQueue<int>::create(2);
- EXPECT_THROW(queue->peek(), std::runtime_error);
+ EXPECT_THROW(queue->peek(), std::runtime_error);
}
TEST(AtomicQueueTest, ShouldReturnFirstElementAndRemoveIt)
{
- RefPtr<AtomicQueue<int> > queue = AtomicQueue<int>::create(2);
- queue->push(7);
- queue->push(14);
- queue->push(10);
+ RefPtr<AtomicQueue<int> > queue = AtomicQueue<int>::create(2);
+ queue->push(7);
+ queue->push(14);
+ queue->push(10);
- ASSERT_EQ(7, queue->pop());
- ASSERT_EQ(2u, queue->length());
+ ASSERT_EQ(7, queue->pop());
+ ASSERT_EQ(2u, queue->length());
}
TEST(AtomicQueueTest, ShouldImitateGstAtomicQueueStructByGpointerAsTemplate)
{
- RefPtr<AtomicQueue<gpointer> > queue = AtomicQueue<gpointer>::create(2);
- int* data = new int(5);
- GstElement* element = gst_element_factory_make("fakesrc", "dummy-name");
- queue->push(data);
- queue->push(element);
-
- int* new_data = static_cast<int*>(queue->pop());
- GstElement* new_element = static_cast<GstElement*>(queue->pop());
- ASSERT_EQ(*new_data, *data);
- ASSERT_TRUE(GST_IS_ELEMENT(element));
- ASSERT_EQ(new_element, element);
- EXPECT_STREQ("dummy-name", gst_element_get_name(new_element));
- delete new_data;
- ASSERT_EQ(1u, GST_OBJECT_REFCOUNT(element));
- gst_object_unref(element);
+ RefPtr<AtomicQueue<gpointer> > queue = AtomicQueue<gpointer>::create(2);
+ int* data = new int(5);
+ GstElement* element = gst_element_factory_make("fakesrc", "dummy-name");
+ queue->push(data);
+ queue->push(element);
+
+ int* new_data = static_cast<int*>(queue->pop());
+ GstElement* new_element = static_cast<GstElement*>(queue->pop());
+ ASSERT_EQ(*new_data, *data);
+ ASSERT_TRUE(GST_IS_ELEMENT(element));
+ ASSERT_EQ(new_element, element);
+ EXPECT_STREQ("dummy-name", gst_element_get_name(new_element));
+ delete new_data;
+ ASSERT_EQ(1u, GST_OBJECT_REFCOUNT(element));
+ gst_object_unref(element);
}
diff --git a/tests/test-buffer.cc b/tests/test-buffer.cc
index bc946a1..9dcbac7 100644
--- a/tests/test-buffer.cc
+++ b/tests/test-buffer.cc
@@ -2,7 +2,7 @@
* test-buffer.cc
*
* Created on: Jul 31, 2013
- * Author: m.kolny
+ * Author: m.kolny
*/
#include <gtest/gtest.h>
@@ -13,25 +13,25 @@ using namespace Gst;
TEST(BufferTest, CheckBufferSize)
{
- gsize buff_size = 23;
- Glib::RefPtr<Buffer> buf = Buffer::create(buff_size);
- Glib::RefPtr<MapInfo> map_info(new MapInfo());
+ gsize buff_size = 23;
+ Glib::RefPtr<Buffer> buf = Buffer::create(buff_size);
+ Glib::RefPtr<MapInfo> map_info(new MapInfo());
- buf->map(map_info, MAP_READ);
+ buf->map(map_info, MAP_READ);
- EXPECT_EQ(buff_size, map_info->get_size());
+ EXPECT_EQ(buff_size, map_info->get_size());
- buf->unmap(map_info);
+ buf->unmap(map_info);
}
TEST(BufferTest, CheckBufferFlags)
{
- guint buff_flags = 1;
- Glib::RefPtr<Buffer> buf = Buffer::create();
+ guint buff_flags = 1;
+ Glib::RefPtr<Buffer> buf = Buffer::create();
- buf->set_flags(buff_flags);
+ buf->set_flags(buff_flags);
- EXPECT_EQ(buff_flags, buf->get_flags());
+ EXPECT_EQ(buff_flags, buf->get_flags());
}
TEST(BufferTest, PeekedMemoryShouldExistsEvenWhenBufferWillBeDestroyed)
@@ -56,7 +56,7 @@ TEST(BufferTest, ShouldInsertMemoryObjectAndResetItButAllowToMakeExplicityRef)
buf->insert_memory(0, std::move(mem));
ASSERT_FALSE(mem);
ASSERT_EQ(2, mem2->gobj()->mini_object.refcount); // two - one handled by mem2,
- //and the second by memory stored in buffer
+ //and the second by memory stored in buffer
}
TEST(BufferTest, ShouldGetMemoryRangeAndIncreaseRefcount)
@@ -126,7 +126,7 @@ TEST(BufferTest, CheckRefcountAppendBufferToBuffer)
{ // buf1 not writable
Glib::RefPtr<Gst::Buffer> buf2 = Gst::Buffer::create(6);
- Glib::RefPtr<Gst::Buffer> dummy = buf1;
+ Glib::RefPtr<Gst::Buffer> dummy = buf1;
Glib::RefPtr<Gst::Buffer> b = buf1->append(std::move(buf2));
ASSERT_FALSE(buf2);
ASSERT_EQ(2, buf1->get_refcount()); // dummy + buf1
diff --git a/tests/test-bus.cc b/tests/test-bus.cc
index 0ae919e..712d34b 100644
--- a/tests/test-bus.cc
+++ b/tests/test-bus.cc
@@ -2,7 +2,7 @@
* test-bus.cc
*
* Created on: Aug 1, 2013
- * Author: m.kolny
+ * Author: m.kolny
*/
#include <gtest/gtest.h>
@@ -13,51 +13,51 @@ using namespace Gst;
class BusTest : public ::testing::Test
{
protected:
- Glib::RefPtr<Bus> bus;
- Glib::RefPtr<Message> message;
-
- void PostMessage()
- {
- bool message_posted = bus->post(MessageEos::create(Glib::RefPtr<Object>()));
- ASSERT_TRUE(message_posted);
- }
-
- void CheckPending(bool expected = true)
- {
- bool have_pending = bus->have_pending();
- EXPECT_EQ(expected, have_pending);
- }
+ Glib::RefPtr<Bus> bus;
+ Glib::RefPtr<Message> message;
+
+ void PostMessage()
+ {
+ bool message_posted = bus->post(MessageEos::create(Glib::RefPtr<Object>()));
+ ASSERT_TRUE(message_posted);
+ }
+
+ void CheckPending(bool expected = true)
+ {
+ bool have_pending = bus->have_pending();
+ EXPECT_EQ(expected, have_pending);
+ }
};
TEST_F(BusTest, CorrectCreateBus)
{
- bus = Bus::create();
+ bus = Bus::create();
- ASSERT_TRUE(bus);
+ ASSERT_TRUE(bus);
}
TEST_F(BusTest, PostMessageAndPeekIt)
{
- bus = Bus::create();
+ bus = Bus::create();
- PostMessage();
- CheckPending();
+ PostMessage();
+ CheckPending();
- Glib::RefPtr<Message> msg = bus->peek();
+ Glib::RefPtr<Message> msg = bus->peek();
- ASSERT_TRUE(msg);
+ ASSERT_TRUE(msg);
}
TEST_F(BusTest, PostMessageAndPopIt)
{
- bus = Bus::create();
+ bus = Bus::create();
- PostMessage();
- CheckPending();
+ PostMessage();
+ CheckPending();
- Glib::RefPtr<Message> msg = bus->pop();
+ Glib::RefPtr<Message> msg = bus->pop();
- ASSERT_TRUE(msg);
+ ASSERT_TRUE(msg);
- CheckPending(false);
+ CheckPending(false);
}
diff --git a/tests/test-caps.cc b/tests/test-caps.cc
index 873c8b2..388e34e 100644
--- a/tests/test-caps.cc
+++ b/tests/test-caps.cc
@@ -2,7 +2,7 @@
* test-caps.cc
*
* Created on: Aug 1, 2013
- * Author: m.kolny
+ * Author: m.kolny
*/
#include <gtest/gtest.h>
@@ -13,31 +13,31 @@ using namespace Gst;
class CapsTest : public ::testing::Test
{
protected:
- Glib::RefPtr<Caps> caps;
-
- static int width;
- static Fraction framerate;
-
- template<typename T>
- void MakeAssert(const T& expected, const T& output)
- {
- EXPECT_EQ(expected, output);
- }
- void MakeAssert(const Fraction& expected, const Fraction& output)
- {
- EXPECT_EQ(expected.denom, output.denom);
- EXPECT_EQ(expected.num, output.num);
- }
-
- template<typename T>
- void CheckCaps(const Glib::ustring& field_name, T expected, int struct_id = 0)
- {
- T output;
- bool ok = caps->get_structure(struct_id).get_field(field_name, output);
-
- ASSERT_TRUE(ok);
- MakeAssert(expected, output);
- }
+ Glib::RefPtr<Caps> caps;
+
+ static int width;
+ static Fraction framerate;
+
+ template<typename T>
+ void MakeAssert(const T& expected, const T& output)
+ {
+ EXPECT_EQ(expected, output);
+ }
+ void MakeAssert(const Fraction& expected, const Fraction& output)
+ {
+ EXPECT_EQ(expected.denom, output.denom);
+ EXPECT_EQ(expected.num, output.num);
+ }
+
+ template<typename T>
+ void CheckCaps(const Glib::ustring& field_name, T expected, int struct_id = 0)
+ {
+ T output;
+ bool ok = caps->get_structure(struct_id).get_field(field_name, output);
+
+ ASSERT_TRUE(ok);
+ MakeAssert(expected, output);
+ }
};
int CapsTest::width = 500;
@@ -45,92 +45,92 @@ Fraction CapsTest::framerate = Fraction(25, 1);
TEST_F(CapsTest, CapsCreateSimple)
{
- caps = Caps::create_simple("video/x-raw");
+ caps = Caps::create_simple("video/x-raw");
- ASSERT_TRUE(caps);
+ ASSERT_TRUE(caps);
}
TEST_F(CapsTest, CapsCreateUsingStructure)
{
- Structure caps_struct("test-struct");
- caps_struct.set_field("width", width);
- caps_struct.set_field("framerate", framerate);
+ Structure caps_struct("test-struct");
+ caps_struct.set_field("width", width);
+ caps_struct.set_field("framerate", framerate);
- caps = Caps::create(caps_struct);
+ caps = Caps::create(caps_struct);
- CheckCaps("width", width);
- CheckCaps("framerate", framerate);
+ CheckCaps("width", width);
+ CheckCaps("framerate", framerate);
}
TEST_F(CapsTest, AppendStructureToCaps)
{
- caps = Caps::create_simple("video/x-raw");
+ caps = Caps::create_simple("video/x-raw");
- Structure caps_struct("test-struct");
- caps_struct.set_field("width", width);
+ Structure caps_struct("test-struct");
+ caps_struct.set_field("width", width);
- caps->set_simple("framerate", framerate);
- caps->append_structure(caps_struct);
+ caps->set_simple("framerate", framerate);
+ caps->append_structure(caps_struct);
- CheckCaps("width", width, 1);
- CheckCaps("framerate", framerate);
+ CheckCaps("width", width, 1);
+ CheckCaps("framerate", framerate);
}
TEST_F(CapsTest, AppendCapsToCaps)
{
- caps = Caps::create_simple("video/x-raw");
- caps->set_simple("framerate", framerate);
+ caps = Caps::create_simple("video/x-raw");
+ caps->set_simple("framerate", framerate);
- Glib::RefPtr<Caps> new_caps = Caps::create_simple("video/x-raw");
- new_caps->set_simple("width", width);
+ Glib::RefPtr<Caps> new_caps = Caps::create_simple("video/x-raw");
+ new_caps->set_simple("width", width);
- caps->append(std::move(new_caps));
+ caps->append(std::move(new_caps));
- CheckCaps("width", width, 1);
- CheckCaps("framerate", framerate);
- ASSERT_FALSE(new_caps);
+ CheckCaps("width", width, 1);
+ CheckCaps("framerate", framerate);
+ ASSERT_FALSE(new_caps);
}
TEST_F(CapsTest, GetNonExistingValue)
{
- caps = Caps::create_simple("video/x-raw");
+ caps = Caps::create_simple("video/x-raw");
- int output;
- bool ok = caps->get_structure(0).get_field("nonexisting-value", output);
+ int output;
+ bool ok = caps->get_structure(0).get_field("nonexisting-value", output);
- ASSERT_FALSE(ok);
+ ASSERT_FALSE(ok);
}
TEST_F(CapsTest, SetCapsToElement)
{
- Glib::RefPtr<Element> element = ElementFactory::create_element("capsfilter", "filter");
+ Glib::RefPtr<Element> element = ElementFactory::create_element("capsfilter", "filter");
- const char* str_caps = "image/jpeg, framerate=(fraction)2/1";
+ const char* str_caps = "image/jpeg, framerate=(fraction)2/1";
- element->set_property("caps", Caps::create_from_string(str_caps));
- element->get_property("caps", caps);
+ element->set_property("caps", Caps::create_from_string(str_caps));
+ element->get_property("caps", caps);
- ASSERT_STREQ(str_caps, caps->to_string().c_str());
+ ASSERT_STREQ(str_caps, caps->to_string().c_str());
}
TEST_F(CapsTest, MergeCaps)
{
- Glib::RefPtr<Caps> tmp = Caps::create_from_string("video/x-raw, format=RGBA");
- Glib::RefPtr<Caps> tmp2 = Caps::create_from_string("video/x-raw, format=RGB");
- tmp = tmp->merge(std::move(tmp2));
- ASSERT_EQ(1, tmp->get_refcount());
- ASSERT_FALSE(tmp2);
+ Glib::RefPtr<Caps> tmp = Caps::create_from_string("video/x-raw, format=RGBA");
+ Glib::RefPtr<Caps> tmp2 = Caps::create_from_string("video/x-raw, format=RGB");
+ tmp = tmp->merge(std::move(tmp2));
+ ASSERT_EQ(1, tmp->get_refcount());
+ ASSERT_FALSE(tmp2);
}
TEST_F(CapsTest, CapsBoxedType)
{
- Glib::RefPtr<Gst::CapsFilter> filter = Gst::CapsFilter::create();
- 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;
- ASSERT_EQ(2, any_caps->get_refcount());
- filter->property_caps() = any_caps2;
- ASSERT_EQ(1, any_caps->get_refcount());
- ASSERT_EQ(2, any_caps2->get_refcount());
+ Glib::RefPtr<Gst::CapsFilter> filter = Gst::CapsFilter::create();
+ 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;
+ ASSERT_EQ(2, any_caps->get_refcount());
+ filter->property_caps() = any_caps2;
+ ASSERT_EQ(1, any_caps->get_refcount());
+ ASSERT_EQ(2, any_caps2->get_refcount());
}
diff --git a/tests/test-capsfeatures.cc b/tests/test-capsfeatures.cc
index 0e06c73..ac8af40 100644
--- a/tests/test-capsfeatures.cc
+++ b/tests/test-capsfeatures.cc
@@ -12,17 +12,17 @@ using namespace Gst;
TEST(CapsFeaturesTest, ShouldCorrectCreateEmptyFeature)
{
- CapsFeatures features;
- ASSERT_EQ(0u, features.get_size());
+ CapsFeatures features;
+ ASSERT_EQ(0u, features.get_size());
}
TEST(CapsFeaturesTest, AddRemoveFeaturesShouldWorkProperly)
{
- CapsFeatures features (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
- ASSERT_EQ(1u, features.get_size());
- ASSERT_STREQ(GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY, features.get_nth(0).c_str());
- features.remove(GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
- ASSERT_EQ(0u, features.get_size());
+ CapsFeatures features (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
+ ASSERT_EQ(1u, features.get_size());
+ ASSERT_STREQ(GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY, features.get_nth(0).c_str());
+ features.remove(GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
+ ASSERT_EQ(0u, features.get_size());
}
diff --git a/tests/test-ghostpad.cc b/tests/test-ghostpad.cc
index 930798b..12315c5 100644
--- a/tests/test-ghostpad.cc
+++ b/tests/test-ghostpad.cc
@@ -2,7 +2,7 @@
* test-ghostpad.cc
*
* Created on: Aug 5, 2013
- * Author: m.kolny
+ * Author: m.kolny
*/
#include <gtest/gtest.h>
@@ -13,23 +13,23 @@ using Glib::RefPtr;
TEST(GhostPadTest, CreatingGhostPad)
{
- Glib::ustring pad_name = "sample_name";
- PadDirection direction = PAD_SINK;
- RefPtr<GhostPad> ghost_pad = GhostPad::create(direction, pad_name);
+ Glib::ustring pad_name = "sample_name";
+ PadDirection direction = PAD_SINK;
+ RefPtr<GhostPad> ghost_pad = GhostPad::create(direction, pad_name);
- ASSERT_TRUE(ghost_pad);
- ASSERT_EQ(direction, ghost_pad->get_direction());
- ASSERT_STREQ(pad_name.c_str(), ghost_pad->get_name().c_str());
+ ASSERT_TRUE(ghost_pad);
+ ASSERT_EQ(direction, ghost_pad->get_direction());
+ ASSERT_STREQ(pad_name.c_str(), ghost_pad->get_name().c_str());
}
TEST(GhostPadTest, CreatingGhostPadFromTemplate)
{
- PadDirection direction = PAD_SRC;
- RefPtr<Caps> caps = Caps::create_simple("video/x-raw-yuv");
- RefPtr<PadTemplate> templ = PadTemplate::create("pad-template", direction, PAD_ALWAYS, caps);
+ PadDirection direction = PAD_SRC;
+ RefPtr<Caps> caps = Caps::create_simple("video/x-raw-yuv");
+ RefPtr<PadTemplate> templ = PadTemplate::create("pad-template", direction, PAD_ALWAYS, caps);
- RefPtr<GhostPad> ghost_pad = GhostPad::create(templ);
+ RefPtr<GhostPad> ghost_pad = GhostPad::create(templ);
- ASSERT_TRUE(ghost_pad);
- ASSERT_EQ(direction, ghost_pad->get_direction());
+ ASSERT_TRUE(ghost_pad);
+ ASSERT_EQ(direction, ghost_pad->get_direction());
}
diff --git a/tests/test-pad.cc b/tests/test-pad.cc
index a473fd3..53635fb 100644
--- a/tests/test-pad.cc
+++ b/tests/test-pad.cc
@@ -2,7 +2,7 @@
* test-pad.cc
*
* Created on: Aug 1, 2013
- * Author: m.kolny
+ * Author: m.kolny
*/
#include <gtest/gtest.h>
@@ -13,17 +13,17 @@ using namespace Gst;
class PadTest : public ::testing::Test
{
protected:
- Glib::RefPtr<Pad> pad;
+ Glib::RefPtr<Pad> pad;
- static Glib::ustring pad_name;
- static PadDirection pad_direction;
+ static Glib::ustring pad_name;
+ static PadDirection pad_direction;
- void CheckPad()
- {
- ASSERT_TRUE(pad);
- EXPECT_EQ(pad_direction, pad->get_direction());
- ASSERT_STREQ(pad_name.c_str(), pad->get_name().c_str());
- }
+ void CheckPad()
+ {
+ ASSERT_TRUE(pad);
+ EXPECT_EQ(pad_direction, pad->get_direction());
+ ASSERT_STREQ(pad_name.c_str(), pad->get_name().c_str());
+ }
};
PadDirection PadTest::pad_direction = PAD_SINK;
@@ -31,33 +31,33 @@ Glib::ustring PadTest::pad_name = "simple-pad";
TEST_F(PadTest, PadCorrectCreatedUsingPadDirection)
{
- pad = Pad::create(pad_name, pad_direction);
+ pad = Pad::create(pad_name, pad_direction);
- CheckPad();
+ CheckPad();
}
TEST_F(PadTest, PadCorrectCreatedUsingTemplate)
{
- Glib::RefPtr<Gst::Caps> caps = Gst::Caps::create_simple("video/x-raw");
- caps->set_simple("width", 500);
- caps->set_simple("framerate", Gst::Fraction(25, 1));
+ Glib::RefPtr<Gst::Caps> caps = Gst::Caps::create_simple("video/x-raw");
+ caps->set_simple("width", 500);
+ caps->set_simple("framerate", Gst::Fraction(25, 1));
- Glib::RefPtr<PadTemplate> pad_tpl = PadTemplate::create("source-template", pad_direction, PAD_ALWAYS,
caps);
+ Glib::RefPtr<PadTemplate> pad_tpl = PadTemplate::create("source-template", pad_direction, PAD_ALWAYS,
caps);
- pad = Pad::create(pad_tpl, pad_name);
+ pad = Pad::create(pad_tpl, pad_name);
- CheckPad();
+ CheckPad();
}
TEST_F(PadTest, PadVerifyGetPadTemplateCaps)
{
- Glib::RefPtr<Gst::Caps> caps;
- {
- Glib::RefPtr<PadTemplate> pad_tpl =
- PadTemplate::create("source-template", pad_direction, PAD_ALWAYS, Caps::create_any());
- caps = Pad::create(pad_tpl, pad_name)->get_pad_template_caps();
- }
- ASSERT_EQ(1, caps->get_refcount());
+ Glib::RefPtr<Gst::Caps> caps;
+ {
+ Glib::RefPtr<PadTemplate> pad_tpl =
+ PadTemplate::create("source-template", pad_direction, PAD_ALWAYS, Caps::create_any());
+ caps = Pad::create(pad_tpl, pad_name)->get_pad_template_caps();
+ }
+ ASSERT_EQ(1, caps->get_refcount());
}
TEST_F(PadTest, PadPushVerifyBufferRefcount)
diff --git a/tests/test-query.cc b/tests/test-query.cc
index 63e9aa7..54ac647 100644
--- a/tests/test-query.cc
+++ b/tests/test-query.cc
@@ -2,7 +2,7 @@
* test-query.cc
*
* Created on: 5 sie 2013
- * Author: loganek
+ * Author: loganek
*/
#include <gtest/gtest.h>
@@ -15,47 +15,47 @@ using Glib::RefPtr;
template<typename QType>
void CreatingQueryTest(std::function<RefPtr<QType>()> create_method, QueryType type)
{
- RefPtr<QType> query = create_method();
+ RefPtr<QType> query = create_method();
- ASSERT_TRUE(query);
- ASSERT_EQ(type, query->get_query_type());
+ ASSERT_TRUE(query);
+ ASSERT_EQ(type, query->get_query_type());
}
template<typename QType>
void CreatingQueryTestStatic(std::function<RefPtr<Query>()> create_method, QueryType type)
{
- RefPtr<Query> query = create_method();
+ RefPtr<Query> query = create_method();
- ASSERT_TRUE(query);
- ASSERT_EQ(type, query->get_query_type());
+ ASSERT_TRUE(query);
+ ASSERT_EQ(type, query->get_query_type());
- RefPtr<QType> query_position = RefPtr<QType>::cast_static(query);
+ RefPtr<QType> query_position = RefPtr<QType>::cast_static(query);
- ASSERT_TRUE(query_position);
+ ASSERT_TRUE(query_position);
}
TEST(QueryTest, CorrectCreatingQueryBuffering)
{
- CreatingQueryTestStatic<QueryBuffering>(
- std::bind(&Query::create_buffering, FORMAT_BUFFERS), QUERY_BUFFERING);
- CreatingQueryTest<QueryBuffering>(
- std::bind(&QueryBuffering::create, FORMAT_BUFFERS), QUERY_BUFFERING);
+ CreatingQueryTestStatic<QueryBuffering>(
+ std::bind(&Query::create_buffering, FORMAT_BUFFERS), QUERY_BUFFERING);
+ CreatingQueryTest<QueryBuffering>(
+ std::bind(&QueryBuffering::create, FORMAT_BUFFERS), QUERY_BUFFERING);
}
TEST(QueryTest, CorrectCreatingQueryPosition)
{
- CreatingQueryTestStatic<QueryPosition>(
- std::bind(&Query::create_position, FORMAT_PERCENT), QUERY_POSITION);
- CreatingQueryTest<QueryPosition>(
- std::bind(&QueryPosition::create, FORMAT_PERCENT), QUERY_POSITION);
+ CreatingQueryTestStatic<QueryPosition>(
+ std::bind(&Query::create_position, FORMAT_PERCENT), QUERY_POSITION);
+ CreatingQueryTest<QueryPosition>(
+ std::bind(&QueryPosition::create, FORMAT_PERCENT), QUERY_POSITION);
}
TEST(QueryTest, CorrectCreatingQueryConvert)
{
- CreatingQueryTestStatic<QueryConvert>(
- std::bind(&Query::create_convert, FORMAT_PERCENT, 10, FORMAT_BYTES), QUERY_CONVERT);
- CreatingQueryTest<QueryConvert>(
- std::bind(&QueryConvert::create, FORMAT_PERCENT, 10, FORMAT_BYTES), QUERY_CONVERT);
+ CreatingQueryTestStatic<QueryConvert>(
+ std::bind(&Query::create_convert, FORMAT_PERCENT, 10, FORMAT_BYTES), QUERY_CONVERT);
+ CreatingQueryTest<QueryConvert>(
+ std::bind(&QueryConvert::create, FORMAT_PERCENT, 10, FORMAT_BYTES), QUERY_CONVERT);
}
TEST(QueryTest, CheckRefCountsDuringQueryCapsCreation)
@@ -79,5 +79,3 @@ TEST(QueryTest, CheckStoringAllocationParams)
ASSERT_EQ(allocator, allocator2);
ASSERT_EQ(params.get_align(), params2.get_align());
}
-
-
diff --git a/tests/test-structure.cc b/tests/test-structure.cc
index 7a113c5..4cacd80 100644
--- a/tests/test-structure.cc
+++ b/tests/test-structure.cc
@@ -2,7 +2,7 @@
* test-structure.cc
*
* Created on: 1 sie 2013
- * Author: loganek
+ * Author: loganek
*/
@@ -14,84 +14,84 @@ using namespace Gst;
template<typename T>
void CheckEq(const T& expected, const T& output)
{
- EXPECT_EQ(expected, output);
+ EXPECT_EQ(expected, output);
}
template<>
void CheckEq(const Fraction& expected, const Fraction& output)
{
- EXPECT_EQ(expected.denom, output.denom);
- EXPECT_EQ(expected.num, output.num);
+ EXPECT_EQ(expected.denom, output.denom);
+ EXPECT_EQ(expected.num, output.num);
}
template<>
void CheckEq(const FractionRange& expected, const FractionRange& output)
{
- CheckEq(expected.min, output.min);
- CheckEq(expected.max, output.max);
+ CheckEq(expected.min, output.min);
+ CheckEq(expected.max, output.max);
}
template<>
void CheckEq(const Glib::DateTime& expected, const Glib::DateTime& output)
{
- CheckEq(expected.get_year(), output.get_year());
- CheckEq(expected.get_second(), output.get_second());
+ CheckEq(expected.get_year(), output.get_year());
+ CheckEq(expected.get_second(), output.get_second());
}
class StructureTest : public ::testing::Test
{
protected:
- Structure structure;
+ Structure structure;
- virtual void SetUp()
- {
- structure = Structure("test-struct");
- }
+ virtual void SetUp()
+ {
+ structure = Structure("test-struct");
+ }
- template<typename T>
- void CheckGetSetField(const T& expected, const Glib::ustring& field_name)
- {
- structure.set_field(field_name, expected);
+ template<typename T>
+ void CheckGetSetField(const T& expected, const Glib::ustring& field_name)
+ {
+ structure.set_field(field_name, expected);
- T output;
- structure.get_field(field_name, output);
+ T output;
+ structure.get_field(field_name, output);
- CheckEq(expected, output);
- }
+ CheckEq(expected, output);
+ }
};
TEST_F(StructureTest, GetSetStringVariable)
{
- CheckGetSetField<std::string>("this is simple test", "string");
+ CheckGetSetField<std::string>("this is simple test", "string");
}
TEST_F(StructureTest, GetSetIntegerVariable)
{
- CheckGetSetField(1234, "integer");
+ CheckGetSetField(1234, "integer");
}
TEST_F(StructureTest, GetSetFractionVariable)
{
- CheckGetSetField(Fraction(5,6), "fraction");
+ CheckGetSetField(Fraction(5,6), "fraction");
}
TEST_F(StructureTest, GetSetFractionRangeVariable)
{
- CheckGetSetField(FractionRange(Fraction(5,6), Gst::Fraction(13,14)), "fraction_range");
+ CheckGetSetField(FractionRange(Fraction(5,6), Gst::Fraction(13,14)), "fraction_range");
}
TEST_F(StructureTest, GetSetDateVariable)
{
- CheckGetSetField(Glib::Date(10, Glib::Date::DECEMBER, 1991), "date");
+ CheckGetSetField(Glib::Date(10, Glib::Date::DECEMBER, 1991), "date");
}
TEST_F(StructureTest, GetSetEnumVariable)
{
- State input_state = STATE_PAUSED;
- structure.set_field("state", Glib::Value<State>::value_type(), input_state);
+ State input_state = STATE_PAUSED;
+ structure.set_field("state", Glib::Value<State>::value_type(), input_state);
- int output_state;
- structure.get_field("state", Glib::Value<State>::value_type(), output_state);
+ int output_state;
+ structure.get_field("state", Glib::Value<State>::value_type(), output_state);
- EXPECT_EQ(input_state, (State)output_state);
+ EXPECT_EQ(input_state, (State)output_state);
}
diff --git a/tests/test-taglist.cc b/tests/test-taglist.cc
index 7b00b0a..f076c67 100644
--- a/tests/test-taglist.cc
+++ b/tests/test-taglist.cc
@@ -2,7 +2,7 @@
* test-taglist.cc
*
* Created on: Jul 31, 2013
- * Author: m.kolny
+ * Author: m.kolny
*/
#include <gtest/gtest.h>
@@ -13,24 +13,24 @@ using namespace Gst;
class TagListTest : public ::testing::Test
{
protected:
- TagList tag_list;
+ TagList tag_list;
- static Glib::ustring song_title;
- static Glib::ustring song_artist;
- static guint64 song_duration;
- static Glib::Date song_date;
+ static Glib::ustring song_title;
+ static Glib::ustring song_artist;
+ static guint64 song_duration;
+ static Glib::Date song_date;
- template<typename Ty>
- Ty ValidateTag(Tag tag)
- {
- Ty output = {};
+ template<typename Ty>
+ Ty ValidateTag(Tag tag)
+ {
+ Ty output = {};
- bool ok = tag_list.get(tag, output);
+ bool ok = tag_list.get(tag, output);
- EXPECT_EQ(true, ok);
+ EXPECT_EQ(true, ok);
- return output;
- }
+ return output;
+ }
};
Glib::ustring TagListTest::song_title = "Funky Song";
@@ -41,45 +41,44 @@ Glib::Date TagListTest::song_date = Glib::Date(28, Glib::Date::DECEMBER, 1991);
TEST_F(TagListTest, GetTagTitleFromList)
{
- tag_list.add(TAG_TITLE, song_title);
+ tag_list.add(TAG_TITLE, song_title);
- Glib::ustring out_title = ValidateTag<Glib::ustring>(TAG_TITLE);
- ASSERT_STREQ(song_title.c_str(), out_title.c_str());
+ Glib::ustring out_title = ValidateTag<Glib::ustring>(TAG_TITLE);
+ ASSERT_STREQ(song_title.c_str(), out_title.c_str());
}
TEST_F(TagListTest, GetTagArtistFromList)
{
- tag_list.add(TAG_ARTIST, song_artist);
+ tag_list.add(TAG_ARTIST, song_artist);
- Glib::ustring out_artist = ValidateTag<Glib::ustring>(TAG_ARTIST);
- ASSERT_STREQ(song_artist.c_str(), out_artist.c_str());
+ Glib::ustring out_artist = ValidateTag<Glib::ustring>(TAG_ARTIST);
+ ASSERT_STREQ(song_artist.c_str(), out_artist.c_str());
}
TEST_F(TagListTest, DISABLED_GetTagDurationFromList)
{
- tag_list.add(TAG_DURATION, song_duration);
+ tag_list.add(TAG_DURATION, song_duration);
- guint64 out_duration = ValidateTag<guint64>(TAG_DURATION);
- EXPECT_EQ(song_duration, out_duration);
+ guint64 out_duration = ValidateTag<guint64>(TAG_DURATION);
+ EXPECT_EQ(song_duration, out_duration);
}
TEST_F(TagListTest, DISABLED_GetTagDateFromList)
{
- tag_list.add(TAG_DATE, song_date);
+ tag_list.add(TAG_DATE, song_date);
- Glib::Date out_date = ValidateTag<Glib::Date>(TAG_DATE);
+ Glib::Date out_date = ValidateTag<Glib::Date>(TAG_DATE);
- EXPECT_EQ(song_date.get_day(), out_date.get_day());
- EXPECT_EQ(song_date.get_year(), out_date.get_year());
- EXPECT_EQ(song_date.get_month(), out_date.get_month());
+ EXPECT_EQ(song_date.get_day(), out_date.get_day());
+ EXPECT_EQ(song_date.get_year(), out_date.get_year());
+ EXPECT_EQ(song_date.get_month(), out_date.get_month());
}
TEST_F(TagListTest, GetNonExistingTag)
{
- Glib::ustring album;
+ Glib::ustring album;
- bool album_exists = tag_list.get(TAG_ALBUM, album);
-
- ASSERT_FALSE(album_exists);
+ bool album_exists = tag_list.get(TAG_ALBUM, album);
+ ASSERT_FALSE(album_exists);
}
diff --git a/tests/test-urihandler.cc b/tests/test-urihandler.cc
index 283949b..717ab09 100644
--- a/tests/test-urihandler.cc
+++ b/tests/test-urihandler.cc
@@ -12,63 +12,62 @@ using namespace Gst;
class UriTestElement: public URIHandler, public Gst::Element {
public:
- typedef Gst::Element::BaseClassType BaseClassType;
- typedef Gst::Element::BaseObjectType BaseObjectType;
- typedef Gst::Element::CppClassType CppClassType;
+ typedef Gst::Element::BaseClassType BaseClassType;
+ typedef Gst::Element::BaseObjectType BaseObjectType;
+ typedef Gst::Element::CppClassType CppClassType;
public:
- static GType get_base_type() G_GNUC_CONST
- {
- return Element::get_base_type();
- }
+ static GType get_base_type() G_GNUC_CONST
+ {
+ return Element::get_base_type();
+ }
- static void base_init(Gst::ElementClass<UriTestElement> *klass)
- {
- klass->set_metadata("uri_longname", "uri_classification",
- "uri_detail_description", "uri_detail_author");
- }
+ static void base_init(Gst::ElementClass<UriTestElement> *klass)
+ {
+ klass->set_metadata("uri_longname", "uri_classification",
+ "uri_detail_description", "uri_detail_author");
+ }
- explicit UriTestElement(GstElement *gobj) :
- Glib::ObjectBase(typeid(UriTestElement)),
- Gst::Element(gobj)
- {
- }
+ explicit UriTestElement(GstElement *gobj)
+ : Glib::ObjectBase(typeid(UriTestElement)),
+ Gst::Element(gobj)
+ {
+ }
- bool set_uri_vfunc(const Glib::ustring& /* uri */, GError** /* error */)
- {
- return true;
- }
+ bool set_uri_vfunc(const Glib::ustring& /* uri */, GError** /* error */)
+ {
+ return true;
+ }
- const gchar * const * get_protocols_vfunc() const
- {
- static const gchar* vect[] = { "dummyprotocol", NULL };
+ const gchar * const * get_protocols_vfunc() const
+ {
+ static const gchar* vect[] = { "dummyprotocol", NULL };
- return vect;
- }
+ return vect;
+ }
- URIType get_type_vfunc() override
- {
- return URI_SINK;
- }
+ URIType get_type_vfunc() override
+ {
+ return URI_SINK;
+ }
- static bool register_uritestelement(Glib::RefPtr<Gst::Plugin> plugin)
- {
- auto t = Gst::register_mm_type<UriTestElement>("uritestelement");
- add_interface(t);
+ static bool register_uritestelement(Glib::RefPtr<Gst::Plugin> plugin)
+ {
+ auto t = Gst::register_mm_type<UriTestElement>("uritestelement");
+ add_interface(t);
- return Gst::ElementFactory::register_element(plugin, "uritestelement",
- 10, t);
- }
+ return Gst::ElementFactory::register_element(plugin, "uritestelement", 10, t);
+ }
};
TEST(URIHandlerTest, CheckURIType)
{
- Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "uritestelement", "uritestelement is
example of C++ element",
- sigc::ptr_fun(&UriTestElement::register_uritestelement), "0.123", "LGPL", "source?",
"package?",
- "http://example.com");
+ Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "uritestelement", "uritestelement is example
of C++ element",
+ sigc::ptr_fun(&UriTestElement::register_uritestelement), "0.123", "LGPL", "source?", "package?",
+ "http://example.com");
- Glib::ustring factory_name =
- URIHandler::make_element_from_uri(URI_SINK, "dummyprotocol:some/path",
"dummy_name")->get_factory()->get_name();
+ Glib::ustring factory_name =
+ URIHandler::make_element_from_uri(URI_SINK, "dummyprotocol:some/path",
"dummy_name")->get_factory()->get_name();
- ASSERT_STREQ("uritestelement", factory_name.c_str());
+ ASSERT_STREQ("uritestelement", factory_name.c_str());
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]