Commit 56f25a46 authored by Edward Hervey's avatar Edward Hervey 🤘

gst/common.h: cleanup

Original commit message from CVS:
* gst/common.h:
cleanup
* gst/gst-types.defs:
* gst/gst.defs:
Updated defs file to current gstreamer core
* gst/gst.override:
Added useless function (at least from python bindings) and little correction
on _wrap_gst_xml_get_topelements()
* gst/gstbin.override:
* gst/gstbuffer.override:
Fix memleak in gst.Buffer.set_caps()
* gst/gstevent.override:
Added wrapper for remaining gst_event_parse_*()
* gst/gstlibs.override:
Wrapped more gst.Controller methods
* gst/gstmodule.c: (init_gst):
new gst_init()
Added atexit(gst_deinit)
* gst/gstpad.override:
Fix memleak in gst.Pad.set_caps()
* gst/gstquery.override:
add gst.Query.parse_segment()
* gst/libs.defs:
Updated to current gst-libs
* gst/pygstminiobject.c: (pygstminiobject_register_wrapper),
(pygstminiobject_new), (pygstminiobject_dealloc):
Added debug
* testsuite/Makefile.am:
* testsuite/common.py:
* testsuite/gstpython.supp:
* testsuite/python.supp:
* testsuite/test_bin.py:
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_ghostpad.py:
* testsuite/test_iterator.py:
* testsuite/test_message.py:
* testsuite/test_pipeline.py:
Proper valgrind testing,
Updated tests to new API
parent 70d68cdd
2005-10-11 Edward Hervey <edward@fluendo.com>
* gst/common.h:
cleanup
* gst/gst-types.defs:
* gst/gst.defs:
Updated defs file to current gstreamer core
* gst/gst.override:
Added useless function (at least from python bindings) and little correction
on _wrap_gst_xml_get_topelements()
* gst/gstbin.override:
* gst/gstbuffer.override:
Fix memleak in gst.Buffer.set_caps()
* gst/gstevent.override:
Added wrapper for remaining gst_event_parse_*()
* gst/gstlibs.override:
Wrapped more gst.Controller methods
* gst/gstmodule.c: (init_gst):
new gst_init()
Added atexit(gst_deinit)
* gst/gstpad.override:
Fix memleak in gst.Pad.set_caps()
* gst/gstquery.override:
add gst.Query.parse_segment()
* gst/libs.defs:
Updated to current gst-libs
* gst/pygstminiobject.c: (pygstminiobject_register_wrapper),
(pygstminiobject_new), (pygstminiobject_dealloc):
Added debug
* testsuite/Makefile.am:
* testsuite/common.py:
* testsuite/gstpython.supp:
* testsuite/python.supp:
* testsuite/test_bin.py:
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_ghostpad.py:
* testsuite/test_iterator.py:
* testsuite/test_message.py:
* testsuite/test_pipeline.py:
Proper valgrind testing,
Updated tests to new API
2005-10-09 Thomas Vander Stichele <thomas at apestaart dot org>
* examples/play.py:
......
common @ 54920e38
Subproject commit eb0dd118a086dd4aa405d3871131839d81306245
Subproject commit 54920e38c65eaf03ea52c21b14a6d104a56581a9
......@@ -58,8 +58,6 @@ PyTypeObject PyGstIterator_Type;
/* from gst-types.c */
/* gboolean pygst_data_from_pyobject(PyObject *object, GstData **data); */
/* PyObject *pygst_data_to_pyobject(GstData *data); */
GstCaps *pygst_caps_from_pyobject (PyObject *object, gboolean *copy);
PyObject* pygst_iterator_new(GstIterator *iter);
......
......@@ -334,6 +334,8 @@
(values
'("locked-state" "GST_ELEMENT_LOCKED_STATE")
'("is-sink" "GST_ELEMENT_IS_SINK")
'("unparenting" "GST_ELEMENT_UNPARENTING")
'("changing-state" "GST_ELEMENT_CHANGING_STATE")
'("flag-last" "GST_ELEMENT_FLAG_LAST")
)
)
......@@ -422,15 +424,21 @@
(gtype-id "GST_TYPE_EVENT_TYPE")
(values
'("unknown" "GST_EVENT_UNKNOWN")
'("flush-start" "GST_EVENT_FLUSH_START")
'("flush-stop" "GST_EVENT_FLUSH_STOP")
'("eos" "GST_EVENT_EOS")
'("flush" "GST_EVENT_FLUSH")
'("discontinuous" "GST_EVENT_DISCONTINUOUS")
'("newsegment" "GST_EVENT_NEWSEGMENT")
'("tag" "GST_EVENT_TAG")
'("filler" "GST_EVENT_FILLER")
'("buffersize" "GST_EVENT_BUFFERSIZE")
'("qos" "GST_EVENT_QOS")
'("seek" "GST_EVENT_SEEK")
'("size" "GST_EVENT_SIZE")
'("rate" "GST_EVENT_RATE")
'("navigation" "GST_EVENT_NAVIGATION")
'("tag" "GST_EVENT_TAG")
'("custom-up" "GST_EVENT_CUSTOM_UP")
'("custom-ds" "GST_EVENT_CUSTOM_DS")
'("custom-ds-oob" "GST_EVENT_CUSTOM_DS_OOB")
'("custom-both" "GST_EVENT_CUSTOM_BOTH")
'("custom-both-oob" "GST_EVENT_CUSTOM_BOTH_OOB")
)
)
......@@ -619,10 +627,13 @@
'("buffering" "GST_MESSAGE_BUFFERING")
'("state-changed" "GST_MESSAGE_STATE_CHANGED")
'("step-done" "GST_MESSAGE_STEP_DONE")
'("clock-provide" "GST_MESSAGE_CLOCK_PROVIDE")
'("clock-lost" "GST_MESSAGE_CLOCK_LOST")
'("new-clock" "GST_MESSAGE_NEW_CLOCK")
'("structure-change" "GST_MESSAGE_STRUCTURE_CHANGE")
'("stream-status" "GST_MESSAGE_STREAM_STATUS")
'("application" "GST_MESSAGE_APPLICATION")
'("element" "GST_MESSAGE_ELEMENT")
'("segment-start" "GST_MESSAGE_SEGMENT_START")
'("segment-done" "GST_MESSAGE_SEGMENT_DONE")
'("any" "GST_MESSAGE_ANY")
......
......@@ -21,32 +21,18 @@
(parameters
'("int*" "argc")
'("char**[]" "argv")
'("GError**" "err")
)
)
(define-function init_with_popt_table
(c-name "gst_init_with_popt_table")
(return-type "none")
(parameters
'("int*" "argc")
'("char**[]" "argv")
'("const-GstPoptOption*" "popt_options")
)
)
(define-function init_check_with_popt_table
(c-name "gst_init_check_with_popt_table")
(return-type "gboolean")
(parameters
'("int*" "argc")
'("char**[]" "argv")
'("const-GstPoptOption*" "popt_options")
)
(define-function gst_init_get_option_group
(c-name "gst_init_get_option_group")
(return-type "GOptionGroup*")
)
(define-function init_get_popt_table
(c-name "gst_init_get_popt_table")
(return-type "const-GstPoptOption*")
(define-function gst_deinit
(c-name "gst_deinit")
(return-type "none")
)
......@@ -1141,15 +1127,6 @@
)
)
(define-method set_state_async
(of-object "GstElement")
(c-name "gst_element_set_state_async")
(return-type "GstStateChangeReturn")
(parameters
'("GstState" "state")
)
)
(define-method abort_state
(of-object "GstElement")
(c-name "gst_element_abort_state")
......@@ -1159,7 +1136,7 @@
(define-method commit_state
(of-object "GstElement")
(c-name "gst_element_commit_state")
(return-type "none")
(return-type "GstStateChangeReturn")
)
(define-method lost_state
......@@ -1653,6 +1630,18 @@
;; From ../gstreamer/gst/gstevent.h
(define-method get_name
(of-object "GstEventType")
(c-name "gst_event_type_get_name")
(return-type "const-gchar*")
)
(define-method to_quark
(of-object "GstEventType")
(c-name "gst_event_type_to_quark")
(return-type "GQuark")
)
(define-function event_get_type
(c-name "gst_event_get_type")
(return-type "GType")
......@@ -1742,6 +1731,29 @@
(caller-owns-return #t)
)
(define-function gst_event_new_buffersize
(c-name "gst_event_new_buffersize")
(return-type "GstEvent*")
(parameters
'("GstFormat" "format")
'("gint64" "minsize")
'("gint64" "maxsize")
'("gboolean" "async")
)
)
(define-method parse_buffersize
(of-object "GstEvent")
(c-name "gst_event_parse_buffersize")
(return-type "none")
(parameters
'("GstFormat*" "format")
'("gint64*" "minsize")
'("gint64*" "maxsize")
'("gboolean*" "async")
)
)
(define-function event_new_qos
(c-name "gst_event_new_qos")
(return-type "GstEvent*")
......@@ -2421,6 +2433,7 @@
(return-type "GstIterator*")
(parameters
'("guint" "size")
'("GType" "type")
'("GMutex*" "lock")
'("guint32*" "master_cookie")
'("GstIteratorNextFunction" "next")
......@@ -2434,6 +2447,7 @@
(c-name "gst_iterator_new_list")
(return-type "GstIterator*")
(parameters
'("GType" "type")
'("GMutex*" "lock")
'("guint32*" "master_cookie")
'("GList**" "list")
......@@ -2629,6 +2643,34 @@
)
)
(define-function gst_message_new_clock_provide
(c-name "gst_message_new_clock_provide")
(return-type "GstMessage*")
(parameters
'("GstObject*" "src")
'("GstClock*" "clock")
'("gboolean" "ready")
)
)
(define-function gst_message_new_clock_lost
(c-name "gst_message_new_clock_lost")
(return-type "GstMessage*")
(parameters
'("GstObject*" "src")
'("GstClock*" "clock")
)
)
(define-function gst_message_new_new_clock
(c-name "gst_message_new_new_clock")
(return-type "GstMessage*")
(parameters
'("GstObject*" "src")
'("GstClock*" "clock")
)
)
(define-function gst_message_new_segment_start
(c-name "gst_message_new_segment_start")
(return-type "GstMessage*")
......@@ -2649,6 +2691,24 @@
)
)
(define-function gst_message_new_application
(c-name "gst_message_new_application")
(return-type "GstMessage*")
(parameters
'("GstObject*" "src")
'("GstStructure*" "structure")
)
)
(define-function gst_message_new_element
(c-name "gst_message_new_element")
(return-type "GstMessage*")
(parameters
'("GstObject*" "src")
'("GstStructure*" "structure")
)
)
(define-function message_new_custom
(c-name "gst_message_new_custom")
(return-type "GstMessage*")
......@@ -2696,6 +2756,35 @@
(parameters
'("GstState*" "old_state")
'("GstState*" "new_state")
'("GstState*" "pending")
)
)
(define-method parse_clock_provide
(of-object "GstMessage")
(c-name "gst_message_parse_clock_provide")
(return-type "none")
(parameters
'("GstClock**" "clock")
'("gboolean*" "ready")
)
)
(define-method parse_clock_lost
(of-object "GstMessage")
(c-name "gst_message_parse_clock_lost")
(return-type "none")
(parameters
'("GstClock**" "clock")
)
)
(define-method parse_new_clock
(of-object "GstMessage")
(c-name "gst_message_parse_new_clock")
(return-type "none")
(parameters
'("GstClock**" "clock")
)
)
......@@ -3004,6 +3093,22 @@
;; From ../gstreamer/gst/gstpad.h
(define-function flow_get_name
(c-name "gst_flow_get_name")
(return-type "const-gchar*")
(parameters
'("GstFlowReturn" "ret")
)
)
(define-function flow_to_quark
(c-name "gst_flow_to_quark")
(return-type "GQuark")
(parameters
'("GstFlowReturn" "ret")
)
)
(define-function gst_pad_get_type
(c-name "gst_pad_get_type")
(return-type "GType")
......@@ -5635,6 +5740,22 @@
)
)
(define-function gst_gdouble_to_guint64
(c-name "gst_gdouble_to_guint64")
(return-type "guint64")
(parameters
'("gdouble" "value")
)
)
(define-function gst_guint64_to_gdouble
(c-name "gst_guint64_to_gdouble")
(return-type "gdouble")
(parameters
'("guint64" "value")
)
)
(define-function gst_util_uint64_scale
(c-name "gst_util_uint64_scale")
(return-type "guint64")
......@@ -5675,6 +5796,40 @@
)
)
(define-function g_static_rec_cond_wait
(c-name "g_static_rec_cond_wait")
(return-type "none")
(parameters
'("GCond*" "cond")
'("GStaticRecMutex*" "mutex")
)
)
(define-function g_static_rec_cond_timed_wait
(c-name "g_static_rec_cond_timed_wait")
(return-type "gboolean")
(parameters
'("GCond*" "cond")
'("GStaticRecMutex*" "mutex")
'("GTimeVal*" "end_time")
)
)
(define-method abort_preroll
(of-object "GstElement")
(c-name "gst_element_abort_preroll")
(return-type "GstFlowReturn")
)
(define-method finish_preroll
(of-object "GstElement")
(c-name "gst_element_finish_preroll")
(return-type "GstFlowReturn")
(parameters
'("GstPad*" "pad")
)
)
(define-method create_all_pads
(of-object "GstElement")
(c-name "gst_element_create_all_pads")
......@@ -5893,14 +6048,6 @@
(caller-owns-return #t)
)
(define-function flow_get_name
(c-name "gst_flow_get_name")
(return-type "const-gchar*")
(parameters
'("GstFlowReturn" "ret")
)
)
(define-method query_position
(of-object "GstPad")
(c-name "gst_pad_query_position")
......@@ -5934,12 +6081,6 @@
(varargs #t)
)
(define-method watch_for_state_change
(of-object "GstBin")
(c-name "gst_bin_watch_for_state_change")
(return-type "none")
)
(define-method merge
(of-object "GstBuffer")
(c-name "gst_buffer_merge")
......
......@@ -311,6 +311,12 @@ ignore
gst_debug_log
gst_debug_log_default
gst_iterator_new_list
gst_task_set_lock
gst_clock_id_compare_func
gst_print_pad_caps
gst_util_set_value_from_string
gst_print_element_args
gst_atomic_int_set
%%
override-slot GstPluginFeature.tp_repr
static PyObject *
......@@ -542,7 +548,8 @@ _wrap_gst_xml_get_topelements(PyGObject *self)
for (l = xml_elements; l; l = l->next) {
GstElement *element = (GstElement*)l->data;
PyList_Append(py_list, pygobject_new(G_OBJECT(element)));
PyList_Append(py_list, pygstobject_new(G_OBJECT(element)));
gst_object_unref (element);
}
return py_list;
......
......@@ -136,8 +136,7 @@ _wrap_gst_bin_get_by_name(PyGObject *self, PyObject *args, PyObject *kwargs)
/* pygobject_new handles NULL checking */
ret = pygstobject_new((GObject *)el);
gst_object_unref (el); /* from _get_by_name */
gst_object_unref (((PyGObject *) ret)->obj); /* from _get_by_name */
return ret;
}
%%
......
......@@ -534,6 +534,28 @@ _wrap_gst_buffer__set_caps (PyGstMiniObject *self, PyObject *value, void *closur
return -1;
pyg_begin_allow_threads;
gst_buffer_set_caps(GST_BUFFER(self->obj), caps);
gst_caps_unref (caps);
pyg_end_allow_threads;
return 0;
}
%%
override gst_buffer_set_caps kwargs
static PyObject *
_wrap_gst_buffer_set_caps(PyGstMiniObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "caps", NULL };
PyObject *py_caps;
GstCaps *caps;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GstBuffer.set_caps", kwlist, &py_caps))
return NULL;
caps = pygst_caps_from_pyobject (py_caps, NULL);
if (PyErr_Occurred())
return NULL;
pyg_begin_allow_threads;
gst_buffer_set_caps(GST_BUFFER(self->obj), caps);
gst_caps_unref (caps);
pyg_end_allow_threads;
Py_INCREF(Py_None);
return Py_None;
}
/* -*- Mode: C; ; c-file-style: "python" -*- */
/* -*- Mode: C; ; c-file-style: "k&r"; c-basic-offset: 4 -*- */
/* gst-python
* Copyright (C) 2005 Edward Hervey
*
......@@ -24,11 +24,11 @@ override gst_event_get_structure noargs
static PyObject *
_wrap_gst_event_get_structure(PyGstMiniObject *self)
{
GstStructure *ret;
GstStructure *ret;
ret = (GstStructure *) gst_event_get_structure(GST_EVENT(self->obj));
/* pyg_boxed_new handles NULL checking */
return pyg_boxed_new(GST_TYPE_STRUCTURE, ret, TRUE, TRUE);
ret = (GstStructure *) gst_event_get_structure(GST_EVENT(self->obj));
/* pyg_boxed_new handles NULL checking */
return pyg_boxed_new(GST_TYPE_STRUCTURE, ret, TRUE, TRUE);
}
%%
......@@ -36,17 +36,120 @@ override-slot GstEvent.tp_repr
static PyObject *
_wrap_gst_event_tp_repr (PyGObject *self)
{
char *buf;
PyObject *retval;
GstEvent *event;
char *buf;
PyObject *retval;
GstEvent *event;
event = GST_EVENT(self->obj);
event = GST_EVENT(self->obj);
buf = g_strdup_printf ("<GstEvent (%s) at %lx>",
gst_event_type_get_name (event->type), (long) self->obj);
buf = g_strdup_printf ("<GstEvent (%s) at %lx>",
gst_event_type_get_name (event->type), (long) self->obj);
retval = PyString_FromString(buf);
g_free(buf);
return retval;
retval = PyString_FromString(buf);
g_free(buf);
return retval;
}
%%
override gst_event_parse_newsegment noargs
static PyObject *
_wrap_gst_event_parse_newsegment (PyGstMiniObject *self)
{
PyObject *ret;
gdouble rate;
GstFormat format;
gint64 start_value, stop_value, base;
if (GST_EVENT_TYPE(self->obj) != GST_EVENT_NEWSEGMENT) {
PyErr_SetString(PyExc_TypeError, "Even is not a 'NewSegment' event");
return NULL;
}
gst_event_parse_newsegment (GST_EVENT(self->obj), &rate, &format,
&start_value, &stop_value, &base);
ret = PyList_New(0);
PyList_Append (ret, PyFloat_FromDouble(rate));
PyList_Append (ret, pyg_enum_from_gtype (GST_TYPE_FORMAT, format));
PyList_Append (ret, PyLong_FromUnsignedLongLong(start_value));
PyList_Append (ret, PyLong_FromUnsignedLongLong(stop_value));
PyList_Append (ret, PyLong_FromUnsignedLongLong(base));
return ret;
}
%%
override gst_event_parse_tag noargs
static PyObject *
_wrap_gst_event_parse_tag (PyGstMiniObject *self)
{
PyObject *ret;
GstTagList *taglist;
if (GST_EVENT_TYPE(self->obj) != GST_EVENT_TAG) {
PyErr_SetString(PyExc_TypeError, "Event is not an 'Tag' event");
return NULL;
}
gst_event_parse_tag (GST_EVENT(self->obj), &taglist);
ret = pyg_boxed_new (GST_TYPE_TAG_LIST, taglist, TRUE, TRUE);
return ret;
}
%%
override gst_event_parse_qos noargs
static PyObject *
_wrap_gst_event_parse_qos (PyGstMiniObject *self)
{
PyObject *ret;
gdouble proportion;
GstClockTimeDiff diff;
GstClockTime timestamp;
if (GST_EVENT_TYPE(self->obj) != GST_EVENT_QOS) {
PyErr_SetString(PyExc_TypeError, "Event is not an 'Qos' event");
return NULL;
}
gst_event_parse_qos (GST_EVENT(self->obj), &proportion,
&diff, &timestamp);
ret = PyList_New (0);
PyList_Append (ret, PyFloat_FromDouble(proportion));
PyList_Append (ret, PyLong_FromLongLong(diff));
PyList_Append (ret, PyLong_FromUnsignedLongLong(timestamp));
return ret;
}
%%
override gst_event_parse_seek noargs
static PyObject *
_wrap_gst_event_parse_seek (PyGstMiniObject *self)
{
PyObject *ret;
gdouble rate;
GstFormat format;
GstSeekFlags flags;
GstSeekType cur_type;
gint64 cur;
GstSeekType stop_type;
gint64 stop;
if (GST_EVENT_TYPE(self->obj) != GST_EVENT_SEEK) {
PyErr_SetString(PyExc_TypeError, "Event is not an 'Seek' event");
return NULL;
}
gst_event_parse_seek (GST_EVENT(self->obj), &rate, &format, &flags,
&cur_type, &cur, &stop_type, &stop);
ret = PyList_New (0);
PyList_Append (ret, PyFloat_FromDouble(rate));
PyList_Append (ret, pyg_enum_from_gtype (GST_TYPE_FORMAT, format));
PyList_Append (ret, pyg_flags_from_gtype (GST_TYPE_SEEK_FLAGS, flags));
PyList_Append (ret, pyg_enum_from_gtype (GST_TYPE_SEEK_TYPE, cur_type));
PyList_Append (ret, PyLong_FromUnsignedLongLong (cur));
PyList_Append (ret, pyg_enum_from_gtype (GST_TYPE_SEEK_TYPE, stop_type));
PyList_Append (ret, PyLong_FromUnsignedLongLong (stop));
return ret;
}
......@@ -20,6 +20,12 @@
* Author: Johan Dahlin <johan@gnome.org>
*/
%%
ignore
gst_controller_new
gst_controller_*_valist
gst_controller_remove_properties_list
%%
override gst_controller_set args
static PyObject *
_wrap_gst_controller_set (PyGObject *self, PyObject *args)
......@@ -67,6 +73,31 @@ _wrap_gst_controller_set (PyGObject *self, PyObject *args)
return Py_False;
}
%%
override gst_controller_get kwargs
static PyObject *
_wrap_gst_controller_get (PyGObject *self, PyObject *args, PyObject *kwargs)
{
GstController *controller = (GstController *) self->obj;
static char *kwlist[] = { "propertyname", "timestamp", NULL };
gchar *propertyname;
GstClockTime timestamp;
GValue *value = NULL;
PyObject *pyvalue;
if (!PyArg_ParseTupleAndKeywords (args, kwargs,
"sL:GstController.get",
kwlist, &propertyname, &timestamp))
return NULL;
value = gst_controller_get (controller, propertyname, timestamp);
if (value) {
pyvalue = pyg_value_as_pyobject (value, FALSE);
return pyvalue;
}
Py_INCREF (Py_None);
return Py_None;
}
%%
override gst_controller_new_list args
static int
_wrap_gst_controller_new_list(PyGObject *self, PyObject *args)
......@@ -101,3 +132,120 @@ _wrap_gst_controller_new_list(PyGObject *self, PyObject *args)
pygobject_register_wrapper((PyObject *) self);
return 0;
}
%%
override gst_controller_remove_properties args
static PyObject *
_wrap_gst_controller_remove_properties (PyGObject *self, PyObject *args)
{
GstController *controller = (GstController *) self->obj;
gint len;
GList *list = NULL;
gboolean res = FALSE;
PyObject *pret;
if ((len = PyTuple_Size(args)) < 1) {
PyErr_SetString(PyExc_TypeError, "Please give at least one property name to remove");
return NULL;
}
while (len--) {
PyObject *temp;
gchar *str;
temp = PyTuple_GetItem(args, len);
str = PyString_AsString(temp);
GST_INFO("prepending %s [%d]", str, len);
list = g_list_prepend(list, PyString_AsString(temp));
}
res = gst_controller_remove_properties_list(controller, list);
if (res)
pret = Py_True;
else
pret = Py_False;
Py_INCREF (pret);
return pret;
}
%%
override gst_controller_set_from_list args
static PyObject *
_wrap_gst_controller_set_from_list (PyGObject *self, PyObject *args)
{
GstController *controller = (GstController *) self->obj;
PyObject *temp;
gint len;
gchar *pname;
GSList *list = NULL;
GList *props;
gboolean res = FALSE;
GType vtype = 0;
PyObject *pret;
if ((len = PyTuple_Size(args)) < 2) {
PyErr_SetString(PyExc_TypeError, "Please give a property name and a tuple of (time,value)");
return NULL;
}
temp = PyTuple_GetItem(args, 0);
if (!PyString_Check (temp)) {
PyErr_SetString(PyExc_TypeError, "First argument must be a string");
return NULL;
}