Commit graph

85 commits

Author SHA1 Message Date
Henry Wilkes dc9dbddbae nleobject: stop using media-duration-factor
The property had been deprecated and is unused.

This property is not needed. Any internal time effect that an nleoperation
wraps is itself responsible for converting seek/segment timestamps.
Previously, the ghostpads were performing a rate conversion after the
rate element had already done so, essentially doubling their effect on
seeks and segment times. This was always unnecessary, but went unnoticed
by the tempochange test because it was using an identity element rather
than an actual rate-changing element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/160>
2020-04-29 12:32:52 +00:00
Thibault Saunier e41a6b6fac ges: Rework the way we ensure core elements are not wrongly moved between clips
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-08 14:35:28 +01:00
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 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 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
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 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 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 bd33ed972c ges: Add API to retrieve the natural framerate of an element 2020-03-25 11:26:27 -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
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 5f3e8caabc track-element: add has-internal-source property
Unless this property is set to TRUE, the in-point must be 0 and the
max-duration must be GST_CLOCK_TIME_NONE.

Also added EXPLICIT_NOTIFY flags to the active and track-type
properties such that their notifies are emitted only if the property
changes, even when the g_object_set, etc, methods are used.

Also added a missing notify signal to the set_active method.
2020-03-16 14:19:52 +00:00
Henry Wilkes 91b5a5804a clip: only allow core elements as children
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-16 14:19:51 +00:00
Henry Wilkes bbff08f078 timeline-element: use default ->list_children_properties
Stop overwriting the ->list_children_properties virtual method in
subclasses because the timeline element class handles everything itself
anyway.
Note that containers already automatically add the children properties of
their child elements in ges_container_add.
2020-03-05 17:04:51 -03:00
Henry Wilkes b3d44f66b7 docs: update GESTrackElement 2020-03-05 16:59:37 -03:00
Thibault Saunier 32dae5e3da validate: Handle absolute control binding support when setting keyframes
And minor fix in set-control-source
2020-02-26 13:36:30 -03:00
Niels De Graef 35d140ad92 Don't pass default GLib marshallers for signals
By passing NULL to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-10-24 15:19:09 +02:00
Thibault Saunier 5caf822526 docs: Minor fixes 2019-05-13 10:30:19 -04:00
Thibault Saunier d87578c843 element: Make return value of setters mean something
Setters return values should return %FALSE **only** when the value
could not be set, not when unchanged or when the subclass handled
it itself!

This patches makes it so the return value is meaningul by allowing
subclasses return anything different than `TRUE` or `FALSE` (convention
is -1) to let the subclass now that it took care of everything and
no signal should be emited.
2019-05-02 12:10:11 -04:00
Thibault Saunier 2ab26ab306 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.
2019-05-01 12:24:30 -04:00
Thibault Saunier 7f0810bae7 Fix splitting control bindings leaks 2019-04-15 17:11:48 -04:00
Thibault Saunier a46390ff56 Reimplement the timeline editing API
This is implemented on top of a Tree that represents the whole timeline.

SourceClips can not fully overlap anymore and the tests have been
updated to take that into account. Some new tests were added to verify
that behaviour in greater details
2019-03-15 23:51:55 +00:00
Thibault Saunier 7c5f2d11b2 timeline-element: Add a method to retrieve layer priority
Each timeline element is in a layer (potentially spanning
over several), it is very often useful to retrieve an element
layer priority (from an app perspective more than the element
priority itself as that is a bit of an implementation detail
in the end).

Port tests to it
2019-03-15 23:51:55 +00:00
Thibault Saunier 1c2784daa6 clip: Add a method to get the priority of the layer it is in
Just an helper method to get the 'priority of a the clip'
2019-03-15 23:51:55 +00:00
Thibault Saunier 9a20b4cfe9 track-element: Ignore writability for whitlisted children props
If the property was explicitely whitelisted, we should expose it
in any case.

This was a regression from 835d693749
2019-01-04 12:36:20 +01:00
Tim-Philipp Müller a7347ca8f7 WIP: ges: fix API export/import and 'inconsistent linkage' on MSVC
Export GES library API in headers when we're building the
library itself, otherwise import the API from the headers.

This fixes linker warnings on Windows when building with MSVC.

Fix up some missing config.h includes when building the lib which
is needed to get the export api define from config.h

Fixes https://gitlab.freedesktop.org/gstreamer/gst-editing-services/issues/42
2018-12-15 00:14:51 +00:00
Thibault Saunier 1b75f8e5b1 track: Fix documentation about "binding_type" 2018-11-27 13:49:56 -03:00
Thibault Saunier 13b8c8554d Update for g_type_class_add_private() deprecation in recent GLib 2018-09-05 22:57:27 -03:00
Thibault Saunier 835d693749 track-element: Fix the way we look for properties on simple elements
Refactor so that the same code is used to add children properties from
bin children and when inspecting a single element.
2018-04-20 19:24:56 -03:00
Stefan Popa 5b321dbe3a track_element: Always emit "control-binding-removed" signal.
When setting a new control binding on a track element, the old control
binding (if any) is going to be removed. Make sure the
"control-binding-removed" signal is emitted in this case.

Fixes https://phabricator.freedesktop.org/T7340#95666

Reviewed-by: Thibault Saunier <thibault.saunier@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1842
2017-09-01 09:38:45 -03:00
Thibault Saunier 35256b47ff docs: Port all docstring to gtk-doc markdown 2017-03-08 18:13:48 -03:00
Alexandru Băluț 3ed09c370a ges: Fix documentation and debug comments
Reviewed-by: Thibault Saunier <thibault.saunier@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1393
2016-11-09 18:35:15 -03:00
Thibault Saunier 4432efcfad track-element: Avoid dereferencing NULL pointer
We set TrackElement track type very early when creating effects
so it now uses that information to find TrackElement in clips
by track type.

Reviewed-by: Alex Băluț <alexandru.balut@gmail.com>
Differential Revision: https://phabricator.freedesktop.org/D1370
2016-10-11 19:25:51 +02:00
Philippe Renon 3cf28775f3 ges-track-element: fix typos in control_binding_removed signal declaration
https://bugzilla.gnome.org/show_bug.cgi?id=770101
2016-08-18 10:21:57 -07:00
Aurélien Zanelli 813c4b4fb7 ges: add some g-i annotations according to documentation
Mainly (transfer xxx) and (nullable). Also fix some typo.

https://bugzilla.gnome.org/show_bug.cgi?id=766459
2016-05-14 20:36:07 -03:00
Thibault Saunier 66d65ed32f track-element: gi: skip now deprecated children property getter/setter
Those are implemented with the exact same API at the GESTimelineElement
level now, and user of those APIs with high level languages will get the
exact same API.
2016-05-06 18:28:01 -03:00
Thibault Saunier 9add236a0e ges: Do not try to set read only properties
When copying and splitting clips

Fixes T7375
2016-04-09 21:12:10 -03:00
Sjors Gielen 84f7f04a64 Handle changing playback rate
Before this patch, NLE and GES did not support NleOperations (respectively
GESEffects) that changed the speed/tempo/rate at which the source plays. For
example, the 'pitch' element can make audio play faster or slower. In GES 1.5.90
and before, an NleOperation containing the pitch element to change the rate (or
tempo) would cause a pipeline state change to PAUSED after that stack; that has
been fixed in 1.5.91 (see #755012 [0]). But even then, in 1.5.91 and later,
NleComposition would send segment events to its NleSources assuming that one
source second is equal to one pipeline second. The resulting early EOS event
(in the case of a source rate higher than 1.0) would cause it to switch stacks
too early, causing confusion in the timeline and spectacularly messed up
output.

This patch fixes that by searching for rate-changing elements in
GESTrackElements such as GESEffects. If such rate-changing elements are found,
their final effect on the playing rate is stored in the corresponding NleObject
as the 'media duration factor', named like this because the 'media duration',
or source duration, of an NleObject can be computed by multiplying the duration
with the media duration factor of that object and its parents (this is called
the 'recursive media duration factor'). For example, a 4-second NleSource with
an NleOperation with a media duration factor of 2.0 will have an 8-second media
duration, which means that for playing 4 seconds in the pipeline, the seek
event sent to it must span 8 seconds of media. (So, the 'duration' of an
NleObject or GES object always refers to its duration in the timeline, not the
media duration.)

To summarize:

* Rate-changing elements are registered in the GESEffectClass (pitch::tempo and
  pitch::rate are registered by default);
* GESTimelineElement is responsible for detecting rate-changing elements and
  computing the media_duration_factor;
* GESTrackElement is responsible for storing the media_duration_factor in
  NleObject;
* NleComposition is responsible for the recursive_media_duration_factor;
* The latter property finally fixes media time computations in NleObject.

NLE and GES tests are included.

[0] https://bugzilla.gnome.org/show_bug.cgi?id=755012

Differential Revision: https://phabricator.freedesktop.org/D276
2016-02-26 19:54:40 +01:00
Thibault Saunier ef69d5f97d ges: Give better names to nleobjects 2016-02-09 12:38:29 +01:00
Lubosz Sarnecki 6381e16c51 trackelement: Make use of read-only children properties.
Read only properties will throw a GLib warning like this
when accessed with "set_child_property":

Warning: g_object_set_property: property 'text-x' of object class 'GstTextOverlay' is not writable
2016-02-04 15:23:30 +01:00
Thibault Saunier a81f4b2d8f track-element: Rely on nleobject to be created at construct time
Avoiding all the pending_xx dance and making the code simpler.

This is now possible thanks to the various recent refactoring.

Thanks to that the user is able to set_child_property on objects
that are not in GESTrack yet, as expected.

Reviewed-by: Thibault Saunier <thibault.saunier@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D739
2016-02-04 15:23:28 +01:00
Thibault Saunier 7211e6982f ges: track-element: Try to create NleObject as soon as possible
This way we have informations about the content of the
children as soon as possible.

Most code paths where already ready to handle that as we use it for
copying clips.

Fix framepositionner to properly handle that (it would have broke
with copied clips before).

Reviewed-by: Thibault Saunier <thibault.saunier@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D736
2016-02-04 15:23:21 +01:00
Sebastian Dröge 4997c455f4 ges: Fix various g-i warnings 2015-12-26 09:43:23 +01:00
Sebastian Dröge f1c823ef60 ges-track-element: Rename control-binding-reomved signal to control-binding-removed
Strictly speaking an API change but nobody on the Internet seemed to have used
the signal with the typo in the name.
2015-12-26 09:43:19 +01:00
Thibault Saunier 0fad60e754 track-element: Handle the case where we have only one keyframe set when interpollating keyframes 2015-07-08 18:59:00 +02:00
Thibault Saunier 58fb9a6720 track-element: Fix splitting bindings and add unit tests 2015-07-03 14:06:54 +02:00
Thibault Saunier 5885f58c14 element: Implement a paste method
Allowing user to copy paste clips very easily
2015-07-03 14:06:54 +02:00
Thibault Saunier 54be29e9ed timeline-element: Add a method to get the TrackType it interacts with
API:
  + ges_timeline_element_get_track_types
2015-07-03 11:20:54 +02:00
Thibault Saunier 6a0ac89009 track-element: Add method to remove control binding
API:
  ges_track_element_remove_control_binding
2015-07-03 11:20:54 +02:00