gstreamer/ges/ges-timeline-tree.h
Henry Wilkes 39097f5574 timeline-tree: simplify and fix editing
Editing has been simplified by breaking down each edit into a
combination of three basic single-element edits: MOVE, TRIM_START, and
TRIM_END.

Each edit follows these steps:
+ Determine which elements are to be edited and under which basic mode
+ Determine which track elements will move as a result
+ Snap the edit position to one of the edges of the main edited element,
  (or the edge of one of its descendants, in the case of MOVE), avoiding
  moving elements.
  NOTE: in particular, we can *not* snap to the edge of a neighbouring
  element in a roll edit. This was previously possible, even though the
  neighbour was moving!
+ Determine the edit positions for clips (or track elements with no
  parent) using the snapped value. In addition, we replace any edits of
  a group with an edit of its descendant clips. If any value would be
  out of bounds (e.g. negative start) we do not edit.
  NOTE: this is now done *after* checking the snapping. This allows the
  edit to succeed if snapping would cause it to go from being invalid to
  valid!
+ Determine whether the collection of edits would result in a valid
  timeline-configuration which does not break the rules for sources
  overlapping.
+ If all this succeeds, we emit snapping-started on the timeline.
+ We then perform all the edits. At this point they should all succeed.

The simplification/unification should make it easier to make other
changes.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/issues/97
Fixes https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/issues/98

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
2020-05-07 09:37:15 +01:00

77 lines
3.7 KiB
C

#pragma once
#include <ges/ges.h>
#include "ges-auto-transition.h"
void timeline_tree_track_element (GNode *root,
GESTimelineElement *element);
void timeline_tree_stop_tracking_element (GNode *root,
GESTimelineElement *element);
gboolean timeline_tree_can_move_element (GNode *root,
GESTimelineElement *element,
guint32 priority,
GstClockTime start,
GstClockTime duration);
gboolean timeline_tree_ripple (GNode *root,
GESTimelineElement *element,
gint64 layer_priority_offset,
GstClockTimeDiff offset,
GESEdge edge,
GstClockTime snapping_distance);
void ges_timeline_emit_snapping (GESTimeline * timeline,
GESTrackElement * elem1,
GESTrackElement * elem2,
GstClockTime snap_time);
gboolean timeline_tree_trim (GNode *root,
GESTimelineElement *element,
gint64 layer_priority_offset,
GstClockTimeDiff offset,
GESEdge edge,
GstClockTime snapping_distance);
gboolean timeline_tree_move (GNode *root,
GESTimelineElement *element,
gint64 layer_priority_offset,
GstClockTimeDiff offset,
GESEdge edge,
GstClockTime snapping_distance);
gboolean timeline_tree_roll (GNode * root,
GESTimelineElement * element,
GstClockTimeDiff offset,
GESEdge edge,
GstClockTime snapping_distance);
typedef GESAutoTransition *
(*GESTreeGetAutoTransitionFunc) (GESTimeline * timeline,
GESTrackElement * previous,
GESTrackElement * next,
GstClockTime transition_duration);
void timeline_tree_create_transitions (GNode *root,
GESTreeGetAutoTransitionFunc get_auto_transition);
GstClockTime timeline_tree_get_duration (GNode *root);
void timeline_tree_debug (GNode * root);
GESAutoTransition *
ges_timeline_create_transition (GESTimeline * timeline, GESTrackElement * previous,
GESTrackElement * next, GESClip * transition,
GESLayer * layer, guint64 start, guint64 duration);
GESAutoTransition *
ges_timeline_find_auto_transition (GESTimeline * timeline, GESTrackElement * prev,
GESTrackElement * next, GstClockTime transition_duration);
void
timeline_update_duration (GESTimeline * timeline);
void timeline_tree_reset_layer_active (GNode *root, GESLayer *layer);
void timeline_tree_init_debug (void);