Commit graph

3217 commits

Author SHA1 Message Date
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
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