[gstreamermm] Add decodebin2 plug-in.



commit 7503f74c6196f83129ca16039b24b08125664552
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Thu Jun 25 20:43:04 2009 -0400

    Add decodebin2 plug-in.

 ChangeLog                                          |   20 ++++++++
 configure.ac                                       |    9 ++--
 gstreamer/src/Makefile_list_of_hg.am_fragment      |    2 +-
 gstreamer/src/enums.ccg                            |    8 +++-
 gstreamer/src/enums.hg                             |   13 +++++-
 .../extra_defs_gen/generate_plugin_gmmproc_file.cc |   49 ++++++++++++--------
 tools/m4/convert_gst.m4                            |    3 +
 tools/m4/ctocpp_gstreamermm.m4                     |    7 ++-
 8 files changed, 83 insertions(+), 28 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c968c3a..e79a691 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2009-06-25  José Alburquerque  <jaalburqu svn gnome org>
+
+	* configure.ac:
+	* gstreamer/src/Makefile_list_of_hg.am_fragment: Added decodebin2
+	plug-in.
+	* gstreamer/src/enums.ccg:
+	* gstreamer/src/enums.hg: Added enum AutoplugSelectResult used in
+	decodebin2's signal "autoplug-select".  It is hard to auto-generate
+	enums used in signals because it's hard to know whether they are local
+	to the plug-in or not.
+	* tools/m4/ctocpp_gstreamermm.m4: Added translations for enum
+	GstAutoplugSelectResult, GValueArray* and GstElementFactory.
+	Corrected GstTagList* translation.
+	* tools/m4/convert_gst.m4: Added enum GstAutoplugSelectResult,
+	GstElementFactory* and GValueArray* conversions.
+
+	* tools/extra_defs_gen/generate_plugin_gmmproc_file.cc: Added enum
+	GstAutoplugSelectResult to wrapped enums.  Use Glib::ustring returns
+	instead of output variables.  Minor code reformatting/correction.
+
 2009-06-24  José Alburquerque  <jaalburqu svn gnome org>
 
 	* gstreamer/src/propertyprobe.hg: Wrap GstPropertyProbe interface
diff --git a/configure.ac b/configure.ac
index 42dfcf9..d0a6488 100644
--- a/configure.ac
+++ b/configure.ac
@@ -185,13 +185,14 @@ AC_SUBST(GST_INSPECT)
 # as "CppClassName" - all in lowercase with a .hg extension).  Make sure that
 # the order of both lists correspond.
 GSTREAMERMM_ALL_PLUGIN_DEFS="capsfilter=CapsFilter fakesrc=FakeSrc \
-fakesink=FakeSink fdsink=FdSink fdsrc=FdSrc filesrc=FileSrc filesink=FileSink \
-identity=Identity multiqueue=MultiQueue queue=Queue tee=Tee \
-typefind=TypeFindElement \
+fakesink=FakeSink fdsink=FdSink fdsrc=FdSrc filesrc=FileSrc \
+filesink=FileSink identity=Identity multiqueue=MultiQueue queue=Queue \
+tee=Tee typefind=TypeFindElement \
 adder=Adder alsamixer=AlsaMixer alsasink=AlsaSink alsasrc=AlsaSrc \
 appsrc=AppSrc appsink=AppSink audioconvert=AudioConvert \
 audioresample=AudioResample audiotestsrc=AudioTestSrc \
 cdparanoiasrc=CdParanoiaSrc clockoverlay=ClockOverlay decodebin=DecodeBin \
+decodebin2=DecodeBin2 \
 ffmpegcolorspace=FfmpegColorSpace gdpdepay=GDPDepay gdppay=GDPPay \
 giosink=GioSink giosrc=GioSrc giostreamsink=GioStreamSink \
 giostreamsrc=GioStreamSrc oggdemux=OggDemux oggmux=OggMux \
@@ -206,7 +207,7 @@ vorbistag=VorbisTag ximagesink=XImageSink xvimagesink=XvImageSink"
 
 # TODO: The following plug-ins (to be added above) can't be wrapped yet because
 # their signals or properties use the GValueArray type which might have to be
-# wrapped in glibmm first: DecodeBin2, MultiFdSink, TcpServerSink, TheoraParse,
+# wrapped in glibmm first: MultiFdSink, TcpServerSink, TheoraParse,
 # UriDecodeBin.
 
 # Go through all the "plug-in defs", extracting the plug-in name and the C++
diff --git a/gstreamer/src/Makefile_list_of_hg.am_fragment b/gstreamer/src/Makefile_list_of_hg.am_fragment
index 390ca72..96652f7 100644
--- a/gstreamer/src/Makefile_list_of_hg.am_fragment
+++ b/gstreamer/src/Makefile_list_of_hg.am_fragment
@@ -38,7 +38,7 @@ files_all_plugin_hg = capsfilter.hg fakesrc.hg fakesink.hg fdsink.hg fdsrc.hg \
 		  adder.hg alsamixer.hg alsasink.hg alsasrc.hg appsrc.hg \
 		  appsink.hg \
 		  audioconvert.hg audioresample.hg audiotestsrc.hg \
-		  cdparanoiasrc.hg clockoverlay.hg decodebin.hg \
+		  cdparanoiasrc.hg clockoverlay.hg decodebin.hg decodebin2.hg \
 		  ffmpegcolorspace.hg gdpdepay.hg gdppay.hg giosink.hg \
 		  giosrc.hg giostreamsink.hg giostreamsrc.hg \
 		  oggdemux.hg oggmux.hg playbin.hg playbin2.hg \
diff --git a/gstreamer/src/enums.ccg b/gstreamer/src/enums.ccg
index 8ef353b..8967478 100644
--- a/gstreamer/src/enums.ccg
+++ b/gstreamer/src/enums.ccg
@@ -19,10 +19,16 @@
 
 #include <gst/gstenumtypes.h>
 
+// Plug-in non-generated enum *_get_type() functions:
 extern "C"
 {
 
-// This function is needed for the TCPProtocol plug-in enum.
+static GType gst_autoplug_select_result_get_type()
+{
+  static GType const type = g_type_from_name("GstAutoplugSelectResult");
+  return type;
+}
+
 static GType gst_tcp_protocol_get_type()
 {
   static GType const type = g_type_from_name("GstTCPProtocol");
diff --git a/gstreamer/src/enums.hg b/gstreamer/src/enums.hg
index 5a52108..487363a 100644
--- a/gstreamer/src/enums.hg
+++ b/gstreamer/src/enums.hg
@@ -22,13 +22,24 @@
 
 _DEFS(gstreamermm,gst)
 
+// Plug-in C enums used in the plug-in signals need to be handwritten.  This
+// one is used in the "autoplug-select" signal of the decodebin2 plug-in:
+enum GstAutoplugSelectResult
+{
+  GST_AUTOPLUG_SELECT_TRY,
+  GST_AUTOPLUG_SELECT_EXPOSE,
+  GST_AUTOPLUG_SELECT_SKIP
+};
+
 namespace Gst
 {
 
 _WRAP_ENUM(MiniObjectFlags, GstMiniObjectFlags)
 _WRAP_ENUM(State, GstState)
 
-// This enum is wrapped for tcp plug-ins (which share it).
+// Plug-in non-genereated enums (some are shared, others are used in plug-in
+// signals and there's no way of knowing whether to generate them or not):
+_WRAP_ENUM(AutoplugSelectResult, GstAutoplugSelectResult)
 _WRAP_ENUM(TCPProtocol, GstTCPProtocol)
 
 } //namespace Gst
diff --git a/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc b/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
index 6f22b7b..dd39a02 100644
--- a/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
+++ b/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
@@ -40,11 +40,12 @@ GType type = 0;
 
 // To add an enum that is already wrapped to the list of wrapped enum, add
 // alphabetically below and increment WRAPPED_ENUMS_SIZE.
-static const int WRAPPED_ENUMS_SIZE = 42;
+static const int WRAPPED_ENUMS_SIZE = 43;
 static const char* wrappedEnums[WRAPPED_ENUMS_SIZE] =
 {
   "GstActivateMode",
   "GstAssocFlags",
+  "GstAutoplugSelectResult",
   "GstBufferCopyFlags",
   "GstBufferFlag",
   "GstBufferingMode",
@@ -194,10 +195,12 @@ bool is_plugin(const Glib::ustring& cTypeName)
   return result;
 }
 
-void get_property_wrap_statements(Glib::ustring& wrapStatements,
-  Glib::ustring& includeMacroCalls, Glib::ustring& enumWrapStatements,
+Glib::ustring get_property_wrap_statements(Glib::ustring& includeMacroCalls,
+  Glib::ustring& enumWrapStatements,
   Glib::ustring& enumGTypeFunctionDefinitions)
 {
+  Glib::ustring wrapStatements;
+
   //Get the list of properties:
   GParamSpec** ppParamSpec = 0;
   guint iCount = 0;
@@ -253,12 +256,12 @@ void get_property_wrap_statements(Glib::ustring& wrapStatements,
             get_cast_macro(propertyCType).lowercase() + "_get_type";
 
           enumGTypeFunctionDefinitions +=
-            "\nstatic GType " + enumGetTypeFunctionName + "()\n" +
+            "static GType " + enumGetTypeFunctionName + "()\n" +
             "{\n" +
             "  static GType const type = g_type_from_name(\"" +
               propertyCType + "\");\n" +
             "  return type;\n" +
-            "}\n";
+            "}\n\n";
         }
 
         wrapStatements += "  _WRAP_PROPERTY(\"" + propertyName + "\", " +
@@ -271,6 +274,7 @@ void get_property_wrap_statements(Glib::ustring& wrapStatements,
   }
 
   g_free(ppParamSpec);
+  return wrapStatements;
 }
 
 Glib::ustring get_method_name(const Glib::ustring& signalName)
@@ -291,9 +295,11 @@ Glib::ustring get_method_name(const Glib::ustring& signalName)
   return result;
 }
 
-void get_signal_wrap_statements(Glib::ustring& wrapStatements,
-  Glib::ustring& includeMacroCalls, Glib::ustring& cClassSignalDeclarations)
+Glib::ustring get_signal_wrap_statements(Glib::ustring& includeMacroCalls,
+  Glib::ustring& cClassSignalDeclarations)
 {
+  Glib::ustring wrapStatements;
+
   gpointer gclass_ref = 0;
   gpointer ginterface_ref = 0;
 
@@ -451,12 +457,15 @@ void get_signal_wrap_statements(Glib::ustring& wrapStatements,
     g_type_class_unref(gclass_ref); //to match the g_type_class_ref() above.
   else if(ginterface_ref)
     g_type_default_interface_unref(ginterface_ref); // for interface ref above.
+
+  return wrapStatements;
 }
 
-void get_interface_macros(Glib::ustring& interfaceMacros,
-  Glib::ustring& includeMacroCalls,
+Glib::ustring get_interface_macros(Glib::ustring& includeMacroCalls,
   Glib::ustring& cppExtends)
 {
+  Glib::ustring interfaceMacros;
+
   guint n_interfaces = 0;
   GType* interfaces = g_type_interfaces(type, &n_interfaces);
 
@@ -482,6 +491,7 @@ void get_interface_macros(Glib::ustring& interfaceMacros,
   }
 
   g_free(interfaces);
+  return interfaceMacros;
 }
 
 void generate_hg_file(const Glib::ustring& includeMacroCalls,
@@ -580,6 +590,9 @@ void generate_ccg_file(const Glib::ustring& enumGTypeFunctionDefinitions,
   std::cout << "extern \"C\"" << std::endl;
   std::cout << "{" << std::endl << std::endl;
 
+  if(!enumGTypeFunctionDefinitions.empty())
+    std::cout << enumGTypeFunctionDefinitions;
+
   std::cout << "GType " << getTypeName << "()" << std::endl;
   std::cout << "{" << std::endl;
   std::cout << "  static GType type = 0;" << std::endl;
@@ -605,9 +618,6 @@ void generate_ccg_file(const Glib::ustring& enumGTypeFunctionDefinitions,
   std::cout << "  return type;" << std::endl;
   std::cout << "}" << std::endl;
 
-  if(!enumGTypeFunctionDefinitions.empty())
-    std::cout << enumGTypeFunctionDefinitions;
-
   std::cout << std::endl << "} // extern \"C\"" << std::endl << std::endl;
 
   std::cout << "namespace " << nmspace << std::endl;
@@ -782,17 +792,17 @@ int main(int argc, char* argv[])
 
     if(hgFile || ccgFile)
     {
-      Glib::ustring propertyWrapStatements;
       Glib::ustring includeMacroCalls;
       Glib::ustring enumWrapStatements;
+      Glib::ustring propertyWrapStatements;
       Glib::ustring signalWrapStatements;
-      Glib::ustring enumGTypeFunctionDeclarations;
       Glib::ustring cClassSignalDeclarations;
+      Glib::ustring enumGTypeFunctionDefinitions;
 
-      get_property_wrap_statements(propertyWrapStatements, includeMacroCalls,
-        enumWrapStatements, enumGTypeFunctionDeclarations);
+      propertyWrapStatements = get_property_wrap_statements(includeMacroCalls,
+        enumWrapStatements, enumGTypeFunctionDefinitions);
 
-      get_signal_wrap_statements(signalWrapStatements, includeMacroCalls,
+      signalWrapStatements = get_signal_wrap_statements(includeMacroCalls,
         cClassSignalDeclarations);
 
       if(hgFile)
@@ -800,15 +810,14 @@ int main(int argc, char* argv[])
         Glib::ustring interfaceMacros;
         Glib::ustring cppExtends;
 
-        get_interface_macros(interfaceMacros, includeMacroCalls,
-          cppExtends);
+        interfaceMacros = get_interface_macros(includeMacroCalls, cppExtends);
 
         generate_hg_file(includeMacroCalls, enumWrapStatements, cppExtends,
           interfaceMacros, propertyWrapStatements, signalWrapStatements);
       }
       else
       {
-        generate_ccg_file(enumGTypeFunctionDeclarations,
+        generate_ccg_file(enumGTypeFunctionDefinitions,
           cClassSignalDeclarations);
       }
     }
diff --git a/tools/m4/convert_gst.m4 b/tools/m4/convert_gst.m4
index 57bc471..8c4d0db 100644
--- a/tools/m4/convert_gst.m4
+++ b/tools/m4/convert_gst.m4
@@ -1,5 +1,6 @@
 #Enums
 _CONV_ENUM(Gst,AssocFlags)
+_CONV_ENUM(Gst,AutoplugSelectResult)
 _CONV_ENUM(Gst,BaseAudioSinkSlaveMethod)
 _CONV_ENUM(Gst,BufferCopyFlags)
 _CONV_ENUM(Gst,BufferFlag)
@@ -85,6 +86,7 @@ _CONVERSION(`State&',`GstState*',`(GstState*)(&$3)')
 #ElementFactory
 _CONVERSION(`GstElementFactory*',`Glib::RefPtr<Gst::ElementFactory>',`Glib::wrap($3)')
 _CONVERSION(`GstElementFactory*',`Glib::RefPtr<const Gst::ElementFactory>',`Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<Gst::ElementFactory>&',`GstElementFactory*', `$3->gobj()')
 
 #Event
 _CONVERSION(`const Glib::RefPtr<Gst::Event>&',`GstEvent*', `Gst::unwrap($3)')
@@ -205,6 +207,7 @@ _CONVERSION(`const va_list&',`va_list',`const_cast<va_list&>($3)')
 _CONVERSION(`GQuark',`Glib::QueryQuark',`Glib::QueryQuark($3)')
 _CONVERSION(`const Glib::QueryQuark&',`GQuark',`$3')
 _CONVERSION(`Glib::StaticRecMutex&',`GStaticRecMutex*',`$3.gobj()')
+_CONVERSION(`const Glib::ValueArray&',`GValueArray*',`const_cast<GValueArray*>($3.gobj())')
 
 #String Conversions
 _CONVERSION(`const std::string&',`const guchar*',`($2)($3.c_str())')
diff --git a/tools/m4/ctocpp_gstreamermm.m4 b/tools/m4/ctocpp_gstreamermm.m4
index fbef4c4..a7203b1 100644
--- a/tools/m4/ctocpp_gstreamermm.m4
+++ b/tools/m4/ctocpp_gstreamermm.m4
@@ -5,18 +5,23 @@
 _TRANSLATION(`GstFlowReturn',`Gst::FlowReturn',`Gst::FlowReturn',,`<gstreamermm/pad.h>')
 _TRANSLATION(`GstFormat',`Gst::Format',`Gst::Format',,`<gstreamermm/format.h>')
 _TRANSLATION(`GstTCPProtocol',`Gst::TCPProtocol',`Gst::TCPProtocol',,`<gstreamermm/enums.h>')
+_TRANSLATION(`GstAutoplugSelectResult',`Gst::AutoplugSelectResult',`Gst::AutoplugSelectResult',,`<gstreamermm/enums.h>')
 
 #giomm
 _TRANSLATION(`GFile*',`Gio::File',`const Glib::RefPtr<Gio::File>&',`Glib::RefPtr<Gio::File>',`<giomm/file.h>')
 _TRANSLATION(`GInputStream*',`Gio::InputStream',`const Glib::RefPtr<Gio::InputStream>&',`Glib::RefPtr<Gio::InputStream>',`<giomm/inputstream.h>')
 _TRANSLATION(`GOutputStream*',`Gio::OutputStream',`const Glib::RefPtr<Gio::OutputStream>&',`Glib::RefPtr<Gio::OutputStream>',`<giomm/outputstream.h>')
 
+#glibmm
+_TRANSLATION(`GValueArray*',`Glib::ValueArray',`const Glib::ValueArray&',`Glib::ValueArray',`<glibmm/valuearray.h>')
+
 #gstreamermm
 _TRANSLATION(`GstBuffer*',`Gst::Buffer',`const Glib::RefPtr<Gst::Buffer>&',`Glib::RefPtr<Gst::Buffer>',`<gstreamermm/buffer.h>')
 _TRANSLATION(`GstCaps*',`Gst::Caps',`const Glib::RefPtr<Gst::Caps>&',`Glib::RefPtr<Gst::Caps>',`<gstreamermm/caps.h>')
 _TRANSLATION(`GstElement*',`Gst::Element',`const Glib::RefPtr<Gst::Element>&',`Glib::RefPtr<Gst::Element>',`<gstreamermm/element.h>')
+_TRANSLATION(`GstElementFactory*',`Gst::ElementFactory',`const Glib::RefPtr<Gst::ElementFactory>&',`Glib::RefPtr<Gst::ElementFactory>',`<gstreamermm/elementfactory.h>')
 _TRANSLATION(`GstPad*',`Gst::Pad',`const Glib::RefPtr<Gst::Pad>&',`Glib::RefPtr<Gst::Pad>',`<gstreamermm/pad.h>')
-_TRANSLATION(`GstTagList*',`Gst::TagList',`Gst::TagList',,`<gstreamermm/taglist.h>')
+_TRANSLATION(`GstTagList*',`Gst::TagList',`const Gst::TagList&',`Gst::TagList',`<gstreamermm/taglist.h>')
 
 #Interfaces
 _TRANSLATION(`GstColorBalance*',`Gst::ColorBalance',`const Glib::RefPtr<Gst::ColorBalance>&',`Glib::RefPtr<Gst::ColorBalance>',`<gstreamermm/colorbalance.h>')



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