mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
gst: run gst-indent all C files
We hadn't done it since the switch to git... whoops
This commit is contained in:
parent
ee647847f3
commit
ab46967800
9 changed files with 505 additions and 499 deletions
|
@ -30,29 +30,29 @@
|
||||||
#include <gst/audio/gstbaseaudiosrc.h>
|
#include <gst/audio/gstbaseaudiosrc.h>
|
||||||
#include "pygst.h"
|
#include "pygst.h"
|
||||||
|
|
||||||
void pyaudio_register_classes (PyObject *d);
|
void pyaudio_register_classes (PyObject * d);
|
||||||
void pyaudio_add_constants(PyObject *module, const gchar *strip_prefix);
|
void pyaudio_add_constants (PyObject * module, const gchar * strip_prefix);
|
||||||
|
|
||||||
extern PyMethodDef pyaudio_functions[];
|
extern PyMethodDef pyaudio_functions[];
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (pygst_debug); /* for python code */
|
GST_DEBUG_CATEGORY (pygst_debug); /* for python code */
|
||||||
|
|
||||||
DL_EXPORT(void)
|
DL_EXPORT (void)
|
||||||
initaudio (void)
|
initaudio (void)
|
||||||
{
|
{
|
||||||
PyObject *m, *d;
|
PyObject *m, *d;
|
||||||
|
|
||||||
init_pygobject ();
|
init_pygobject ();
|
||||||
pygst_init();
|
pygst_init ();
|
||||||
|
|
||||||
m = Py_InitModule ("audio", pyaudio_functions);
|
m = Py_InitModule ("audio", pyaudio_functions);
|
||||||
d = PyModule_GetDict (m);
|
d = PyModule_GetDict (m);
|
||||||
|
|
||||||
pyaudio_register_classes (d);
|
pyaudio_register_classes (d);
|
||||||
pyaudio_add_constants (m, "GST_");
|
pyaudio_add_constants (m, "GST_");
|
||||||
|
|
||||||
if (PyErr_Occurred ()) {
|
if (PyErr_Occurred ()) {
|
||||||
PyErr_Print ();
|
PyErr_Print ();
|
||||||
Py_FatalError ("can't initialize module gst.audio");
|
Py_FatalError ("can't initialize module gst.audio");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,32 +35,31 @@
|
||||||
* and NULL is returned.
|
* and NULL is returned.
|
||||||
*/
|
*/
|
||||||
GstCaps *
|
GstCaps *
|
||||||
pygst_caps_from_pyobject (PyObject *object, gboolean *copy)
|
pygst_caps_from_pyobject (PyObject * object, gboolean * copy)
|
||||||
{
|
{
|
||||||
if (pyg_boxed_check(object, GST_TYPE_CAPS)) {
|
if (pyg_boxed_check (object, GST_TYPE_CAPS)) {
|
||||||
GstCaps *caps = pyg_boxed_get(object, GstCaps);
|
GstCaps *caps = pyg_boxed_get (object, GstCaps);
|
||||||
if (copy) {
|
if (copy) {
|
||||||
*copy = FALSE;
|
*copy = FALSE;
|
||||||
return caps;
|
return caps;
|
||||||
} else {
|
} else {
|
||||||
return gst_caps_copy (caps);
|
return gst_caps_copy (caps);
|
||||||
}
|
}
|
||||||
} else if (pyg_boxed_check(object, GST_TYPE_STRUCTURE)) {
|
} else if (pyg_boxed_check (object, GST_TYPE_STRUCTURE)) {
|
||||||
GstStructure *structure = pyg_boxed_get(object, GstStructure);
|
GstStructure *structure = pyg_boxed_get (object, GstStructure);
|
||||||
if (copy)
|
if (copy)
|
||||||
*copy = TRUE;
|
*copy = TRUE;
|
||||||
return gst_caps_new_full (gst_structure_copy (structure), NULL);
|
return gst_caps_new_full (gst_structure_copy (structure), NULL);
|
||||||
} else if (PyString_Check (object)) {
|
} else if (PyString_Check (object)) {
|
||||||
GstCaps *caps = gst_caps_from_string (PyString_AsString (object));
|
GstCaps *caps = gst_caps_from_string (PyString_AsString (object));
|
||||||
if (!caps) {
|
if (!caps) {
|
||||||
PyErr_SetString(PyExc_TypeError, "could not convert string to GstCaps");
|
PyErr_SetString (PyExc_TypeError, "could not convert string to GstCaps");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (copy)
|
if (copy)
|
||||||
*copy = TRUE;
|
*copy = TRUE;
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
PyErr_SetString(PyExc_TypeError, "could not convert to GstCaps");
|
PyErr_SetString (PyExc_TypeError, "could not convert to GstCaps");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,27 +29,27 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include "pygst.h"
|
#include "pygst.h"
|
||||||
|
|
||||||
void pyinterfaces_register_classes (PyObject *d);
|
void pyinterfaces_register_classes (PyObject * d);
|
||||||
void pyinterfaces_add_constants(PyObject *module, const gchar *strip_prefix);
|
void pyinterfaces_add_constants (PyObject * module, const gchar * strip_prefix);
|
||||||
|
|
||||||
extern PyMethodDef pyinterfaces_functions[];
|
extern PyMethodDef pyinterfaces_functions[];
|
||||||
|
|
||||||
DL_EXPORT(void)
|
DL_EXPORT (void)
|
||||||
initinterfaces (void)
|
initinterfaces (void)
|
||||||
{
|
{
|
||||||
PyObject *m, *d;
|
PyObject *m, *d;
|
||||||
|
|
||||||
init_pygobject ();
|
init_pygobject ();
|
||||||
pygst_init();
|
pygst_init ();
|
||||||
|
|
||||||
m = Py_InitModule ("interfaces", pyinterfaces_functions);
|
m = Py_InitModule ("interfaces", pyinterfaces_functions);
|
||||||
d = PyModule_GetDict (m);
|
d = PyModule_GetDict (m);
|
||||||
|
|
||||||
pyinterfaces_register_classes (d);
|
pyinterfaces_register_classes (d);
|
||||||
pyinterfaces_add_constants (m, "GST_");
|
pyinterfaces_add_constants (m, "GST_");
|
||||||
|
|
||||||
if (PyErr_Occurred ()) {
|
if (PyErr_Occurred ()) {
|
||||||
PyErr_Print ();
|
PyErr_Print ();
|
||||||
Py_FatalError ("can't initialize module gst.interfaces");
|
Py_FatalError ("can't initialize module gst.interfaces");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,33 +28,33 @@
|
||||||
#include <gst/pbutils/pbutils.h>
|
#include <gst/pbutils/pbutils.h>
|
||||||
#include "pygst.h"
|
#include "pygst.h"
|
||||||
|
|
||||||
void pypbutils_register_classes (PyObject *d);
|
void pypbutils_register_classes (PyObject * d);
|
||||||
void pypbutils_add_constants(PyObject *module, const gchar *strip_prefix);
|
void pypbutils_add_constants (PyObject * module, const gchar * strip_prefix);
|
||||||
|
|
||||||
extern PyMethodDef pypbutils_functions[];
|
extern PyMethodDef pypbutils_functions[];
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (pygst_debug); /* for python code */
|
GST_DEBUG_CATEGORY (pygst_debug); /* for python code */
|
||||||
|
|
||||||
DL_EXPORT(void)
|
DL_EXPORT (void)
|
||||||
initpbutils (void)
|
initpbutils (void)
|
||||||
{
|
{
|
||||||
PyObject *m, *d;
|
PyObject *m, *d;
|
||||||
PyObject *gst;
|
PyObject *gst;
|
||||||
|
|
||||||
init_pygobject ();
|
init_pygobject ();
|
||||||
|
|
||||||
/* Make sure gst module is loaded and ready */
|
/* Make sure gst module is loaded and ready */
|
||||||
gst = pygst_init();
|
gst = pygst_init ();
|
||||||
gst_pb_utils_init ();
|
gst_pb_utils_init ();
|
||||||
|
|
||||||
m = Py_InitModule ("pbutils", pypbutils_functions);
|
|
||||||
d = PyModule_GetDict (m);
|
|
||||||
|
|
||||||
pypbutils_register_classes (d);
|
m = Py_InitModule ("pbutils", pypbutils_functions);
|
||||||
pypbutils_add_constants (m, "GST_");
|
d = PyModule_GetDict (m);
|
||||||
|
|
||||||
if (PyErr_Occurred ()) {
|
pypbutils_register_classes (d);
|
||||||
PyErr_Print ();
|
pypbutils_add_constants (m, "GST_");
|
||||||
Py_FatalError ("can't initialize module gst.pbutils");
|
|
||||||
}
|
if (PyErr_Occurred ()) {
|
||||||
|
PyErr_Print ();
|
||||||
|
Py_FatalError ("can't initialize module gst.pbutils");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,235 +33,237 @@ PyObject *PyGstExc_ElementNotFoundError = NULL;
|
||||||
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
call_exception_init(PyObject *args)
|
call_exception_init (PyObject * args)
|
||||||
{
|
{
|
||||||
PyObject *parent_init = NULL;
|
PyObject *parent_init = NULL;
|
||||||
PyObject *res = NULL;
|
PyObject *res = NULL;
|
||||||
|
|
||||||
/* get Exception.__init__ */
|
/* get Exception.__init__ */
|
||||||
parent_init = PyObject_GetAttrString(PyExc_Exception, "__init__");
|
parent_init = PyObject_GetAttrString (PyExc_Exception, "__init__");
|
||||||
if (parent_init == NULL)
|
if (parent_init == NULL)
|
||||||
goto exception;
|
goto exception;
|
||||||
|
|
||||||
/* call Exception.__init__. This will set self.args */
|
/* call Exception.__init__. This will set self.args */
|
||||||
res = PyObject_CallObject(parent_init, args);
|
res = PyObject_CallObject (parent_init, args);
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
goto exception;
|
goto exception;
|
||||||
|
|
||||||
Py_DECREF(parent_init);
|
Py_DECREF (parent_init);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
exception:
|
exception:
|
||||||
Py_XDECREF(parent_init);
|
Py_XDECREF (parent_init);
|
||||||
Py_XDECREF(res);
|
Py_XDECREF (res);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
add_method(PyObject *klass, PyObject *dict, PyMethodDef *method) {
|
add_method (PyObject * klass, PyObject * dict, PyMethodDef * method)
|
||||||
PyObject *module = NULL;
|
{
|
||||||
PyObject *func = NULL;
|
PyObject *module = NULL;
|
||||||
PyObject *meth = NULL;
|
PyObject *func = NULL;
|
||||||
|
PyObject *meth = NULL;
|
||||||
|
|
||||||
|
module = PyString_FromString ("gst");
|
||||||
|
if (module == NULL)
|
||||||
|
goto exception;
|
||||||
|
|
||||||
|
func = PyCFunction_NewEx (method, NULL, module);
|
||||||
|
if (func == NULL)
|
||||||
|
goto exception;
|
||||||
|
Py_DECREF (module);
|
||||||
|
|
||||||
|
meth = PyMethod_New (func, NULL, klass);
|
||||||
|
if (meth == NULL)
|
||||||
|
goto exception;
|
||||||
|
Py_DECREF (func);
|
||||||
|
|
||||||
|
if (PyDict_SetItemString (dict, method->ml_name, meth) < 0)
|
||||||
|
goto exception;
|
||||||
|
Py_DECREF (meth);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
module = PyString_FromString("gst");
|
|
||||||
if (module == NULL)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
func = PyCFunction_NewEx(method, NULL, module);
|
|
||||||
if (func == NULL)
|
|
||||||
goto exception;
|
|
||||||
Py_DECREF(module);
|
|
||||||
|
|
||||||
meth = PyMethod_New(func, NULL, klass);
|
|
||||||
if (meth == NULL)
|
|
||||||
goto exception;
|
|
||||||
Py_DECREF(func);
|
|
||||||
|
|
||||||
if (PyDict_SetItemString(dict, method->ml_name, meth) < 0)
|
|
||||||
goto exception;
|
|
||||||
Py_DECREF(meth);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
exception:
|
exception:
|
||||||
Py_XDECREF(module);
|
Py_XDECREF (module);
|
||||||
Py_XDECREF(func);
|
Py_XDECREF (func);
|
||||||
Py_XDECREF(meth);
|
Py_XDECREF (meth);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
link_error_init(PyObject *self, PyObject *args)
|
link_error_init (PyObject * self, PyObject * args)
|
||||||
{
|
{
|
||||||
PyObject *err_type = NULL;
|
PyObject *err_type = NULL;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O|O:__init__", &self, &err_type))
|
if (!PyArg_ParseTuple (args, "O|O:__init__", &self, &err_type))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (err_type == NULL)
|
if (err_type == NULL)
|
||||||
err_type = Py_None;
|
err_type = Py_None;
|
||||||
Py_INCREF(err_type);
|
Py_INCREF (err_type);
|
||||||
|
|
||||||
/* set self.error */
|
/* set self.error */
|
||||||
status = PyObject_SetAttrString(self, "error", err_type);
|
status = PyObject_SetAttrString (self, "error", err_type);
|
||||||
Py_DECREF(err_type);
|
Py_DECREF (err_type);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return call_exception_init(args);
|
return call_exception_init (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
element_not_found_error_init(PyObject *self, PyObject *args)
|
element_not_found_error_init (PyObject * self, PyObject * args)
|
||||||
{
|
{
|
||||||
PyObject *element_name = NULL;
|
PyObject *element_name = NULL;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O|O:__init__", &self, &element_name))
|
if (!PyArg_ParseTuple (args, "O|O:__init__", &self, &element_name))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (element_name == NULL)
|
if (element_name == NULL)
|
||||||
element_name = Py_None;
|
element_name = Py_None;
|
||||||
Py_INCREF(element_name);
|
Py_INCREF (element_name);
|
||||||
|
|
||||||
/* set self.name */
|
|
||||||
status = PyObject_SetAttrString(self, "name", element_name);
|
|
||||||
Py_DECREF(element_name);
|
|
||||||
if (status < 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return call_exception_init(args);
|
/* set self.name */
|
||||||
|
status = PyObject_SetAttrString (self, "name", element_name);
|
||||||
|
Py_DECREF (element_name);
|
||||||
|
if (status < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return call_exception_init (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyMethodDef link_error_init_method = {"__init__",
|
static PyMethodDef link_error_init_method = { "__init__",
|
||||||
link_error_init, METH_VARARGS
|
link_error_init, METH_VARARGS
|
||||||
};
|
};
|
||||||
|
|
||||||
static PyMethodDef element_not_found_error_init_method = {"__init__",
|
static PyMethodDef element_not_found_error_init_method = { "__init__",
|
||||||
element_not_found_error_init, METH_VARARGS
|
element_not_found_error_init, METH_VARARGS
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
pygst_exceptions_register_classes(PyObject *d)
|
pygst_exceptions_register_classes (PyObject * d)
|
||||||
{
|
{
|
||||||
PyObject *dict = NULL;
|
PyObject *dict = NULL;
|
||||||
|
|
||||||
/* register gst.LinkError */
|
|
||||||
dict = PyDict_New();
|
|
||||||
if (dict == NULL)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
PyGstExc_LinkError = PyErr_NewException("gst.LinkError",
|
|
||||||
PyExc_Exception, dict);
|
|
||||||
if (PyGstExc_LinkError == NULL)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
if (add_method(PyGstExc_LinkError, dict, &link_error_init_method) < 0)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
Py_DECREF(dict);
|
|
||||||
|
|
||||||
if (PyDict_SetItemString(d, "LinkError", PyGstExc_LinkError) < 0)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
Py_DECREF(PyGstExc_LinkError);
|
|
||||||
|
|
||||||
/* register gst.AddError */
|
|
||||||
PyGstExc_AddError = PyErr_NewException("gst.AddError",
|
|
||||||
PyExc_Exception, NULL);
|
|
||||||
if (PyGstExc_AddError == NULL)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
if (PyDict_SetItemString(d, "AddError", PyGstExc_AddError) < 0)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
Py_DECREF(PyGstExc_AddError);
|
/* register gst.LinkError */
|
||||||
|
dict = PyDict_New ();
|
||||||
/* register gst.RemoveError */
|
if (dict == NULL)
|
||||||
PyGstExc_RemoveError = PyErr_NewException("gst.RemoveError",
|
goto exception;
|
||||||
PyExc_Exception, NULL);
|
|
||||||
if (PyGstExc_RemoveError == NULL)
|
PyGstExc_LinkError = PyErr_NewException ("gst.LinkError",
|
||||||
goto exception;
|
PyExc_Exception, dict);
|
||||||
|
if (PyGstExc_LinkError == NULL)
|
||||||
if (PyDict_SetItemString(d, "RemoveError", PyGstExc_RemoveError) < 0)
|
goto exception;
|
||||||
goto exception;
|
|
||||||
|
if (add_method (PyGstExc_LinkError, dict, &link_error_init_method) < 0)
|
||||||
Py_DECREF(PyGstExc_RemoveError);
|
goto exception;
|
||||||
|
|
||||||
|
Py_DECREF (dict);
|
||||||
|
|
||||||
|
if (PyDict_SetItemString (d, "LinkError", PyGstExc_LinkError) < 0)
|
||||||
|
goto exception;
|
||||||
|
|
||||||
|
Py_DECREF (PyGstExc_LinkError);
|
||||||
|
|
||||||
|
/* register gst.AddError */
|
||||||
|
PyGstExc_AddError = PyErr_NewException ("gst.AddError",
|
||||||
|
PyExc_Exception, NULL);
|
||||||
|
if (PyGstExc_AddError == NULL)
|
||||||
|
goto exception;
|
||||||
|
|
||||||
|
if (PyDict_SetItemString (d, "AddError", PyGstExc_AddError) < 0)
|
||||||
|
goto exception;
|
||||||
|
|
||||||
|
Py_DECREF (PyGstExc_AddError);
|
||||||
|
|
||||||
|
/* register gst.RemoveError */
|
||||||
|
PyGstExc_RemoveError = PyErr_NewException ("gst.RemoveError",
|
||||||
|
PyExc_Exception, NULL);
|
||||||
|
if (PyGstExc_RemoveError == NULL)
|
||||||
|
goto exception;
|
||||||
|
|
||||||
|
if (PyDict_SetItemString (d, "RemoveError", PyGstExc_RemoveError) < 0)
|
||||||
|
goto exception;
|
||||||
|
|
||||||
|
Py_DECREF (PyGstExc_RemoveError);
|
||||||
|
|
||||||
|
/* register gst.QueryError */
|
||||||
|
PyGstExc_QueryError = PyErr_NewException ("gst.QueryError",
|
||||||
|
PyExc_Exception, NULL);
|
||||||
|
if (PyGstExc_QueryError == NULL)
|
||||||
|
goto exception;
|
||||||
|
|
||||||
|
if (PyDict_SetItemString (d, "QueryError", PyGstExc_QueryError) < 0)
|
||||||
|
goto exception;
|
||||||
|
|
||||||
|
Py_DECREF (PyGstExc_QueryError);
|
||||||
|
|
||||||
/* register gst.QueryError */
|
|
||||||
PyGstExc_QueryError = PyErr_NewException("gst.QueryError",
|
|
||||||
PyExc_Exception, NULL);
|
|
||||||
if (PyGstExc_QueryError == NULL)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
if (PyDict_SetItemString(d, "QueryError", PyGstExc_QueryError) < 0)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
Py_DECREF(PyGstExc_QueryError);
|
|
||||||
|
|
||||||
/* FIXME: remove this method in 0.11; element_factory_make deals with element
|
/* FIXME: remove this method in 0.11; element_factory_make deals with element
|
||||||
factories, not plug-ins */
|
factories, not plug-ins */
|
||||||
|
|
||||||
/* register gst.PluginNotFoundError */
|
|
||||||
dict = PyDict_New();
|
|
||||||
if (dict == NULL)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
PyGstExc_PluginNotFoundError = \
|
|
||||||
PyErr_NewException("gst.PluginNotFoundError", PyExc_Exception, dict);
|
|
||||||
if (PyGstExc_PluginNotFoundError == NULL)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
if (add_method(PyGstExc_PluginNotFoundError,
|
|
||||||
dict, &element_not_found_error_init_method) < 0)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
Py_DECREF(dict);
|
/* register gst.PluginNotFoundError */
|
||||||
|
dict = PyDict_New ();
|
||||||
if (PyDict_SetItemString(d, "PluginNotFoundError",
|
if (dict == NULL)
|
||||||
PyGstExc_PluginNotFoundError) < 0)
|
goto exception;
|
||||||
goto exception;
|
|
||||||
|
|
||||||
Py_DECREF(PyGstExc_PluginNotFoundError);
|
PyGstExc_PluginNotFoundError =
|
||||||
|
PyErr_NewException ("gst.PluginNotFoundError", PyExc_Exception, dict);
|
||||||
|
if (PyGstExc_PluginNotFoundError == NULL)
|
||||||
|
goto exception;
|
||||||
|
|
||||||
/* register gst.ElementNotFoundError */
|
if (add_method (PyGstExc_PluginNotFoundError,
|
||||||
dict = PyDict_New();
|
dict, &element_not_found_error_init_method) < 0)
|
||||||
if (dict == NULL)
|
goto exception;
|
||||||
goto exception;
|
|
||||||
|
|
||||||
PyGstExc_ElementNotFoundError = \
|
|
||||||
PyErr_NewException("gst.ElementNotFoundError", PyGstExc_PluginNotFoundError, dict);
|
|
||||||
if (PyGstExc_ElementNotFoundError == NULL)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
if (add_method(PyGstExc_ElementNotFoundError,
|
|
||||||
dict, &element_not_found_error_init_method) < 0)
|
|
||||||
goto exception;
|
|
||||||
|
|
||||||
Py_DECREF(dict);
|
Py_DECREF (dict);
|
||||||
|
|
||||||
if (PyDict_SetItemString(d, "ElementNotFoundError",
|
if (PyDict_SetItemString (d, "PluginNotFoundError",
|
||||||
PyGstExc_ElementNotFoundError) < 0)
|
PyGstExc_PluginNotFoundError) < 0)
|
||||||
goto exception;
|
goto exception;
|
||||||
|
|
||||||
|
Py_DECREF (PyGstExc_PluginNotFoundError);
|
||||||
|
|
||||||
|
/* register gst.ElementNotFoundError */
|
||||||
|
dict = PyDict_New ();
|
||||||
|
if (dict == NULL)
|
||||||
|
goto exception;
|
||||||
|
|
||||||
|
PyGstExc_ElementNotFoundError =
|
||||||
|
PyErr_NewException ("gst.ElementNotFoundError",
|
||||||
|
PyGstExc_PluginNotFoundError, dict);
|
||||||
|
if (PyGstExc_ElementNotFoundError == NULL)
|
||||||
|
goto exception;
|
||||||
|
|
||||||
|
if (add_method (PyGstExc_ElementNotFoundError,
|
||||||
|
dict, &element_not_found_error_init_method) < 0)
|
||||||
|
goto exception;
|
||||||
|
|
||||||
|
Py_DECREF (dict);
|
||||||
|
|
||||||
|
if (PyDict_SetItemString (d, "ElementNotFoundError",
|
||||||
|
PyGstExc_ElementNotFoundError) < 0)
|
||||||
|
goto exception;
|
||||||
|
|
||||||
|
Py_DECREF (PyGstExc_ElementNotFoundError);
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
Py_DECREF(PyGstExc_ElementNotFoundError);
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
exception:
|
exception:
|
||||||
Py_XDECREF(dict);
|
Py_XDECREF (dict);
|
||||||
Py_XDECREF(PyGstExc_LinkError);
|
Py_XDECREF (PyGstExc_LinkError);
|
||||||
Py_XDECREF(PyGstExc_AddError);
|
Py_XDECREF (PyGstExc_AddError);
|
||||||
Py_XDECREF(PyGstExc_RemoveError);
|
Py_XDECREF (PyGstExc_RemoveError);
|
||||||
Py_XDECREF(PyGstExc_QueryError);
|
Py_XDECREF (PyGstExc_QueryError);
|
||||||
Py_XDECREF(PyGstExc_PluginNotFoundError);
|
Py_XDECREF (PyGstExc_PluginNotFoundError);
|
||||||
Py_XDECREF(PyGstExc_ElementNotFoundError);
|
Py_XDECREF (PyGstExc_ElementNotFoundError);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,8 +148,8 @@ pygst_iterator_new (GstIterator * iter)
|
||||||
PyGstIterator *self;
|
PyGstIterator *self;
|
||||||
|
|
||||||
if (iter == NULL) {
|
if (iter == NULL) {
|
||||||
PyErr_SetString (PyExc_TypeError, "Invalid GstIterator (NULL)");
|
PyErr_SetString (PyExc_TypeError, "Invalid GstIterator (NULL)");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
self = PyObject_NEW (PyGstIterator, &PyGstIterator_Type);
|
self = PyObject_NEW (PyGstIterator, &PyGstIterator_Type);
|
||||||
|
|
|
@ -24,12 +24,12 @@
|
||||||
#include "pygstminiobject.h"
|
#include "pygstminiobject.h"
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
static const gchar pygstminiobject_class_id[] = "PyGstMiniObject::class";
|
static const gchar pygstminiobject_class_id[] = "PyGstMiniObject::class";
|
||||||
static GQuark pygstminiobject_class_key = 0;
|
static GQuark pygstminiobject_class_key = 0;
|
||||||
/* static const gchar pygstminiobject_wrapper_id[] = "PyGstMiniObject::wrapper"; */
|
/* static const gchar pygstminiobject_wrapper_id[] = "PyGstMiniObject::wrapper"; */
|
||||||
/* static GQuark pygstminiobject_wrapper_key = 0; */
|
/* static GQuark pygstminiobject_wrapper_key = 0; */
|
||||||
|
|
||||||
static void pygstminiobject_dealloc(PyGstMiniObject *self);
|
static void pygstminiobject_dealloc (PyGstMiniObject * self);
|
||||||
/* static int pygstminiobject_traverse(PyGstMiniObject *self, visitproc visit, void *arg); */
|
/* static int pygstminiobject_traverse(PyGstMiniObject *self, visitproc visit, void *arg); */
|
||||||
/* static int pygstminiobject_clear(PyGstMiniObject *self); */
|
/* static int pygstminiobject_clear(PyGstMiniObject *self); */
|
||||||
|
|
||||||
|
@ -49,19 +49,19 @@ GST_DEBUG_CATEGORY_EXTERN (pygst_debug);
|
||||||
* GType has no registered type and a new type couldn't be created
|
* GType has no registered type and a new type couldn't be created
|
||||||
*/
|
*/
|
||||||
PyTypeObject *
|
PyTypeObject *
|
||||||
pygstminiobject_lookup_class(GType gtype)
|
pygstminiobject_lookup_class (GType gtype)
|
||||||
{
|
{
|
||||||
PyTypeObject *py_type = NULL;
|
PyTypeObject *py_type = NULL;
|
||||||
GType ctype = gtype;
|
GType ctype = gtype;
|
||||||
|
|
||||||
while (!py_type && ctype) {
|
while (!py_type && ctype) {
|
||||||
py_type = g_type_get_qdata(ctype, pygstminiobject_class_key);
|
py_type = g_type_get_qdata (ctype, pygstminiobject_class_key);
|
||||||
ctype = g_type_parent(ctype);
|
ctype = g_type_parent (ctype);
|
||||||
}
|
}
|
||||||
if (!ctype)
|
if (!ctype)
|
||||||
g_error ("Couldn't find a good base type!!");
|
g_error ("Couldn't find a good base type!!");
|
||||||
|
|
||||||
return py_type;
|
return py_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,49 +78,49 @@ pygstminiobject_lookup_class(GType gtype)
|
||||||
* which simplifies initialisation.
|
* which simplifies initialisation.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pygstminiobject_register_class(PyObject *dict, const gchar *type_name,
|
pygstminiobject_register_class (PyObject * dict, const gchar * type_name,
|
||||||
GType gtype, PyTypeObject *type,
|
GType gtype, PyTypeObject * type, PyObject * bases)
|
||||||
PyObject *bases)
|
|
||||||
{
|
{
|
||||||
PyObject *o;
|
PyObject *o;
|
||||||
const char *class_name, *s;
|
const char *class_name, *s;
|
||||||
|
|
||||||
if (!pygstminiobject_class_key)
|
if (!pygstminiobject_class_key)
|
||||||
pygstminiobject_class_key = g_quark_from_static_string(pygstminiobject_class_id);
|
pygstminiobject_class_key =
|
||||||
|
g_quark_from_static_string (pygstminiobject_class_id);
|
||||||
|
|
||||||
class_name = type->tp_name;
|
class_name = type->tp_name;
|
||||||
s = strrchr(class_name, '.');
|
s = strrchr (class_name, '.');
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
class_name = s + 1;
|
class_name = s + 1;
|
||||||
|
|
||||||
type->ob_type = &PyType_Type;
|
|
||||||
type->tp_alloc = PyType_GenericAlloc;
|
|
||||||
type->tp_new = PyType_GenericNew;
|
|
||||||
if (bases) {
|
|
||||||
type->tp_bases = bases;
|
|
||||||
type->tp_base = (PyTypeObject *)PyTuple_GetItem(bases, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PyType_Ready(type) < 0) {
|
type->ob_type = &PyType_Type;
|
||||||
g_warning ("couldn't make the type `%s' ready", type->tp_name);
|
type->tp_alloc = PyType_GenericAlloc;
|
||||||
return;
|
type->tp_new = PyType_GenericNew;
|
||||||
}
|
if (bases) {
|
||||||
|
type->tp_bases = bases;
|
||||||
|
type->tp_base = (PyTypeObject *) PyTuple_GetItem (bases, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (gtype) {
|
if (PyType_Ready (type) < 0) {
|
||||||
o = pyg_type_wrapper_new(gtype);
|
g_warning ("couldn't make the type `%s' ready", type->tp_name);
|
||||||
PyDict_SetItemString(type->tp_dict, "__gtype__", o);
|
return;
|
||||||
Py_DECREF(o);
|
}
|
||||||
|
|
||||||
/* stash a pointer to the python class with the GType */
|
if (gtype) {
|
||||||
Py_INCREF(type);
|
o = pyg_type_wrapper_new (gtype);
|
||||||
g_type_set_qdata(gtype, pygstminiobject_class_key, type);
|
PyDict_SetItemString (type->tp_dict, "__gtype__", o);
|
||||||
}
|
Py_DECREF (o);
|
||||||
|
|
||||||
PyDict_SetItemString(dict, (char *)class_name, (PyObject *)type);
|
/* stash a pointer to the python class with the GType */
|
||||||
|
Py_INCREF (type);
|
||||||
|
g_type_set_qdata (gtype, pygstminiobject_class_key, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDict_SetItemString (dict, (char *) class_name, (PyObject *) type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pygstminiobject_register_wrapper (PyObject *self)
|
pygstminiobject_register_wrapper (PyObject * self)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,239 +135,244 @@ pygstminiobject_register_wrapper (PyObject *self)
|
||||||
* Returns: a reference to the wrapper for the GstMiniObject.
|
* Returns: a reference to the wrapper for the GstMiniObject.
|
||||||
*/
|
*/
|
||||||
PyObject *
|
PyObject *
|
||||||
pygstminiobject_new (GstMiniObject *obj)
|
pygstminiobject_new (GstMiniObject * obj)
|
||||||
{
|
{
|
||||||
PyGstMiniObject *self = NULL;
|
PyGstMiniObject *self = NULL;
|
||||||
PyGILState_STATE state;
|
PyGILState_STATE state;
|
||||||
PyTypeObject *tp = NULL;
|
PyTypeObject *tp = NULL;
|
||||||
|
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
Py_INCREF (Py_None);
|
Py_INCREF (Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* since mini objects cannot notify us when they get destroyed, we
|
/* since mini objects cannot notify us when they get destroyed, we
|
||||||
* can't use a global hash to map GMO to PyO, and have to create a new
|
* can't use a global hash to map GMO to PyO, and have to create a new
|
||||||
* Python object every time we see it */
|
* Python object every time we see it */
|
||||||
tp = pygstminiobject_lookup_class (G_OBJECT_TYPE (obj));
|
tp = pygstminiobject_lookup_class (G_OBJECT_TYPE (obj));
|
||||||
GST_DEBUG ("have to create wrapper for object %p", obj);
|
GST_DEBUG ("have to create wrapper for object %p", obj);
|
||||||
if (!tp)
|
if (!tp)
|
||||||
g_warning ("Couldn't get class for type object : %p", obj);
|
g_warning ("Couldn't get class for type object : %p", obj);
|
||||||
if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
||||||
GST_INFO ("Increment refcount %p", tp);
|
GST_INFO ("Increment refcount %p", tp);
|
||||||
Py_INCREF (tp);
|
Py_INCREF (tp);
|
||||||
}
|
}
|
||||||
state = pyg_gil_state_ensure();
|
state = pyg_gil_state_ensure ();
|
||||||
self = PyObject_New (PyGstMiniObject, tp);
|
self = PyObject_New (PyGstMiniObject, tp);
|
||||||
pyg_gil_state_release(state);
|
pyg_gil_state_release (state);
|
||||||
|
|
||||||
if (self == NULL)
|
if (self == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
self->obj = gst_mini_object_ref (obj);
|
self->obj = gst_mini_object_ref (obj);
|
||||||
|
|
||||||
self->inst_dict = NULL;
|
self->inst_dict = NULL;
|
||||||
self->weakreflist = NULL;
|
self->weakreflist = NULL;
|
||||||
|
|
||||||
GST_DEBUG ("created Python object %p for GstMiniObject %p [ref:%d]",
|
GST_DEBUG ("created Python object %p for GstMiniObject %p [ref:%d]",
|
||||||
self, obj, GST_MINI_OBJECT_REFCOUNT_VALUE (obj));
|
self, obj, GST_MINI_OBJECT_REFCOUNT_VALUE (obj));
|
||||||
return (PyObject *) self;
|
return (PyObject *) self;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pygstminiobject_dealloc(PyGstMiniObject *self)
|
pygstminiobject_dealloc (PyGstMiniObject * self)
|
||||||
{
|
{
|
||||||
PyGILState_STATE state;
|
PyGILState_STATE state;
|
||||||
|
|
||||||
g_return_if_fail (self != NULL);
|
g_return_if_fail (self != NULL);
|
||||||
|
|
||||||
GST_DEBUG ("At the beginning %p", self);
|
GST_DEBUG ("At the beginning %p", self);
|
||||||
state = pyg_gil_state_ensure();
|
state = pyg_gil_state_ensure ();
|
||||||
|
|
||||||
if (self->obj) {
|
if (self->obj) {
|
||||||
GST_DEBUG ("PyO %p unreffing GstMiniObject %p [ref:%d]", self,
|
GST_DEBUG ("PyO %p unreffing GstMiniObject %p [ref:%d]", self,
|
||||||
self->obj, GST_MINI_OBJECT_REFCOUNT_VALUE (self->obj));
|
self->obj, GST_MINI_OBJECT_REFCOUNT_VALUE (self->obj));
|
||||||
gst_mini_object_unref(self->obj);
|
gst_mini_object_unref (self->obj);
|
||||||
GST_DEBUG ("setting self %p -> obj to NULL", self);
|
GST_DEBUG ("setting self %p -> obj to NULL", self);
|
||||||
self->obj = NULL;
|
self->obj = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->inst_dict) {
|
if (self->inst_dict) {
|
||||||
Py_DECREF(self->inst_dict);
|
Py_DECREF (self->inst_dict);
|
||||||
self->inst_dict = NULL;
|
self->inst_dict = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->ob_type->tp_free((PyObject *) self);
|
self->ob_type->tp_free ((PyObject *) self);
|
||||||
pyg_gil_state_release(state);
|
pyg_gil_state_release (state);
|
||||||
GST_DEBUG ("At the end %p", self);
|
GST_DEBUG ("At the end %p", self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pygstminiobject_compare(PyGstMiniObject *self, PyGstMiniObject *v)
|
pygstminiobject_compare (PyGstMiniObject * self, PyGstMiniObject * v)
|
||||||
{
|
{
|
||||||
if (self->obj == v->obj) return 0;
|
if (self->obj == v->obj)
|
||||||
if (self->obj > v->obj) return -1;
|
return 0;
|
||||||
return 1;
|
if (self->obj > v->obj)
|
||||||
|
return -1;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long
|
static long
|
||||||
pygstminiobject_hash(PyGstMiniObject *self)
|
pygstminiobject_hash (PyGstMiniObject * self)
|
||||||
{
|
{
|
||||||
return (long)self->obj;
|
return (long) self->obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pygstminiobject_repr(PyGstMiniObject *self)
|
pygstminiobject_repr (PyGstMiniObject * self)
|
||||||
{
|
{
|
||||||
gchar buf[256];
|
gchar buf[256];
|
||||||
|
|
||||||
g_snprintf(buf, sizeof(buf),
|
g_snprintf (buf, sizeof (buf),
|
||||||
"<%s mini-object (%s) at 0x%lx>",
|
"<%s mini-object (%s) at 0x%lx>",
|
||||||
self->ob_type->tp_name,
|
self->ob_type->tp_name,
|
||||||
self->obj ? G_OBJECT_TYPE_NAME(self->obj) : "uninitialized",
|
self->obj ? G_OBJECT_TYPE_NAME (self->obj) : "uninitialized",
|
||||||
(long)self);
|
(long) self);
|
||||||
return PyString_FromString(buf);
|
return PyString_FromString (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pygstminiobject_free(PyObject *op)
|
pygstminiobject_free (PyObject * op)
|
||||||
{
|
{
|
||||||
PyObject_FREE(op);
|
PyObject_FREE (op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ---------------- PyGstMiniObject methods ----------------- */
|
/* ---------------- PyGstMiniObject methods ----------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pygstminiobject_init(PyGstMiniObject *self, PyObject *args, PyObject *kwargs)
|
pygstminiobject_init (PyGstMiniObject * self, PyObject * args,
|
||||||
|
PyObject * kwargs)
|
||||||
{
|
{
|
||||||
GType object_type;
|
GType object_type;
|
||||||
GstMiniObjectClass *class;
|
GstMiniObjectClass *class;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, ":GstMiniObject.__init__", &object_type))
|
if (!PyArg_ParseTuple (args, ":GstMiniObject.__init__", &object_type))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
object_type = pyg_type_from_object((PyObject *)self);
|
object_type = pyg_type_from_object ((PyObject *) self);
|
||||||
if (!object_type)
|
if (!object_type)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (G_TYPE_IS_ABSTRACT(object_type)) {
|
if (G_TYPE_IS_ABSTRACT (object_type)) {
|
||||||
PyErr_Format(PyExc_TypeError, "cannot create instance of abstract "
|
PyErr_Format (PyExc_TypeError, "cannot create instance of abstract "
|
||||||
"(non-instantiable) type `%s'", g_type_name(object_type));
|
"(non-instantiable) type `%s'", g_type_name (object_type));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((class = g_type_class_ref (object_type)) == NULL) {
|
if ((class = g_type_class_ref (object_type)) == NULL) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString (PyExc_TypeError,
|
||||||
"could not get a reference to type class");
|
"could not get a reference to type class");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->obj = gst_mini_object_new(object_type);
|
self->obj = gst_mini_object_new (object_type);
|
||||||
if (self->obj == NULL)
|
if (self->obj == NULL)
|
||||||
PyErr_SetString (PyExc_RuntimeError, "could not create object");
|
PyErr_SetString (PyExc_RuntimeError, "could not create object");
|
||||||
|
|
||||||
g_type_class_unref(class);
|
g_type_class_unref (class);
|
||||||
|
|
||||||
return (self->obj) ? 0 : -1;
|
return (self->obj) ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pygstminiobject__gstminiobject_init__(PyGstMiniObject *self, PyObject *args, PyObject *kwargs)
|
pygstminiobject__gstminiobject_init__ (PyGstMiniObject * self, PyObject * args,
|
||||||
|
PyObject * kwargs)
|
||||||
{
|
{
|
||||||
if (pygstminiobject_init(self, args, kwargs) < 0)
|
if (pygstminiobject_init (self, args, kwargs) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF (Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pygstminiobject_copy(PyGstMiniObject *self, PyObject *args)
|
pygstminiobject_copy (PyGstMiniObject * self, PyObject * args)
|
||||||
{
|
{
|
||||||
return pygstminiobject_new(gst_mini_object_copy(self->obj));
|
return pygstminiobject_new (gst_mini_object_copy (self->obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyMethodDef pygstminiobject_methods[] = {
|
static PyMethodDef pygstminiobject_methods[] = {
|
||||||
{ "__gstminiobject_init__", (PyCFunction)pygstminiobject__gstminiobject_init__,
|
{"__gstminiobject_init__",
|
||||||
METH_VARARGS|METH_KEYWORDS },
|
(PyCFunction) pygstminiobject__gstminiobject_init__,
|
||||||
{ "copy", (PyCFunction)pygstminiobject_copy, METH_VARARGS, "Copies the miniobject"},
|
METH_VARARGS | METH_KEYWORDS},
|
||||||
{ NULL, NULL, 0 }
|
{"copy", (PyCFunction) pygstminiobject_copy, METH_VARARGS,
|
||||||
|
"Copies the miniobject"},
|
||||||
|
{NULL, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pygstminiobject_get_dict(PyGstMiniObject *self, void *closure)
|
pygstminiobject_get_dict (PyGstMiniObject * self, void *closure)
|
||||||
{
|
{
|
||||||
if (self->inst_dict == NULL) {
|
if (self->inst_dict == NULL) {
|
||||||
self->inst_dict = PyDict_New();
|
self->inst_dict = PyDict_New ();
|
||||||
if (self->inst_dict == NULL)
|
if (self->inst_dict == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Py_INCREF(self->inst_dict);
|
Py_INCREF (self->inst_dict);
|
||||||
return self->inst_dict;
|
return self->inst_dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pygstminiobject_get_refcount(PyGstMiniObject *self, void *closure)
|
pygstminiobject_get_refcount (PyGstMiniObject * self, void *closure)
|
||||||
{
|
{
|
||||||
return PyInt_FromLong(GST_MINI_OBJECT_REFCOUNT_VALUE(self->obj));
|
return PyInt_FromLong (GST_MINI_OBJECT_REFCOUNT_VALUE (self->obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pygstminiobject_get_flags(PyGstMiniObject *self, void *closure)
|
pygstminiobject_get_flags (PyGstMiniObject * self, void *closure)
|
||||||
{
|
{
|
||||||
return PyInt_FromLong(GST_MINI_OBJECT_FLAGS(self->obj));
|
return PyInt_FromLong (GST_MINI_OBJECT_FLAGS (self->obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyGetSetDef pygstminiobject_getsets[] = {
|
static PyGetSetDef pygstminiobject_getsets[] = {
|
||||||
{ "__dict__", (getter)pygstminiobject_get_dict, (setter)0 },
|
{"__dict__", (getter) pygstminiobject_get_dict, (setter) 0},
|
||||||
{ "__grefcount__", (getter)pygstminiobject_get_refcount, (setter)0, },
|
{"__grefcount__", (getter) pygstminiobject_get_refcount, (setter) 0,},
|
||||||
{ "flags", (getter)pygstminiobject_get_flags, (setter)0, },
|
{"flags", (getter) pygstminiobject_get_flags, (setter) 0,},
|
||||||
{ NULL, 0, 0 }
|
{NULL, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
PyTypeObject PyGstMiniObject_Type = {
|
PyTypeObject PyGstMiniObject_Type = {
|
||||||
PyObject_HEAD_INIT(NULL)
|
PyObject_HEAD_INIT (NULL)
|
||||||
0, /* ob_size */
|
0, /* ob_size */
|
||||||
"gst.MiniObject", /* tp_name */
|
"gst.MiniObject", /* tp_name */
|
||||||
sizeof(PyGstMiniObject), /* tp_basicsize */
|
sizeof (PyGstMiniObject), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
/* methods */
|
/* methods */
|
||||||
(destructor)pygstminiobject_dealloc, /* tp_dealloc */
|
(destructor) pygstminiobject_dealloc, /* tp_dealloc */
|
||||||
(printfunc)0, /* tp_print */
|
(printfunc) 0, /* tp_print */
|
||||||
(getattrfunc)0, /* tp_getattr */
|
(getattrfunc) 0, /* tp_getattr */
|
||||||
(setattrfunc)0, /* tp_setattr */
|
(setattrfunc) 0, /* tp_setattr */
|
||||||
(cmpfunc)pygstminiobject_compare, /* tp_compare */
|
(cmpfunc) pygstminiobject_compare, /* tp_compare */
|
||||||
(reprfunc)pygstminiobject_repr, /* tp_repr */
|
(reprfunc) pygstminiobject_repr, /* tp_repr */
|
||||||
0, /* tp_as_number */
|
0, /* tp_as_number */
|
||||||
0, /* tp_as_sequence */
|
0, /* tp_as_sequence */
|
||||||
0, /* tp_as_mapping */
|
0, /* tp_as_mapping */
|
||||||
(hashfunc)pygstminiobject_hash, /* tp_hash */
|
(hashfunc) pygstminiobject_hash, /* tp_hash */
|
||||||
(ternaryfunc)0, /* tp_call */
|
(ternaryfunc) 0, /* tp_call */
|
||||||
(reprfunc)0, /* tp_str */
|
(reprfunc) 0, /* tp_str */
|
||||||
(getattrofunc)0, /* tp_getattro */
|
(getattrofunc) 0, /* tp_getattro */
|
||||||
(setattrofunc)0, /* tp_setattro */
|
(setattrofunc) 0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
NULL, /* Documentation string */
|
NULL, /* Documentation string */
|
||||||
(traverseproc)0, /* tp_traverse */
|
(traverseproc) 0, /* tp_traverse */
|
||||||
(inquiry)0, /* tp_clear */
|
(inquiry) 0, /* tp_clear */
|
||||||
(richcmpfunc)0, /* tp_richcompare */
|
(richcmpfunc) 0, /* tp_richcompare */
|
||||||
offsetof(PyGstMiniObject, weakreflist), /* tp_weaklistoffset */
|
offsetof (PyGstMiniObject, weakreflist), /* tp_weaklistoffset */
|
||||||
(getiterfunc)0, /* tp_iter */
|
(getiterfunc) 0, /* tp_iter */
|
||||||
(iternextfunc)0, /* tp_iternext */
|
(iternextfunc) 0, /* tp_iternext */
|
||||||
pygstminiobject_methods, /* tp_methods */
|
pygstminiobject_methods, /* tp_methods */
|
||||||
0, /* tp_members */
|
0, /* tp_members */
|
||||||
pygstminiobject_getsets, /* tp_getset */
|
pygstminiobject_getsets, /* tp_getset */
|
||||||
(PyTypeObject *)0, /* tp_base */
|
(PyTypeObject *) 0, /* tp_base */
|
||||||
(PyObject *)0, /* tp_dict */
|
(PyObject *) 0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
offsetof(PyGstMiniObject, inst_dict), /* tp_dictoffset */
|
offsetof (PyGstMiniObject, inst_dict), /* tp_dictoffset */
|
||||||
(initproc)pygstminiobject_init, /* tp_init */
|
(initproc) pygstminiobject_init, /* tp_init */
|
||||||
(allocfunc)0, /* tp_alloc */
|
(allocfunc) 0, /* tp_alloc */
|
||||||
(newfunc)0, /* tp_new */
|
(newfunc) 0, /* tp_new */
|
||||||
(freefunc)pygstminiobject_free, /* tp_free */
|
(freefunc) pygstminiobject_free, /* tp_free */
|
||||||
(inquiry)0, /* tp_is_gc */
|
(inquiry) 0, /* tp_is_gc */
|
||||||
(PyObject *)0, /* tp_bases */
|
(PyObject *) 0, /* tp_bases */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -28,31 +28,31 @@
|
||||||
#include <gst/tag/tag.h>
|
#include <gst/tag/tag.h>
|
||||||
#include "pygst.h"
|
#include "pygst.h"
|
||||||
|
|
||||||
void pytag_register_classes (PyObject *d);
|
void pytag_register_classes (PyObject * d);
|
||||||
void pytag_add_constants(PyObject *module, const gchar *strip_prefix);
|
void pytag_add_constants (PyObject * module, const gchar * strip_prefix);
|
||||||
|
|
||||||
extern PyMethodDef pytag_functions[];
|
extern PyMethodDef pytag_functions[];
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (pygst_debug); /* for python code */
|
GST_DEBUG_CATEGORY (pygst_debug); /* for python code */
|
||||||
|
|
||||||
DL_EXPORT(void)
|
DL_EXPORT (void)
|
||||||
inittag (void)
|
inittag (void)
|
||||||
{
|
{
|
||||||
PyObject *m, *d;
|
PyObject *m, *d;
|
||||||
|
|
||||||
init_pygobject ();
|
init_pygobject ();
|
||||||
pygst_init ();
|
pygst_init ();
|
||||||
/* Initialize tag library */
|
/* Initialize tag library */
|
||||||
gst_tag_register_musicbrainz_tags ();
|
gst_tag_register_musicbrainz_tags ();
|
||||||
|
|
||||||
m = Py_InitModule ("tag", pytag_functions);
|
|
||||||
d = PyModule_GetDict (m);
|
|
||||||
|
|
||||||
pytag_register_classes (d);
|
m = Py_InitModule ("tag", pytag_functions);
|
||||||
pytag_add_constants (m, "GST_");
|
d = PyModule_GetDict (m);
|
||||||
|
|
||||||
if (PyErr_Occurred ()) {
|
pytag_register_classes (d);
|
||||||
PyErr_Print ();
|
pytag_add_constants (m, "GST_");
|
||||||
Py_FatalError ("can't initialize module gst.tag");
|
|
||||||
}
|
if (PyErr_Occurred ()) {
|
||||||
|
PyErr_Print ();
|
||||||
|
Py_FatalError ("can't initialize module gst.tag");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,29 +30,29 @@
|
||||||
#include <gst/video/gstvideofilter.h>
|
#include <gst/video/gstvideofilter.h>
|
||||||
#include "pygst.h"
|
#include "pygst.h"
|
||||||
|
|
||||||
void pyvideo_register_classes (PyObject *d);
|
void pyvideo_register_classes (PyObject * d);
|
||||||
void pyvideo_add_constants(PyObject *module, const gchar *strip_prefix);
|
void pyvideo_add_constants (PyObject * module, const gchar * strip_prefix);
|
||||||
|
|
||||||
extern PyMethodDef pyvideo_functions[];
|
extern PyMethodDef pyvideo_functions[];
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (pygst_debug); /* for python code */
|
GST_DEBUG_CATEGORY (pygst_debug); /* for python code */
|
||||||
|
|
||||||
DL_EXPORT(void)
|
DL_EXPORT (void)
|
||||||
initvideo (void)
|
initvideo (void)
|
||||||
{
|
{
|
||||||
PyObject *m, *d, *gst;
|
PyObject *m, *d, *gst;
|
||||||
|
|
||||||
init_pygobject ();
|
init_pygobject ();
|
||||||
gst = pygst_init ();
|
gst = pygst_init ();
|
||||||
|
|
||||||
m = Py_InitModule ("video", pyvideo_functions);
|
m = Py_InitModule ("video", pyvideo_functions);
|
||||||
d = PyModule_GetDict (m);
|
d = PyModule_GetDict (m);
|
||||||
|
|
||||||
pyvideo_register_classes (d);
|
pyvideo_register_classes (d);
|
||||||
pyvideo_add_constants (m, "GST_");
|
pyvideo_add_constants (m, "GST_");
|
||||||
|
|
||||||
if (PyErr_Occurred ()) {
|
if (PyErr_Occurred ()) {
|
||||||
PyErr_Print ();
|
PyErr_Print ();
|
||||||
Py_FatalError ("can't initialize module gst.video");
|
Py_FatalError ("can't initialize module gst.video");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue