diff --git a/ChangeLog b/ChangeLog index caa373f307..cfc20a45d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2006-05-19 Edward Hervey + + * configure.ac: + * gst/Makefile.am: + * gst/gst-0.10.7.ignore: + * gst/gstversion.override.in: + Added ignore file for core 0.10.7 + * gst/base.defs: + Added gst_adapter_take_buffer + * gst/gst-0.10.6.ignore: + Filed API addition for 0.10.6 + * gst/gst-types.defs: + Added GstTypeFind pointer definition + * gst/gst.defs: + * gst/gst.override: + Added fake function gst_type_find_new() to create a GstTypeFind that can + be used in all typefinding function. + GstTypeFind * + gst_type_find_new(data, peekfunction, suggestfunction [, getlenghtfunction]) + 2006-05-09 Edward Hervey * configure.ac: diff --git a/common b/common index e41606ab2c..764c5f2510 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit e41606ab2c6a31be473de511b5fd776bd2593b56 +Subproject commit 764c5f25101d20da7f26942c36ba840ba65c63d7 diff --git a/configure.ac b/configure.ac index a8295e35ce..20b3960f72 100644 --- a/configure.ac +++ b/configure.ac @@ -113,16 +113,25 @@ then else IGNORE_GST_0_10_6="" fi + + if test $GST_MINOR_VERSION -lt "7" + then + IGNORE_GST_0_10_7="gst-0.10.7.ignore" + else + IGNORE_GST_0_10_7="" + fi else IGNORE_GST_0_10_3="" IGNORE_GST_0_10_4="" IGNORE_GST_0_10_5="" IGNORE_GST_0_10_6="" + IGNORE_GST_0_10_7="" fi AC_SUBST(IGNORE_GST_0_10_3) AC_SUBST(IGNORE_GST_0_10_4) AC_SUBST(IGNORE_GST_0_10_5) AC_SUBST(IGNORE_GST_0_10_6) +AC_SUBST(IGNORE_GST_0_10_7) dnl check for gstreamer-base; uninstalled is selected preferentially PKG_CHECK_MODULES(GST_BASE, gstreamer-base-$GST_MAJORMINOR >= $GST_REQ, diff --git a/gst/Makefile.am b/gst/Makefile.am index 2802333dd2..9c776c604d 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -26,7 +26,8 @@ versioned_overrides = \ gst-0.10.3.ignore \ gst-0.10.4.ignore \ gst-0.10.5.ignore \ - gst-0.10.6.ignore + gst-0.10.6.ignore \ + gst-0.10.7.ignore INCLUDES = $(PYTHON_INCLUDES) EXTRA_DIST = $(defs_DATA) $(versioned_overrides) common.h arg-types.py diff --git a/gst/base.defs b/gst/base.defs index f12c4c0984..c4d97a635b 100644 --- a/gst/base.defs +++ b/gst/base.defs @@ -105,6 +105,15 @@ ) ) +(define-method take_buffer + (of-object "GstAdapter") + (c-name "gst_adapter_take_buffer") + (return-type "GstBuffer*") + (parameters + '("guint" "nbytes") + ) +) + (define-method available (of-object "GstAdapter") (c-name "gst_adapter_available") diff --git a/gst/gst-0.10.6.ignore b/gst/gst-0.10.6.ignore index 3a31b8ac95..63c8507885 100644 --- a/gst/gst-0.10.6.ignore +++ b/gst/gst-0.10.6.ignore @@ -3,4 +3,5 @@ ignore gst_event_new_new_segment_full gst_event_parse_new_segment_full gst_segment_set_newsegment_full + gst_adapter_take_buffer %% diff --git a/gst/gst-0.10.7.ignore b/gst/gst-0.10.7.ignore new file mode 100644 index 0000000000..496f1770c9 --- /dev/null +++ b/gst/gst-0.10.7.ignore @@ -0,0 +1,7 @@ +%% +ignore + gst_type_find_new +%% +ignore-type + GstTypeFind +%% diff --git a/gst/gst-types.defs b/gst/gst-types.defs index 3bb7222f68..6f456908a6 100644 --- a/gst/gst-types.defs +++ b/gst/gst-types.defs @@ -305,6 +305,14 @@ ) ) +(define-pointer TypeFind + (in-module "Gst") + (c-name "GstTypeFind") + (gtype-id "GST_TYPE_TYPE_FIND") + (fields + ) +) + ;; Enumerations and flags ... (define-flags BinFlags diff --git a/gst/gst.defs b/gst/gst.defs index 12cbc73329..d7fbac3593 100644 --- a/gst/gst.defs +++ b/gst/gst.defs @@ -6089,6 +6089,11 @@ ;; From ../gstreamer/gst/gsttypefind.h +(define-function type_find_new + (c-name "gst_type_find_new") + (return-type "GstTypeFind*") +) + (define-method peek (of-object "GstTypeFind") (c-name "gst_type_find_peek") diff --git a/gst/gst.override b/gst/gst.override index 143a19ba11..9803ffa0ff 100644 --- a/gst/gst.override +++ b/gst/gst.override @@ -967,3 +967,168 @@ _wrap_gst_type_find_helper_for_buffer (PyObject *self, PyObject *args, PyObject return py_ret; } +%% +override gst_type_find_new kwargs + +static guint8 * +gst_type_find_peek_handler (gpointer data, gint64 offset, guint size) +{ + PyGILState_STATE state; + guint8 * ret = NULL; + PyObject *py_data; + PyObject *callback, *args; + PyObject *py_ret; + + GST_DEBUG ("mkay"); + + g_return_val_if_fail (data != NULL, NULL); + py_data = (PyObject *) data; + g_assert (PyTuple_Check (py_data)); + + state = pyg_gil_state_ensure (); + + /* Figure out the callback and create the arguments */ + if (!(callback = PyTuple_GetItem(py_data, 1))) + goto beach; + + args = Py_BuildValue ("(OLI)", + PyTuple_GetItem(py_data, 0), + offset, size); + if (!args) + goto beach; + + /* Call python method */ + py_ret = PyObject_CallObject (callback, args); + + /* transform return value (a string) */ + if (!py_ret) { + Py_DECREF (args); + goto beach; + } + if (!PyString_Check(py_ret)) { + Py_DECREF (py_ret); + Py_DECREF (args); + goto beach; + } else { + gchar *str; + int len; + + if ((PyString_AsStringAndSize(py_ret, &str, &len)) == -1) { + Py_DECREF (py_ret); + Py_DECREF (args); + goto beach; + } + GST_DEBUG ("got string of len %d", len); + if (len) + ret = g_memdup((gconstpointer) str, (guint) len); + } + Py_DECREF (py_ret); + Py_DECREF (args); + + beach: + pyg_gil_state_release (state); + return ret; +} + +static void +gst_type_find_suggest_handler (gpointer data, guint probability, const GstCaps * caps) +{ + PyGILState_STATE state; + PyObject *py_data; + PyObject *callback, *args; + + GST_DEBUG ("mkay"); + + if (!data) + return; + py_data = (PyObject *) data; + g_assert (PyTuple_Check (py_data)); + + state = pyg_gil_state_ensure (); + + /* Figure out the callback and create the arguments */ + if (!(callback = PyTuple_GetItem(py_data, 2))) + goto beach; + + args = Py_BuildValue ("(OIN)", + PyTuple_GetItem(py_data, 0), + probability, pyg_boxed_new (GST_TYPE_CAPS, (GstCaps*) caps, FALSE, TRUE)); + if (!args) + goto beach; + + /* Call python method */ + PyObject_CallObject (callback, args); + + Py_DECREF (args); + + beach: + pyg_gil_state_release (state); + return; +} + +static guint64 +gst_type_find_get_length_handler (gpointer data) +{ + guint64 ret = 0; + + /* Call python method */ + return ret; +} + +static PyObject * +_wrap_gst_type_find_new (PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "data", "peekfunction", "suggestfunction", "getlengthfunction", NULL }; + PyObject *py_data; + gpointer data; + PyObject *peekfunction; + PyObject *suggestfunction; + PyObject *getlengthfunction = NULL; + PyObject *pytypefind = NULL; + GstTypeFind *typefind = NULL; + + GST_DEBUG ("poeut"); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO|O:type_find_new", + kwlist, &py_data, &peekfunction, + &suggestfunction, &getlengthfunction)) { + PyErr_SetString (PyExc_TypeError, "Error parsing values ..."); + return NULL; + } + + if (!PyCallable_Check(peekfunction)) { + PyErr_SetString (PyExc_TypeError, "peekfunction is not callable"); + return NULL; + } + if (!PyCallable_Check(suggestfunction)) { + PyErr_SetString (PyExc_TypeError, "suggestfunction is not callable"); + return NULL; + } + if (getlengthfunction && (!PyCallable_Check(suggestfunction))) { + PyErr_SetString (PyExc_TypeError, "getlengthfunction is not callable"); + return NULL; + } + + /* Create a python list to put in typefind->data */ + if (getlengthfunction) + data = Py_BuildValue("(OOOO)", py_data, peekfunction, suggestfunction, getlengthfunction); + else + data = Py_BuildValue("(OOO)", py_data, peekfunction, suggestfunction); + + typefind = g_new0(GstTypeFind, 1); + typefind->peek = gst_type_find_peek_handler; + typefind->suggest = gst_type_find_suggest_handler; + typefind->data = data; + if (getlengthfunction) + typefind->get_length = gst_type_find_get_length_handler; + + pytypefind = pyg_pointer_new (GST_TYPE_TYPE_FIND, typefind); + + if (!pytypefind) { + PyErr_SetString (PyExc_TypeError, "pyg_pointer_new failed"); + } + + GST_DEBUG ("poeut : %p", pytypefind); + + return pytypefind; +} diff --git a/gst/gstversion.override.in b/gst/gstversion.override.in index b4584e078d..168f4a09bb 100644 --- a/gst/gstversion.override.in +++ b/gst/gstversion.override.in @@ -4,4 +4,5 @@ include @IGNORE_GST_0_10_4@ @IGNORE_GST_0_10_5@ @IGNORE_GST_0_10_6@ +@IGNORE_GST_0_10_7@ %%