summaryrefslogtreecommitdiff
path: root/ges/ges-clip.c
AgeCommit message (Collapse)AuthorFilesLines
2021-08-14clip: Copy trackelement's metadata upon splittingPiotrek BrzeziƄski1-0/+5
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/260>
2020-09-11ges: Do not recreate auto-transitions when changing clip assetsThibault Saunier1-2/+3
Otherwise we loose the configuration of the auto transition, and it is not required at all in any case. Fixes https://gitlab.gnome.org/GNOME/pitivi/-/issues/2380 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/208>
2020-06-19ges: Add all missing Since markers from 1.16 onwardThibault Saunier1-0/+6
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/191>
2020-06-03add missing Since annotations on new APIGuillaume Desmottes1-0/+8
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/181>
2020-05-25uri-clip: don't assume duration needs to stay the sameHenry Wilkes1-0/+49
ges_uri_clip_asset_get_duration does not tell us what the duration in the timeline needs to be. Especially when we have time effects, or effects with finite max-durations. So we should no longer expect the duration to stay the same when replacing assets. Instead, we just check that the new max-duration would be compatible with the current in-point (which was not checked before), and the clip would not be totally overlapped if its duration-limit changes. This is based on the assumption that each source is replaced one-to-one in its track. If a source is replaced with nothing in the same track, this check may be a little too strong (but still mostly weaker than before). However, problems could occur if track selection does something unexpected, such as placing the new source in a track not previously occupied. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/177>
2020-05-25clip: provide an example of using time effectsHenry Wilkes1-1/+84
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/177>
2020-05-25track-element: use out-point for updating control bindingsHenry Wilkes1-15/+65
The out-point, which is an internal time, is used instead of the duration for determining the control binding value at the end of the element. Also, allow the user to switch off the auto-clamping of control sources if they are not desired. And allow them to clamp specific control sources individually. Also, fix a lot of memory leaks related to control sources. In particular, releasing the extra ref gained by source in g_object_get (binding, "control-source", &source, NULL); Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/177>
2020-05-25clip: test for layer in groupHenry Wilkes1-1/+2
Make sure the layer exists before we try to remove the grouped clips from it. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/177>
2020-05-25clip: add method for adding top effectsHenry Wilkes1-45/+265
Unlike ges_container_add, this lets you set the index and will check that track selection did not fail. This is useful for time effects whose addition would create an unsupported timeline configuration. Also can use the clip add error in ges_timeline_add_clip to let the user know when adding a clip to a layer that its in-point is set larger than the max-duration of its core children. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/177>
2020-05-25timeline-tree: take time effects into account when trimmingHenry Wilkes1-0/+27
When trimming the start of a clip, we want to set the in-point of its children such that whatever data was at the timeline time T still remains at the timeline time T after the trim, where T = MAX (prev_start, new_start) Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/177>
2020-05-25clip: use time translation for splitHenry Wilkes1-7/+33
The new in-point should be the media position corresponding to the media position. media_duration_factor is no longer needed. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/177>
2020-05-25clip: fix warning when getting duration-limitHenry Wilkes1-0/+1
The duration-limit case was missing a 'break;' statement. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/177>
2020-05-25clip: add methods to convert between time coordinatesHenry Wilkes1-34/+678
Add methods to convert between the timeline time coordinates and the internal time coordinates of a track element in a clip, taking time effects into account. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/177>
2020-05-22effect: Add support for time effectsHenry Wilkes1-27/+181
Allow the user to register a child property of a base effect as a time property. This can be used by GES to correctly calculate the duration-limit of a clip when it has time effects on it. The existing ges_effect_class_register_rate_property is now used to automatically register such time effects for rate effects. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/177>
2020-05-22errors: added edit errorsHenry Wilkes1-79/+135
Added more errors to GES_ERROR for when edits fail (other than programming or usage errors). Also promoted some GST messages if they related to a usage error. Also added explanation of timeline overlap rules in user docs. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/177>
2020-05-13track-element: Add is_core method to APIHenry Wilkes1-22/+48
Open up the method to the user, since they may need the information. Also added more documentation on what a core track element is to a clip and how they are treated. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
2020-05-07clip: enforce duration-limitHenry Wilkes1-65/+457
Prevent setting of properties or that of children, if the clip would not be able to set the corresponding duration if the duration-limit would drop below the currently set duration. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
2020-05-07clip: make sure core child is active for non-core in same trackHenry Wilkes1-35/+169
Each active non-core child must have a corresponding active core child in the same track. Therefore, if we de-activate a core child, we also need to de-activate all the non-core children in the same track. Similarly, if we activate a non-core child, we need to activate the corresponding core child as well. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
2020-05-07clip: be more robust in handling priorityHenry Wilkes1-48/+73
Make less assumptions about the priority of effects and core elements so that the code would still work if the priority of an element was set directly. In particular, the index of a top effect will always be its position in the effect ordering. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
2020-05-07container: stop storing priority offset in child mappingHenry Wilkes1-38/+11
GESGroup no longer uses this, and GESClip can be made simpler without it. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
2020-05-07clip: preserve auto-transition in splitHenry Wilkes1-2/+25
When splitting a clip, keep the auto-transition at the end of the clip alive and move its source to that of the corresponding split track element. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
2020-05-07clip: change order of splitHenry Wilkes1-7/+8
We first change the duration of the splitted clip, then we add the new clip to the layer and assign the tracks for its children. Normally, when a clip is added to a layer it will have its track elements created, if needed, and then assigned to their tracks. This will fail if any sources would fully or triple overlap existing sources in the same track. However, here we were adding the clip to the layer *and* avoiding the track assignment process and instead setting the tracks explicitly. In particular, the order was: + add new clip to layer with no tracks assigned + shrink the split clip + assign the tracks for the new clip This has been changed to: + shrink the split clip + add new clip to layer with no tracks assigned + assign the tracks for the new clip Thus, the order of events for any users connecting to object signals will be close to that of adding another clip to the layer. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
2020-05-07timeline: create auto-transitions during track-element-addedHenry Wilkes1-4/+0
Any time a track element is added to a track, we need to check whether we need to create a new corresponding auto-transition. This simply moves the code from ges-clip.c to ges-timeline.c, where it is more appropriate. Moreover, it technically opens the possibility for creating auto-transitions for track elements in the timeline that have no corresponding clip. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
2020-05-07clip: make auto-transitions less expensive when adding to trackHenry Wilkes1-2/+2
Only check the overlaps with the actual track element that was just added to the track. This reduces the tree traversal by one order. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
2020-05-07timeline-element: stop using edit vmethodsHenry Wilkes1-49/+0
These were all redirecting to essentially ges_timeline_element_edit anyway. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
2020-05-07timeline-element: simplify check for being editedHenry Wilkes1-10/+5
It should be sufficient to set the edit flag only on the toplevel, which allows all of its children to know they are being edited and should not move in response. Also, removed some unnecessary setting/checking of this. Also, supplied the ges_timeline_element_peak_toplevel, which unlike ges_timeline_element_get_toplevel_parent, does not add a reference to the toplevel. Some corresponding leaks in auto-transition have been fixed by using this instead. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
2020-05-07timeline-tree: simplify and fix editingHenry Wilkes1-21/+18
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-07clip: add the duration-limit propertyHenry Wilkes1-72/+380
The duration-limit is the maximum duration that can be set for the clip given its current children and their properties. If a change in the children properties causes this to drop below the current duration, it is automatically capped by this limit. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
2020-04-10ges: Always check return value of `ges_container_add`Thibault Saunier1-1/+4
Making coverity happy CIDs: 1461460, 1461461, 1461462, 1461463, 1461464, 1461465, 1461466, 1461468,
2020-04-08ges: Rework the way we ensure core elements are not wrongly moved between clipsThibault Saunier1-43/+18
Instead of focusing on the instances of the clips and their children, we relax the check to allow moving track element clip between clips that share a common asset. This makes it as correct conceptually but more flexible, and the code becomes simpler.
2020-04-08clip: tidy groupingHenry Wilkes1-112/+91
Make the grouping of clips cleaner by checking that the clips share the same asset.
2020-04-08clip: secure adding clip to layerHenry Wilkes1-21/+57
Add more checks when adding a clip to a layer, or moving a clip to a new layer. Also, mark the "layer" property as explicit-notify.
2020-04-08timeline: re-handle clip children track selectionHenry Wilkes1-189/+428
The way a clip's track elements are added to tracks was re-handled. This doesn't affect the normal usage of a simple audio-video timeline, where the tracks are added before any clips, but usage for multi-track timelines has improved. The main changes are: + We can now handle a track being selected for more than one track, including a full copy of their children properties and bindings. (Previously broken.) + When a clip is split, we copy the new elements directly into the same track, avoiding select-tracks-for-object. + When a clip is grouped or ungrouped, we avoid moving the elements to or from tracks. + Added API to allow users to copy the core elements of a clip directly into a track, complementing select-tracks-for-object. + Enforced the rule that a clip can only contain one core child in a track, and all the non-core children must be added to tracks that already contains a core child. This extends the previous condition that two sources from the same clip should not be added to the same track. + Made ges_track_add_element check that the newly added track element does not break the configuration rules of the timeline. + When adding a track to a timeline, we only use select-tracks-for-object to check whether track elements should be added to the new track, not existing ones. + When removing a track from a timeline, we empty it of all the track elements that are controlled by a clip. Thus, we ensure that a clip only contains elements that are in the tracks of the same timeline, or no track. Similarly, when removing a clip from a timeline. + We can now avoid unsupported timeline configurations when a layer is added to a timeline, and already contains clips. + We can now avoid unsupported timeline configurations when a track is added to a timeline, and the timeline already contains clips. Fixes https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/issues/84
2020-04-07clip: allow arbitrary max-duration when no core childrenHenry Wilkes1-21/+32
Before the max-duration could be set arbitrarily when the clip was empty, to indicate what the max-duration would be once the core children were created. Now, we can also do this whilst the clip only contains non-core children.
2020-04-07track-element: change owner to creatorHenry Wilkes1-64/+103
Rename the private "owners" to "creators" to avoid confusing this with the owner of the track element's memory. Also made the ungroup method for GESClip symmetric by making all the children of the resulting clips share their creators, which allows them to be added to any of the other ungrouped clips. Once the clips are grouped back together, the tracks loose these extra creators.
2020-03-25ges: Add APIs to have a sens of frame numbersThibault Saunier1-0/+56
APIs: - ges_timeline_get_frame_time - ges_timeline_get_frame_at - ges_clip_asset_get_frame_time - ges_clip_get_timeline_time_from_source_frame Extracting ges_util_structure_get_clocktime to internal utilities adding support for specifying timing values in frames with the special f<frame-number> synthax.
2020-03-25ges: Ensure GESClips assets are always ClipAssetsThibault Saunier1-1/+10
2020-03-25ges: Add API to retrieve the natural framerate of an elementThibault Saunier1-0/+17
2020-03-18clip: Allow setting max-duration clips without TrackElementsThibault Saunier1-0/+10
Otherwise this breaks quite a few assumption in user code, several pitivi tests broke because of that.
2020-03-18ges: Make it so core elements can be re added to their 'owners'Thibault Saunier1-41/+51
The user might want to add/remove/add core children to clips and be able to regroup ungrouped clip. This is needed for undo/redo in Pitivi for example
2020-03-16timeline-element: make max-duration cap in-pointHenry Wilkes1-9/+70
Do not allow the in-point to exceed the max-duration of any timeline element.
2020-03-16clip: only allow children with the same timelineHenry Wilkes1-0/+9
Refuse the addition of children whose timeline is neither NULL nor the clip's timeline.
2020-03-16clip: re-handle child in-point and max-durationHenry Wilkes1-27/+161
The in-point of a clip is kept in sync with its core children, unless they have no has-internal-source. The max-duration is defined as the minimum max-duration amongst the clip's core children. If it is set to a new value, this sets the max-duration of its core children to the same value if they have has-internal-source set as TRUE. Non-core children (such as effects on a source clip) do not influence these values. As part of this, we no longer track in-point in GESContainer. Unlike start and duration, the in-point of a timeline element does not refer to its extent in the timeline. As such, it has little meaning for most collections of timeline-elements, in particular GESGroups. As such, there is no generic way to relate the in-point of a container to its children.
2020-03-16clip: copy and paste control bindingsHenry Wilkes1-10/+14
Previously the control bindings were not properly copied into the pasted clip. Also changed the order so that elements are added to the clip before the clip is added to the timeline.
2020-03-16container: freeze notifies during add and removeHenry Wilkes1-11/+15
Hold the notify signals for the container and the children until after the child has been fully added or removed. After the previous commit, this was used to ensure that the notify::priority signal was sent for children of a clip *after* the child-removed signal. This stopped being the case when the code in ->child_removed was moved to ->remove_child (the latter is called before the child-removed signal is emitted, whilst the former is called afterwards). Rather than undo this move of code, which was necessary to ensure that ->add_child was always reversed, the notify::priority signal is now simply delayed until after removing the child has completed. This was done for all notify signals, as well as in the add method, to ensure consistency. This allows the test_clips.py test_signal_order_when_removing_effect to pass. Also make subclasses take a copy of the list of the children before setting the start and duration, since this can potentially re-order the children (if they have the SET_SIMPLE flag set).
2020-03-16clip: make remove_child a reverse of add_childHenry Wilkes1-27/+19
Previously, we relied on ->child_removed to reverse the priority changes that occured in ->add_child. However, ->child_removed is not always called (the signal child-removed is not always emitted) when a ->add_child needs to be removed. However, ->remove_child is always called to reverse ->add_child, so the code was moved here. Otherwise, we risk that the priorities of the clip will contain gaps, which will cause problems when another child is added to the clip.
2020-03-16clip: tidy handling of child prioritiesHenry Wilkes1-49/+78
Handle the child priorities in a way that keeps the container children list sorted by priority at all times. Also, no longer rely on the control_mode of the container, since we have less control over its value, compared to private variables. Also fixed the changing of priorities in set_top_effect_index: previously *all* children whose priority was above or below the new priority were shifted, when we should have been only shifting priorities for the children whose priority lied *between* the old and the new priority of the effect. E.g. effect: A B C D E F index: 0 1 2 3 4 5 After moving effect E to index 1, previously, we would get effect: A B C D E F index: 0 2 3 4 1 6 (this would have also shifted the priority for the core children as well!). Whereas now, we have the correct: effect: A B C D E F index: 0 2 3 4 1 5
2020-03-16clip: only allow core elements as childrenHenry Wilkes1-114/+142
Only allow elements that were created by ges_clip_create_track_elements (or copied from such an element) to be added to a clip. This prevents users from adding arbitrary elements to a clip. As an exception, a user can add GESBaseEffects to clips whose class supports it, i.e. to a GESSourceClip and a GESBaseEffectClip. This change also introduces a distinction between the core elements of a clip (created by ges_clip_create_track_elements) and non-core elements (currently, only GESBaseEffects, for some classes). In particular, GESBaseEffectClip will now distinguish between its core elements and effects added by the user. This means that the core elements will always have the lowest priority, and will not be listed as top effects. This is desirable because it brings the behaviour of GESBaseEffectClip in line with other clip types.
2020-03-09ges: Make setting start/duration move or trim genericThibault Saunier1-1/+4
We were implementing the logic for moving/trimming elements specific to SourceClip but this was not correct ass the new timeline tree allows us to handle that for all element types in a generic and nice way. This make us need to have groups trimming properly implemented in the timeline tree, leading to some fixes in the group tests. This adds tests for the various cases known to not be handled properly by the previous code. Fixes https://gitlab.freedesktop.org/gstreamer/gst-editing-services/issues/92
2020-03-06clip: Don't split clips at illegal positionThibault Saunier1-2/+24
Make sure that when we split a clip, the resulting timeline would not be in an illegal state. Fixes https://gitlab.freedesktop.org/gstreamer/gst-editing-services/issues/94