Commit graph

3181 commits

Author SHA1 Message Date
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
Henry Wilkes
7725e48a80 timeline-element: make in-point and max-duration EXPLICIT_NOTIFY
As such, they only emit a signal if their value changes, either through
their _set_inpoint or _set_max_duration methods, or through
g_object_set, etc.

Also, we now require the ->set_max_duration method to be implemented.
This was added to GESGroup, which will only allow the max-duration to be
set to GST_CLOCK_TIME_NONE.
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
dc4ca15ba8 clip: copy and paste control bindings
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-16 14:19:52 +00:00
Henry Wilkes
c63fb5db0e timeline-element: add signals for child properties
Add the child-property-added and child-property-removed signals to
GESTimelineElement.

GESContainer is able to use this to keep their child properties in sync
with their children: if they are added or removed from the child, they
are also added or removed from the container.
2020-03-16 14:19:52 +00:00
Henry Wilkes
74ae0ba5df container: freeze notifies during add and remove
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-16 14:19:52 +00:00
Henry Wilkes
3af38e1719 clip: make remove_child a reverse of add_child
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-16 14:19:52 +00:00
Henry Wilkes
d1276ed29b clip: tidy handling of child priorities
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-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
Thibault Saunier
41be342ba8 nle: Delay marking object as not in composition
Instead of doing it at the time of resetting `object->in_composition`
when user calls `gst_bin_remove` do it after we actually removed
it from the object thread, and do it in the `nle_object_reset`
method where it belongs

Fixes https://gitlab.freedesktop.org/gstreamer/gst-editing-services/issues/96
2020-03-11 22:44:52 +00:00
Henry Wilkes
ec2325ee9b auto-transition: fix setting of SET_SIMPLE flag
Previously, the SET_SIMPLE flag was non unset for auto-transitions after
it had been set.
2020-03-11 17:35:07 +00:00
Sebastian Dröge
76a3e1d39d Fix build with Python 3.8 by also checking for python-3.X-embed.pc
Since Python 3.8 the normal checks don't include the Python libraries
anymore and linking of the Python formatters would fail.

See also https://github.com/mesonbuild/meson/issues/5629
and https://gitlab.freedesktop.org/gstreamer/gst-python/issues/28
2020-03-11 13:42:50 +02:00
Thibault Saunier
1f919dae98 validate: Handle checking/setting subprojects ges properties 2020-03-09 11:50:01 -03:00
Thibault Saunier
5ea914a575 project: Do not warn when resetting URI to the same one 2020-03-09 11:49:02 -03:00
Thibault Saunier
6b7c658b6a ges: Make setting start/duration move or trim generic
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-09 11:48:37 -03:00
Thibault Saunier
b66290d1be group: Update priority when a child is removed
Fixes https://gitlab.freedesktop.org/gstreamer/gst-editing-services/issues/93
2020-03-06 18:18:28 +00:00
Thibault Saunier
f8091262b5 clip: Don't split clips at illegal position
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
2020-03-06 18:18:28 +00:00
Henry Wilkes
1cc5221d49 pipeline: don't link tracks unnecessarily
Unless the pipeline is in certain modes, we do not want to try and link
every track. The previous debug message implied this, but the method did
not actually end early.
Also, we always end early if we receive a track that is neither video
nor audio.
2020-03-05 17:04:51 -03:00
Henry Wilkes
7f65b7be0c asset: fix handling of proxies
Previous usage of the property proxy-target seemed to alternate between
the two definitions:
+ The asset we are the default proxy of
+ The asset we are in the proxy list of
Now, the latter definition is used, which seems more useful to a user
since knowing the latter can easily allow you to find out the former.

The previous behaviour of ges_asset_set_proxy (asset, NULL) was not very
clear. It is now defined so that it clears all the proxies for 'asset'.
This means that after this call, the GESAsset:proxy property will indeed
be NULL.

Also fixed:
+ We can call ges_asset_set_proxy (asset, proxy) when 'proxy' is already
  in the proxy list of 'asset'.
+ Handling of removing the default proxy in ges_asset_unproxy. This was
  sending out the wrong notifies.
+ Prohibiting circular proxying. Before we could only prevent one case,
  we should now be able to prevent all cases. This will prevent a hang
  in ges_asset_request.
2020-03-05 17:04:51 -03:00
Henry Wilkes
b03915bc87 test: remove asset test that needs internal method
The test_proxy_asset test needs the internal method
ges_asset_finish_proxy. The test also uses the associated internal methods
ges_asset_try_proxy and ges_asset_cache_lookup. However, these are
marked with GES_API in ges-internal.h, which allows us access to them
here.
The new method is not marked as GES_API because it would not allow us to
remove the method in the future without removing it from the symbols list.
We do not want to add to the problem.

The test was simply commented out since we may wish to support tests
that access internal methods in the future using meson.
2020-03-05 17:04:51 -03:00
Henry Wilkes
8f12663428 asset: fix ownership in ges_asset_request
Fix the ownership in ges_asset_request. This should be transfer-full,
but for proxies it would fail to add a reference. Also,
ges_asset_cache_put was leaking memory if the asset already existed.
2020-03-05 17:04:51 -03:00
Henry Wilkes
c12b84788d asset: move set_proxy (NULL, proxy) behaviour to new method
We should not be accepting ges_asset_set_proxy (NULL, proxy) as part of
the API! This behaviour was used internally in combination with
ges_asset_try_proxy, which is called on a still loading asset, so it was
moved to ges_asset_finish_proxy.
2020-03-05 17:04:51 -03:00
Henry Wilkes
46f2b5a9bc asset: deprecate ->proxied method
This method was no longer called, so it has been deprecated.
2020-03-05 17:04:51 -03:00
Henry Wilkes
0bc4c0820f asset: make proxy-target read only
We should not be able to set this property.
2020-03-05 17:04:51 -03:00
Henry Wilkes
a8458d59de timeline: fix layer priority argument in trim
Previously, we tested that the given priority was `>0`, when it seems
that `>=0` was intended. A priority of `-1` means leave the priority
unchanged, whilst a priority of 0, or more, means move to this layer
priority.
2020-03-05 17:04:51 -03: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
b76e7db461 group: fix memory leak in child layer callback
We were leaking the sigids->layer argument because gst_clip_get_layer
returns a new reference.
2020-03-05 17:04:51 -03:00
Henry Wilkes
7afa704054 container: fix child duration callback
Previously, we were setting the inpoint_offset using the start offset in
the duration callback!

Also added a notify for when the duration is changed in the child start
callback.
2020-03-05 17:04:51 -03:00
Henry Wilkes
11d93367a9 group: fix max layer priority
The maximum priority is `height - prio - 1`. Previously missing the -1.

Related to, but does not completely fix,
https://gitlab.freedesktop.org/gstreamer/gst-editing-services/issues/91
2020-03-05 17:04:51 -03:00
Henry Wilkes
f1d29e10e6 clip: allow for neither track nor type in search
Previously, either the track or track_type arguments had to be specified
in order to find **any** track elements. Now, you can specify neither,
which will match any track element, of the specified type.
2020-03-05 17:04:51 -03:00
Henry Wilkes
b6fb2ed531 pythontests: change num layers in timeline to 1
In the test_timeline.test_auto_transition, the corresponding xges only
has one layer, so we should only expect one layer when we extract the
timeline. This fixes a change that was missing from commit
d3e2cf55e3
2020-03-05 17:04:51 -03:00
Henry Wilkes
9a459d0cb5 extractable: check extractable-type of set asset
When setting the asset of a GESExtractable object, first make sure that
the asset's extractable-type matches the type of the object.
2020-03-05 17:04:51 -03:00
Henry Wilkes
1332ed674a layer: fix ownership when failing to add clip
If a clip is already part of a layer, then adding it to another layer
should fail. Previously, in this case, `ges_layer_add_clip` was adding a
reference to the clip instead, without subsequently giving up ownership.
This meant that the clip would be left with an unowned reference.
This has now been corrected by also calling `unref` after the
`ref_sink`.

Note that, since `clip` is already part of `current_layer`, it should
already be non-floating, so the `ref_sink`-`unref` should do nothing
overall. But we keep both to make the ownership (transfer floating/none)
explicit.
2020-03-05 17:04:51 -03:00
Henry Wilkes
a03afa5476 docs: update GESAudioTrack and GESVideoTrack 2020-03-05 17:04:51 -03:00
Henry Wilkes
2f2d57ff2b docs: update GESPipeline 2020-03-05 17:04:51 -03:00
Henry Wilkes
3324fe7d95 docs: update GESMetaContainer 2020-03-05 17:04:51 -03:00
Henry Wilkes
e55c87c5e5 docs: update GESExtractable 2020-03-05 17:04:51 -03:00
Henry Wilkes
dfe3b805f3 docs: update GESAsset 2020-03-05 17:04:51 -03:00
Henry Wilkes
b3d44f66b7 docs: update GESTrackElement 2020-03-05 16:59:37 -03:00
Henry Wilkes
cb35f5ec50 docs: update GESTrack 2020-03-05 16:59:37 -03:00
Henry Wilkes
ac2da96144 docs: update GESClip 2020-03-05 16:59:37 -03:00
Henry Wilkes
427d541f58 docs: update GESGroup 2020-03-05 16:59:37 -03:00
Henry Wilkes
1c6bdf3fcd docs: update GESContainer 2020-03-05 16:59:37 -03:00
Henry Wilkes
4b3fe5f622 docs: update GESTimelineElement 2020-03-05 16:59:37 -03:00
Henry Wilkes
94db57b9bd validate: unref copied and pasted 2020-03-05 16:59:37 -03:00
Henry Wilkes
615bf9e47a timeline: fix paste ownership
The method steals ownership of `copied_from`, so should be responsible
for unreffing it. Also make sure we fail when `layer != -1`, since this
functionality is not supported.
2020-03-05 16:59:37 -03:00