1 /* GStreamer Editing Services
2 * Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
3 * 2009 Nokia Corporation
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef __GES_INTERNAL_H__
22 #define __GES_INTERNAL_H__
24 #include <gst/pbutils/encoding-profile.h>
27 #include "ges-timeline.h"
28 #include "ges-track-element.h"
29 #include "ges-timeline-element.h"
31 #include "ges-asset.h"
32 #include "ges-base-xml-formatter.h"
33 #include "ges-timeline-tree.h"
37 GST_DEBUG_CATEGORY_EXTERN (_ges_debug);
38 #ifndef GST_CAT_DEFAULT
39 #define GST_CAT_DEFAULT _ges_debug
42 /* The first 2 NLE priorities are used for:
43 * 0- The Mixing element
46 #define MIN_NLE_PRIO 2
47 #define LAYER_HEIGHT 1000
49 #define _START(obj) GES_TIMELINE_ELEMENT_START (obj)
50 #define _INPOINT(obj) GES_TIMELINE_ELEMENT_INPOINT (obj)
51 #define _DURATION(obj) GES_TIMELINE_ELEMENT_DURATION (obj)
52 #define _MAXDURATION(obj) GES_TIMELINE_ELEMENT_MAX_DURATION (obj)
53 #define _PRIORITY(obj) GES_TIMELINE_ELEMENT_PRIORITY (obj)
55 #define _END(obj) (_START (obj) + _DURATION (obj))
57 #define _set_start0 ges_timeline_element_set_start
58 #define _set_inpoint0 ges_timeline_element_set_inpoint
59 #define _set_duration0 ges_timeline_element_set_duration
60 #define _set_priority0 ges_timeline_element_set_priority
62 #define GES_TIMELINE_ELEMENT_FORMAT \
64 " [ %" GST_TIME_FORMAT \
65 " (%" GST_TIME_FORMAT \
66 ") - %" GST_TIME_FORMAT "(%" GST_TIME_FORMAT") layer: %" G_GINT32_FORMAT "] "
68 #define GES_TIMELINE_ELEMENT_ARGS(element) \
69 GES_TIMELINE_ELEMENT_NAME(element), element, \
70 GST_TIME_ARGS(GES_TIMELINE_ELEMENT_START(element)), \
71 GST_TIME_ARGS(GES_TIMELINE_ELEMENT_INPOINT(element)), \
72 GST_TIME_ARGS(GES_TIMELINE_ELEMENT_DURATION(element)), \
73 GST_TIME_ARGS(GES_TIMELINE_ELEMENT_MAX_DURATION(element)), \
74 GES_TIMELINE_ELEMENT_LAYER_PRIORITY(element)
76 #define GES_FORMAT GES_TIMELINE_ELEMENT_FORMAT
77 #define GES_ARGS GES_TIMELINE_ELEMENT_ARGS
79 G_GNUC_INTERNAL gboolean
80 timeline_ripple_object (GESTimeline *timeline, GESTimelineElement *obj,
81 gint new_layer_priority,
82 GList * layers, GESEdge edge,
85 G_GNUC_INTERNAL gboolean
86 timeline_slide_object (GESTimeline *timeline, GESTrackElement *obj,
87 GList * layers, GESEdge edge, guint64 position);
89 G_GNUC_INTERNAL gboolean
90 timeline_roll_object (GESTimeline *timeline, GESTimelineElement *obj,
91 GList * layers, GESEdge edge, guint64 position);
93 G_GNUC_INTERNAL gboolean
94 timeline_trim_object (GESTimeline *timeline, GESTimelineElement * object,
95 guint32 new_layer_priority, GList * layers, GESEdge edge,
97 G_GNUC_INTERNAL gboolean
98 ges_timeline_trim_object_simple (GESTimeline * timeline, GESTimelineElement * obj,
99 guint32 new_layer_priority, GList * layers, GESEdge edge,
100 guint64 position, gboolean snapping);
102 G_GNUC_INTERNAL gboolean
103 ges_timeline_move_object_simple (GESTimeline * timeline, GESTimelineElement * object,
104 GList * layers, GESEdge edge, guint64 position);
106 G_GNUC_INTERNAL gboolean
107 timeline_move_object (GESTimeline *timeline, GESTimelineElement * object,
108 guint32 new_layer_priority, GList * layers, GESEdge edge,
112 timeline_add_group (GESTimeline *timeline,
115 timeline_remove_group (GESTimeline *timeline,
118 timeline_emit_group_added (GESTimeline *timeline,
121 timeline_emit_group_removed (GESTimeline * timeline,
122 GESGroup * group, GPtrArray * array);
126 timeline_add_element (GESTimeline *timeline,
127 GESTimelineElement *element);
130 timeline_remove_element (GESTimeline *timeline,
131 GESTimelineElement *element);
135 timeline_get_tree (GESTimeline *timeline);
139 timeline_update_transition (GESTimeline *timeline);
143 timeline_fill_gaps (GESTimeline *timeline);
146 timeline_create_transitions (GESTimeline * timeline, GESTrackElement * track_element);
150 track_resort_and_fill_gaps (GESTrack *track);
154 track_disable_last_gap (GESTrack *track, gboolean disabled);
157 ges_asset_cache_init (void);
160 ges_asset_cache_deinit (void);
163 ges_asset_set_id (GESAsset *asset, const gchar *id);
166 ges_asset_cache_put (GESAsset * asset, GTask *task);
168 G_GNUC_INTERNAL gboolean
169 ges_asset_cache_set_loaded(GType extractable_type, const gchar * id, GError *error);
172 ges_asset_cache_lookup(GType extractable_type, const gchar * id);
175 ges_asset_try_proxy (GESAsset *asset, const gchar *new_id);
177 G_GNUC_INTERNAL gboolean
178 ges_asset_request_id_update (GESAsset *asset, gchar **proposed_id,
180 G_GNUC_INTERNAL gchar *
181 ges_effect_assect_id_get_type_and_bindesc (const char *id,
182 GESTrackType *track_type,
185 G_GNUC_INTERNAL void _ges_uri_asset_cleanup (void);
187 G_GNUC_INTERNAL gboolean _ges_uri_asset_ensure_setup (gpointer uriasset_class);
189 /* GESExtractable internall methods
191 * FIXME Check if that should be public later
193 G_GNUC_INTERNAL GType
194 ges_extractable_type_get_asset_type (GType type);
196 G_GNUC_INTERNAL gchar *
197 ges_extractable_type_check_id (GType type, const gchar *id, GError **error);
199 G_GNUC_INTERNAL GParameter *
200 ges_extractable_type_get_parameters_from_id (GType type, const gchar *id,
202 G_GNUC_INTERNAL GType
203 ges_extractable_get_real_extractable_type_for_id (GType type, const gchar * id);
205 G_GNUC_INTERNAL gboolean
206 ges_extractable_register_metas (GType extractable_type, GESAsset *asset);
208 /************************************************
210 * GESFormatter internal methods *
212 ************************************************/
214 ges_formatter_set_project (GESFormatter *formatter,
215 GESProject *project);
216 G_GNUC_INTERNAL GESProject *
217 ges_formatter_get_project (GESFormatter *formatter);
218 G_GNUC_INTERNAL GESAsset *
219 _find_formatter_asset_for_id (const gchar *id);
223 /************************************************
225 * GESProject internal methods *
227 ************************************************/
229 /* FIXME This should probably become public, but we need to make sure it
230 * is the right API before doing so */
231 G_GNUC_INTERNAL gboolean ges_project_set_loaded (GESProject * project,
232 GESFormatter *formatter,
234 G_GNUC_INTERNAL gchar * ges_project_try_updating_id (GESProject *self,
237 G_GNUC_INTERNAL void ges_project_add_loading_asset (GESProject *project,
238 GType extractable_type,
240 G_GNUC_INTERNAL gchar* ges_uri_asset_try_update_id (GError *error, GESAsset *wrong_asset);
241 /************************************************
243 * GESBaseXmlFormatter internal methods *
245 ************************************************/
247 /* FIXME GESBaseXmlFormatter is all internal for now, the API is not stable
248 * fo now, so do not expose it */
249 G_GNUC_INTERNAL void ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self,
251 const char *asset_id,
254 GstClockTime inpoint,
255 GstClockTime duration,
257 GESTrackType track_types,
258 GstStructure *properties,
259 GstStructure * children_properties,
260 const gchar *metadatas,
262 G_GNUC_INTERNAL void ges_base_xml_formatter_add_asset (GESBaseXmlFormatter * self,
264 GType extractable_type,
265 GstStructure *properties,
266 const gchar *metadatas,
267 const gchar *proxy_id,
269 G_GNUC_INTERNAL void ges_base_xml_formatter_add_layer (GESBaseXmlFormatter *self,
270 GType extractable_type,
272 GstStructure *properties,
273 const gchar *metadatas,
275 G_GNUC_INTERNAL void ges_base_xml_formatter_add_track (GESBaseXmlFormatter *self,
276 GESTrackType track_type,
279 GstStructure *properties,
280 const gchar *metadatas,
282 G_GNUC_INTERNAL void ges_base_xml_formatter_add_encoding_profile(GESBaseXmlFormatter * self,
286 const gchar * description,
288 const gchar * preset,
289 GstStructure * preset_properties,
290 const gchar * preset_name,
293 GstCaps * restriction,
295 gboolean variableframerate,
296 GstStructure * properties,
299 G_GNUC_INTERNAL void ges_base_xml_formatter_add_track_element (GESBaseXmlFormatter *self,
301 const gchar *asset_id,
302 const gchar * track_id,
303 const gchar *timeline_obj_id,
304 GstStructure *children_properties,
305 GstStructure *properties,
306 const gchar *metadatas,
309 G_GNUC_INTERNAL void ges_base_xml_formatter_add_source (GESBaseXmlFormatter *self,
310 const gchar * track_id,
311 GstStructure *children_properties);
313 G_GNUC_INTERNAL void ges_base_xml_formatter_add_group (GESBaseXmlFormatter *self,
315 const gchar *properties,
316 const gchar *metadatas);
318 G_GNUC_INTERNAL void ges_base_xml_formatter_last_group_add_child(GESBaseXmlFormatter *self,
322 G_GNUC_INTERNAL void ges_base_xml_formatter_add_control_binding (GESBaseXmlFormatter * self,
323 const gchar * binding_type,
324 const gchar * source_type,
325 const gchar * property_name,
327 const gchar *track_id,
328 GSList * timed_values);
330 G_GNUC_INTERNAL void ges_base_xml_formatter_set_timeline_properties(GESBaseXmlFormatter * self,
331 GESTimeline *timeline,
332 const gchar *properties,
333 const gchar *metadatas);
334 G_GNUC_INTERNAL void ges_xml_formatter_deinit (void);
336 G_GNUC_INTERNAL gboolean set_property_foreach (GQuark field_id,
337 const GValue * value,
340 G_GNUC_INTERNAL GstElement * get_element_for_encoding_profile (GstEncodingProfile *prof,
341 GstElementFactoryListType type);
343 /* Function to initialise GES */
344 G_GNUC_INTERNAL void _init_standard_transition_assets (void);
345 G_GNUC_INTERNAL void _init_formatter_assets (void);
346 G_GNUC_INTERNAL void _deinit_formatter_assets (void);
349 G_GNUC_INTERNAL gint element_start_compare (GESTimelineElement * a,
350 GESTimelineElement * b);
351 G_GNUC_INTERNAL gint element_end_compare (GESTimelineElement * a,
352 GESTimelineElement * b);
353 G_GNUC_INTERNAL GstElementFactory *
354 ges_get_compositor_factory (void);
357 ges_idle_add (GSourceFunc func, gpointer udata, GDestroyNotify notify);
360 /****************************************************
362 ****************************************************/
363 G_GNUC_INTERNAL void _ges_container_sort_children (GESContainer *container);
364 G_GNUC_INTERNAL void _ges_container_sort_children_by_end (GESContainer *container);
365 G_GNUC_INTERNAL void _ges_container_set_height (GESContainer * container,
367 G_GNUC_INTERNAL gint _ges_container_get_priority_offset (GESContainer * container,
368 GESTimelineElement *elem);
369 G_GNUC_INTERNAL void _ges_container_set_priority_offset (GESContainer * container,
370 GESTimelineElement *elem,
371 gint32 priority_offset);
374 /****************************************************
376 ****************************************************/
377 G_GNUC_INTERNAL void ges_clip_set_layer (GESClip *clip, GESLayer *layer);
378 G_GNUC_INTERNAL gboolean ges_clip_is_moving_from_layer (GESClip *clip);
379 G_GNUC_INTERNAL void ges_clip_set_moving_from_layer (GESClip *clip, gboolean is_moving);
380 G_GNUC_INTERNAL GESTrackElement* ges_clip_create_track_element (GESClip *clip, GESTrackType type);
381 G_GNUC_INTERNAL GList* ges_clip_create_track_elements (GESClip *clip, GESTrackType type);
383 /****************************************************
385 ****************************************************/
386 G_GNUC_INTERNAL gboolean ges_layer_resync_priorities (GESLayer * layer);
387 G_GNUC_INTERNAL void layer_set_priority (GESLayer * layer, guint priority, gboolean emit);
389 /****************************************************
391 ****************************************************/
392 #define NLE_OBJECT_TRACK_ELEMENT_QUARK (g_quark_from_string ("nle_object_track_element_quark"))
393 G_GNUC_INTERNAL gboolean ges_track_element_set_track (GESTrackElement * object, GESTrack * track);
394 G_GNUC_INTERNAL void ges_track_element_copy_properties (GESTimelineElement * element,
395 GESTimelineElement * elementcopy);
397 G_GNUC_INTERNAL void ges_track_element_copy_bindings (GESTrackElement *element,
398 GESTrackElement *new_element,
401 G_GNUC_INTERNAL GstElement *ges_source_create_topbin (const gchar * bin_name, GstElement * sub_element, ...);
402 G_GNUC_INTERNAL void ges_track_set_caps (GESTrack *track,
403 const GstCaps *caps);
404 G_GNUC_INTERNAL GstElement * ges_track_get_composition (GESTrack *track);
407 /*********************************************
408 * GESTrackElement subclasses contructores *
409 ********************************************/
410 G_GNUC_INTERNAL GESAudioTestSource * ges_audio_test_source_new (void);
411 G_GNUC_INTERNAL GESAudioUriSource * ges_audio_uri_source_new (gchar *uri);
412 G_GNUC_INTERNAL GESVideoUriSource * ges_video_uri_source_new (gchar *uri);
413 G_GNUC_INTERNAL GESImageSource * ges_image_source_new (gchar *uri);
414 G_GNUC_INTERNAL GESTitleSource * ges_title_source_new (void);
415 G_GNUC_INTERNAL GESVideoTestSource * ges_video_test_source_new (void);
417 /****************************************************
418 * GESTimelineElement *
419 ****************************************************/
422 GES_CLIP_IS_MOVING = (1 << 0),
423 GES_TIMELINE_ELEMENT_SET_SIMPLE = (1 << 1),
424 } GESTimelineElementFlags;
426 G_GNUC_INTERNAL gdouble ges_timeline_element_get_media_duration_factor(GESTimelineElement *self);
427 G_GNUC_INTERNAL GESTimelineElement * ges_timeline_element_get_copied_from (GESTimelineElement *self);
428 G_GNUC_INTERNAL GESTimelineElementFlags ges_timeline_element_flags (GESTimelineElement *self);
429 G_GNUC_INTERNAL void ges_timeline_element_set_flags (GESTimelineElement *self, GESTimelineElementFlags flags);
431 #define ELEMENT_FLAGS(obj) (ges_timeline_element_flags (GES_TIMELINE_ELEMENT(obj)))
432 #define ELEMENT_SET_FLAG(obj,flag) (ges_timeline_element_set_flags(GES_TIMELINE_ELEMENT(obj), (ELEMENT_FLAGS(obj) | (flag))))
433 #define ELEMENT_UNSET_FLAG(obj,flag) (ges_timeline_element_set_flags(GES_TIMELINE_ELEMENT(obj), (ELEMENT_FLAGS(obj) & ~(flag))))
434 #define ELEMENT_FLAG_IS_SET(obj,flag) ((ELEMENT_FLAGS (obj) & (flag)) == (flag))
436 /******************************
437 * GESMultiFile internal API *
438 ******************************/
439 typedef struct GESMultiFileURI
446 G_GNUC_INTERNAL GESMultiFileURI * ges_multi_file_uri_new (const gchar * uri);
448 /************************
449 * Our property masks *
450 ************************/
451 #define GES_PARAM_NO_SERIALIZATION (1 << (G_PARAM_USER_SHIFT + 1))
453 /********************
455 ********************/
457 G_GNUC_INTERNAL gboolean ges_nle_composition_add_object (GstElement *comp, GstElement *object);
458 G_GNUC_INTERNAL gboolean ges_nle_composition_remove_object (GstElement *comp, GstElement *object);
459 G_GNUC_INTERNAL gboolean ges_nle_object_commit (GstElement * nlesource, gboolean recurse);
463 #endif /* __GES_INTERNAL_H__ */