gnomemm r1777 - in gstreamermm/trunk: . gstreamer/src tests
- From: jaalburqu svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1777 - in gstreamermm/trunk: . gstreamer/src tests
- Date: Fri, 7 Nov 2008 19:42:19 +0000 (UTC)
Author: jaalburqu
Date: Fri Nov 7 19:42:18 2008
New Revision: 1777
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1777&view=rev
Log:
2008-11-07 Josà Alburquerque <jaalburqu svn gnome org>
* gstreamer/src/caps.ccg:
* gstreamer/src/caps.hg:
* tests/test-caps.cc: Added a set_simple() for C strings (const char*)
and modified test to ensure it works.
* gstreamer/src/tagsetter.ccg:
* gstreamer/src/tagsetter.hg:
* tests/test-tagsetter.cc: Added add_tag() for C strings (const char*)
and modified test to ensure it works.
Modified:
gstreamermm/trunk/ChangeLog
gstreamermm/trunk/gstreamer/src/caps.ccg
gstreamermm/trunk/gstreamer/src/caps.hg
gstreamermm/trunk/gstreamer/src/tagsetter.ccg
gstreamermm/trunk/gstreamer/src/tagsetter.hg
gstreamermm/trunk/tests/test-caps.cc
gstreamermm/trunk/tests/test-tagsetter.cc
Modified: gstreamermm/trunk/gstreamer/src/caps.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/caps.ccg (original)
+++ gstreamermm/trunk/gstreamer/src/caps.ccg Fri Nov 7 19:42:18 2008
@@ -109,6 +109,12 @@
//return Glib::wrap(gobj(), true);
}
+void
+Caps::set_simple(const Glib::ustring& name, const char* data)
+{
+ set_simple(name, (std::string)(data));
+}
+
xmlpp::Node* Caps::save(xmlpp::Node* parent) const
{
gst_caps_save_thyself(gobj(), parent->cobj());
Modified: gstreamermm/trunk/gstreamer/src/caps.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/caps.hg (original)
+++ gstreamermm/trunk/gstreamer/src/caps.hg Fri Nov 7 19:42:18 2008
@@ -144,6 +144,14 @@
template <class DataType>
void set_simple(const Glib::ustring& name, const DataType& data);
+ /** Sets fields in a simple Gst::Caps. A simple Gst::Caps is one that only
+ * has one structure.
+ *
+ * @param name Field to set.
+ * @param data A C string (const char*) which the field should be set to.
+ */
+ void set_simple(const Glib::ustring& name, const char* data);
+
_WRAP_METHOD(bool is_any() const, gst_caps_is_any)
_WRAP_METHOD(bool empty() const, gst_caps_is_empty)
_WRAP_METHOD(bool is_fixed() const, gst_caps_is_fixed)
Modified: gstreamermm/trunk/gstreamer/src/tagsetter.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/tagsetter.ccg (original)
+++ gstreamermm/trunk/gstreamer/src/tagsetter.ccg Fri Nov 7 19:42:18 2008
@@ -27,4 +27,9 @@
gst_tag_setter_add_tag_values(gobj(), (GstTagMergeMode) mode, tag.c_str(), value.gobj(), NULL);
}
+void TagSetter::add_tag(const Glib::ustring& tag, const char* data, TagMergeMode mode)
+{
+ gst_tag_setter_add_tags(gobj(), (GstTagMergeMode) mode, tag.c_str(), data, NULL);
+}
+
} //namespace Gst
Modified: gstreamermm/trunk/gstreamer/src/tagsetter.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/tagsetter.hg (original)
+++ gstreamermm/trunk/gstreamer/src/tagsetter.hg Fri Nov 7 19:42:18 2008
@@ -59,7 +59,7 @@
void add_tag(const Glib::ustring& tag, const Glib::ValueBase& value, TagMergeMode mode=TAG_MERGE_PREPEND);
_IGNORE(gst_tag_setter_add_tag_valist, gst_tag_setter_add_tag_valist_values)
- /** Adds the given value on the setter using the given merge mode.
+ /** Adds the given value on the setter using the given merge mode.
*
* @param tag The tag to set.
* @param data The value to set the tag to (this may be any supported C++
@@ -69,6 +69,14 @@
template <class DataType>
void add_tag(const Glib::ustring& tag, const DataType& data, TagMergeMode mode=TAG_MERGE_PREPEND);
+ /** Adds the given value on the setter using the given merge mode.
+ *
+ * @param tag The tag to set.
+ * @param data The value to set the tag to.
+ * @param mode The mode to use.
+ */
+ void add_tag(const Glib::ustring& tag, const char* data, TagMergeMode mode=TAG_MERGE_PREPEND);
+
_WRAP_METHOD(TagList get_tag_list(), gst_tag_setter_get_tag_list)
_WRAP_METHOD(void set_tag_merge_mode(TagMergeMode mode), gst_tag_setter_set_tag_merge_mode)
_WRAP_METHOD(TagMergeMode qet_tag_merge_mode(), gst_tag_setter_get_tag_merge_mode)
Modified: gstreamermm/trunk/tests/test-caps.cc
==============================================================================
--- gstreamermm/trunk/tests/test-caps.cc (original)
+++ gstreamermm/trunk/tests/test-caps.cc Fri Nov 7 19:42:18 2008
@@ -47,10 +47,12 @@
{
int width;
Gst::Fraction rate;
+ std::string string;
Glib::RefPtr<Gst::Caps> caps = Gst::Caps::create_simple("video/x-raw-yuv");
caps->set_simple("width", 500);
caps->set_simple("framerate", Gst::Fraction(25, 1));
+ caps->set_simple("string", "A string");
if (caps->get_structure(0).get_field("width", width))
{
@@ -67,6 +69,14 @@
}
else
std::cout << "Getting of simple caps framerate field failed." << std::endl;
+
+ if (caps->get_structure(0).get_field("string", string))
+ {
+ std::cout << "Simple caps string after setting = " << string << "." <<
+ std::endl;
+ }
+ else
+ std::cout << "Getting of simple caps sting field failed." << std::endl;
}
int main (int argc, char* argv[])
Modified: gstreamermm/trunk/tests/test-tagsetter.cc
==============================================================================
--- gstreamermm/trunk/tests/test-tagsetter.cc (original)
+++ gstreamermm/trunk/tests/test-tagsetter.cc Fri Nov 7 19:42:18 2008
@@ -44,14 +44,24 @@
exit(1);
}
- setter->add_tag("bitrate", 192);
+ setter->add_tag(Gst::Tag::BITRATE, 192);
+ setter->add_tag(Gst::Tag::TITLE, "A Song");
int bitrate = 0;
- if(setter->get_tag_list().get("bitrate", bitrate))
+ if(setter->get_tag_list().get(Gst::Tag::BITRATE, bitrate))
std::cout << "bitrate = " << bitrate << "." << std::endl;
else
- std::cout << "Could not get tag `bitrate' from tagsetter." << std::endl;
+ std::cout << "Could not get tag `" << Gst::Tag::BITRATE <<
+ "' from tagsetter." << std::endl;
+
+ std::string title;
+
+ if(setter->get_tag_list().get(Gst::Tag::TITLE, title))
+ std::cout << "title = `" << title << "'." << std::endl;
+ else
+ std::cout << "Could not get tag `" << Gst::Tag::TITLE <<
+ "' from tagsetter." << std::endl;
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]