gnomemm r1711 - in clutter-gstreamermm/trunk: . clutter-gstreamer/src examples



Author: siavashs
Date: Mon Sep 22 19:21:24 2008
New Revision: 1711
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1711&view=rev

Log:
Added missing ctor argument for Gst::VideoSink and the video-sink example

        * clutter-gstreamer/src/gst-video-sink.hg: Added missing ctor argument
        * examples/Makefile.am:
        * examples/video-sink.cc: Added the video-sink example



Added:
   clutter-gstreamermm/trunk/examples/video-sink.cc
Modified:
   clutter-gstreamermm/trunk/ChangeLog
   clutter-gstreamermm/trunk/clutter-gstreamer/src/gst-video-sink.hg
   clutter-gstreamermm/trunk/examples/Makefile.am

Modified: clutter-gstreamermm/trunk/clutter-gstreamer/src/gst-video-sink.hg
==============================================================================
--- clutter-gstreamermm/trunk/clutter-gstreamer/src/gst-video-sink.hg	(original)
+++ clutter-gstreamermm/trunk/clutter-gstreamer/src/gst-video-sink.hg	Mon Sep 22 19:21:24 2008
@@ -33,12 +33,12 @@
   _CLASS_GOBJECT(VideoSink, ClutterGstVideoSink, CLUTTER_GST_VIDEO_SINK, ::Gst::BaseSink, GstBaseSink)
 
 protected:
-  _CTOR_DEFAULT
+  _WRAP_CTOR(VideoSink(const Glib::RefPtr<Texture>& texture), clutter_gst_video_sink_new)
 
 public:
-  _WRAP_CREATE()
+  _WRAP_CREATE(const Glib::RefPtr<Texture>& texture)
 
-  _WRAP_PROPERTY("texture", Glib::RefPtr<Clutter::Texture>)
+  _WRAP_PROPERTY("texture", Glib::RefPtr<Texture>)
   _WRAP_PROPERTY("use-shaders", bool)
 };
 

Modified: clutter-gstreamermm/trunk/examples/Makefile.am
==============================================================================
--- clutter-gstreamermm/trunk/examples/Makefile.am	(original)
+++ clutter-gstreamermm/trunk/examples/Makefile.am	Mon Sep 22 19:21:24 2008
@@ -2,6 +2,6 @@
 
 include Makefile.am_fragment
 
-noinst_PROGRAMS = audio
+noinst_PROGRAMS = audio video-sink
 audio_SOURCES = audio.cc
-
+video_sink_SOURCES = video-sink.cc

Added: clutter-gstreamermm/trunk/examples/video-sink.cc
==============================================================================
--- (empty file)
+++ clutter-gstreamermm/trunk/examples/video-sink.cc	Mon Sep 22 19:21:24 2008
@@ -0,0 +1,85 @@
+#include <clutter-gstreamermm.h>
+
+Glib::RefPtr<Clutter::Stage> stage;
+Glib::RefPtr<Clutter::Texture> texture;
+
+void on_size_change(int width, int height)
+{
+  int new_x, new_y, new_width, new_height;
+
+  new_height = (height * stage->get_width()) / width;
+  if(new_height <= stage->get_height())
+  {
+    new_width = stage->get_width();
+
+    new_x = 0;
+    new_y = (stage->get_height() - new_height) / 2;
+  }
+  else
+  {
+    new_width  = (width * stage->get_height()) / height;
+    new_height = stage->get_height();
+
+    new_x = (stage->get_width() - new_width) / 2;
+    new_y = 0;
+  }
+
+  texture->set_position(new_x, new_y);
+
+  texture->set_size(new_width, new_height);
+}
+
+int main(int argc, char** argv)
+{
+  if (argc < 1) {
+          g_error ("Usage: %s", argv[0]);
+          return 1;
+  }
+
+  Glib::RefPtr<Clutter::Timeline> timeline;
+  Glib::RefPtr<Gst::Pipeline> pipeline;
+  Glib::RefPtr<Gst::Element> src;
+  Glib::RefPtr<Gst::Element> warp;
+  Glib::RefPtr<Gst::Element> colorspace;
+  Glib::RefPtr<Clutter::Gst::VideoSink> sink;
+
+  Clutter::init(&argc, &argv);
+  Gst::init(argc, argv);
+
+  stage = Clutter::Stage::get_default();
+
+  // Make a timeline, 100 frames, 30 fps
+  timeline = Clutter::Timeline::create(100, 30);
+  timeline->set_loop();
+
+  // We need to set certain props on the target texture currently for
+  // efficient/corrent playback onto the texture (which sucks a bit)
+  texture = Glib::wrap(CLUTTER_TEXTURE(g_object_new (CLUTTER_TYPE_TEXTURE, "sync-size", FALSE, "disable-slicing", TRUE, NULL)));
+  //texture = Clutter::Texture::create();
+  //texture->property_sync_size() = false;
+  //texture->property_disable_slicing() = true;
+  
+
+  texture->signal_size_change().connect(sigc::ptr_fun(&on_size_change), texture);
+
+  // Set up pipeline
+  pipeline = Gst::Pipeline::create("video-sink");
+
+  src = Gst::ElementFactory::create_element("videotestsrc");
+  warp = Gst::ElementFactory::create_element("warptv");
+  colorspace = Gst::ElementFactory::create_element("ffmpegcolorspace");
+  sink = Clutter::Gst::VideoSink::create(texture);
+
+  pipeline->add(src)->add(warp)->add(colorspace)->add(sink);
+  src->link(warp)->link(colorspace)->link(sink);
+
+  pipeline->set_state(Gst::STATE_PLAYING);
+
+  timeline->start();
+
+  stage->show_all();
+
+  Clutter::main();
+
+  return 0;
+}



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