gst/Makefile.am: gst.pbutils also needs to handle miniobjects
authorEdward Hervey <bilboed@bilboed.com>
Fri, 11 Jan 2008 16:30:45 +0000 (16:30 +0000)
committerEdward Hervey <bilboed@bilboed.com>
Fri, 11 Jan 2008 16:30:45 +0000 (16:30 +0000)
Original commit message from CVS:
* gst/Makefile.am:
gst.pbutils also needs to handle miniobjects
* gst/pbutils.defs:
Add new InstallPluginsContext boxed definition.
All the *_new() functions should be accessible (and not act as
constructors).
* gst/pbutils.override:
Add override for install_plugins_sync().
* gst/pbutilsmodule.c:
Add pygst_debug debug category in this module too.
* testsuite/test_pbutils.py:
Test existence of new API. Needs more tests.

ChangeLog
common
gst/Makefile.am
gst/pbutils.defs
gst/pbutils.override
gst/pbutilsmodule.c
testsuite/test_pbutils.py

index 67871f7..5de8faf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2008-01-11  Edward Hervey  <edward.hervey@collabora.co.uk>
+
+       * gst/Makefile.am:
+       gst.pbutils also needs to handle miniobjects
+       * gst/pbutils.defs:
+       Add new InstallPluginsContext boxed definition.
+       All the *_new() functions should be accessible (and not act as
+       constructors).
+       * gst/pbutils.override:
+       Add override for install_plugins_sync().
+       * gst/pbutilsmodule.c:
+       Add pygst_debug debug category in this module too.
+       * testsuite/test_pbutils.py:
+       Test existence of new API. Needs more tests.
+
 2008-01-10  Sebastian Dröge  <slomo@circular-chaos.org>
 
        * autogen.sh:
diff --git a/common b/common
index 49c2fc5..bd02d78 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 49c2fc5c9bff0e9858e89978bd98164a386de51d
+Subproject commit bd02d788384b40ff511cac0e32aa77f51a68912d
index 233a463..8246dfd 100644 (file)
@@ -100,7 +100,7 @@ pbutils_la_CFLAGS = $(common_cflags) $(GST_PLUGINS_BASE_CFLAGS)
 pbutils_la_LIBADD = $(common_libadd) $(GST_PLUGINS_BASE_LIBS) -lgstpbutils-0.10
 pbutils_la_LDFLAGS = $(common_ldflags) \
        -export-symbols-regex "^(initpbutils|_PyGObject_API).*" $(GST_PLUGINS_BASE_LIBS)
-pbutils_la_SOURCES = pbutilsmodule.c gst-argtypes.c
+pbutils_la_SOURCES = pbutilsmodule.c gst-argtypes.c pygstminiobject.c
 nodist_pbutils_la_SOURCES = pbutils.c
 PBUTILS_OVERRIDES = pbutils.override
 PBUTILS_DEFS = pbutils.defs
index b4c3c3b..85934df 100644 (file)
@@ -2,6 +2,12 @@
 ; object definitions ...
 ;; Enumerations and flags ...
 
+(define-boxed InstallPluginsContext
+  (in-module "Gst")
+  (c-name "GstInstallPluginsContext")
+  (gtype-id "GST_TYPE_INSTALL_PLUGINS_CONTEXT")
+)
+
 (define-enum InstallPluginsReturn
   (in-module "Gst")
   (c-name "GstInstallPluginsReturn")
 
 (define-function missing_uri_source_message_new
   (c-name "gst_missing_uri_source_message_new")
-  (is-constructor-of "GstMissingUriSourceMessage")
   (return-type "GstMessage*")
   (parameters
     '("GstElement*" "element")
 
 (define-function missing_uri_sink_message_new
   (c-name "gst_missing_uri_sink_message_new")
-  (is-constructor-of "GstMissingUriSinkMessage")
   (return-type "GstMessage*")
   (parameters
     '("GstElement*" "element")
 
 (define-function missing_element_message_new
   (c-name "gst_missing_element_message_new")
-  (is-constructor-of "GstMissingElementMessage")
   (return-type "GstMessage*")
   (parameters
     '("GstElement*" "element")
 
 (define-function missing_decoder_message_new
   (c-name "gst_missing_decoder_message_new")
-  (is-constructor-of "GstMissingDecoderMessage")
   (return-type "GstMessage*")
   (parameters
     '("GstElement*" "element")
 
 (define-function missing_encoder_message_new
   (c-name "gst_missing_encoder_message_new")
-  (is-constructor-of "GstMissingEncoderMessage")
   (return-type "GstMessage*")
   (parameters
     '("GstElement*" "element")
 
 (define-function missing_uri_source_installer_detail_new
   (c-name "gst_missing_uri_source_installer_detail_new")
-  (is-constructor-of "GstMissingUriSourceInstallerDetail")
   (return-type "gchar*")
   (parameters
     '("const-gchar*" "protocol")
 
 (define-function missing_uri_sink_installer_detail_new
   (c-name "gst_missing_uri_sink_installer_detail_new")
-  (is-constructor-of "GstMissingUriSinkInstallerDetail")
   (return-type "gchar*")
   (parameters
     '("const-gchar*" "protocol")
 
 (define-function missing_element_installer_detail_new
   (c-name "gst_missing_element_installer_detail_new")
-  (is-constructor-of "GstMissingElementInstallerDetail")
   (return-type "gchar*")
   (parameters
     '("const-gchar*" "factory_name")
 
 (define-function missing_decoder_installer_detail_new
   (c-name "gst_missing_decoder_installer_detail_new")
-  (is-constructor-of "GstMissingDecoderInstallerDetail")
   (return-type "gchar*")
   (parameters
     '("const-GstCaps*" "decode_caps")
 
 (define-function missing_encoder_installer_detail_new
   (c-name "gst_missing_encoder_installer_detail_new")
-  (is-constructor-of "GstMissingEncoderInstallerDetail")
   (return-type "gchar*")
   (parameters
     '("const-GstCaps*" "encode_caps")
index 85fce41..7dd8113 100644 (file)
@@ -28,6 +28,9 @@ headers
 #include <gst/gst.h>
 
 #include <gst/pbutils/pbutils.h>
+#include "pygstminiobject.h"
+GST_DEBUG_CATEGORY_EXTERN (pygst_debug);
+#define GST_CAT_DEFAULT pygst_debug
 
 %%
 modulename gst.pbutils
@@ -44,5 +47,66 @@ include
 ignore-glob
  _*
  *init
+ *_free
  *_get_type
 %%
+override gst_install_plugins_sync kwargs
+static PyObject *
+_wrap_gst_install_plugins_sync(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+    static char *kwlist[] = { "details", "context", NULL };
+    PyObject *py_ctx;
+    GstInstallPluginsContext *ctx;
+    GstInstallPluginsReturn ret;
+    gchar **details;
+    gint len;
+    PyObject *py_ret;
+    PyObject *py_details;
+    Py_ssize_t i;
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:install_plugins_async",
+                                    kwlist, &py_details, &py_ctx))
+       return NULL;
+
+    if (!pyg_boxed_check(py_ctx, GST_TYPE_INSTALL_PLUGINS_CONTEXT)) {
+       PyErr_SetString(PyExc_TypeError, "Argument 2 must be a gst.pbutils.InstallPluginsContext");
+       return NULL;
+    }
+
+    len = PySequence_Size(py_details);
+    if ((!PySequence_Check(py_details)) || (len < 1)) {
+       PyErr_SetString(PyExc_TypeError, "Details need to be a non-empty list or tuple of strings");
+       Py_DECREF(py_details);
+       return NULL;
+    }
+
+    details = g_new0(gchar*, len+1);
+
+    /* Check all items in py_details are strings */
+    for (i = 0; i < len; i++) {
+       PyObject *py_str = PySequence_GetItem(py_details, i);
+       gchar *str;
+
+       if (!PyString_Check(py_str)) {
+           PyErr_SetString(PyExc_TypeError, "Details need to be a non-empty list or tuple of strings");
+           Py_DECREF(py_str);
+           Py_DECREF(py_details);
+           return NULL;
+       }
+       if (!(str = PyString_AsString(py_str))) {
+           Py_DECREF(py_str);
+           Py_DECREF(py_details);
+           return NULL;
+       }
+       details[i] = g_strdup(str);
+       Py_DECREF(py_str);
+    }
+    
+    ctx = (GstInstallPluginsContext *) pyg_boxed_get(py_ctx, GstInstallPluginsContext);
+    ret = gst_install_plugins_sync(details, ctx);
+
+    g_strfreev(details);
+
+    py_ret = pyg_enum_from_gtype(GST_TYPE_INSTALL_PLUGINS_RETURN, ret);
+    return py_ret;
+}
index f1ced05..9df79a1 100644 (file)
@@ -32,6 +32,8 @@ void pypbutils_add_constants(PyObject *module, const gchar *strip_prefix);
                
 extern PyMethodDef pypbutils_functions[];
 
+GST_DEBUG_CATEGORY (pygst_debug); /* for python code */
+
 DL_EXPORT(void)
 initpbutils (void)
 {
index c3abf96..b5540c6 100644 (file)
@@ -55,6 +55,11 @@ class Descriptions(TestCase):
     def testAddCodecDescription(self):
         assert hasattr(gst.pbutils, 'add_codec_description_to_tag_list')
 
+class InstallPlugins(TestCase):
+
+    def testPluginsContext(self):
+        assert hasattr(gst.pbutils, "InstallPluginsContext")
+
 # TODO
 # Add tests for the other parts of pbutils:
 # * missing-plugins