mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
ges: Move ges_container_edit
to GESTimelineElement
Now that the notion of layer has been moved down to #GESTimelineElement (through the new #ges_timeline_element_get_layer_priority method), this method make much more sense directly in the base class.
This commit is contained in:
parent
63ee426207
commit
2ab26ab306
7 changed files with 78 additions and 97 deletions
|
@ -81,6 +81,12 @@ class TimelineElement(GES.TimelineElement):
|
||||||
TimelineElement = override(TimelineElement)
|
TimelineElement = override(TimelineElement)
|
||||||
__all__.append('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:
|
try:
|
||||||
from gi.repository import Gst
|
from gi.repository import Gst
|
||||||
|
|
|
@ -615,50 +615,6 @@ done:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
static void
|
||||||
_deep_copy (GESTimelineElement * element, GESTimelineElement * copy)
|
_deep_copy (GESTimelineElement * element, GESTimelineElement * copy)
|
||||||
{
|
{
|
||||||
|
@ -855,7 +811,6 @@ ges_clip_class_init (GESClipClass * klass)
|
||||||
container_class->ungroup = _ungroup;
|
container_class->ungroup = _ungroup;
|
||||||
container_class->group = _group;
|
container_class->group = _group;
|
||||||
container_class->grouping_priority = G_MAXUINT;
|
container_class->grouping_priority = G_MAXUINT;
|
||||||
container_class->edit = _edit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1007,6 +1007,8 @@ ges_container_group (GList * containers)
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the container as been edited properly, %FALSE if an error
|
* Returns: %TRUE if the container as been edited properly, %FALSE if an error
|
||||||
* occured
|
* occured
|
||||||
|
*
|
||||||
|
* Deprecated: 1.18: use #ges_timeline_element_edit instead.
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
ges_container_edit (GESContainer * container, GList * layers,
|
ges_container_edit (GESContainer * container, GList * layers,
|
||||||
|
@ -1014,11 +1016,6 @@ ges_container_edit (GESContainer * container, GList * layers,
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GES_IS_CONTAINER (container), FALSE);
|
g_return_val_if_fail (GES_IS_CONTAINER (container), FALSE);
|
||||||
|
|
||||||
if (G_UNLIKELY (GES_CONTAINER_GET_CLASS (container)->edit == NULL)) {
|
return ges_timeline_element_edit (GES_TIMELINE_ELEMENT (container),
|
||||||
GST_WARNING_OBJECT (container, "No edit vmethod implementation");
|
layers, new_layer_priority, mode, edge, position);
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GES_CONTAINER_GET_CLASS (container)->edit (container, layers,
|
|
||||||
new_layer_priority, mode, edge, position);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,8 @@ struct _GESContainerClass
|
||||||
gboolean (*remove_child) (GESContainer *container, GESTimelineElement *element);
|
gboolean (*remove_child) (GESContainer *container, GESTimelineElement *element);
|
||||||
GList* (*ungroup) (GESContainer *container, gboolean recursive);
|
GList* (*ungroup) (GESContainer *container, gboolean recursive);
|
||||||
GESContainer * (*group) (GList *containers);
|
GESContainer * (*group) (GList *containers);
|
||||||
|
|
||||||
|
/* Deprecated and not used anymore */
|
||||||
gboolean (*edit) (GESContainer * container,
|
gboolean (*edit) (GESContainer * container,
|
||||||
GList * layers, gint new_layer_priority,
|
GList * layers, gint new_layer_priority,
|
||||||
GESEditMode mode,
|
GESEditMode mode,
|
||||||
|
|
|
@ -1942,3 +1942,56 @@ ges_timeline_element_set_flags (GESTimelineElement * self,
|
||||||
self->priv->flags = flags;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -337,7 +337,15 @@ GES_API
|
||||||
GESTrackType ges_timeline_element_get_track_types (GESTimelineElement * self);
|
GESTrackType ges_timeline_element_get_track_types (GESTimelineElement * self);
|
||||||
|
|
||||||
GES_API
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -1343,57 +1343,17 @@ ges_track_element_copy_bindings (GESTrackElement * element,
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the object as been edited properly, %FALSE if an error
|
* Returns: %TRUE if the object as been edited properly, %FALSE if an error
|
||||||
* occured
|
* occured
|
||||||
|
*
|
||||||
|
* Deprecated: 1.18: use #ges_timeline_element_edit instead.
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
ges_track_element_edit (GESTrackElement * object,
|
ges_track_element_edit (GESTrackElement * object,
|
||||||
GList * layers, GESEditMode mode, GESEdge edge, guint64 position)
|
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);
|
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), FALSE);
|
||||||
|
|
||||||
if (G_UNLIKELY (!track)) {
|
return ges_timeline_element_edit (GES_TIMELINE_ELEMENT (object),
|
||||||
GST_WARNING_OBJECT (object, "Trying to edit in %d mode but not in "
|
layers, -1, mode, edge, position);
|
||||||
"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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue