[gstreamermm: 90/167] added appsink plugin. appsink.{hg|ccg} as handcrafted files



commit 21c1a424ca505eafb8f1216a562e942b26e078dc
Author: Marcin Kolny at Flytronic <marcin kolny flytronic pl>
Date:   Tue Jul 30 16:14:39 2013 +0200

    added appsink plugin. appsink.{hg|ccg} as handcrafted files

 .gitignore                |    2 -
 configure.ac              |    1 -
 gstreamer/src/appsink.ccg |  104 +++++++++++++++++++++++++++++++++++++++++++++
 gstreamer/src/appsink.hg  |  102 ++++++++++++++++++++++++++++++++++++++++++++
 gstreamer/src/filelist.am |    1 +
 tools/m4/convert_gst.m4   |    1 +
 6 files changed, 208 insertions(+), 3 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a1af55d..b9bdcf2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -337,8 +337,6 @@ gstreamer/src/alsasink.ccg
 gstreamer/src/alsasink.hg
 gstreamer/src/alsasrc.ccg
 gstreamer/src/alsasrc.hg
-gstreamer/src/appsink.ccg
-gstreamer/src/appsink.hg
 gstreamer/src/appsrc.ccg
 gstreamer/src/appsrc.hg
 gstreamer/src/audioconvert.ccg
diff --git a/configure.ac b/configure.ac
index 14026a3..6c6c177 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,7 +100,6 @@ AC_SUBST([GSTREAMERMM_PLUGIN_DEFS], ["\
 adder|adder|Adder \
 alsasink|alsasink|AlsaSink \
 alsasrc|alsasrc|AlsaSrc \
-appsink|appsink|AppSink \
 appsrc|appsrc|AppSrc \
 audioconvert|audioconvert|AudioConvert \
 audiorate|audiorate|AudioRate \
diff --git a/gstreamer/src/appsink.ccg b/gstreamer/src/appsink.ccg
new file mode 100644
index 0000000..0c35512
--- /dev/null
+++ b/gstreamer/src/appsink.ccg
@@ -0,0 +1,104 @@
+/*
+ * appsink.ccg
+ *
+ *  Created on: Jul 30, 2013
+ *      Author: m.kolny
+ */
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+_PINCLUDE(gstreamermm/private/basesink_p.h)
+
+extern "C"
+{
+
+GType gst_app_sink_gstreamermm_get_type()
+{
+  static GType type = 0;
+  GstElementFactory* factory = 0;
+  GstPluginFeature* feature = 0;
+
+  if(!type)
+  {
+    factory = gst_element_factory_find("appsink");
+    // Make sure that the feature is actually loaded:
+    if(factory)
+    {
+      feature =
+        gst_plugin_feature_load(GST_PLUGIN_FEATURE(factory));
+
+      g_object_unref(factory);
+      factory = GST_ELEMENT_FACTORY(feature);
+      type = gst_element_factory_get_element_type(factory);
+      g_object_unref(factory);
+
+      // Register the new type with wrapping system
+      Glib::wrap_register(type, &Gst::AppSink_Class::wrap_new);
+    }
+  }
+
+  return type;
+}
+
+} // extern "C"
+
+namespace Gst
+{
+
+AppSink::AppSink()
+: _CONSTRUCT("name", static_cast<char*>(0))
+{}
+
+AppSink::AppSink(const Glib::ustring& name)
+: _CONSTRUCT("name", name.c_str())
+{}
+
+Glib::RefPtr<Gst::Sample> AppSink::pull_preroll()
+{
+  GstSample* result;
+  g_signal_emit_by_name(gobj(), "pull-preroll", &result, static_cast<void*>(0));
+  return _CONVERT(`GstSample*', `Glib::RefPtr<Gst::Sample>', `result');
+}
+
+Glib::RefPtr<Gst::Sample> AppSink::pull_sample()
+{
+  GstSample* result;
+  g_signal_emit_by_name(gobj(), "pull-sample", &result, static_cast<void*>(0));
+  return _CONVERT(`GstSample*', `Glib::RefPtr<Gst::Sample>', `result');
+}
+
+}
+namespace Glib
+{
+
+Glib::RefPtr<Gst::AppSink> wrap(GstAppSink* object, bool take_copy)
+{
+  static bool registered_wrap_new = false;
+  if(!registered_wrap_new)
+  {
+    // Call get *_get_type() function which does the registration.
+    gst_app_sink_gstreamermm_get_type();
+    registered_wrap_new = true;
+  }
+
+  return Glib::RefPtr<Gst::AppSink>( dynamic_cast<Gst::AppSink*> (Glib::wrap_auto ((GObject*)(object), 
take_copy)) );
+}
+
+}
diff --git a/gstreamer/src/appsink.hg b/gstreamer/src/appsink.hg
new file mode 100644
index 0000000..6a8d4f4
--- /dev/null
+++ b/gstreamer/src/appsink.hg
@@ -0,0 +1,102 @@
+/*
+ * appsink.ccg
+ *
+ *  Created on: Jul 30, 2013
+ *      Author: m.kolny
+ */
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+#include <gstreamermm/basesink.h>
+#include <gstreamermm/caps.h>
+#include <gstreamermm/pad.h>
+#include <gstreamermm/sample.h>
+#include <gstreamermm/urihandler.h>
+_DEFS(gstreamermm,gst)
+
+// Plug-in C enums used in signals:
+namespace Gst
+{
+
+/** A Wrapper for the appsink plugin.
+ * Please note that not all plug-ins are available on all systems so care
+ * must be taken that they exist before they are used otherwise there will
+ * be errors and possibly a crash.
+ *
+ * @ingroup GstPlugins
+ */
+class AppSink
+: public Gst::BaseSink, public Gst::URIHandler
+{
+  _CLASS_GOBJECT(AppSink, GstAppSink, GST_APP_SINK_GSTREAMERMM, Gst::BaseSink, GstBaseSink)
+  _IMPLEMENTS_INTERFACE(Gst::URIHandler)
+
+  _IS_GSTREAMERMM_PLUGIN
+  _NO_WRAP_INIT_REGISTRATION
+  _CUSTOM_WRAP_FUNCTION
+
+protected:
+  AppSink();
+  explicit AppSink(const Glib::ustring& name);
+
+public:
+  /** Creates a new appsink plugin with a unique name.
+   */
+  _WRAP_CREATE()
+
+  /** Creates a new appsink plugin with the given name.
+   */
+  _WRAP_CREATE(const Glib::ustring& name)
+
+  /** This is a convenience method for the action signal
+   * signal_pull_preroll().
+   */
+  Glib::RefPtr<Gst::Sample> pull_preroll();
+
+  /** This is a convenience method for the action signal
+   * signal_pull_sample().
+   */
+  Glib::RefPtr<Gst::Sample> pull_sample();
+
+
+  _WRAP_PROPERTY("caps", Glib::RefPtr<Gst::Caps>)
+  _WRAP_PROPERTY("eos", bool)
+  _WRAP_PROPERTY("emit-signals", bool)
+  _WRAP_PROPERTY("max-buffers", guint)
+  _WRAP_PROPERTY("drop", bool)
+
+  _WRAP_SIGNAL(void eos(), "eos", no_default_handler)
+  _WRAP_SIGNAL(Gst::FlowReturn new_preroll(), "new-preroll", no_default_handler)
+  _WRAP_SIGNAL(Gst::FlowReturn new_sample(), "new-sample", no_default_handler)
+
+  /** This is an action signal which is designed to be used as a method.  To 
+   * do that, use its convenience method, pull_preroll().
+   */
+  _WRAP_SIGNAL(Glib::RefPtr<Gst::Sample> pull_preroll(), "pull-preroll", no_default_handler)
+
+
+  /** This is an action signal which is designed to be used as a method.  To 
+   * do that, use its convenience method, pull_sample().
+   */
+  _WRAP_SIGNAL(Glib::RefPtr<Gst::Sample> pull_sample(), "pull-sample", no_default_handler)
+
+};
+
+} // namespace Gst
diff --git a/gstreamer/src/filelist.am b/gstreamer/src/filelist.am
index 847f054..05c2a2b 100644
--- a/gstreamer/src/filelist.am
+++ b/gstreamer/src/filelist.am
@@ -26,6 +26,7 @@ plugins_hg =                    \
         adder.hg                \
         alsasink.hg             \
         alsasrc.hg              \
+        appsink.hg              \
         appsrc.hg               \
         audioconvert.hg         \
         audiorate.hg            \
diff --git a/tools/m4/convert_gst.m4 b/tools/m4/convert_gst.m4
index 9686595..b85305d 100644
--- a/tools/m4/convert_gst.m4
+++ b/tools/m4/convert_gst.m4
@@ -190,6 +190,7 @@ dnl Sample
 _CONVERSION(`GstSample*',`Glib::RefPtr<Gst::Sample>',`Glib::wrap($3)')
 _CONVERSION(`GstSample*',`Glib::RefPtr<const Gst::Sample>',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<Gst::Sample>&',`GstSample*', `Glib::unwrap($3)')
+_CONVERSION(`Glib::RefPtr<Gst::Sample>', `GstSample*', `Glib::unwrap($3)')
 
 dnl Segment
 _CONVERSION(`GstSegment*',`Glib::RefPtr<Gst::Segment>',`Glib::wrap($3)')


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