gst-editing-services: python: Bind the new Timeline editing mode API

Thibault Saunier tsaunier at kemper.freedesktop.org
Wed Apr 25 14:55:07 PDT 2012


Module: gst-editing-services
Branch: master
Commit: a03da389f724187145549bb488212c58223093d8
URL:    http://cgit.freedesktop.org/gstreamer/gst-editing-services/commit/?id=a03da389f724187145549bb488212c58223093d8

Author: Thibault Saunier <thibault.saunier at collabora.com>
Date:   Fri Feb 10 16:58:14 2012 -0300

python: Bind the new Timeline editing mode API

---

 bindings/python/ges-types.defs |   24 +++++++++++
 bindings/python/ges.defs       |   50 +++++++++++++++++++++++
 bindings/python/ges.override   |   87 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 161 insertions(+), 0 deletions(-)

diff --git a/bindings/python/ges-types.defs b/bindings/python/ges-types.defs
index 632fe37..8ab2a48 100644
--- a/bindings/python/ges-types.defs
+++ b/bindings/python/ges-types.defs
@@ -396,3 +396,27 @@
     '("smart-render" "TIMELINE_MODE_SMART_RENDER")
   )
 )
+
+(define-enum Edge
+  (in-module "GES")
+  (c-name "GESEdge")
+  (gtype-id "GES_TYPE_EDGE")
+  (values
+    '("edge_start" "GES_EDGE_START")
+    '("edge_end" "GES_EDGE_END")
+    '("edge_none" "GES_EDGE_NONE")
+  )
+)
+
+(define-enum EditMode
+  (in-module "GES")
+  (c-name "GESEditMode")
+  (gtype-id "GES_TYPE_EDIT_MODE")
+  (values
+    '("edit_normal" "GES_EDIT_MODE_NORMAL")
+    '("edit_ripple" "GES_EDIT_MODE_RIPPLE")
+    '("edit_roll" "GES_EDIT_MODE_ROLL")
+    '("edit_trim" "GES_EDIT_MODE_TRIM")
+    '("edit_slide" "GES_EDIT_MODE_SLIDE")
+  )
+)
diff --git a/bindings/python/ges.defs b/bindings/python/ges.defs
index 77e911a..a4fd6fd 100644
--- a/bindings/python/ges.defs
+++ b/bindings/python/ges.defs
@@ -351,6 +351,30 @@
   )
 )
 
+(define-enum Edge
+  (in-module "GES")
+  (c-name "GESEdge")
+  (gtype-id "GES_TYPE_EDGE")
+  (values
+    '("edge_start" "GES_EDGE_START")
+    '("edge_end" "GES_EDGE_END")
+    '("edge_none" "GES_EDGE_NONE")
+  )
+)
+
+(define-enum EditMode
+  (in-module "GES")
+  (c-name "GESEditMode")
+  (gtype-id "GES_TYPE_EDIT_MODE")
+  (values
+    '("edit_normal" "GES_EDIT_MODE_NORMAL")
+    '("edit_ripple" "GES_EDIT_MODE_RIPPLE")
+    '("edit_roll" "GES_EDIT_MODE_ROLL")
+    '("edit_trim" "GES_EDIT_MODE_TRIM")
+    '("edit_slide" "GES_EDIT_MODE_SLIDE")
+  )
+)
+
 (define-enum TextHAlign
   (in-module "GES")
   (c-name "GESTextHAlign")
@@ -1157,6 +1181,20 @@
   )
 )
 
+(define-method edit
+  (of-object "GESTimelineObject")
+  (c-name "ges_timeline_object_edit")
+  (return-type "gboolean")
+  (parameters
+    '("GList*" "layers")
+    '("guint" "move_layer")
+    '("GESEditMode" "mode")
+    '("GESEdge" "edge")
+    '("guint64" "position")
+    '("guint64" "snap_distance")
+  )
+)
+
 (define-method get_supported_formats
   (of-object "GESTimelineObject")
   (c-name "ges_timeline_object_get_supported_formats")
@@ -2021,6 +2059,18 @@
   (varargs #t)
 )
 
+(define-method edit
+  (of-object "GESTrackObject")
+  (c-name "ges_track_object_edit")
+  (return-type "gboolean")
+  (parameters
+    '("GList*" "layers")
+    '("GESEditMode" "mode")
+    '("GESEdge" "edge")
+    '("guint64" "position")
+    '("guint64" "snap_distance")
+  )
+)
 
 
 ;; From ges-track-operation.h
diff --git a/bindings/python/ges.override b/bindings/python/ges.override
index b9d97dc..18e873a 100644
--- a/bindings/python/ges.override
+++ b/bindings/python/ges.override
@@ -489,6 +489,93 @@ _wrap_ges_version (PyObject *self)
 
 
 %%
+override ges_track_object_edit kwargs
+static PyObject *
+_wrap_ges_track_object_edit (PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+    GList *layers = NULL;
+    GESEditMode mode;
+    GESEdge edge;
+    guint64 position;
+    guint i;
+    gboolean ret;
+
+    PyObject *py_position = NULL;
+    PyObject *list = NULL, *pymode = NULL, *pyedge = NULL;
+    PyGObject *tmpobj = NULL;
+    Py_ssize_t list_size;
+
+    GESTrackObject *tckobj = GES_TRACK_OBJECT (self->obj);
+
+    if (!PyArg_ParseTuple(args, "OOOl:GESTrackObject.edit",
+                          &list, &pymode, &pyedge, &py_position))
+        return NULL;
+
+    position = PyLong_AsUnsignedLongLong(py_position);
+
+    list_size = PyList_GET_SIZE(list);
+
+    for (i = 0; i < list_size; i++) {
+      tmpobj = (PyGObject*)PyList_GetItem(list, i);
+      layers = g_list_prepend (layers, GES_TIMELINE_LAYER (tmpobj->obj));
+    }
+
+    if (pyg_enum_get_value(GES_TYPE_EDIT_MODE, pymode, (gpointer)&mode))
+        return FALSE;
+
+    if (pyg_enum_get_value(GES_TYPE_EDGE, pyedge, (gpointer)&edge))
+        return FALSE;
+
+    ret = ges_track_object_edit (tckobj, layers, mode, edge, position);
+
+    return PyBool_FromLong(ret);
+}
+
+%%
+override ges_timeline_object_edit kwargs
+static PyObject *
+_wrap_ges_timeline_object_edit (PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+    GList *layers = NULL;
+    GESEditMode mode;
+    GESEdge edge;
+    gint64 position;
+    guint move_layer, i;
+    gboolean ret;
+
+    PyObject *py_position = NULL;
+    PyObject *list = NULL, *pymode = NULL, *pyedge = NULL;
+    PyGObject *tmpobj = NULL;
+    Py_ssize_t list_size;
+
+    GESTimelineObject *tlobj = GES_TIMELINE_OBJECT (self->obj);
+
+    if (!PyArg_ParseTuple(args, "OiOOO:GESTimelineObject.edit",
+                          &list, &move_layer, &pymode, &pyedge, &py_position))
+        return NULL;
+
+    position = PyLong_AsUnsignedLongLong(py_position);
+
+    list_size = PyList_GET_SIZE(list);
+
+    for (i = 0; i < list_size; i++) {
+      tmpobj = (PyGObject*)PyList_GetItem(list, i);
+      layers = g_list_prepend (layers, GES_TIMELINE_LAYER (tmpobj->obj));
+    }
+
+    if (pyg_enum_get_value(GES_TYPE_EDIT_MODE, pymode, (gpointer)&mode))
+        return FALSE;
+
+    if (pyg_enum_get_value(GES_TYPE_EDGE, pyedge, (gpointer)&edge))
+        return FALSE;
+
+    ret = ges_timeline_object_edit (tlobj, layers, move_layer, mode, edge, position);
+
+    return PyBool_FromLong(ret);
+}
+
+
+%%
 ignore-glob
 
   *_get_type



More information about the gstreamer-commits mailing list