gnomemm r1538 - in gstreamermm/trunk: . examples/media_player_gtkmm gstreamer/src gstreamerbase/src
- From: jaalburqu svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1538 - in gstreamermm/trunk: . examples/media_player_gtkmm gstreamer/src gstreamerbase/src
- Date: Wed, 28 May 2008 02:26:17 +0000 (UTC)
Author: jaalburqu
Date: Wed May 28 02:26:16 2008
New Revision: 1538
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1538&view=rev
Log:
2008-05-27 Josà Alburquerque <jaalburqu svn gnome org>
* examples/media_player_gtkmm/player_window.cc:
* examples/media_player_gtkmm/player_window.h: Use
Gst::Bus::signal_sync_message() to receive synchronous messages
instead of setting a sync handler on the Bus.
* gstreamer/src/elementfactory.hg: Added C++ code example on using
Gst::ElementFactory; Corrected class docs.
* gstreamer/src/error.hg: Removed unnecessary TODO.
* gstreamer/src/event.ccg:
* gstreamer/src/event.hg: Modified Gst::EventTag::parse() to return a
Gst::TagList instead of setting a passed reference.
* gstreamerbase/src/xoverlay.hg: Added C++ code example on using
GstBase::XOverlay.
Modified:
gstreamermm/trunk/ChangeLog
gstreamermm/trunk/examples/media_player_gtkmm/player_window.cc
gstreamermm/trunk/examples/media_player_gtkmm/player_window.h
gstreamermm/trunk/gstreamer/src/elementfactory.hg
gstreamermm/trunk/gstreamer/src/error.hg
gstreamermm/trunk/gstreamer/src/event.ccg
gstreamermm/trunk/gstreamer/src/event.hg
gstreamermm/trunk/gstreamerbase/src/xoverlay.hg
Modified: gstreamermm/trunk/examples/media_player_gtkmm/player_window.cc
==============================================================================
--- gstreamermm/trunk/examples/media_player_gtkmm/player_window.cc (original)
+++ gstreamermm/trunk/examples/media_player_gtkmm/player_window.cc Wed May 28 02:26:16 2008
@@ -84,10 +84,13 @@
// Get the bus from the pipeline:
Glib::RefPtr<Gst::Bus> bus = playbin->get_bus();
- // Add a sync handler to receive synchronous messages from the pipeline's
- // bus (this is done so that m_video_area can be set up for drawing at an
- // exact appropriate time):
- bus->set_sync_handler(
+ // Enable synchronous message emission to set up video (if any) at the
+ // exact appropriate time
+ bus->enable_sync_message_emission();
+
+ // Connect to bus's synchronous message signal (this is done so that
+ // m_video_area can be set up for drawing at the exact appropriate time):
+ bus->signal_sync_message().connect(
sigc::mem_fun(*this, &PlayerWindow::on_bus_message_sync));
// Add a bus watch to receive messages from the pipeline's bus:
@@ -109,16 +112,15 @@
}
// This function is used to receive asynchronous messages from mainPipeline's bus
-Gst::BusSyncReply PlayerWindow::on_bus_message_sync(
- const Glib::RefPtr<Gst::Bus>& /* bus */,
+void PlayerWindow::on_bus_message_sync(
const Glib::RefPtr<Gst::Message>& message)
{
// ignore anything but 'prepare-xwindow-id' element messages
if(message->get_message_type() != Gst::MESSAGE_ELEMENT)
- return Gst::BUS_PASS;
+ return;
if(!message->get_structure().has_name("prepare-xwindow-id"))
- return Gst::BUS_PASS;
+ return;
Glib::RefPtr<Gst::Element> element =
Glib::RefPtr<Gst::Element>::cast_dynamic(message->get_source());
@@ -131,8 +133,6 @@
const gulong xWindowId = GDK_WINDOW_XID(m_video_area.get_window()->gobj());
xoverlay->set_xwindow_id(xWindowId);
}
-
- return Gst::BUS_DROP;
}
// This function is used to receive asynchronous messages from play_bin's bus
Modified: gstreamermm/trunk/examples/media_player_gtkmm/player_window.h
==============================================================================
--- gstreamermm/trunk/examples/media_player_gtkmm/player_window.h (original)
+++ gstreamermm/trunk/examples/media_player_gtkmm/player_window.h Wed May 28 02:26:16 2008
@@ -45,7 +45,7 @@
protected:
//Signal handlers:
- Gst::BusSyncReply on_bus_message_sync(const Glib::RefPtr<Gst::Bus>& bus, const Glib::RefPtr<Gst::Message>& message);
+ void on_bus_message_sync(const Glib::RefPtr<Gst::Message>& message);
bool on_bus_message(const Glib::RefPtr<Gst::Bus>& bus, const Glib::RefPtr<Gst::Message>& message);
bool on_video_pad_got_buffer(const Glib::RefPtr<Gst::Pad>& pad, const Glib::RefPtr<Gst::MiniObject>& buffer);
Modified: gstreamermm/trunk/gstreamer/src/elementfactory.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/elementfactory.hg (original)
+++ gstreamermm/trunk/gstreamer/src/elementfactory.hg Wed May 28 02:26:16 2008
@@ -35,12 +35,41 @@
/** Gst::ElementFactory â Create Gst::Element from a factory.
* Gst::ElementFactory is used to create instances of elements. A
* Gst::ElementFactory can be added to a Gst::Plugin as it is also a
- * Gst::PluginFeature. Use the find() and create() functions to create element
- * instances. or use the static create() as a convenient shortcut.
+ * Gst::PluginFeature. Use find() to get a particular element factory. Use
+ * create_named_element() and the create_element() functions to create element
+ * instances.
*
- * The following code example shows you how to create a GstFileSrc element.
+ * The following code example shows you how to create a 'filesrc' element.
*
- * TODO: Add code example from GStreamer docs
+ * @code
+ * #include <gstreamermm.h>
+ * #include <iostream>
+
+ * int main (int argc, char *argc[])
+ * {
+ * Glib::RefPtr<Gst::Element> src;
+ * Glib::RefPtr<Gst::ElementFactory> srcfactory;
+ *
+ * Gst::init(&argc,&argv);
+ *
+ * srcfactory = Gst::ElementFactory::find("filesrc");
+ *
+ * if (!srcfactory)
+ * {
+ * std::cout << "Could not find factory 'filesrc'" << std::endl;
+ * exit(1);
+ * }
+ *
+ * src = srcfactory->create_named_element("src");
+ *
+ * if (!src)
+ * {
+ * std::cout << "Could not create element 'src'" << std::endl;
+ * exit(1);
+ * }
+ * ...
+ * }
+ * @endcode
*
*/
class ElementFactory : public PluginFeature
Modified: gstreamermm/trunk/gstreamer/src/error.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/error.hg (original)
+++ gstreamermm/trunk/gstreamer/src/error.hg Wed May 28 02:26:16 2008
@@ -80,7 +80,6 @@
*/
_WRAP_GERROR(CoreError, GstCoreError, GST_CORE_ERROR, NO_GTYPE)
-//TODO: As in rest of API, put these get_*_quark() methods in namespace.
/** Get error domain for core system. Errors in this domain will be from the
* Gst::CoreError enumeration.
*
Modified: gstreamermm/trunk/gstreamer/src/event.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/event.ccg (original)
+++ gstreamermm/trunk/gstreamer/src/event.ccg Wed May 28 02:26:16 2008
@@ -208,14 +208,11 @@
return Gst::Event::wrap(event, false);
}
-void EventTag::parse(TagList& taglist)
+TagList EventTag::parse()
{
GstTagList* gst_taglist = gst_tag_list_new();
gst_event_parse_tag(gobj(), &gst_taglist);
- TagList parsed_taglist(gst_taglist);
-
- //swap() method is generated by _CLASS_BOXEDTYPE class macro.
- taglist.swap(parsed_taglist);
+ return TagList(gst_taglist);
}
Glib::RefPtr<Event> Event::wrap(GstEvent* event, bool take_copy) {
Modified: gstreamermm/trunk/gstreamer/src/event.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/event.hg (original)
+++ gstreamermm/trunk/gstreamer/src/event.hg Wed May 28 02:26:16 2008
@@ -513,11 +513,10 @@
*/
static Glib::RefPtr<Event> create(const TagList& taglist);
- //TODO: Use return value:
/** Parses a tag event and stores the results in the given taglist location.
- * @param taglist Pointer to metadata list.
+ * @return Metadata list.
*/
- void parse(TagList& taglist);
+ TagList parse();
};
} //namespace Gst
Modified: gstreamermm/trunk/gstreamerbase/src/xoverlay.hg
==============================================================================
--- gstreamermm/trunk/gstreamerbase/src/xoverlay.hg (original)
+++ gstreamermm/trunk/gstreamerbase/src/xoverlay.hg Wed May 28 02:26:16 2008
@@ -54,7 +54,48 @@
* posted on the bus to inform the application that it should set the Window
* identifier immediately. Here is an example on how to do that correctly:
*
- * TODO: Insert translated example code from C API
+ * @code
+ * #include <gdk/gdkx.h>
+ * ...
+ * void PlayerWindow::on_bus_message_sync(
+ * const Glib::RefPtr<Gst::Message>& message)
+ * {
+ * // ignore anything but 'prepare-xwindow-id' element messages
+ * if(message->get_message_type() != Gst::MESSAGE_ELEMENT)
+ * return;
+ *
+ * if(!message->get_structure().has_name("prepare-xwindow-id"))
+ * return;
+ *
+ * Glib::RefPtr<Gst::Element> element =
+ * Glib::RefPtr<Gst::Element>::cast_dynamic(message->get_source());
+ *
+ * Glib::RefPtr< Gst::ElementInterfaced<GstBase::XOverlay> > xoverlay =
+ * Gst::Interface::cast <GstBase::XOverlay>(element);
+ *
+ * if(xoverlay)
+ * {
+ * const gulong xWindowId =
+ * GDK_WINDOW_XID(widget->get_window()->gobj());
+ * xoverlay->set_xwindow_id(xWindowId);
+ * }
+ * }
+ * ...
+ * int main (int argc, char *argv[])
+ * {
+ * ...
+ * // Get the bus from the pipeline:
+ * Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
+ *
+ * // Enable synchronous message emission:
+ * bus->enable_sync_message_emission();
+ *
+ * // Connect to bus's synchronous message signal:
+ * bus->signal_sync_message().connect(
+ * sigc::mem_fun(*this, &PlayerWindow::on_bus_message_sync));
+ * ...
+ * }
+ * @endcode
*/
class XOverlay : public Glib::Interface
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]