Commit graph

3226 commits

Author SHA1 Message Date
Henry Wilkes
ba31a8d6a0 timeline-element: only copy read-write properties
Only copy the properties that can be both read and written, and are not
construct only. Similarly for child properties when a track-element is
deep copied.
2020-04-08 14:35:28 +01:00
Henry Wilkes
fe854bba69 timeline: return sunk element on pasting
Technically, an element can still be floating on the return from
`->paste` (e.g. a clip not in a layer). Since the return of the `_paste`
methods are (return full) a non-floating object is probably expected in
all cases.
2020-04-08 14:35:28 +01:00
Henry Wilkes
067304a05f auto-transition: select track directly
By-pass the select-tracks-for-object signal for auto-transitions since
their track element must land in the same track as the elements it is
the auto-transition for.
2020-04-08 14:35:28 +01:00
Henry Wilkes
269c2d1dc0 timeline: re-handle clip children track selection
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-08 14:35:28 +01:00
Henry Wilkes
f7a1bdb289 timeline: stop connecting to track-element-added
This was used to connect to the track element's notify::start signal in
order to update the duration of the timeline (it is not clear why the
notify::duration signal was not also connected to for the same reason).
However, this is already covered by the timeline_tree_move method, which
is always called to update the start of a track element, even if it is not
part of a clip (and similarly for timeline_tree_trim, which is called
when the duration is set).
2020-04-07 11:17:54 +01:00
Henry Wilkes
a93e873402 clip: allow arbitrary max-duration when no core children
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-07 11:17:54 +01:00
Henry Wilkes
278a5fd796 track-element: change owner to creator
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-04-07 11:17:44 +01:00
Henry Wilkes
6e55a6556f container: change ownership when adding
Make sure we sink the child on adding, and keep it alive until the end
in case the method fails.

Also, since the child mappings hold a ref to the child, they should give
them up in their free method. This way, the ref will be given up on
disposing, even if ges_container_remove fails.

Also, reverse setting of the start of the container if adding fails.
2020-04-07 09:34:12 +01:00
Nirbheek Chauhan
917eba54f7 ges: Fix build with GCC 10
gcc-10 defaults to -fno-common, which exposes a symbol conflict, so
use `static` correctly. Also we don't use `parent_extractable_iface`
in `ges-uri-clip.c`.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678
2020-04-06 23:06:29 +05:30
Thibault Saunier
f307d3d51b ges: Fix trimming clip inside deeply nested groups
This broke in 6b7c658b6a
2020-03-31 15:19:52 -03:00
Thibault Saunier
b1e7be7bfc uri-clip: Remove dead code
GES_TESTING_ASSETS_DIRECTORY is prehistoric and since then
new mechanism for asset relocation have been added, it makes
no sense to keep that unused code path
2020-03-30 06:54:22 -03:00
Thibault Saunier
3118e3ebaf uri-clip: Remove ->create_track_element implementation
It is dead code
2020-03-30 06:54:22 -03:00
Thibault Saunier
ddaf67fed3 ges: Deprecate GESImageSource and GESMultiFileSource
Refactoring GESVideoSource so that #GESUriVideoSource can handle
still image in a simple way

MultiFileSource has been replaced with the new `imagesequencesrc`
element, this was totally broken anyway as `multifilesrc` can not seek
properly.
2020-03-30 06:54:22 -03:00
Thibault Saunier
f99034a522 track-element: Create nleobject on GESExtractable::set_asset
This means that we have all the information about the asset
when constructing the underlying GstElements.

This also allows to cleanup some code all around
2020-03-27 17:17:23 -03:00
Thibault Saunier
c2287696b1 timeline:element: Refactor the way we 'copy'
Simplifying the implementation and making sure assets are set asap
2020-03-27 17:17:23 -03:00
Thibault Saunier
ffc11daa40 ges: Use assets to instantiate track elements/group
And deprecate all GESTrackElement constructors, but the GESEffect one.
Those should **never** be created by users and should become internal
in the future.

Stop having docstring for the constructors that were internal.
2020-03-27 17:17:23 -03:00
Thibault Saunier
cec1dd3302 tests: Cleanup test files handling 2020-03-25 18:00:09 -03:00
Thibault Saunier
2d810bd7b7 formatter: Serialize source properties
This way we ensure that the TrackElement 'active' property is
properly serialized
2020-03-25 15:40:25 -03:00
Thibault Saunier
f9f30c4ced ges: Add a way to set layer activeness by track
a.k.a muting layers.

Adding unit tests and making sure serialization works properly
2020-03-25 15:40:25 -03:00
Thibault Saunier
7ccc7aa7ca element: Add API safe guard against invalid position in edit() 2020-03-25 11:26:29 -03:00
Thibault Saunier
1577ac1038 validate: Refactor actions implementation
Making them simpler to read and avoiding leaks
2020-03-25 11:26:29 -03:00
Thibault Saunier
42fc26ee94 structured-interface: Fix adding clip to layer error reporting 2020-03-25 11:26:29 -03:00
Thibault Saunier
13325aabdd ges: Add a SourceClipAsset class
Cleaning up the way we use the default framerate for natural
frame rate.
2020-03-25 11:26:29 -03:00
Thibault Saunier
130140d059 launch: Add a way to disable validate at runtime
Also avoid to add useless bin in our sinks
2020-03-25 11:26:29 -03:00
Thibault Saunier
dcb3ad620d ges: Plug some leaks 2020-03-25 11:26:29 -03:00
Thibault Saunier
ae6124e282 validate: Add support to seek in frames 2020-03-25 11:26:29 -03:00
Thibault Saunier
0c87b44fae ges: support test clips assets natural size/framerate
This way we can test this kind of behaviour without requiring
real sources.

Also add simple tests.
2020-03-25 11:26:29 -03:00
Thibault Saunier
e835042f04 ges: Add APIs to have a sens of frame numbers
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-25 11:26:29 -03:00
Henry Wilkes
e8a69f5563 utils: fix argument sanitization
_sanitize_argument is supposed to wrap arguments in '"' quote marks such
that they can be parsed and copied into a GstStructure string. This
purpose is now supported more directly, which fixes some bugs, e.g.:
  arguments                before                  fix
+title my=title          +title my="title"       +title "my=title"
+title abc n=my=name     +title abc n="my="name" +title abc n="my=name"
+title my"title          +title "my"title"       +title "my\"title"
+title my\title          +title "my\title"       +title "my\\title"
2020-03-25 11:26:29 -03:00
Thibault Saunier
f0677291d1 launch: Fix memory management issue with the rendering format 2020-03-25 11:26:29 -03:00
Thibault Saunier
f7bd6d63c4 validate: Rename edit-container to edit
Keeping the old version for backward compat
2020-03-25 11:26:29 -03:00
Thibault Saunier
2cbc1f14df ges: Add a timeoverlay to video test sources
This is often very useful to have a timeoverlay inside test sources.
We do not want to use it as an effect as segments are not the sames
in GES when it comes to nleoperations.
2020-03-25 11:26:29 -03:00
Thibault Saunier
66fb647183 element: Handle using own property as child property
Avoiding ref cycles
2020-03-25 11:26:29 -03:00
Thibault Saunier
7f0fc6fbed ges: Ensure GESClips assets are always ClipAssets 2020-03-25 11:26:29 -03:00
Thibault Saunier
bd33ed972c ges: Add API to retrieve the natural framerate of an element 2020-03-25 11:26:27 -03:00
Thibault Saunier
b93caf362c ges: Some memory management fixes setting track mixing
Also fix 'mixing' property notifies
2020-03-23 12:09:22 -03:00
Thibault Saunier
e6e05be88a ges: Cleanup GESEdge and GESEditMode GEnum values
By duplicating the registered values, so that bindings have
better values to use
2020-03-19 18:45:51 -03:00
Thibault Saunier
329cbbcba7 launch: Make command line provided sinks override scenario defined ones 2020-03-19 18:45:51 -03:00
Thibault Saunier
ed2c7006c5 framepositioner: Avoid dereferencing NULL pointer 2020-03-19 18:45:51 -03:00
Thibault Saunier
e3aa157d53 validate: Initialize GValue before calling g_object_get_value
This is required with GLib < 2.60
2020-03-19 18:45:51 -03:00
Thibault Saunier
ff2180b284 ges: Use #pragma once everywhere 2020-03-19 21:09:18 +00:00
Thibault Saunier
0012c6a3b0 ges: Cleanup the way we declare object types
We create our own _DECLARE_ macro because we have instance structures
2020-03-19 21:09:18 +00:00
Thibault Saunier
aaf2025c71 ges: Stop using hash_table_steal_extended
This appeard in GLib 2.58

Fixes https://gitlab.freedesktop.org/gstreamer/gst-editing-services/issues/99
2020-03-19 09:15:11 -03:00
Thibault Saunier
314db9f1bd clip: Allow setting max-duration clips without TrackElements
Otherwise this breaks quite a few assumption in user code, several
pitivi tests broke because of that.
2020-03-18 21:58:11 -03:00
Thibault Saunier
fc0333922f ges: Make it so core elements can be re added to their 'owners'
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-18 21:58:11 -03:00
Thibault Saunier
10590e25f0 container: Let subclass know adding child was interrupted
When the `child-added` signal emission was called, the
`GESContainer->child_added` vmethod was called (the signal is
`G_SIGNAL_RUN_FIRST`) so we need to call `GESContainer->child_removed`
ourself so subclasses know they do not control the child anymore.
2020-03-18 14:04:49 -03:00
Henry Wilkes
eb8e429c80 timeline-element: make start and duration EXPLICIT_NOTIFY
The properties will only have their signal emitted when they change in
value, even when g_object_set, etc, methods are used.

The _set_start method already did this, but start was missing the
EXPLICIT_NOTIFY flag. There should be no need to check that the property
has changed in ->set_start or ->set_duration
2020-03-16 14:19:52 +00:00
Henry Wilkes
658e64432d timeline-element: make max-duration cap in-point
Do not allow the in-point to exceed the max-duration of any timeline
element.
2020-03-16 14:19:52 +00:00
Henry Wilkes
d03e0fa8c5 clip: only allow children with the same timeline
Refuse the addition of children whose timeline is neither NULL nor the
clip's timeline.
2020-03-16 14:19:52 +00:00
Henry Wilkes
cd9cba55c0 clip: re-handle child in-point and max-duration
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-16 14:19:52 +00:00