Commit graph

78 commits

Author SHA1 Message Date
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
Thibault Saunier
38dbfc1c24 ges: Allow setting children property using the set_object_arg format
This make it much simpler for the user to set enum values and should not cause any issue
2020-02-25 17:44:51 -03:00
Thibault Saunier
82159882d7 ges: Ignore deprecation of GParameter
GParameter is part of our API, and for GLib < 2.54 we do not even have
a way around avoiding it (namely `g_object_new_with_properties`).

We should stop using GParameter once we depend on GLib 2.54.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-editing-services/issues/86
2020-02-07 11:58:37 -03:00
Thibault Saunier
000edd268e ges: Use G_DEPRECATE to mark deprecated methods
Cleanup a few things on the way.

And move ges-track-element deprecations to a dedicated header file
2019-12-18 15:48:23 -03:00
Henry Wilkes
7b5f655c9a ges-source-clip: fixed return of duration setter
In general, brought the behaviour of the `start`, `duration` and
`inpoint` setters in line with each other. In particular:
1. fixed return value the GESSourceClip `duration` setter
2. changed the GESClip `start` setter
3. fixed the inpoint callback for GESContainer
4. changed the type of `res` in GESTimelineElement to be gint to
   emphasise that the GES library is using the hack that a return of -1
   from klass->set_duration means no notify signal should be sent out.

Also added a new test for clips to ensure that the setters work for
clips within and outside of timelines, and that the `start`, `inpoint`
and `duration` of a clip will match its children.
2019-12-14 18:12:51 +00: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
5847c6e5ed ges: Implement our own idle_add which uses the thread local maincontext 2019-07-26 13:48:51 -04:00
Thibault Saunier
ded3a5fb2f element: Properly handle the fact that pasting can return NULL
And fix paste annotation
2019-06-05 00:43:48 +00:00
Thibault Saunier
b8c0894f34 docs: Minor documentation fixes 2019-05-23 18:54:42 -04:00
Thibault Saunier
ab2582c97e ges: Minor reorganisation of timeline-element.c 2019-05-23 18:54:42 -04:00
Sebastian Dröge
acf3e31907 timeline-element: Mark edit() as Since: 1.18 2019-05-16 15:09:51 +03:00
Sebastian Dröge
214987bd8a ges: Sprinkle around some Since: 1.16 markers 2019-05-16 15:09:13 +03: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
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
69456e4f14 ges: Move GESClipFlags to GESTimelineElementFlags
Keeping it internal

And add an internal method to get layer priority for GESTimelineElements
(dirty implementation to make it simple for now)
2019-03-15 23:51:55 +00:00
Seungha Yang
acbd7e7bc5 timeline-element: Chain up to parent impl. on dispose()
... as documented in glib
2018-12-27 00:14:03 +09: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
Víctor Manuel Jáquez Leal
c04342e4f1 timeline-element: Fix compilation errors
There were some code errors introduced in commit 6b738b7a
2018-11-05 13:58:06 +01:00
Corentin Noël
6b738b7aa4 timeline-element: Align virtual methods and invokers prototypes 2018-11-05 11:00:58 +01:00
Thibault Saunier
534855d42e ges: Mark GValue in child property setters as const
We can't change the vmethod at this point so just cast. This makes
the API more explicit so it is better in all cases.
2018-11-02 09:43:50 -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
15782c6ecd ges: Update the media-duration-factor each time a child property is set
Otherwise the changes won't be reflected in the NLE backend.

This makes speed changes working inside ges-launch-1.0

  ges-launch-1.0 +clip /path/to/file i=10 d=5 +effect videorate set-rate 5.0

https://bugzilla.gnome.org/show_bug.cgi?id=794699
2018-03-26 12:39:55 -03:00
Harish Fulara
e944739ca5 Added paste functionality to GESTimeline class
https://bugzilla.gnome.org/show_bug.cgi?id=793820
2018-03-02 08:10:50 -03:00
Edward Hervey
d91cc7e7b6 ges: Fix sizeof() usage
The entries of the array are "gchar *" and not "gchar **"

CID #1427091
CID #1427120
2018-01-11 10:57:30 +01:00
Edward Hervey
9a45d0ef85 ges: Fix a bunch of leaks
There are definitely more left, but don't have time for more debugging
2017-11-27 11:49:43 +01:00
Stefan Popa
e9794d2bf2 "deep-notify" signal gets emitted only from the main thread
https://bugzilla.gnome.org/show_bug.cgi?id=784414
2017-07-03 11:40:04 -04:00
Thibault Saunier
88a5894fbd ges: Handle g_object_newv deprecation in latest GLib 2017-06-23 16:17:57 -04:00
Sebastian Dröge
be67574245 ges: Correctly handling floating references
If we ref_sink() a parameter, it must be marked as (transfer floating)
and it also has to be handled consistently between error and normal cases.

See https://bugzilla.gnome.org/show_bug.cgi?id=782499

https://bugzilla.gnome.org/show_bug.cgi?id=782652
2017-05-20 16:53:57 +02:00
Thibault Saunier
35256b47ff docs: Port all docstring to gtk-doc markdown 2017-03-08 18:13:48 -03:00
Thibault Saunier
ab7865d41c clip: Make sure that clip start change is notified before children changes
Fixes https://phabricator.freedesktop.org/T7577

Differential Revision: https://phabricator.freedesktop.org/D1600
2017-01-09 19:49:19 -03:00
Thibault Saunier
ad27229dac element: Rework set_child_property_by_pspec
It was making no sense to loose the information about the pspec itself
to retrieve the child associated to it and was failling when we were
forcing the AssociateType::prop synthax
2016-12-01 17:08:43 -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
3409719de5 ges: Deprecate GESTimelineElement::priority writability
GESLayer is now responsible for setting clips priorites. Also
GESClip top effects priorities are now set by the
ges_clip_set_top_effect_index method, the user should never call
ges_timeline_element_set_priority as it will anyway be overriden
by GES itself.

Differential Revision: https://phabricator.freedesktop.org/D1280
2016-09-26 13:32:58 -03:00
Edward Hervey
be5b9270ac timeline-element: Reset pointer after freeing
dispose can be called multiple times, make sure we don't call functions
on free'd pointers.
2016-08-13 11:08:34 +02:00
Aurélien Zanelli
96a8c6db0c ges: fix various leaks with usage of ges_timeline_element_lookup_child
Some callers forgot to unref out child, pspec or both leading to leaks.

https://bugzilla.gnome.org/show_bug.cgi?id=766449
2016-06-20 13:16:29 +01: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
79e2bbac5d element: Also accept GParamSpec.owner_type name as a child property prefix
Makes it simpler for python users to be able to retrieve children
properties iterating over them.
2016-05-06 22:30:23 -03:00
Thibault Saunier
7d34e33ac4 title: Do not concider inpoints
It does not make sense for titles
Handle element with no inpoint handling in the timeline

Fixes https://phabricator.freedesktop.org/T7319
2016-04-22 16:15:33 -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
2fae9ee50d group: Make deep copying actually copy deep
Allowing pasting groups paste exactly what had been copied

And not the new version of the contained objects

This technically breaks the C API but this is a new API and I believe
and hope nobody is using it right now.

Reviewed-by: Thibault Saunier <thibault.saunier@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D616
2016-01-17 09:23:35 +01:00
Thibault Saunier
b75d9b11c6 Revert "timeline-element: Do not consider not serializable elements when getting top element"
This commit was causing issue where we were reporting the toplevel
element as an element but that element was actually in another
not serialized group. That is very tricky to handle for end users
as they are not guaranteed the toplevel clips were actually not
contained in another element.

This reverts commit ceb82ba302.

Reviewed-by: Thibault Saunier <thibault.saunier@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D627
2016-01-17 09:23:16 +01:00
Sebastian Dröge
4997c455f4 ges: Fix various g-i warnings 2015-12-26 09:43:23 +01:00
Thibault Saunier
ceb82ba302 timeline-element: Do not consider not serializable elements when getting top element
Those are temporary elements that should not be considered when dealing
with the hierarchy of objects.

Fixes T3455
2015-12-21 18:12:40 +01:00
Justin Kim
731bda1592 timeline-element,track,framepositionner: don't leak internal object
https://bugzilla.gnome.org/show_bug.cgi?id=755247
2015-09-30 11:50:28 +02:00
Thibault Saunier
6fc6ce29f9 ges; Minor debug enhancement 2015-07-16 10:53:17 +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
Mathieu Duponchelle
e89dccc9aa timeline-element: Disconnect child properties handlers.
Summary:
+ And freeze notifies while doing so.

We had a race with GstController which isn't MT safe, we can
fix it by propertly disconnecting signals, and making sure
no notifies are emitted while doing so.

Reviewers: thiblahute

Differential Revision: http://phabricator.freedesktop.org/D64
2015-03-31 15:32:08 +02:00