mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
286 lines
7.4 KiB
C
286 lines
7.4 KiB
C
/* -*- Mode: C; c-basic-offset: 4 -*- */
|
|
%%
|
|
headers
|
|
#define NO_IMPORT_PYGOBJECT
|
|
#include <pygobject.h>
|
|
|
|
#include <gst/gst.h>
|
|
#include <ges/ges.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.Caps as PyGstCaps_Type
|
|
import gst.Buffer as PyGstBuffer_Type
|
|
import gst.Pad as PyGstPad_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)
|
|
{
|
|
const GstCaps *ret;
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE (self->obj), PyList_New(0));
|
|
|
|
pyg_begin_allow_threads;
|
|
ret = ges_track_get_caps(GES_TRACK(self->obj));
|
|
pyg_end_allow_threads;
|
|
/* pygobject_new handles NULL checking */
|
|
return pygobject_new((GObject *)ret);
|
|
}
|
|
|
|
|
|
%%
|
|
override ges_track_set_caps noargs
|
|
static void
|
|
_wrap_ges_track_set_caps(PyGObject *self, const GstCaps *caps)
|
|
{
|
|
pyg_begin_allow_threads;
|
|
ges_track_set_caps (GES_TRACK(self->obj), caps);
|
|
pyg_end_allow_threads;
|
|
}
|
|
|
|
%%
|
|
override ges_track_object_lookup_child noargs
|
|
static PyObject *
|
|
_wrap_ges_track_object_lookup_child(PyGObject *self, gchar *name)
|
|
{
|
|
GParamSpec *pspec;
|
|
GstElement *element;
|
|
gboolean ret;
|
|
|
|
pyg_begin_allow_threads;
|
|
ret = ges_track_object_lookup_child (GES_TRACK_OBJECT (self->obj), name, &element, &pspec);
|
|
pyg_end_allow_threads;
|
|
|
|
return PyBool_FromLong(ret);
|
|
}
|
|
|
|
%%
|
|
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;
|
|
}
|
|
|
|
%%
|
|
ignore-glob
|
|
|
|
*_get_type
|
|
ges_formatter_set_data
|
|
ges_formatter_set_data
|