Commit graph

3370 commits

Author SHA1 Message Date
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
Henry Wilkes
8ad9952cdb docs: update GESTimeline and GESLayer 2020-03-05 16:59:37 -03:00
Thibault Saunier
e7b2570c39 python: Cleanup overrides using monkey patching
Following the PyGObject guidelines[0], this starts monkey patching
overridden elements instead of subclassing them.

[0]: https://pygobject.readthedocs.io/en/latest/devguide/override_guidelines.html#python-override-guidelines
2020-03-03 21:34:23 +00:00
Jens Göpfert
dc463e2550 add assets to layer and adjust position and duration (closes #45) 2020-03-03 12:27:33 +00:00
Thibault Saunier
3b182342e0 python: Add a Timeline.iter_clips() helper to iterate clips 2020-03-02 19:14:01 -03:00
Thibault Saunier
9ec1ebfbdf meson: Add an option to enable/disable validate integration 2020-02-26 13:39:29 -03:00
Thibault Saunier
9cf986c71c framepositioner: Reposition source when the user positioned them
Keeping the same proportion in the size and position and only if
the aspect ratio is conserved.
2020-02-26 13:39:29 -03:00
Thibault Saunier
f55033223f ges:launch: Handle setting playback information in scenarios
This way we can avoid real sinks when implementing scenarios
2020-02-26 13:36:30 -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
Thibault Saunier
53637ad749 ges: Properly position video sources in the scene by default
We try to do our best to have the video frames scaled the best way
to fill most space on the final frames, keeping aspect ratio. The user
can later on rescale or move the sources as usual but it makes the
default behaviour a better and more natural especially now that we
set default restriction caps to the video tracks.

And fix the unit test to take that change into account
2020-02-26 13:36:30 -03:00
Thibault Saunier
7b3ac927dc ges: Add a method to retrieve the 'natural' size of VideoSource
This way the user can easily know how the clip would look like
if no scaling was applied to the clip, this is useful to be able
to properly position the clips with the framepositionner element.
2020-02-26 13:36:30 -03:00
Thibault Saunier
c802a40a96 ges: Call the right ->set_child_property vmethod
We used to always call the `->set_child_property` virtual method
of the object that `ges_timeline_element_set_child_property` was called
from, but that means that, in the case of referencing GESContainer
children properties from its children, the children wouldn't know
what child property have been set, and the children override wouldn't
be takent into account, in turns, it means that the behaviour could be
different in the setter depending on parent the method was called,
which is totally unexpected.

We now make sure that the vmethod from the element that introduced the
child property is called whatever parent method is called, making the
behaviour more uniform.

Fix the python override to make sure that new behaviour is respected.
2020-02-26 13:36:30 -03:00