gnomemm r1854 - in gstreamermm/trunk: . examples/media_player_gtkmm gstreamerbase/src



Author: jaalburqu
Date: Mon Dec 15 04:03:08 2008
New Revision: 1854
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1854&view=rev

Log:
2008-12-14  Josà Alburquerque  <jaalburqu svn gnome org>

	* gstreamerbase/src/Makefile_list_of_hg.am_fragment: Removed some
	plug-ins that were not generated in jhbuild.  Will re-add them after
	making sure they are generated.

	* examples/media_player_gtkmm/main.cc:
	* examples/media_player_gtkmm/player_window.cc:
	* examples/media_player_gtkmm/player_window.h: Modified example to use
	GstBase::PlayBin2 and GstBase::XImageSink plug-ins.  They work, but
	some warnings that have to be looked into are generated (I hope
	they're not too bad :-)

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/examples/media_player_gtkmm/main.cc
   gstreamermm/trunk/examples/media_player_gtkmm/player_window.cc
   gstreamermm/trunk/examples/media_player_gtkmm/player_window.h
   gstreamermm/trunk/gstreamerbase/src/Makefile_list_of_hg.am_fragment

Modified: gstreamermm/trunk/examples/media_player_gtkmm/main.cc
==============================================================================
--- gstreamermm/trunk/examples/media_player_gtkmm/main.cc	(original)
+++ gstreamermm/trunk/examples/media_player_gtkmm/main.cc	Mon Dec 15 04:03:08 2008
@@ -25,6 +25,8 @@
 #include <gstreamermm/elementfactory.h>
 #include <gstreamermm/pad.h>
 #include <gstreamermm/pipeline.h>
+#include <gstreamerbasemm/playbin2.h>
+#include <gstreamerbasemm/ximagesink.h>
 #include <iostream>
 #include "player_window.h"
 
@@ -39,22 +41,22 @@
 
   // Create the elements:
 
-  // playbin plays any media type, choosing an appropriate set of elements
+  // playbin2 plays any media type, choosing an appropriate set of elements
   // and linking them together.
-  // playbin implements GstBase::XOverlay so it accepts a window id in which 
+  // playbin2 implements GstBase::XOverlay so it accepts a window id in which 
   // to draw video.
-  Glib::RefPtr<Gst::Element> playbin = Gst::ElementFactory::create_element("playbin");
+  Glib::RefPtr<GstBase::PlayBin2> playbin =
+                        GstBase::PlayBin2::create("playbin");
 
-  //The playbin element is actually a pipeline:
-  Glib::RefPtr<Gst::Pipeline> pipeline = Glib::RefPtr<Gst::Pipeline>::cast_dynamic(playbin);
-  if(!pipeline)
+  if(!playbin)
   {
     std::cerr << "The playbin could not be created." << std::endl;
     return -1;
   }
 
   // Create a video sink where video (if any) will be drawn:
-  Glib::RefPtr<Gst::Element> video_sink = Gst::ElementFactory::create_element("ximagesink");
+  Glib::RefPtr<GstBase::XImageSink> video_sink =
+                        GstBase::XImageSink::create("ximagesink");
   if (!video_sink)
   {
     std::cerr << "The ximagesink could not be created." << std::endl;
@@ -62,15 +64,14 @@
   }
 
   // Set the playbin's video-sink property so that our video sink is used for video display:
-  // TODO: Create a PlayBin class that we can dynamic_cast<> to, so we can use property_video_sink()?
-  pipeline->set_property("video-sink", video_sink);
+  playbin->property_video_sink() = video_sink;
 
   //Create our player window and give it the pipeline and video sink:
-  PlayerWindow mainWindow(pipeline, video_sink);
+  PlayerWindow mainWindow(playbin, video_sink);
   kit.run(mainWindow);
 
   // Clean up nicely:
-  pipeline->set_state(Gst::STATE_NULL);
+  playbin->set_state(Gst::STATE_NULL);
 
   return 0;
 }

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	Mon Dec 15 04:03:08 2008
@@ -36,7 +36,8 @@
 #include <iomanip>
 #include "player_window.h"
 
-PlayerWindow::PlayerWindow(const Glib::RefPtr<Gst::Pipeline>& playbin, const Glib::RefPtr<Gst::Element>& video_sink)
+PlayerWindow::PlayerWindow(const Glib::RefPtr<GstBase::PlayBin2>& playbin,
+  const Glib::RefPtr<GstBase::XImageSink>& video_sink)
 : m_vbox(false, 6),
   m_progress_label("000:00:00.000000000 / 000:00:00.000000000"),
   m_play_button(Gtk::Stock::MEDIA_PLAY),
@@ -361,8 +362,7 @@
     working_dir = chooser.get_current_folder();
 
     // Set uri property on the playbin.
-    // TODO: Create a PlayBin class that we can dynamic_cast<> to, so we can use property_uri()?
-    m_play_bin->set_property("uri", chooser.get_uri());
+    m_play_bin->property_uri() = chooser.get_uri();
 
     // Resize m_video_area and window to minimum when opening a file
     m_video_area.set_size_request(0, 0);

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	Mon Dec 15 04:03:08 2008
@@ -31,6 +31,8 @@
 #include <gstreamermm/element.h>
 #include <gstreamermm/pipeline.h>
 #include <gstreamermm/bus.h>
+#include <gstreamerbasemm/playbin2.h>
+#include <gstreamerbasemm/ximagesink.h>
 
 class PlayerWindow : public Gtk::Window
 {
@@ -39,7 +41,7 @@
    * @param playbin The pipeline that can play media files.
    * @param video_sink The video sink to use to display stream video (if any).
    */
-  PlayerWindow(const Glib::RefPtr<Gst::Pipeline>& playbin, const Glib::RefPtr<Gst::Element>& video_sink);
+  PlayerWindow(const Glib::RefPtr<GstBase::PlayBin2>& playbin, const Glib::RefPtr<GstBase::XImageSink>& video_sink);
   virtual ~PlayerWindow();
 
 protected:
@@ -73,8 +75,8 @@
   Gtk::Button m_forward_button;
   Gtk::Button m_open_button;
 
-  Glib::RefPtr<Gst::Pipeline> m_play_bin;
-  Glib::RefPtr<Gst::Element> m_video_sink;
+  Glib::RefPtr<GstBase::PlayBin2> m_play_bin;
+  Glib::RefPtr<GstBase::XImageSink> m_video_sink;
   sigc::connection m_timeout_connection;
   guint m_watch_id;
   gint64 m_duration;
@@ -82,5 +84,3 @@
 };
 
 #endif /* _PLAYERWINDOW_H */
-
- 

Modified: gstreamermm/trunk/gstreamerbase/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- gstreamermm/trunk/gstreamerbase/src/Makefile_list_of_hg.am_fragment	(original)
+++ gstreamermm/trunk/gstreamerbase/src/Makefile_list_of_hg.am_fragment	Mon Dec 15 04:03:08 2008
@@ -13,15 +13,19 @@
 
 files_plugin_hg = adder.hg alsamixer.hg alsasink.hg alsasrc.hg \
 		  audioconvert.hg audioresample.hg audiotestsrc.hg \
-		  cdparanoiasrc.hg clockoverlay.hg decodebin.hg \
-		  ffmpegcolorspace.hg gdpdepay.hg gdppay.hg giosink.hg \
-		  giosrc.hg giostreamsink.hg giostreamsrc.hg \
+		  clockoverlay.hg decodebin.hg \
+		  ffmpegcolorspace.hg gdpdepay.hg gdppay.hg \
 		  oggdemux.hg oggmux.hg playbin2.hg \
 		  textoverlay.hg \
 		  textrender.hg theoradec.hg theoraenc.hg \
 		  timeoverlay.hg videorate.hg videoscale.hg \
 		  videotestsrc.hg volume.hg vorbisdec.hg vorbisenc.hg \
-		  vorbisparse.hg vorbistag.hg ximagesink.hg xvimagesink.hg
+		  vorbisparse.hg vorbistag.hg ximagesink.hg
+
+#TODO: The following plug-ins are not genereated in jhbuild; investigate and
+# add to above list:
+# cdparanoiasrc giosink giosrc giostreamsink giostreamsrc xvimagesink.
+
 
 #TODO: Add decodebin2 to plugin list above.
 #TODO: Add multifdsink to plugin list above.



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