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"
36 GST_DEBUG_CATEGORY_EXTERN (_ges_debug);
37 #ifndef GST_CAT_DEFAULT
38 #define GST_CAT_DEFAULT _ges_debug
41 /* The first 2 NLE priorities are used for:
42 * 0- The Mixing element
45 #define MIN_NLE_PRIO 2
46 #define LAYER_HEIGHT 1000
48 #define _START(obj) GES_TIMELINE_ELEMENT_START (obj)
49 #define _INPOINT(obj) GES_TIMELINE_ELEMENT_INPOINT (obj)
50 #define _DURATION(obj) GES_TIMELINE_ELEMENT_DURATION (obj)
51 #define _MAXDURATION(obj) GES_TIMELINE_ELEMENT_MAX_DURATION (obj)
52 #define _PRIORITY(obj) GES_TIMELINE_ELEMENT_PRIORITY (obj)
53 #define _END(obj) (_START (obj) + _DURATION (obj))
54 #define _set_start0 ges_timeline_element_set_start
55 #define _set_inpoint0 ges_timeline_element_set_inpoint
56 #define _set_duration0 ges_timeline_element_set_duration
57 #define _set_priority0 ges_timeline_element_set_priority
59 #define GES_TIMELINE_ELEMENT_FORMAT \
61 " start: %" GST_TIME_FORMAT \
62 " inpoint: %" GST_TIME_FORMAT \
63 " duration: %" GST_TIME_FORMAT
65 #define GES_TIMELINE_ELEMENT_ARGS(element) \
66 GES_TIMELINE_ELEMENT_NAME(element), element, \
67 GST_TIME_ARGS(GES_TIMELINE_ELEMENT_START(element)), \
68 GST_TIME_ARGS(GES_TIMELINE_ELEMENT_INPOINT(element)), \
69 GST_TIME_ARGS(GES_TIMELINE_ELEMENT_DURATION(element))
71 G_GNUC_INTERNAL gboolean
72 timeline_ripple_object (GESTimeline *timeline, GESTrackElement *obj,
73 GList * layers, GESEdge edge,
76 G_GNUC_INTERNAL gboolean
77 timeline_slide_object (GESTimeline *timeline, GESTrackElement *obj,
78 GList * layers, GESEdge edge, guint64 position);
80 G_GNUC_INTERNAL gboolean
81 timeline_roll_object (GESTimeline *timeline, GESTrackElement *obj,
82 GList * layers, GESEdge edge, guint64 position);
84 G_GNUC_INTERNAL gboolean
85 timeline_trim_object (GESTimeline *timeline, GESTrackElement * object,
86 GList * layers, GESEdge edge, guint64 position);
87 G_GNUC_INTERNAL gboolean
88 ges_timeline_trim_object_simple (GESTimeline * timeline, GESTimelineElement * obj,
89 GList * layers, GESEdge edge, guint64 position, gboolean snapping);
91 G_GNUC_INTERNAL gboolean
92 ges_timeline_move_object_simple (GESTimeline * timeline, GESTimelineElement * object,
93 GList * layers, GESEdge edge, guint64 position);
95 G_GNUC_INTERNAL gboolean
96 timeline_move_object (GESTimeline *timeline, GESTrackElement * object,
97 GList * layers, GESEdge edge, guint64 position);
99 G_GNUC_INTERNAL gboolean
100 timeline_context_to_layer (GESTimeline *timeline, gint offset);
103 timeline_add_group (GESTimeline *timeline,
106 timeline_remove_group (GESTimeline *timeline,
109 timeline_emit_group_added (GESTimeline *timeline,
112 timeline_emit_group_removed (GESTimeline * timeline,
113 GESGroup * group, GPtrArray * array);
117 timeline_add_element (GESTimeline *timeline,
118 GESTimelineElement *element);
121 timeline_remove_element (GESTimeline *timeline,
122 GESTimelineElement *element);
126 timeline_fill_gaps (GESTimeline *timeline);
129 timeline_create_transitions (GESTimeline * timeline, GESTrackElement * track_element);
133 track_resort_and_fill_gaps (GESTrack *track);
137 track_disable_last_gap (GESTrack *track, gboolean disabled);
140 ges_asset_cache_init (void);
143 ges_asset_cache_deinit (void);
146 ges_asset_set_id (GESAsset *asset, const gchar *id);
149 ges_asset_cache_put (GESAsset * asset, GTask *task);
151 G_GNUC_INTERNAL gboolean
152 ges_asset_cache_set_loaded(GType extractable_type, const gchar * id, GError *error);
155 ges_asset_cache_lookup(GType extractable_type, const gchar * id);
158 ges_asset_try_proxy (GESAsset *asset, const gchar *new_id);
160 G_GNUC_INTERNAL gboolean
161 ges_asset_request_id_update (GESAsset *asset, gchar **proposed_id,
163 G_GNUC_INTERNAL gchar *
164 ges_effect_assect_id_get_type_and_bindesc (const char *id,
165 GESTrackType *track_type,
168 G_GNUC_INTERNAL void _ges_uri_asset_cleanup (void);
170 G_GNUC_INTERNAL gboolean _ges_uri_asset_ensure_setup (gpointer uriasset_class);
172 /* GESExtractable internall methods
174 * FIXME Check if that should be public later
176 G_GNUC_INTERNAL GType
177 ges_extractable_type_get_asset_type (GType type);
179 G_GNUC_INTERNAL gchar *
180 ges_extractable_type_check_id (GType type, const gchar *id, GError **error);
182 G_GNUC_INTERNAL GParameter *
183 ges_extractable_type_get_parameters_from_id (GType type, const gchar *id,
185 G_GNUC_INTERNAL GType
186 ges_extractable_get_real_extractable_type_for_id (GType type, const gchar * id);
188 G_GNUC_INTERNAL gboolean
189 ges_extractable_register_metas (GType extractable_type, GESAsset *asset);
191 /************************************************
193 * GESFormatter internal methods *
195 ************************************************/
197 ges_formatter_set_project (GESFormatter *formatter,
198 GESProject *project);
199 G_GNUC_INTERNAL GESProject *
200 ges_formatter_get_project (GESFormatter *formatter);
201 G_GNUC_INTERNAL GESAsset *
202 _find_formatter_asset_for_id (const gchar *id);
206 /************************************************
208 * GESProject internal methods *
210 ************************************************/
212 /* FIXME This should probably become public, but we need to make sure it
213 * is the right API before doing so */
214 G_GNUC_INTERNAL gboolean ges_project_set_loaded (GESProject * project,
215 GESFormatter *formatter);
216 G_GNUC_INTERNAL gchar * ges_project_try_updating_id (GESProject *self,
219 G_GNUC_INTERNAL void ges_project_add_loading_asset (GESProject *project,
220 GType extractable_type,
222 G_GNUC_INTERNAL gchar* ges_uri_asset_try_update_id (GError *error, GESAsset *wrong_asset);
223 /************************************************
225 * GESBaseXmlFormatter internal methods *
227 ************************************************/
229 /* FIXME GESBaseXmlFormatter is all internal for now, the API is not stable
230 * fo now, so do not expose it */
231 G_GNUC_INTERNAL void ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self,
233 const char *asset_id,
236 GstClockTime inpoint,
237 GstClockTime duration,
239 GESTrackType track_types,
240 GstStructure *properties,
241 GstStructure * children_properties,
242 const gchar *metadatas,
244 G_GNUC_INTERNAL void ges_base_xml_formatter_add_asset (GESBaseXmlFormatter * self,
246 GType extractable_type,
247 GstStructure *properties,
248 const gchar *metadatas,
249 const gchar *proxy_id,
251 G_GNUC_INTERNAL void ges_base_xml_formatter_add_layer (GESBaseXmlFormatter *self,
252 GType extractable_type,
254 GstStructure *properties,
255 const gchar *metadatas,
257 G_GNUC_INTERNAL void ges_base_xml_formatter_add_track (GESBaseXmlFormatter *self,
258 GESTrackType track_type,
261 GstStructure *properties,
262 const gchar *metadatas,
264 G_GNUC_INTERNAL void ges_base_xml_formatter_add_encoding_profile(GESBaseXmlFormatter * self,
268 const gchar * description,
270 const gchar * preset,
271 GstStructure * preset_properties,
272 const gchar * preset_name,
275 GstCaps * restriction,
277 gboolean variableframerate,
278 GstStructure * properties,
281 G_GNUC_INTERNAL void ges_base_xml_formatter_add_track_element (GESBaseXmlFormatter *self,
283 const gchar *asset_id,
284 const gchar * track_id,
285 const gchar *timeline_obj_id,
286 GstStructure *children_properties,
287 GstStructure *properties,
288 const gchar *metadatas,
291 G_GNUC_INTERNAL void ges_base_xml_formatter_add_source (GESBaseXmlFormatter *self,
292 const gchar * track_id,
293 GstStructure *children_properties);
295 G_GNUC_INTERNAL void ges_base_xml_formatter_add_group (GESBaseXmlFormatter *self,
297 const gchar *properties,
298 const gchar *metadatas);
300 G_GNUC_INTERNAL void ges_base_xml_formatter_last_group_add_child(GESBaseXmlFormatter *self,
304 G_GNUC_INTERNAL void ges_base_xml_formatter_add_control_binding (GESBaseXmlFormatter * self,
305 const gchar * binding_type,
306 const gchar * source_type,
307 const gchar * property_name,
309 const gchar *track_id,
310 GSList * timed_values);
312 G_GNUC_INTERNAL gboolean set_property_foreach (GQuark field_id,
313 const GValue * value,
316 G_GNUC_INTERNAL GstElement * get_element_for_encoding_profile (GstEncodingProfile *prof,
317 GstElementFactoryListType type);
319 /* Function to initialise GES */
320 G_GNUC_INTERNAL void _init_standard_transition_assets (void);
321 G_GNUC_INTERNAL void _init_formatter_assets (void);
324 G_GNUC_INTERNAL gint element_start_compare (GESTimelineElement * a,
325 GESTimelineElement * b);
326 G_GNUC_INTERNAL gint element_end_compare (GESTimelineElement * a,
327 GESTimelineElement * b);
328 G_GNUC_INTERNAL GstElementFactory *
329 ges_get_compositor_factory (void);
332 ges_base_xml_formatter_set_timeline_properties(GESBaseXmlFormatter * self,
333 GESTimeline *timeline,
334 const gchar *properties,
335 const gchar *metadatas);
337 /****************************************************
339 ****************************************************/
340 G_GNUC_INTERNAL void _ges_container_sort_children (GESContainer *container);
341 G_GNUC_INTERNAL void _ges_container_sort_children_by_end (GESContainer *container);
342 G_GNUC_INTERNAL void _ges_container_set_height (GESContainer * container,
344 G_GNUC_INTERNAL gint _ges_container_get_priority_offset (GESContainer * container,
345 GESTimelineElement *elem);
346 G_GNUC_INTERNAL void _ges_container_set_priority_offset (GESContainer * container,
347 GESTimelineElement *elem,
348 gint32 priority_offset);
351 /****************************************************
353 ****************************************************/
354 G_GNUC_INTERNAL void ges_clip_set_layer (GESClip *clip, GESLayer *layer);
355 G_GNUC_INTERNAL gboolean ges_clip_is_moving_from_layer (GESClip *clip);
356 G_GNUC_INTERNAL guint32 ges_clip_get_layer_priority (GESClip *clip);
357 G_GNUC_INTERNAL void ges_clip_set_moving_from_layer (GESClip *clip, gboolean is_moving);
358 G_GNUC_INTERNAL GESTrackElement* ges_clip_create_track_element (GESClip *clip, GESTrackType type);
359 G_GNUC_INTERNAL GList* ges_clip_create_track_elements (GESClip *clip, GESTrackType type);
361 /****************************************************
363 ****************************************************/
364 G_GNUC_INTERNAL gboolean ges_layer_resync_priorities (GESLayer * layer);
365 G_GNUC_INTERNAL void layer_set_priority (GESLayer * layer, guint priority, gboolean emit);
367 /****************************************************
369 ****************************************************/
370 #define NLE_OBJECT_TRACK_ELEMENT_QUARK (g_quark_from_string ("nle_object_track_element_quark"))
371 G_GNUC_INTERNAL gboolean ges_track_element_set_track (GESTrackElement * object, GESTrack * track);
372 G_GNUC_INTERNAL guint32 _ges_track_element_get_layer_priority (GESTrackElement * element);
373 G_GNUC_INTERNAL void ges_track_element_copy_properties (GESTimelineElement * element,
374 GESTimelineElement * elementcopy);
376 G_GNUC_INTERNAL void ges_track_element_copy_bindings (GESTrackElement *element,
377 GESTrackElement *new_element,
380 G_GNUC_INTERNAL GstElement *ges_source_create_topbin (const gchar * bin_name, GstElement * sub_element, ...);
381 G_GNUC_INTERNAL void ges_track_set_caps (GESTrack *track,
382 const GstCaps *caps);
383 G_GNUC_INTERNAL GstElement * ges_track_get_composition (GESTrack *track);
386 /*********************************************
387 * GESTrackElement subclasses contructores *
388 ********************************************/
389 G_GNUC_INTERNAL GESAudioTestSource * ges_audio_test_source_new (void);
390 G_GNUC_INTERNAL GESAudioUriSource * ges_audio_uri_source_new (gchar *uri);
391 G_GNUC_INTERNAL GESVideoUriSource * ges_video_uri_source_new (gchar *uri);
392 G_GNUC_INTERNAL GESImageSource * ges_image_source_new (gchar *uri);
393 G_GNUC_INTERNAL GESTitleSource * ges_title_source_new (void);
394 G_GNUC_INTERNAL GESVideoTestSource * ges_video_test_source_new (void);
396 /****************************************************
397 * GESTimelineElement *
398 ****************************************************/
399 G_GNUC_INTERNAL gdouble ges_timeline_element_get_media_duration_factor(GESTimelineElement *self);
400 G_GNUC_INTERNAL GESTimelineElement * ges_timeline_element_get_copied_from (GESTimelineElement *self);
402 /******************************
403 * GESMultiFile internal API *
404 ******************************/
405 typedef struct GESMultiFileURI
412 G_GNUC_INTERNAL GESMultiFileURI * ges_multi_file_uri_new (const gchar * uri);
414 /************************
415 * Our property masks *
416 ************************/
417 #define GES_PARAM_NO_SERIALIZATION (1 << (G_PARAM_USER_SHIFT + 1))
419 /********************
421 ********************/
423 G_GNUC_INTERNAL gboolean ges_nle_composition_add_object (GstElement *comp, GstElement *object);
424 G_GNUC_INTERNAL gboolean ges_nle_composition_remove_object (GstElement *comp, GstElement *object);
425 G_GNUC_INTERNAL gboolean ges_nle_object_commit (GstElement * nlesource, gboolean recurse);
429 #endif /* __GES_INTERNAL_H__ */