gstreamer/bindings/python/ges.override
2011-08-11 14:40:10 +02:00

401 lines
10 KiB
C

/* -*- Mode: C; c-basic-offset: 4 -*- */
%%
headers
#define NO_IMPORT_PYGOBJECT
#include <pygobject.h>
#include <pygst/pygst.h>
#include <gst/gst.h>
#include <ges/ges.h>
#include <pygst/pygst.h>
#include <glib.h>
#include <pyglib.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
/* Boonky define that allows for backwards compatibility with Python 2.4 */
#if PY_VERSION_HEX < 0x02050000
#define Py_ssize_t int
#endif
void pyges_register_classes(PyObject *d);
void pyges_add_constants(PyObject *module, const gchar *strip_prefix);
%%
import gobject.GObject as PyGObject_Type
import gobject.MainContext as PyGMainContext_Type
import gobject.GObject as PyGInitiallyUnowned_Type
import gst.Bin as PyGstBin_Type
import gst.Pipeline as PyGstPipeline_Type
import gst.Element as PyGstElement_Type
import gst.Buffer as PyGstBuffer_Type
import gst.Pad as PyGstPad_Type
import gst.pbutils.EncodingProfile as PyGstEncodingProfile_Type
%%
override ges_track_get_timeline kwargs
static PyObject *
_wrap_ges_track_get_timeline(PyGObject *self)
{
const GESTimeline *ret;
pyg_begin_allow_threads;
ret = ges_track_get_timeline(GES_TRACK(self->obj));
pyg_end_allow_threads;
/* pygobject_new handles NULL checking */
return pygobject_new((GObject *)ret);
}
%%
override ges_track_get_caps noargs
static PyObject *
_wrap_ges_track_get_caps(PyGObject *self, void* closure)
{
const GstCaps *ret;
ret = ges_track_get_caps(GES_TRACK(self->obj));
return pyg_boxed_new (GST_TYPE_CAPS, (GstCaps*) ret, TRUE, TRUE);
}
%%
override ges_track_set_caps kwargs
static PyObject *
_wrap_ges_track_set_caps(PyGObject *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 = pyg_boxed_get (py_caps, GstCaps);
if (PyErr_Occurred())
return NULL;
pyg_begin_allow_threads;
ges_track_set_caps (GES_TRACK(self->obj), caps);
pyg_end_allow_threads;
Py_INCREF(Py_None);
return Py_None;
}
%%
new-constructor GES_TYPE_TRACK
%%
override ges_track_new kwargs
static int
_wrap_ges_track_new(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "type", "caps", NULL };
PyObject *py_type = NULL;
GESTrackType type;
GstCaps *caps;
PyObject *py_caps;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,"OO:GES.Track.__init__", kwlist, &py_type, &py_caps))
return -1;
if (pyg_flags_get_value(GES_TYPE_TRACK_TYPE, py_type, (gpointer)&type))
return -1;
caps = pyg_boxed_get (py_caps, GstCaps);
self->obj = (GObject *)ges_track_new(type, caps);
if (!self->obj) {
PyErr_SetString(PyExc_RuntimeError, "could not create GESTrack object");
return -1;
}
pygobject_register_wrapper((PyObject *)self);
return 0;
}
%%
override ges_track_object_lookup_child kwargs
static PyObject *
_wrap_ges_track_object_lookup_child(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"name", NULL};
char *name = NULL;
GParamSpec *pspec;
GstElement *element;
gboolean ret;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"z:GES.TrackObject.lookup_child", kwlist, &name))
return FALSE;
pyg_begin_allow_threads;
ret = ges_track_object_lookup_child (GES_TRACK_OBJECT (self->obj), name, &element, &pspec);
pyg_end_allow_threads;
if (!ret)
return PyBool_FromLong(ret);
return pygobject_new((GObject *)element);
}
%%
override ges_timeline_parse_launch_effect_new kwargs
static int
_wrap_ges_timeline_parse_launch_effect_new(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "video_bin_description", "audio_bin_description", NULL };
char *video_bin_description, *audio_bin_description = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,"zz:GES.TimelineParseLaunchEffect.__init__", kwlist, &video_bin_description, &audio_bin_description))
return -1;
self->obj = (GObject *)ges_timeline_parse_launch_effect_new(video_bin_description, audio_bin_description);
if (!self->obj) {
PyErr_SetString(PyExc_RuntimeError, "could not create GESTimelineParseLaunchEffect object");
return -1;
}
pygobject_register_wrapper((PyObject *)self);
return 0;
}
/* I did not override ges_formatter_get_data and set_data for these functions are deprecated */
%%
override ges_timeline_object_get_top_effects noargs
static PyObject *
_wrap_ges_timeline_object_get_top_effects(PyGObject *self)
{
const GList *l, *list;
PyObject *py_list;
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (self->obj),PyList_New(0));
pyg_begin_allow_threads;
list = ges_timeline_object_get_top_effects(GES_TIMELINE_OBJECT(self->obj));
pyg_end_allow_threads;
py_list = PyList_New(0);
for (l = list; l; l = l->next) {
GESTrackEffect *track_effect = (GESTrackEffect*)l->data;
PyObject *py_track_effect = pygobject_new(G_OBJECT(track_effect));
PyList_Append(py_list, py_track_effect);
Py_DECREF(py_track_effect);
}
return py_list;
}
%%
override ges_timeline_get_tracks noargs
static PyObject *
_wrap_ges_timeline_get_tracks(PyGObject *self)
{
const GList *l, *list;
PyObject *py_list;
g_return_val_if_fail (GES_IS_TIMELINE (self->obj),PyList_New(0));
pyg_begin_allow_threads;
list = ges_timeline_get_tracks(GES_TIMELINE(self->obj));
pyg_end_allow_threads;
py_list = PyList_New(0);
for (l = list; l; l = l->next) {
GESTrack *track = (GESTrack*)l->data;
PyObject *py_track = pygobject_new(G_OBJECT(track));
PyList_Append(py_list, py_track);
Py_DECREF(py_track);
}
return py_list;
}
%%
override ges_timeline_get_layers noargs
static PyObject *
_wrap_ges_timeline_get_layers(PyGObject *self)
{
const GList *l, *list;
PyObject *py_list;
g_return_val_if_fail (GES_IS_TIMELINE (self->obj), PyList_New(0));
pyg_begin_allow_threads;
list = ges_timeline_get_layers(GES_TIMELINE(self->obj));
pyg_end_allow_threads;
py_list = PyList_New(0);
for (l = list; l; l = l->next) {
GESTimelineLayer *layer = (GESTimelineLayer*)l->data;
PyObject *py_layer = pygobject_new(G_OBJECT(layer));
PyList_Append(py_list, py_layer);
Py_DECREF(py_layer);
}
return py_list;
}
%%
override ges_timeline_layer_get_objects noargs
static PyObject *
_wrap_ges_timeline_layer_get_objects(PyGObject *self)
{
const GList *l, *list;
PyObject *py_list;
g_return_val_if_fail (GES_IS_TIMELINE_LAYER (self->obj), PyList_New(0));
pyg_begin_allow_threads;
list = ges_timeline_layer_get_objects(GES_TIMELINE_LAYER(self->obj));
pyg_end_allow_threads;
py_list = PyList_New(0);
for (l = list; l; l = l->next) {
GESTimelineObject *object = (GESTimelineObject*)l->data;
PyObject *py_object = pygobject_new(G_OBJECT(object));
PyList_Append(py_list, py_object);
Py_DECREF(py_object);
}
return py_list;
}
%%
override ges_timeline_object_get_track_objects noargs
static PyObject *
_wrap_ges_timeline_object_get_track_objects(PyGObject *self)
{
const GList *l, *list;
PyObject *py_list;
g_return_val_if_fail (GES_IS_TIMELINE_OBJECT (self->obj), PyList_New(0));
pyg_begin_allow_threads;
list = ges_timeline_object_get_track_objects(GES_TIMELINE_OBJECT(self->obj));
pyg_end_allow_threads;
py_list = PyList_New(0);
for (l = list; l; l = l->next) {
GESTrackObject *object = (GESTrackObject*)l->data;
PyObject *py_object = pygobject_new(G_OBJECT(object));
PyList_Append(py_list, py_object);
Py_DECREF(py_object);
}
return py_list;
}
%%
override ges_track_object_get_child_property kwargs
static PyObject *
_wrap_ges_track_object_get_child_property (PyGObject *self, PyObject *args, PyObject *kwargs)
{
gchar *property_name;
GESTrackObject *obj = GES_TRACK_OBJECT (self->obj);
GParamSpec *pspec = NULL;
GValue value = { 0, } ;
PyObject *ret;
if (!PyArg_ParseTuple(args, "s:GESTrackObject.get_child_property",
&property_name)) {
return NULL;
}
ges_track_object_lookup_child(obj, property_name, NULL, &pspec);
if (!pspec) {
gchar buf[512];
g_snprintf(buf, sizeof(buf),
"container does not support property `%s'",
property_name);
PyErr_SetString(PyExc_TypeError, buf);
return NULL;
}
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec));
ges_track_object_get_child_property_by_pspec(obj,
pspec,
&value);
ret = pyg_value_as_pyobject(&value, TRUE);
g_value_unset(&value);
return ret;
}
%%
override ges_track_object_set_child_property kwargs
static PyObject *
_wrap_ges_track_object_set_child_property (PyGObject *self, PyObject *args, PyObject *kwargs)
{
gchar *property_name;
GESTrackObject *obj = GES_TRACK_OBJECT (self->obj);
GParamSpec *pspec = NULL;
PyGObject *pyvalue;
GValue value = { 0, } ;
if (!PyArg_ParseTuple(args, "sO:GESTrackObject.set_child_property",
&property_name, &pyvalue)) {
return NULL;
}
ges_track_object_lookup_child(obj, property_name, NULL, &pspec);
if (!pspec) {
gchar buf[512];
g_snprintf(buf, sizeof(buf),
"container does not support property `%s'",
property_name);
PyErr_SetString(PyExc_TypeError, buf);
return NULL;
}
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec));
pyg_value_from_pyobject(&value, (PyObject*)pyvalue);
ges_track_object_set_child_property_by_pspec(obj,
pspec,
&value);
g_value_unset(&value);
Py_INCREF(Py_None);
return Py_None;
}
%%
override ges_track_object_list_children_properties noargs
static PyObject *
_wrap_ges_track_object_list_children_properties (PyGObject *self)
{
GParamSpec **specs;
PyObject *list;
guint nprops;
guint i;
specs = ges_track_object_list_children_properties(GES_TRACK_OBJECT (self->obj), &nprops);
list = PyTuple_New(nprops);
if (list == NULL) {
g_free(specs);
return NULL;
}
for (i = 0; i < nprops; i++) {
PyTuple_SetItem(list, i, pyg_param_spec_new(specs[i]));
}
g_free(specs);
return list;
}
%%
ignore-glob
*_get_type
ges_formatter_set_data
ges_formatter_set_data
*_valist
*_by_pspec