TimelineElement = override(TimelineElement)
__all__.append('TimelineElement')
+class Container(GES.Container):
+ def edit(self, layers, new_layer_priority, mode, edge, position):
+ return GES.TimelineElement.edit(self, layers, new_layer_priority, mode, edge, position)
+
+Container = override(Container)
+__all__.append('Container')
try:
from gi.repository import Gst
}
-static gboolean
-_edit (GESContainer * container, GList * layers,
- gint new_layer_priority, GESEditMode mode, GESEdge edge, guint64 position)
-{
- GESTimeline *timeline = GES_TIMELINE_ELEMENT_TIMELINE (container);
- GESTimelineElement *element = GES_TIMELINE_ELEMENT (container);
-
- if (!G_UNLIKELY (GES_CONTAINER_CHILDREN (container))) {
- GST_WARNING_OBJECT (container, "Trying to edit, but not containing"
- "any TrackElement yet.");
- return FALSE;
- }
-
- if (!timeline) {
- GST_WARNING_OBJECT (container, "Trying to edit, but not in any"
- "timeline.");
- return FALSE;
- }
-
- switch (mode) {
- case GES_EDIT_MODE_RIPPLE:
- return timeline_ripple_object (timeline, element,
- new_layer_priority <
- 0 ? GES_TIMELINE_ELEMENT_LAYER_PRIORITY (container) :
- new_layer_priority, layers, edge, position);
- case GES_EDIT_MODE_TRIM:
- return timeline_trim_object (timeline, element,
- new_layer_priority <
- 0 ? GES_TIMELINE_ELEMENT_LAYER_PRIORITY (container) :
- new_layer_priority, layers, edge, position);
- case GES_EDIT_MODE_NORMAL:
- return timeline_move_object (timeline, element,
- new_layer_priority <
- 0 ? GES_TIMELINE_ELEMENT_LAYER_PRIORITY (container) :
- new_layer_priority, layers, edge, position);
- case GES_EDIT_MODE_ROLL:
- return timeline_roll_object (timeline, element, layers, edge, position);
- case GES_EDIT_MODE_SLIDE:
- GST_ERROR ("Sliding not implemented.");
- return FALSE;
- }
- return FALSE;
-}
-
static void
_deep_copy (GESTimelineElement * element, GESTimelineElement * copy)
{
container_class->ungroup = _ungroup;
container_class->group = _group;
container_class->grouping_priority = G_MAXUINT;
- container_class->edit = _edit;
}
static void
*
* Returns: %TRUE if the container as been edited properly, %FALSE if an error
* occured
+ *
+ * Deprecated: 1.18: use #ges_timeline_element_edit instead.
*/
gboolean
ges_container_edit (GESContainer * container, GList * layers,
{
g_return_val_if_fail (GES_IS_CONTAINER (container), FALSE);
- if (G_UNLIKELY (GES_CONTAINER_GET_CLASS (container)->edit == NULL)) {
- GST_WARNING_OBJECT (container, "No edit vmethod implementation");
- return FALSE;
- }
-
- return GES_CONTAINER_GET_CLASS (container)->edit (container, layers,
- new_layer_priority, mode, edge, position);
+ return ges_timeline_element_edit (GES_TIMELINE_ELEMENT (container),
+ layers, new_layer_priority, mode, edge, position);
}
gboolean (*remove_child) (GESContainer *container, GESTimelineElement *element);
GList* (*ungroup) (GESContainer *container, gboolean recursive);
GESContainer * (*group) (GList *containers);
+
+ /* Deprecated and not used anymore */
gboolean (*edit) (GESContainer * container,
GList * layers, gint new_layer_priority,
GESEditMode mode,
self->priv->flags = flags;
}
+
+/**
+ * ges_timeline_element_edit:
+ * @self: the #GESClip to edit
+ * @layers: (element-type GESLayer): The layers you want the edit to
+ * happen in, %NULL means that the edition is done in all the
+ * #GESLayers contained in the current timeline.
+ * @new_layer_priority: The priority of the layer @self should land in.
+ * If the layer you're trying to move the element to doesn't exist, it will
+ * be created automatically. -1 means no move.
+ * @mode: The #GESEditMode in which the editition will happen.
+ * @edge: The #GESEdge the edit should happen on.
+ * @position: The position at which to edit @self (in nanosecond)
+ *
+ * Edit @self in the different exisiting #GESEditMode modes. In the case of
+ * slide, and roll, you need to specify a #GESEdge
+ *
+ * Returns: %TRUE if @self as been edited properly, %FALSE if an error
+ * occured
+ */
+gboolean
+ges_timeline_element_edit (GESTimelineElement * self, GList * layers,
+ gint64 new_layer_priority, GESEditMode mode, GESEdge edge, guint64 position)
+{
+ GESTimeline *timeline;
+
+ g_return_val_if_fail (GES_IS_TIMELINE_ELEMENT (self), FALSE);
+
+ timeline = GES_TIMELINE_ELEMENT_TIMELINE (self);
+ switch (mode) {
+ case GES_EDIT_MODE_RIPPLE:
+ return timeline_ripple_object (timeline, self,
+ new_layer_priority <
+ 0 ? GES_TIMELINE_ELEMENT_LAYER_PRIORITY (self) :
+ new_layer_priority, layers, edge, position);
+ case GES_EDIT_MODE_TRIM:
+ return timeline_trim_object (timeline, self,
+ new_layer_priority <
+ 0 ? GES_TIMELINE_ELEMENT_LAYER_PRIORITY (self) :
+ new_layer_priority, layers, edge, position);
+ case GES_EDIT_MODE_NORMAL:
+ return timeline_move_object (timeline, self,
+ new_layer_priority <
+ 0 ? GES_TIMELINE_ELEMENT_LAYER_PRIORITY (self) :
+ new_layer_priority, layers, edge, position);
+ case GES_EDIT_MODE_ROLL:
+ return timeline_roll_object (timeline, self, layers, edge, position);
+ case GES_EDIT_MODE_SLIDE:
+ GST_ERROR_OBJECT (self, "Sliding not implemented.");
+ return FALSE;
+ }
+ return FALSE;
+}
GESTrackType ges_timeline_element_get_track_types (GESTimelineElement * self);
GES_API
-guint32 ges_timeline_element_get_layer_priority (GESTimelineElement * self);
+guint32 ges_timeline_element_get_layer_priority (GESTimelineElement * self);
+
+GES_API
+gboolean ges_timeline_element_edit (GESTimelineElement * self,
+ GList * layers,
+ gint64 new_layer_priority,
+ GESEditMode mode,
+ GESEdge edge,
+ guint64 position);
G_END_DECLS
*
* Returns: %TRUE if the object as been edited properly, %FALSE if an error
* occured
+ *
+ * Deprecated: 1.18: use #ges_timeline_element_edit instead.
*/
gboolean
ges_track_element_edit (GESTrackElement * object,
GList * layers, GESEditMode mode, GESEdge edge, guint64 position)
{
- GESTrack *track = ges_track_element_get_track (object);
- GESTimeline *timeline;
-
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), FALSE);
- if (G_UNLIKELY (!track)) {
- GST_WARNING_OBJECT (object, "Trying to edit in %d mode but not in "
- "any Track yet.", mode);
- return FALSE;
- }
-
- timeline = GES_TIMELINE (ges_track_get_timeline (track));
-
- if (G_UNLIKELY (!timeline)) {
- GST_WARNING_OBJECT (object, "Trying to edit in %d mode but "
- "track %p is not in any timeline yet.", mode, track);
- return FALSE;
- }
-
- switch (mode) {
- case GES_EDIT_MODE_NORMAL:
- return timeline_move_object (timeline, GES_TIMELINE_ELEMENT (object), -1,
- layers, edge, position);
- break;
- case GES_EDIT_MODE_TRIM:
- return timeline_trim_object (timeline, GES_TIMELINE_ELEMENT (object), -1,
- layers, edge, position);
- break;
- case GES_EDIT_MODE_RIPPLE:
- return timeline_ripple_object (timeline, GES_TIMELINE_ELEMENT (object),
- GES_TIMELINE_ELEMENT_PRIORITY (object) / LAYER_HEIGHT,
- layers, edge, position);
- break;
- case GES_EDIT_MODE_ROLL:
- return timeline_roll_object (timeline, GES_TIMELINE_ELEMENT (object),
- layers, edge, position);
- break;
- case GES_EDIT_MODE_SLIDE:
- return timeline_slide_object (timeline, object, layers, edge, position);
- break;
- default:
- GST_ERROR ("Unkown edit mode: %d", mode);
- return FALSE;
- }
-
- return TRUE;
+ return ges_timeline_element_edit (GES_TIMELINE_ELEMENT (object),
+ layers, -1, mode, edge, position);
}
/**