Re: gstmm add element to pipeline test
- From: José Alburquerque <jaalburquerque cox net>
- To: Murray Cumming <murrayc murrayc com>
- Cc: gtkmm-list gnome org
- Subject: Re: gstmm add element to pipeline test
- Date: Fri, 30 Nov 2007 12:20:01 -0500
José Alburquerque wrote:
I'm not able to check this patch in (if it's good).
-Jose
I thought I should also include a test to link several elements so if
you check this in, would you use this new patch instead? Thanks.
-Jose
Index: ChangeLog
===================================================================
--- ChangeLog (revision 89)
+++ ChangeLog (working copy)
@@ -1,3 +1,15 @@
+2007-11-30 José Alburquerque <jaalburquerque cox net>
+
+ * gst/gstmm.h: added <gstmm/pipeline.h>
+ * gst/src/bin.ccg: removed 2nd arg from Glib::wrap in
+ Gst::Bin::create()
+ * gst/src/pipeline.ccg: removed 2nd arg from Glib::wrap in
+ Gst::Pipeline::create() and fixed Gst:Pipeline::add() unref error
+ * tests/Makefile.am: added test to add element to pipeline and one to
+ link several elements
+ * tests/test-link-elements.cc:
+ * tests/test-pipeline-add-element.cc:
+
2007-11-28 Siavash Safi <siavash safi gmail com>
* gst/src/element.hg: seek_simple(), seek()
Index: gst/src/pipeline.ccg
===================================================================
--- gst/src/pipeline.ccg (revision 89)
+++ gst/src/pipeline.ccg (working copy)
@@ -6,7 +6,7 @@
Glib::RefPtr<Pipeline> Pipeline::create(const std::string& name)
{
GstElement* pipeline = gst_pipeline_new(name.c_str());
- return Glib::wrap((GstPipeline*) pipeline, false);
+ return Glib::wrap((GstPipeline*) pipeline);
}
} //namespace Gst
Index: gst/src/bin.ccg
===================================================================
--- gst/src/bin.ccg (revision 89)
+++ gst/src/bin.ccg (working copy)
@@ -6,7 +6,7 @@
Glib::RefPtr<Bin> Bin::create(const std::string& name)
{
GstElement* bin = gst_bin_new(name.c_str());
- return Glib::wrap((GstBin*) bin, false);
+ return Glib::wrap((GstBin*) bin);
}
Glib::RefPtr<Bin> Bin::add(const Glib::RefPtr<Element>& element)
@@ -14,7 +14,7 @@
bool result = gst_bin_add(gobj(), element->gobj());
if(result)
- return Glib::RefPtr<Bin>(this);
+ return Glib::wrap(gobj(), true);
else
throw std::runtime_error("Bin '" + get_name() + "' does not want to accept Element '" + element->get_name() + "'");
}
Index: gst/gstmm.h
===================================================================
--- gst/gstmm.h (revision 89)
+++ gst/gstmm.h (working copy)
@@ -8,6 +8,7 @@
#include <gstmm/iterator.h>
#include <gstmm/object.h>
#include <gstmm/pad.h>
+#include <gstmm/pipeline.h>
#include <gstmm/structure.h>
#include <gstmm/systemclock.h>
Index: tests/test-pipeline-add-element.cc
===================================================================
--- tests/test-pipeline-add-element.cc (revision 0)
+++ tests/test-pipeline-add-element.cc (revision 0)
@@ -0,0 +1,18 @@
+#include <gstmm.h>
+#include <iostream>
+
+int main (int argc, char* argv[])
+{
+ Gst::init(argc, argv);
+
+ Glib::RefPtr<Gst::Pipeline> pipeline = Gst::Pipeline::create("my-pipeline");
+ Glib::RefPtr<Gst::Element> source = Gst::Element::create("fakesrc", "source");
+
+ pipeline->add(source);
+
+ Glib::RefPtr<Gst::Element> sourceCopy = pipeline->get_by_name("source");
+
+ if (sourceCopy)
+ std::cout << "Successfully added element '" << sourceCopy->get_name() <<
+ "' to pipeline '" << pipeline->get_name() << "'." << std::endl;
+}
Index: tests/test-link-elements.cc
===================================================================
--- tests/test-link-elements.cc (revision 0)
+++ tests/test-link-elements.cc (revision 0)
@@ -0,0 +1,24 @@
+#include <gstmm.h>
+#include <iostream>
+
+int main (int argc, char* argv[])
+{
+ Gst::init(argc, argv);
+
+ Glib::RefPtr<Gst::Pipeline> pipeline;
+ Glib::RefPtr<Gst::Element> source, filter, sink;
+
+
+ pipeline = Gst::Pipeline::create("my-pipeline");
+
+ source = Gst::Element::create("fakesrc", "source");
+ filter = Gst::Element::create("identity", "filter");
+ sink = Gst::Element::create("fakesink", "sink");
+
+ pipeline->add(source)->add(filter)->add(sink);
+ source->link(filter)->link(sink);
+
+ std::cout << "Successfully linked elements '" << source->get_name() <<
+ "', '" << filter->get_name() << "' and '" << sink->get_name() <<
+ "'." << std::endl;
+}
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am (revision 89)
+++ tests/Makefile.am (working copy)
@@ -2,11 +2,17 @@
LDADD=$(top_builddir)/gst/gstmm/libgstmm-1.0.la
-noinst_PROGRAMS = test-create-element
+noinst_PROGRAMS = test-create-element test-pipeline-add-element test-link-elements
test_create_element_SOURCES=test-create-element.cc
test_create_element_LDFLAGS= GSTMM_LIBS@
+test_pipeline_add_element_SOURCES=test-pipeline-add-element.cc
+test_pipeline_add_element_LDFLAGS= GSTMM_LIBS@
+
+test_link_elements_SOURCES=test-link-elements.cc
+test_link_elements_LDFLAGS= GSTMM_LIBS@
+
#runtestbasic runtestlangs \
#runtestsearch runtestmimetypes \
#runtestgetbuffer
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]