gnomemm r1369 - in gstreamermm/trunk: . examples/ogg_player examples/ogg_player_gtkmm gstreamer/gstreamermm gstreamer/src tools/m4



Author: murrayc
Date: Mon Feb 25 17:24:11 2008
New Revision: 1369
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1369&view=rev

Log:
2008-02-25  Siavash Safi  <siavash safi gmail com>

* examples/ogg_player/main.cc: Commented out unused argument const Glib::RefPtr<Gst::Bus>&' in
PlayerWindow::on_bus_message, Glib::ListHandle<
Glib::RefPtr<Glib::Object> >', note: the ownership of items is not
known, see the todo
* gstreamer/src/index.ccg:
* gstreamer/src/index.hg: Added const Glib::RefPtr<Pad>&' to SlotBlock
* gstreamer/src/structure.ccg: Fixed foreach(), map_in_place() to
return the value from C API
* tools/m4/convert_gst.m4: Added _CONV_ENUM(Gst,FlowReturn)


Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/examples/ogg_player/main.cc
   gstreamermm/trunk/examples/ogg_player_gtkmm/PlayerWindow.cc
   gstreamermm/trunk/gstreamer/gstreamermm/init.cc
   gstreamermm/trunk/gstreamer/src/element.ccg
   gstreamermm/trunk/gstreamer/src/filter.ccg
   gstreamermm/trunk/gstreamer/src/index.ccg
   gstreamermm/trunk/gstreamer/src/index.hg
   gstreamermm/trunk/gstreamer/src/pad.ccg
   gstreamermm/trunk/gstreamer/src/pad.hg
   gstreamermm/trunk/gstreamer/src/structure.ccg
   gstreamermm/trunk/tools/m4/convert_gst.m4

Modified: gstreamermm/trunk/examples/ogg_player/main.cc
==============================================================================
--- gstreamermm/trunk/examples/ogg_player/main.cc	(original)
+++ gstreamermm/trunk/examples/ogg_player/main.cc	Mon Feb 25 17:24:11 2008
@@ -62,7 +62,7 @@
 }
 
 // This function is used to receive asynchronous messages in the main loop.
-bool on_bus_message(const Glib::RefPtr<Gst::Bus>& bus, const Glib::RefPtr<Gst::Message>& message)
+bool on_bus_message(const Glib::RefPtr<Gst::Bus>& /* bus_not_used */, const Glib::RefPtr<Gst::Message>& message)
 {
   switch (message->get_message_type()) {
     case Gst::MESSAGE_EOS:

Modified: gstreamermm/trunk/examples/ogg_player_gtkmm/PlayerWindow.cc
==============================================================================
--- gstreamermm/trunk/examples/ogg_player_gtkmm/PlayerWindow.cc	(original)
+++ gstreamermm/trunk/examples/ogg_player_gtkmm/PlayerWindow.cc	Mon Feb 25 17:24:11 2008
@@ -98,7 +98,7 @@
 }
 
 // This function is used to receive asynchronous messages from mainPipeline's bus
-bool PlayerWindow::on_bus_message(const Glib::RefPtr<Gst::Bus>& bus,
+bool PlayerWindow::on_bus_message(const Glib::RefPtr<Gst::Bus>& /* bus_not_used */,
 					const Glib::RefPtr<Gst::Message>& message)
 {
     switch (message->get_message_type())
@@ -192,14 +192,20 @@
     progressScale.set_value(0);
 }
 
-bool PlayerWindow::on_scale_value_changed(Gtk::ScrollType type, double value)
+bool PlayerWindow::on_scale_value_changed(Gtk::ScrollType /* type_not_used */, double value)
 {
     gint64 newPos = gint64(value * duration);
 
     if (mainPipeline->seek(Gst::FORMAT_TIME, Gst::SEEK_FLAG_FLUSH, newPos))
+    {
         display_label_progress(newPos, duration);
+	return true;
+    }
     else
+    {
         std::cerr << "Could not seek!" << std::endl;
+	return false;
+    }
 }
 
 void PlayerWindow::on_rewind(void)

Modified: gstreamermm/trunk/gstreamer/gstreamermm/init.cc
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm/init.cc	(original)
+++ gstreamermm/trunk/gstreamer/gstreamermm/init.cc	Mon Feb 25 17:24:11 2008
@@ -46,16 +46,12 @@
 
 bool init_check(int& argc, char**& argv, Glib::Error& error)
 {
-  static bool s_init = false;
-  if(!s_init)
-  {
-    Glib::init();
-    GError* c_error;
-    gst_init_check(&argc, &argv, &c_error);
-    error = Glib::Error(c_error);
-    Gst::wrap_init();
-    s_init = true;
-  }
+  Glib::init();
+  GError* c_error;
+  bool result = gst_init_check(&argc, &argv, &c_error);
+  error = Glib::Error(c_error);
+  Gst::wrap_init();
+  return result;
 }
 
 Glib::OptionGroup init_get_option_group()

Modified: gstreamermm/trunk/gstreamer/src/element.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/element.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/element.ccg	Mon Feb 25 17:24:11 2008
@@ -84,12 +84,12 @@
   return gst_element_query_duration(const_cast<GstElement*>(gobj()), reinterpret_cast<GstFormat*>(&format), NULL);
 }
 
- // This method is written manually because an extra ref is necessary. See
- // gst_element_send_event() docs
- bool Element::send_event(const Glib::RefPtr<Event>& event)
+// This method is written manually because an extra ref is necessary. See
+// gst_element_send_event() docs
+bool Element::send_event(const Glib::RefPtr<Event>& event)
 {
   event->reference();
-  gst_element_send_event(gobj(), event->gobj());
+  return gst_element_send_event(gobj(), event->gobj());
 }
 
 } //namespace Gst

Modified: gstreamermm/trunk/gstreamer/src/filter.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/filter.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/filter.ccg	Mon Feb 25 17:24:11 2008
@@ -48,7 +48,8 @@
 Filter::run(const Glib::ListHandle<Glib::RefPtr<Glib::Object> >& list, const SlotFilter& slot, bool first)
 {
   SlotFilter slot_copy(slot);
-  gst_filter_run(list.data(), &Filter_Filter_gstreamermm_callback, first, &slot_copy);
+  // TODO: we don't know the ownership of the items, I filed bug #518627 for GStreamer
+  return Glib::ListHandle< Glib::RefPtr<Glib::Object> >(gst_filter_run(list.data(), &Filter_Filter_gstreamermm_callback, first, &slot_copy), Glib::OWNERSHIP_NONE);
 }
 
 } //namespace Gst

Modified: gstreamermm/trunk/gstreamer/src/index.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/index.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/index.ccg	Mon Feb 25 17:24:11 2008
@@ -27,9 +27,10 @@
 static gboolean Index_Filter_gstreamermm_callback(GstIndex* index, GstIndexEntry* entry, gpointer data)
 {
   Index::SlotFilter * the_slot = static_cast<Index::SlotFilter*>(data);
-  
+
+  Glib::RefPtr<Index> cpp_index = Glib::wrap(index, true);
   IndexEntry cpp_entry = Glib::wrap(entry, true);
-  const gboolean result = (*the_slot)(cpp_entry);
+  const gboolean result = (*the_slot)(cpp_index, cpp_entry);
   return result;
 }
 
@@ -44,9 +45,10 @@
 {
   Index::SlotResolver * the_slot = static_cast<Index::SlotResolver*>(data);
 
+  Glib::RefPtr<Index> cpp_index = Glib::wrap(index, true);
   Glib::RefPtr<Gst::Object> cpp_writer = Glib::wrap(writer, true);
   Glib::ustring cpp_writer_string;
-  const gboolean result = (*the_slot)(cpp_writer, cpp_writer_string);
+  const gboolean result = (*the_slot)(cpp_index, cpp_writer, cpp_writer_string);
   
   if(writer_string)
   {

Modified: gstreamermm/trunk/gstreamer/src/index.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/index.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/index.hg	Mon Feb 25 17:24:11 2008
@@ -81,16 +81,16 @@
   _WRAP_METHOD(IndexEntry get_assoc_entry(int id, IndexLookupMethod method, AssocFlags flags, Format format, gint64 value) const, gst_index_get_assoc_entry)
 
   /** For example,
-   * bool on_filter(IndexEntry entry);
+   * bool on_filter(const Glib::RefPtr<Index>& index, IndexEntry entry);
    */ 
-  typedef sigc::slot<bool, IndexEntry> SlotFilter;
+  typedef sigc::slot<bool, const Glib::RefPtr<Index>&, IndexEntry> SlotFilter;
 
   void set_filter(const SlotFilter& slot);
 
   /** For example,
    * bool on_resolve(const Glib::RefPtr<Gst::Object>& writer, Glib::ustring& writer_string);
    */ 
-  typedef sigc::slot<bool, const Glib::RefPtr<Gst::Object>&, Glib::ustring&> SlotResolver;
+  typedef sigc::slot<bool, const Glib::RefPtr<Index>&, const Glib::RefPtr<Gst::Object>&, Glib::ustring&> SlotResolver;
 
   void set_resolver(const SlotResolver& slot);
 };

Modified: gstreamermm/trunk/gstreamer/src/pad.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/pad.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/pad.ccg	Mon Feb 25 17:24:11 2008
@@ -72,13 +72,13 @@
 FlowReturn Pad::push(const Glib::RefPtr<Buffer>& buffer)
 {
   buffer->reference();
-  gst_pad_push(gobj(), buffer->gobj());
+  return FlowReturn(gst_pad_push(gobj(), buffer->gobj()));
 }
 
 bool Pad::push_event(const Glib::RefPtr<Event>& event)
 {
   event->reference();
-  gst_pad_push_event(gobj(), event->gobj());
+  return gst_pad_push_event(gobj(), event->gobj());
 }
 
 FlowReturn Pad::pull_range(guint64 offset, guint size, Glib::RefPtr<Buffer>& buffer)
@@ -92,7 +92,7 @@
 bool Pad::send_event(const Glib::RefPtr<Event>& event)
 {
   event->reference();
-  gst_pad_send_event(gobj(), event->gobj());
+  return gst_pad_send_event(gobj(), event->gobj());
 }
 
 bool Pad::query_position(Format& format) const
@@ -118,13 +118,15 @@
 FlowReturn Pad::chain(const Glib::RefPtr<Buffer>& buffer)
 {
   buffer->reference();
-  gst_pad_chain(gobj(), buffer->gobj());
+  return FlowReturn(gst_pad_chain(gobj(), buffer->gobj()));
 }
 
 static void Pad_Block_gstreamermm_callback(GstPad* pad, gboolean blocked, gpointer data)
 {
   Pad::SlotBlock * the_slot = static_cast<Pad::SlotBlock*>(data);
- (*the_slot)(blocked);
+
+  Glib::RefPtr<Pad> cpp_pad = Glib::wrap(pad, true);
+  (*the_slot)(cpp_pad, blocked);
   delete the_slot;
 }
 

Modified: gstreamermm/trunk/gstreamer/src/pad.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/pad.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/pad.hg	Mon Feb 25 17:24:11 2008
@@ -160,9 +160,9 @@
 	  gst_pad_set_internal_link_function, gst_pad_get_pad_template_caps)
 
   /** For example,
-   * void on_block(bool blocked);
+   * void on_block(const Glib::RefPtr<Pad>& pad, bool blocked);
    */
-  typedef sigc::slot<void, bool> SlotBlock;
+  typedef sigc::slot<void, const Glib::RefPtr<Pad>&, bool> SlotBlock;
 
   bool set_blocked_async(bool blocked, const SlotBlock& slot);
 

Modified: gstreamermm/trunk/gstreamer/src/structure.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/structure.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/structure.ccg	Mon Feb 25 17:24:11 2008
@@ -169,14 +169,14 @@
 Structure::foreach(const SlotForeach& slot)
 {
   SlotForeach slot_copy(slot);
-  gst_structure_foreach(gobj(), &Structure_Foreach_gstreamermm_callback, &slot_copy);
+  return gst_structure_foreach(gobj(), &Structure_Foreach_gstreamermm_callback, &slot_copy);
 }
 
 bool
 Structure::map_in_place(const SlotMap& slot)
 {
   SlotMap slot_copy(slot);
-  gst_structure_map_in_place(gobj(), &Structure_Map_gstreamermm_callback, &slot_copy);
+  return gst_structure_map_in_place(gobj(), &Structure_Map_gstreamermm_callback, &slot_copy);
 }
 
 Structure

Modified: gstreamermm/trunk/tools/m4/convert_gst.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/convert_gst.m4	(original)
+++ gstreamermm/trunk/tools/m4/convert_gst.m4	Mon Feb 25 17:24:11 2008
@@ -122,6 +122,7 @@
 _CONV_ENUM(Gst,ClockReturn)
 _CONV_ENUM(Gst,ClockTime)
 _CONV_ENUM(Gst,EventType)
+_CONV_ENUM(Gst,FlowReturn)
 _CONV_ENUM(Gst,Format)
 _CONV_ENUM(Gst,IndexCertainty)
 _CONV_ENUM(Gst,IndexEntryType)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]