mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 23:28:16 +00:00
gst/gstbuffer.override: Proper wrapping of the GstBuffer.caps attribute
Original commit message from CVS: * gst/gstbuffer.override: (_wrap_gst_buffer__get_caps): Proper wrapping of the GstBuffer.caps attribute * gst/gstmodule.c: (init_gst): * gst/pygstminiobject.c: (pygstminiobject_register_class): gst-debug initialisation should happen before anything else if we want the debugging functions to work.
This commit is contained in:
parent
ca1cb51d1a
commit
2a96c988c0
4 changed files with 50 additions and 8 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2005-10-06 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* gst/gstbuffer.override: (_wrap_gst_buffer__get_caps):
|
||||
Proper wrapping of the GstBuffer.caps attribute
|
||||
|
||||
* gst/gstmodule.c: (init_gst):
|
||||
* gst/pygstminiobject.c: (pygstminiobject_register_class):
|
||||
gst-debug initialisation should happen before anything else if we
|
||||
want the debugging functions to work.
|
||||
|
||||
2005-10-06 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* configure.ac:
|
||||
|
|
|
@ -44,6 +44,7 @@ _wrap_gst_buffer_new(PyGstMiniObject *self, PyObject *args, PyObject *kwargs)
|
|||
int size = 0;
|
||||
int buf_size = -1;
|
||||
|
||||
GST_INFO("self:%p", self);
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|z#i:GstBuffer.__init__", kwlist,
|
||||
&data, &size, &buf_size))
|
||||
return -1;
|
||||
|
@ -60,7 +61,9 @@ _wrap_gst_buffer_new(PyGstMiniObject *self, PyObject *args, PyObject *kwargs)
|
|||
}
|
||||
|
||||
self->obj = GST_MINI_OBJECT(gst_buffer_new_and_alloc(buf_size));
|
||||
|
||||
GST_INFO ("pyo:%p pyr:%d minio:%p minir:%d",
|
||||
self, ((PyObject*)self)->ob_refcnt,
|
||||
self->obj, GST_MINI_OBJECT_REFCOUNT_VALUE(self->obj));
|
||||
if (!self->obj) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "could not create GstBuffer object");
|
||||
return -1;
|
||||
|
@ -287,6 +290,7 @@ _wrap_gst_buffer_copy_on_write (PyObject *self)
|
|||
{
|
||||
GstBuffer *buf = pyg_boxed_get(self, GstBuffer);
|
||||
|
||||
GST_INFO("INCREF");
|
||||
if (gst_buffer_is_writable (buf)) {
|
||||
Py_INCREF (self);
|
||||
return self;
|
||||
|
@ -503,3 +507,33 @@ _wrap_gst_buffer_stamp (PyGstMiniObject *self, PyObject *args, PyObject *kwargs)
|
|||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
%%
|
||||
override-attr GstBuffer.caps
|
||||
static PyObject *
|
||||
_wrap_gst_buffer__get_caps (PyObject *self, void *closure)
|
||||
{
|
||||
GstMiniObject *miniobject;
|
||||
GstCaps *ret;
|
||||
|
||||
miniobject = pygstminiobject_get (self);
|
||||
g_assert (miniobject);
|
||||
|
||||
pyg_begin_allow_threads;
|
||||
ret = gst_buffer_get_caps(GST_BUFFER(miniobject));
|
||||
pyg_end_allow_threads;
|
||||
return pyg_boxed_new (GST_TYPE_CAPS, ret, FALSE, TRUE);
|
||||
}
|
||||
static int
|
||||
_wrap_gst_buffer__set_caps (PyGstMiniObject *self, PyObject *value, void *closure)
|
||||
{
|
||||
GstCaps *caps;
|
||||
g_assert (self);
|
||||
|
||||
caps = pygst_caps_from_pyobject (value, NULL);
|
||||
if (PyErr_Occurred())
|
||||
return -1;
|
||||
pyg_begin_allow_threads;
|
||||
gst_buffer_set_caps(GST_BUFFER(self->obj), caps);
|
||||
pyg_end_allow_threads;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -148,6 +148,11 @@ init_gst (void)
|
|||
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");
|
||||
|
||||
/* _pygst_register_boxed_types (NULL); */
|
||||
pygobject_register_sinkfunc(GST_TYPE_OBJECT, pygstobject_sink);
|
||||
|
||||
|
@ -208,11 +213,6 @@ init_gst (void)
|
|||
PyModule_AddObject (m, "TYPE_TYPE_FIND_FACTORY",
|
||||
pyg_type_wrapper_new(GST_TYPE_TYPE_FIND_FACTORY));
|
||||
|
||||
/* 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");
|
||||
|
||||
g_timeout_add_full (0, 100, python_do_pending_calls, NULL, NULL);
|
||||
|
||||
if (PyErr_Occurred ()) {
|
||||
|
|
|
@ -115,11 +115,9 @@ pygstminiobject_register_class(PyObject *dict, const gchar *type_name,
|
|||
if (gtype) {
|
||||
o = pyg_type_wrapper_new(gtype);
|
||||
PyDict_SetItemString(type->tp_dict, "__gtype__", o);
|
||||
GST_INFO ("Decrement refcount %p", o);
|
||||
Py_DECREF(o);
|
||||
|
||||
/* stash a pointer to the python class with the GType */
|
||||
GST_INFO ("Increment refcount %p", type);
|
||||
Py_INCREF(type);
|
||||
g_type_set_qdata(gtype, pygstminiobject_class_key, type);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue