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__
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"
36 GST_DEBUG_CATEGORY_EXTERN (_ges_debug);
37 #define GST_CAT_DEFAULT _ges_debug
39 /* The first 2 NLE priorities are used for:
40 * 0- The Mixing element
43 #define MIN_NLE_PRIO 2
44 #define LAYER_HEIGHT 1000
46 #define _START(obj) GES_TIMELINE_ELEMENT_START (obj)
47 #define _INPOINT(obj) GES_TIMELINE_ELEMENT_INPOINT (obj)
48 #define _DURATION(obj) GES_TIMELINE_ELEMENT_DURATION (obj)
49 #define _MAXDURATION(obj) GES_TIMELINE_ELEMENT_MAX_DURATION (obj)
50 #define _PRIORITY(obj) GES_TIMELINE_ELEMENT_PRIORITY (obj)
51 #define _END(obj) (_START (obj) + _DURATION (obj))
52 #define _set_start0 ges_timeline_element_set_start
53 #define _set_inpoint0 ges_timeline_element_set_inpoint
54 #define _set_duration0 ges_timeline_element_set_duration
55 #define _set_priority0 ges_timeline_element_set_priority
57 #define GES_TIMELINE_ELEMENT_FORMAT \
59 " start: %" GST_TIME_FORMAT \
60 " inpoint: %" GST_TIME_FORMAT \
61 " duration: %" GST_TIME_FORMAT
63 #define GES_TIMELINE_ELEMENT_ARGS(element) \
64 GES_TIMELINE_ELEMENT_NAME(element), element, \
65 GST_TIME_ARGS(GES_TIMELINE_ELEMENT_START(element)), \
66 GST_TIME_ARGS(GES_TIMELINE_ELEMENT_INPOINT(element)), \
67 GST_TIME_ARGS(GES_TIMELINE_ELEMENT_DURATION(element))
69 G_GNUC_INTERNAL gboolean
70 timeline_ripple_object (GESTimeline *timeline, GESTrackElement *obj,
71 GList * layers, GESEdge edge,
74 G_GNUC_INTERNAL gboolean
75 timeline_slide_object (GESTimeline *timeline, GESTrackElement *obj,
76 GList * layers, GESEdge edge, guint64 position);
78 G_GNUC_INTERNAL gboolean
79 timeline_roll_object (GESTimeline *timeline, GESTrackElement *obj,
80 GList * layers, GESEdge edge, guint64 position);
82 G_GNUC_INTERNAL gboolean
83 timeline_trim_object (GESTimeline *timeline, GESTrackElement * object,
84 GList * layers, GESEdge edge, guint64 position);
85 G_GNUC_INTERNAL gboolean
86 ges_timeline_trim_object_simple (GESTimeline * timeline, GESTimelineElement * obj,
87 GList * layers, GESEdge edge, guint64 position, gboolean snapping);
89 G_GNUC_INTERNAL gboolean
90 ges_timeline_move_object_simple (GESTimeline * timeline, GESTimelineElement * object,
91 GList * layers, GESEdge edge, guint64 position);
93 G_GNUC_INTERNAL gboolean
94 timeline_move_object (GESTimeline *timeline, GESTrackElement * object,
95 GList * layers, GESEdge edge, guint64 position);
97 G_GNUC_INTERNAL gboolean
98 timeline_context_to_layer (GESTimeline *timeline, gint offset);
101 timeline_add_group (GESTimeline *timeline,
104 timeline_remove_group (GESTimeline *timeline,
107 timeline_emit_group_added (GESTimeline *timeline,
110 timeline_emit_group_removed (GESTimeline * timeline,
111 GESGroup * group, GPtrArray * array);
115 timeline_add_element (GESTimeline *timeline,
116 GESTimelineElement *element);
119 timeline_remove_element (GESTimeline *timeline,
120 GESTimelineElement *element);
124 timeline_fill_gaps (GESTimeline *timeline);
128 track_resort_and_fill_gaps (GESTrack *track);
132 track_disable_last_gap (GESTrack *track, gboolean disabled);
135 ges_asset_cache_init (void);
138 ges_asset_set_id (GESAsset *asset, const gchar *id);
141 ges_asset_cache_put (GESAsset * asset, GTask *task);
143 G_GNUC_INTERNAL gboolean
144 ges_asset_cache_set_loaded(GType extractable_type, const gchar * id, GError *error);
147 ges_asset_cache_lookup(GType extractable_type, const gchar * id);
150 ges_asset_try_proxy (GESAsset *asset, const gchar *new_id);
152 G_GNUC_INTERNAL gboolean
153 ges_asset_request_id_update (GESAsset *asset, gchar **proposed_id,
155 G_GNUC_INTERNAL gchar *
156 ges_effect_assect_id_get_type_and_bindesc (const char *id,
157 GESTrackType *track_type,
160 G_GNUC_INTERNAL void _ges_uri_asset_cleanup (void);
162 /* GESExtractable internall methods
164 * FIXME Check if that should be public later
166 G_GNUC_INTERNAL GType
167 ges_extractable_type_get_asset_type (GType type);
169 G_GNUC_INTERNAL gchar *
170 ges_extractable_type_check_id (GType type, const gchar *id, GError **error);
172 G_GNUC_INTERNAL GParameter *
173 ges_extractable_type_get_parameters_from_id (GType type, const gchar *id,
175 G_GNUC_INTERNAL GType
176 ges_extractable_get_real_extractable_type_for_id (GType type, const gchar * id);
178 G_GNUC_INTERNAL gboolean
179 ges_extractable_register_metas (GType extractable_type, GESAsset *asset);
181 /************************************************
183 * GESFormatter internal methods *
185 ************************************************/
187 ges_formatter_set_project (GESFormatter *formatter,
188 GESProject *project);
189 G_GNUC_INTERNAL GESProject *
190 ges_formatter_get_project (GESFormatter *formatter);
191 G_GNUC_INTERNAL GESAsset *
192 _find_formatter_asset_for_id (const gchar *id);
196 /************************************************
198 * GESProject internal methods *
200 ************************************************/
202 /* FIXME This should probably become public, but we need to make sure it
203 * is the right API before doing so */
204 G_GNUC_INTERNAL gboolean ges_project_set_loaded (GESProject * project,
205 GESFormatter *formatter);
206 G_GNUC_INTERNAL gchar * ges_project_try_updating_id (GESProject *self,
209 G_GNUC_INTERNAL void ges_project_add_loading_asset (GESProject *project,
210 GType extractable_type,
212 /************************************************
214 * GESBaseXmlFormatter internal methods *
216 ************************************************/
218 /* FIXME GESBaseXmlFormatter is all internal for now, the API is not stable
219 * fo now, so do not expose it */
220 G_GNUC_INTERNAL void ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self,
222 const char *asset_id,
225 GstClockTime inpoint,
226 GstClockTime duration,
228 GESTrackType track_types,
229 GstStructure *properties,
230 const gchar *metadatas,
232 G_GNUC_INTERNAL void ges_base_xml_formatter_add_asset (GESBaseXmlFormatter * self,
234 GType extractable_type,
235 GstStructure *properties,
236 const gchar *metadatas,
237 const gchar *proxy_id,
239 G_GNUC_INTERNAL void ges_base_xml_formatter_add_layer (GESBaseXmlFormatter *self,
240 GType extractable_type,
242 GstStructure *properties,
243 const gchar *metadatas,
245 G_GNUC_INTERNAL void ges_base_xml_formatter_add_track (GESBaseXmlFormatter *self,
246 GESTrackType track_type,
249 GstStructure *properties,
250 const gchar *metadatas,
252 G_GNUC_INTERNAL void ges_base_xml_formatter_add_encoding_profile(GESBaseXmlFormatter * self,
256 const gchar * description,
258 const gchar * preset,
259 const gchar * preset_name,
262 GstCaps * restriction,
264 gboolean variableframerate,
265 GstStructure * properties,
268 G_GNUC_INTERNAL void ges_base_xml_formatter_add_track_element (GESBaseXmlFormatter *self,
270 const gchar *asset_id,
271 const gchar * track_id,
272 const gchar *timeline_obj_id,
273 GstStructure *children_properties,
274 GstStructure *properties,
275 const gchar *metadatas,
278 G_GNUC_INTERNAL void ges_base_xml_formatter_add_source (GESBaseXmlFormatter *self,
279 const gchar * track_id,
280 GstStructure *children_properties);
282 G_GNUC_INTERNAL void ges_base_xml_formatter_add_group (GESBaseXmlFormatter *self,
284 const gchar *properties);
286 G_GNUC_INTERNAL void ges_base_xml_formatter_last_group_add_child(GESBaseXmlFormatter *self,
290 G_GNUC_INTERNAL void ges_base_xml_formatter_add_control_binding (GESBaseXmlFormatter * self,
291 const gchar * binding_type,
292 const gchar * source_type,
293 const gchar * property_name,
295 const gchar *track_id,
296 GSList * timed_values);
298 G_GNUC_INTERNAL gboolean set_property_foreach (GQuark field_id,
299 const GValue * value,
302 /* Function to initialise GES */
303 G_GNUC_INTERNAL void _init_standard_transition_assets (void);
304 G_GNUC_INTERNAL void _init_formatter_assets (void);
307 G_GNUC_INTERNAL gint element_start_compare (GESTimelineElement * a,
308 GESTimelineElement * b);
309 G_GNUC_INTERNAL gint element_end_compare (GESTimelineElement * a,
310 GESTimelineElement * b);
311 G_GNUC_INTERNAL GstElementFactory *
312 ges_get_compositor_factory (void);
315 ges_base_xml_formatter_set_timeline_properties(GESBaseXmlFormatter * self,
316 GESTimeline *timeline,
317 const gchar *properties,
318 const gchar *metadatas);
320 /****************************************************
322 ****************************************************/
323 G_GNUC_INTERNAL void _ges_container_sort_children (GESContainer *container);
324 G_GNUC_INTERNAL void _ges_container_sort_children_by_end (GESContainer *container);
325 G_GNUC_INTERNAL void _ges_container_set_height (GESContainer * container,
327 G_GNUC_INTERNAL gint _ges_container_get_priority_offset (GESContainer * container,
328 GESTimelineElement *elem);
329 G_GNUC_INTERNAL void _ges_container_set_priority_offset (GESContainer * container,
330 GESTimelineElement *elem,
331 gint32 priority_offset);
334 /****************************************************
336 ****************************************************/
337 G_GNUC_INTERNAL void ges_clip_set_layer (GESClip *clip, GESLayer *layer);
338 G_GNUC_INTERNAL gboolean ges_clip_is_moving_from_layer (GESClip *clip);
339 G_GNUC_INTERNAL guint32 ges_clip_get_layer_priority (GESClip *clip);
340 G_GNUC_INTERNAL void ges_clip_set_moving_from_layer (GESClip *clip, gboolean is_moving);
341 G_GNUC_INTERNAL GESTrackElement* ges_clip_create_track_element (GESClip *clip, GESTrackType type);
342 G_GNUC_INTERNAL GList* ges_clip_create_track_elements (GESClip *clip, GESTrackType type);
344 /****************************************************
346 ****************************************************/
347 G_GNUC_INTERNAL gboolean ges_layer_resync_priorities (GESLayer * layer);
349 /****************************************************
351 ****************************************************/
352 #define NLE_OBJECT_TRACK_ELEMENT_QUARK (g_quark_from_string ("nle_object_track_element_quark"))
353 G_GNUC_INTERNAL gboolean ges_track_element_set_track (GESTrackElement * object, GESTrack * track);
354 G_GNUC_INTERNAL guint32 _ges_track_element_get_layer_priority (GESTrackElement * element);
355 G_GNUC_INTERNAL void ges_track_element_copy_properties (GESTimelineElement * element,
356 GESTimelineElement * elementcopy);
358 G_GNUC_INTERNAL void ges_track_element_copy_bindings (GESTrackElement *element,
359 GESTrackElement *new_element,
362 G_GNUC_INTERNAL GstElement *ges_source_create_topbin (const gchar * bin_name, GstElement * sub_element, ...);
363 G_GNUC_INTERNAL void ges_track_set_caps (GESTrack *track,
364 const GstCaps *caps);
365 G_GNUC_INTERNAL GstElement * ges_track_get_composition (GESTrack *track);
368 /*********************************************
369 * GESTrackElement subclasses contructores *
370 ********************************************/
371 G_GNUC_INTERNAL GESAudioTestSource * ges_audio_test_source_new (void);
372 G_GNUC_INTERNAL GESAudioUriSource * ges_audio_uri_source_new (gchar *uri);
373 G_GNUC_INTERNAL GESVideoUriSource * ges_video_uri_source_new (gchar *uri);
374 G_GNUC_INTERNAL GESImageSource * ges_image_source_new (gchar *uri);
375 G_GNUC_INTERNAL GESTitleSource * ges_title_source_new (void);
376 G_GNUC_INTERNAL GESVideoTestSource * ges_video_test_source_new (void);
378 /****************************************************
379 * GESTimelineElement *
380 ****************************************************/
381 G_GNUC_INTERNAL gdouble ges_timeline_element_get_media_duration_factor(GESTimelineElement *self);
383 /******************************
384 * GESMultiFile internal API *
385 ******************************/
386 typedef struct GESMultiFileURI
393 G_GNUC_INTERNAL GESMultiFileURI * ges_multi_file_uri_new (const gchar * uri);
395 /************************
396 * Our property masks *
397 ************************/
398 #define GES_PARAM_NO_SERIALIZATION (1 << (G_PARAM_USER_SHIFT + 1))
400 /********************
402 ********************/
404 G_GNUC_INTERNAL gboolean ges_nle_composition_add_object (GstElement *comp, GstElement *object);
405 G_GNUC_INTERNAL gboolean ges_nle_composition_remove_object (GstElement *comp, GstElement *object);
406 G_GNUC_INTERNAL gboolean ges_nle_object_commit (GstElement * nlesource, gboolean recurse);
410 #endif /* __GES_INTERNAL_H__ */