Commit a41177e5 authored by Edward Hervey's avatar Edward Hervey 🤘

Wrap new API added in gstreamer-0.10.23. Partially fixes #578848

parent e9d2003a
......@@ -160,6 +160,13 @@ then
IGNORE_GST_0_10_22=""
fi
if test $GST_MINOR_VERSION -lt "23"
then
IGNORE_GST_0_10_23="gst-0.10.23.ignore"
else
IGNORE_GST_0_10_23=""
fi
dnl plugins base
if test $GST_PB_MINOR_VERSION -lt "14"
then
......@@ -199,6 +206,7 @@ else
IGNORE_GST_0_10_20=""
IGNORE_GST_0_10_21=""
IGNORE_GST_0_10_22=""
IGNORE_GST_0_10_23=""
IGNORE_GST_PB_0_10_14=""
IGNORE_GST_PB_0_10_16=""
IGNORE_GST_PB_0_10_18=""
......@@ -216,6 +224,7 @@ AC_SUBST(IGNORE_GST_0_10_18)
AC_SUBST(IGNORE_GST_0_10_20)
AC_SUBST(IGNORE_GST_0_10_21)
AC_SUBST(IGNORE_GST_0_10_22)
AC_SUBST(IGNORE_GST_0_10_23)
AC_SUBST(IGNORE_GST_PB_0_10_14)
AC_SUBST(IGNORE_GST_PB_0_10_16)
AC_SUBST(IGNORE_GST_PB_0_10_18)
......
......@@ -33,6 +33,7 @@ versioned_overrides = \
gst-0.10.20.ignore \
gst-0.10.21.ignore \
gst-0.10.22.ignore \
gst-0.10.23.ignore \
gst-pb-0.10.14.ignore \
gst-pb-0.10.16.ignore \
gst-pb-0.10.18.ignore \
......
......@@ -974,6 +974,15 @@
)
)
(define-function type_find_helper_for_extension
(c-name "gst_type_find_helper_for_extension")
(return-type "GstCaps*")
(parameters
'("GstObject*" "obj")
'("const-gchar*" "extension")
)
)
;; From gstdataqueue.h
(define-function gst_data_queue_get_type
......
%%
ignore
gst_debug_construct_win_color
gst_message_new_request_state
gst_message_parse_request_state
gst_util_array_binary_search
gst_poll_new_timer
gst_poll_write_control
gst_poll_read_control
gst_tag_list_get_buffer
gst_tag_list_get_buffer_index
gst_fixme
gst_memdump
gst_object_fixme
gst_object_memdump
gst_type_find_helper_for_extension
%%
ignore-type
GstSearchMode
%%
......@@ -67,6 +67,22 @@
)
)
(define-function fixme
(c-name "gst_fixme")
(return-type "none")
(parameters
'("gchar *" "msg")
)
)
(define-function memdump
(c-name "gst_memdump")
(return-type "none")
(parameters
'("gchar *" "msg")
)
)
;; OBJECT DEBUGGING FUNCTIONS FROM PYTHON
;; The c functions don't actually exist
......@@ -114,3 +130,21 @@
'("gchar *" "msg")
)
)
(define-method fixme
(of-object "GstObject")
(c-name "gst_object_fixme")
(return-type "none")
(parameters
'("gchar *" "msg")
)
)
(define-method memdump
(of-object "GstObject")
(c-name "gst_object_memdump")
(return-type "none")
(parameters
'("gchar *" "msg")
)
)
......@@ -349,6 +349,9 @@
'("in-caps" "GST_BUFFER_FLAG_IN_CAPS")
'("gap" "GST_BUFFER_FLAG_GAP")
'("delta-unit" "GST_BUFFER_FLAG_DELTA_UNIT")
'("media1" "GST_BUFFER_FLAG_MEDIA1")
'("media2" "GST_BUFFER_FLAG_MEDIA2")
'("media3" "GST_BUFFER_FLAG_MEDIA3")
'("last" "GST_BUFFER_FLAG_LAST")
)
)
......@@ -459,6 +462,18 @@
)
)
(define-flags ParamFlags
(in-module "Gst")
(c-name "GstParamFlags")
(values
'("controllable" "GST_PARAM_CONTROLLABLE")
'("mutable-ready" "GST_PARAM_MUTABLE_READY")
'("mutable-paused" "GST_PARAM_MUTABLE_PAUSED")
'("mutable-playing" "GST_PARAM_MUTABLE_PLAYING")
'("user-shift" "GST_PARAM_USER_SHIFT")
)
)
(define-enum CoreError
(in-module "Gst")
(c-name "GstCoreError")
......@@ -697,6 +712,8 @@
'("info" "GST_LEVEL_INFO")
'("debug" "GST_LEVEL_DEBUG")
'("log" "GST_LEVEL_LOG")
'("fixme" "GST_LEVEL_FIXME")
'("memdump" "GST_LEVEL_MEMDUMP")
'("count" "GST_LEVEL_COUNT")
)
)
......@@ -778,6 +795,7 @@
'("latency" "GST_MESSAGE_LATENCY")
'("async-start" "GST_MESSAGE_ASYNC_START")
'("async-done" "GST_MESSAGE_ASYNC_DONE")
'("request-state" "GST_MESSAGE_REQUEST_STATE")
'("any" "GST_MESSAGE_ANY")
)
)
......@@ -1115,6 +1133,17 @@
)
)
(define-enum SearchMode
(in-module "Gst")
(c-name "GstSearchMode")
(gtype-id "GST_TYPE_SEARCH_MODE")
(values
'("exact" "GST_SEARCH_MODE_EXACT")
'("before" "GST_SEARCH_MODE_BEFORE")
'("after" "GST_SEARCH_MODE_AFTER")
)
)
(define-interface URIHandler
(in-module "Gst")
(c-name "GstURIHandler")
......
......@@ -2849,6 +2849,14 @@
)
)
(define-function debug_construct_win_color
(c-name "gst_debug_construct_win_color")
(return-type "gint")
(parameters
'("guint" "colorinfo")
)
)
(define-function debug_remove_log_function
(c-name "gst_debug_remove_log_function")
(return-type "guint")
......@@ -3255,6 +3263,25 @@
)
)
(define-function message_new_request_state
(c-name "gst_message_new_request_state")
(return-type "GstMessage*")
(caller-owns-return #t)
(parameters
'("GstObject*" "src")
'("GstState" "state")
)
)
(define-method parse_request_state
(of-object "GstMessage")
(c-name "gst_message_parse_request_state")
(return-type "none")
(parameters
'("GstState*" "state")
)
)
(define-function message_new_custom
(c-name "gst_message_new_custom")
(return-type "GstMessage*")
......@@ -4414,6 +4441,20 @@
(return-type "GstClockTime")
)
(define-function util_array_binary_search
(c-name "gst_util_array_binary_search")
(return-type "gpointer")
(parameters
'("gpointer" "array")
'("guint" "num_elements")
'("gsize" "element_size")
'("GCompareDataFunc" "search_func")
'("GstSearchMode" "mode")
'("gconstpointer" "search_data")
'("gpointer" "user_data")
)
)
(define-function pad_load_and_link
(c-name "gst_pad_load_and_link")
(return-type "none")
......@@ -4845,6 +4886,12 @@
)
)
(define-function poll_new_timer
(c-name "gst_poll_new_timer")
(caller-owns-return #t)
(return-type "GstPoll*")
)
(define-method free
(of-object "GstPoll")
(c-name "gst_poll_free")
......@@ -4973,6 +5020,18 @@
)
)
(define-method write_control
(of-object "GstPoll")
(c-name "gst_poll_write_control")
(return-type "gboolean")
)
(define-method read_control
(of-object "GstPoll")
(c-name "gst_poll_read_control")
(return-type "gboolean")
)
;; From gstpreset.h
(define-function gst_preset_get_type
......@@ -6738,6 +6797,26 @@
)
)
(define-method get_buffer
(of-object "GstTagList")
(c-name "gst_tag_list_get_buffer")
(return-type "gboolean")
(parameters
'("const-gchar*" "tag")
'("GstBuffer**" "value")
)
)
(define-method get_buffer_index
(of-object "GstTagList")
(c-name "gst_tag_list_get_buffer_index")
(return-type "gboolean")
(parameters
'("const-gchar*" "tag")
'("guint" "index")
'("GstBuffer**" "value")
)
)
;; From ../gstreamer/gst/gsttaginterface.h
......
......@@ -802,6 +802,20 @@ _wrap_gst_error (PyObject *whatever, PyObject *string)
{
return pygst_debug_log (whatever, string, GST_LEVEL_ERROR, FALSE);
}
%%
override gst_fixme args
static PyObject *
_wrap_gst_fixme (PyObject *whatever, PyObject *string)
{
return pygst_debug_log (whatever, string, GST_LEVEL_FIXME, FALSE);
}
%%
override gst_memdump args
static PyObject *
_wrap_gst_memdump (PyObject *whatever, PyObject *string)
{
return pygst_debug_log (whatever, string, GST_LEVEL_MEMDUMP, FALSE);
}
%%
override gst_object_log args
......@@ -839,6 +853,20 @@ _wrap_gst_object_error (PyObject *whatever, PyObject *string)
return pygst_debug_log (whatever, string, GST_LEVEL_ERROR, TRUE);
}
%%
override gst_object_fixme args
static PyObject *
_wrap_gst_object_fixme (PyObject *whatever, PyObject *string)
{
return pygst_debug_log (whatever, string, GST_LEVEL_FIXME, TRUE);
}
%%
override gst_object_memdump args
static PyObject *
_wrap_gst_object_memdump (PyObject *whatever, PyObject *string)
{
return pygst_debug_log (whatever, string, GST_LEVEL_MEMDUMP, TRUE);
}
%%
override GST_TIME_ARGS kwargs
static PyObject *
_wrap_GST_TIME_ARGS(PyObject *self, PyObject *args, PyObject *kwargs)
......
......@@ -34,14 +34,14 @@
#include <locale.h>
void pygst_register_classes (PyObject *d);
void pygst_add_constants(PyObject *module, const gchar *strip_prefix);
void _pygst_register_boxed_types(PyObject *moddict);
void pygst_register_classes (PyObject * d);
void pygst_add_constants (PyObject * module, const gchar * strip_prefix);
void _pygst_register_boxed_types (PyObject * moddict);
extern PyMethodDef pygst_functions[];
GST_DEBUG_CATEGORY (pygst_debug); /* for bindings code */
GST_DEBUG_CATEGORY (python_debug); /* for python code */
GST_DEBUG_CATEGORY (pygst_debug); /* for bindings code */
GST_DEBUG_CATEGORY (python_debug); /* for python code */
/* copied from pygtk to register GType */
#define REGISTER_TYPE(d, type, name) \
......@@ -58,200 +58,218 @@ GST_DEBUG_CATEGORY (python_debug); /* for python code */
o=pyg_type_wrapper_new(gtype)); \
Py_DECREF(o);
static PyObject*
pygstminiobject_from_gvalue(const GValue *value)
static PyObject *
pygstminiobject_from_gvalue (const GValue * value)
{
GstMiniObject *miniobj;
GstMiniObject *miniobj;
if ((miniobj = gst_value_get_mini_object (value)) == NULL) {
Py_INCREF(Py_None);
return Py_None;
}
return pygstminiobject_new(miniobj);
if ((miniobj = gst_value_get_mini_object (value)) == NULL) {
Py_INCREF (Py_None);
return Py_None;
}
return pygstminiobject_new (miniobj);
}
static int
pygstminiobject_to_gvalue(GValue *value, PyObject *obj)
pygstminiobject_to_gvalue (GValue * value, PyObject * obj)
{
PyGstMiniObject *self = (PyGstMiniObject*) obj;
PyGstMiniObject *self = (PyGstMiniObject *) obj;
gst_value_set_mini_object(value, self->obj);
return 0;
gst_value_set_mini_object (value, self->obj);
return 0;
}
static void
sink_gstobject(GObject *object)
sink_gstobject (GObject * object)
{
if (GST_OBJECT_IS_FLOATING(object)) {
g_object_ref(object);
gst_object_sink(GST_OBJECT(object));
}
if (GST_OBJECT_IS_FLOATING (object)) {
g_object_ref (object);
gst_object_sink (GST_OBJECT (object));
}
}
DL_EXPORT(void)
DL_EXPORT (void)
init_gst (void)
{
PyObject *m, *d;
PyObject *av, *tuple;
int argc, i;
guint major, minor, micro, nano;
char **argv;
GError *error = NULL;
init_pygobject ();
/* pull in arguments */
av = PySys_GetObject ("argv");
if (av != NULL) {
argc = PyList_Size (av);
argv = g_new (char *, argc);
for (i = 0; i < argc; i++)
argv[i] = g_strdup (PyString_AsString (PyList_GetItem (av, i)));
} else {
/* gst_init_check does not like argc == 0 */
argc = 1;
argv = g_new (char *, argc);
argv[0] = g_strdup("");
}
if (!gst_init_check (&argc, &argv, &error)) {
gchar *errstr;
if (argv != NULL) {
for (i = 0; i < argc; i++)
g_free (argv[i]);
g_free (argv);
}
errstr = g_strdup_printf ("can't initialize module gst: %s",
error ? GST_STR_NULL (error->message) : "no error given");
PyErr_SetString (PyExc_RuntimeError, errstr);
g_free (errstr);
g_error_free (error);
setlocale(LC_NUMERIC, "C");
return;
}
setlocale(LC_NUMERIC, "C");
if (argv != NULL) {
PySys_SetArgv (argc, argv);
for (i = 0; i < argc; i++)
g_free (argv[i]);
g_free (argv);
}
/* Initialize debugging category */
GST_DEBUG_CATEGORY_INIT (pygst_debug, "pygst", 0, "GStreamer python bindings");
GST_DEBUG_CATEGORY_INIT (python_debug, "python",
GST_DEBUG_FG_GREEN, "python code using gst-python");
pygobject_register_sinkfunc(GST_TYPE_OBJECT, sink_gstobject);
m = Py_InitModule ("_gst", pygst_functions);
d = PyModule_GetDict (m);
/* gst version */
gst_version(&major, &minor, &micro, &nano);
tuple = Py_BuildValue("(iii)", major, minor, micro);
PyDict_SetItemString(d, "gst_version", tuple);
Py_DECREF(tuple);
/* gst-python version */
tuple = Py_BuildValue ("(iii)", PYGST_MAJOR_VERSION, PYGST_MINOR_VERSION,
PYGST_MICRO_VERSION);
PyDict_SetItemString(d, "pygst_version", tuple);
Py_DECREF(tuple);
/* clock stuff */
PyModule_AddIntConstant(m, "SECOND", GST_SECOND);
PyModule_AddIntConstant(m, "MSECOND", GST_MSECOND);
PyModule_AddIntConstant(m, "NSECOND", GST_NSECOND);
PyModule_AddObject(m, "CLOCK_TIME_NONE", PyLong_FromUnsignedLongLong(GST_CLOCK_TIME_NONE));
PyModule_AddObject(m, "BUFFER_OFFSET_NONE", PyLong_FromUnsignedLongLong(GST_BUFFER_OFFSET_NONE));
pygst_exceptions_register_classes (d);
REGISTER_TYPE(d, PyGstIterator_Type, "Iterator");
pygstminiobject_register_class(d, "GstMiniObject", GST_TYPE_MINI_OBJECT,
&PyGstMiniObject_Type, NULL);
pyg_register_boxed_custom(GST_TYPE_MINI_OBJECT,
pygstminiobject_from_gvalue,
pygstminiobject_to_gvalue);
pygst_register_classes (d);
pygst_add_constants (m, "GST_");
/* make our types available */
PyModule_AddObject (m, "TYPE_ELEMENT_FACTORY",
pyg_type_wrapper_new(GST_TYPE_ELEMENT_FACTORY));
PyModule_AddObject (m, "TYPE_INDEX_FACTORY",
pyg_type_wrapper_new(GST_TYPE_INDEX_FACTORY));
PyModule_AddObject (m, "TYPE_TYPE_FIND_FACTORY",
pyg_type_wrapper_new(GST_TYPE_TYPE_FIND_FACTORY));
/* GStreamer core tags */
PyModule_AddStringConstant (m, "TAG_TITLE", GST_TAG_TITLE);
PyModule_AddStringConstant (m, "TAG_ARTIST", GST_TAG_ARTIST);
PyModule_AddStringConstant (m, "TAG_ALBUM", GST_TAG_ALBUM);
PyModule_AddStringConstant (m, "TAG_DATE", GST_TAG_DATE);
PyModule_AddStringConstant (m, "TAG_GENRE", GST_TAG_GENRE);
PyModule_AddStringConstant (m, "TAG_COMMENT", GST_TAG_COMMENT);
PyModule_AddStringConstant (m, "TAG_TRACK_NUMBER", GST_TAG_TRACK_NUMBER);
PyModule_AddStringConstant (m, "TAG_TRACK_COUNT", GST_TAG_TRACK_COUNT);
PyModule_AddStringConstant (m, "TAG_ALBUM_VOLUME_NUMBER", GST_TAG_ALBUM_VOLUME_NUMBER);
PyModule_AddStringConstant (m, "TAG_ALBUM_VOLUME_COUNT", GST_TAG_ALBUM_VOLUME_COUNT);
PyModule_AddStringConstant (m, "TAG_LOCATION", GST_TAG_LOCATION);
PyModule_AddStringConstant (m, "TAG_DESCRIPTION", GST_TAG_DESCRIPTION);
PyModule_AddStringConstant (m, "TAG_VERSION", GST_TAG_VERSION);
PyModule_AddStringConstant (m, "TAG_ISRC", GST_TAG_ISRC);
PyModule_AddStringConstant (m, "TAG_ORGANIZATION", GST_TAG_ORGANIZATION);
PyModule_AddStringConstant (m, "TAG_COPYRIGHT", GST_TAG_COPYRIGHT);
PyModule_AddStringConstant (m, "TAG_CONTACT", GST_TAG_CONTACT);
PyModule_AddStringConstant (m, "TAG_LICENSE", GST_TAG_LICENSE);
PyModule_AddStringConstant (m, "TAG_PERFORMER", GST_TAG_PERFORMER);
PyModule_AddStringConstant (m, "TAG_DURATION", GST_TAG_DURATION);
PyModule_AddStringConstant (m, "TAG_CODEC", GST_TAG_CODEC);
PyModule_AddStringConstant (m, "TAG_VIDEO_CODEC", GST_TAG_VIDEO_CODEC);
PyModule_AddStringConstant (m, "TAG_AUDIO_CODEC", GST_TAG_AUDIO_CODEC);
PyModule_AddStringConstant (m, "TAG_BITRATE", GST_TAG_BITRATE);
PyModule_AddStringConstant (m, "TAG_NOMINAL_BITRATE", GST_TAG_NOMINAL_BITRATE);
PyModule_AddStringConstant (m, "TAG_MINIMUM_BITRATE", GST_TAG_MINIMUM_BITRATE);
PyModule_AddStringConstant (m, "TAG_MAXIMUM_BITRATE", GST_TAG_MAXIMUM_BITRATE);
PyModule_AddStringConstant (m, "TAG_SERIAL", GST_TAG_SERIAL);
PyModule_AddStringConstant (m, "TAG_ENCODER", GST_TAG_ENCODER);
PyModule_AddStringConstant (m, "TAG_ENCODER_VERSION", GST_TAG_ENCODER_VERSION);
PyModule_AddStringConstant (m, "TAG_TRACK_GAIN", GST_TAG_TRACK_GAIN);
PyModule_AddStringConstant (m, "TAG_TRACK_PEAK", GST_TAG_TRACK_PEAK);
PyModule_AddStringConstant (m, "TAG_ALBUM_GAIN", GST_TAG_ALBUM_GAIN);
PyModule_AddStringConstant (m, "TAG_ALBUM_PEAK", GST_TAG_ALBUM_PEAK);
PyModule_AddStringConstant (m, "TAG_LANGUAGE_CODE", GST_TAG_LANGUAGE_CODE);
PyObject *m, *d;
PyObject *av, *tuple;
int argc, i;
guint major, minor, micro, nano;
char **argv;
GError *error = NULL;
init_pygobject ();
/* pull in arguments */
av = PySys_GetObject ("argv");
if (av != NULL) {
argc = PyList_Size (av);
argv = g_new (char *, argc);
for (i = 0; i < argc; i++)
argv[i] = g_strdup (PyString_AsString (PyList_GetItem (av, i)));
} else {
/* gst_init_check does not like argc == 0 */
argc = 1;
argv = g_new (char *, argc);
argv[0] = g_strdup ("");
}
if (!gst_init_check (&argc, &argv, &error)) {
gchar *errstr;
if (argv != NULL) {
for (i = 0; i < argc; i++)
g_free (argv[i]);
g_free (argv);
}
errstr = g_strdup_printf ("can't initialize module gst: %s",
error ? GST_STR_NULL (error->message) : "no error given");
PyErr_SetString (PyExc_RuntimeError, errstr);
g_free (errstr);
g_error_free (error);
setlocale (LC_NUMERIC, "C");
return;
}
setlocale (LC_NUMERIC, "C");
if (argv != NULL) {
PySys_SetArgv (argc, argv);
for (i = 0; i < argc; i++)
g_free (argv[i]);
g_free (argv);
}
/* Initialize debugging category */
GST_DEBUG_CATEGORY_INIT (pygst_debug, "pygst", 0,
"GStreamer python bindings");
GST_DEBUG_CATEGORY_INIT (python_debug, "python", GST_DEBUG_FG_GREEN,
"python code using gst-python");
pygobject_register_sinkfunc (GST_TYPE_OBJECT, sink_gstobject);
m = Py_InitModule ("_gst", pygst_functions);
d = PyModule_GetDict (m);
/* gst version */
gst_version (&major, &minor, &micro, &nano);
tuple = Py_BuildValue ("(iii)", major, minor, micro);
PyDict_SetItemString (d, "gst_version", tuple);
Py_DECREF (tuple);
/* gst-python version */
tuple = Py_BuildValue ("(iii)", PYGST_MAJOR_VERSION, PYGST_MINOR_VERSION,
PYGST_MICRO_VERSION);
PyDict_SetItemString (d, "pygst_version", tuple);
Py_DECREF (tuple);
/* clock stuff */
PyModule_AddIntConstant (m, "SECOND", GST_SECOND);
PyModule_AddIntConstant (m, "MSECOND", GST_MSECOND);
PyModule_AddIntConstant (m, "NSECOND", GST_NSECOND);
PyModule_AddObject (m, "CLOCK_TIME_NONE",
PyLong_FromUnsignedLongLong (GST_CLOCK_TIME_NONE));