ges: Keep backward compatibility for relocated assets CLI
[platform/upstream/gst-editing-services.git] / ges / ges-internal.h
1 /* GStreamer Editing Services
2  * Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
3  *               2009 Nokia Corporation
4  *
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.
9  *
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.
14  *
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.
19  */
20
21 #ifndef __GES_INTERNAL_H__
22 #define __GES_INTERNAL_H__
23
24 #include <gst/gst.h>
25 #include <gio/gio.h>
26
27 #include "ges-timeline.h"
28 #include "ges-track-element.h"
29 #include "ges-timeline-element.h"
30
31 #include "ges-asset.h"
32 #include "ges-base-xml-formatter.h"
33
34 GST_DEBUG_CATEGORY_EXTERN (_ges_debug);
35 #define GST_CAT_DEFAULT _ges_debug
36
37 /*  The first 2 NLE priorities are used for:
38  *    0- The Mixing element
39  *    1- The Gaps
40  */
41 #define MIN_NLE_PRIO 2
42 #define LAYER_HEIGHT 1000
43
44 #define _START(obj) GES_TIMELINE_ELEMENT_START (obj)
45 #define _INPOINT(obj) GES_TIMELINE_ELEMENT_INPOINT (obj)
46 #define _DURATION(obj) GES_TIMELINE_ELEMENT_DURATION (obj)
47 #define _MAXDURATION(obj) GES_TIMELINE_ELEMENT_MAX_DURATION (obj)
48 #define _PRIORITY(obj) GES_TIMELINE_ELEMENT_PRIORITY (obj)
49 #define _END(obj) (_START (obj) + _DURATION (obj))
50 #define _set_start0 ges_timeline_element_set_start
51 #define _set_inpoint0 ges_timeline_element_set_inpoint
52 #define _set_duration0 ges_timeline_element_set_duration
53 #define _set_priority0 ges_timeline_element_set_priority
54
55 G_GNUC_INTERNAL gboolean
56 timeline_ripple_object         (GESTimeline *timeline, GESTrackElement *obj,
57                                     GList * layers, GESEdge edge,
58                                     guint64 position);
59
60 G_GNUC_INTERNAL gboolean
61 timeline_slide_object          (GESTimeline *timeline, GESTrackElement *obj,
62                                     GList * layers, GESEdge edge, guint64 position);
63
64 G_GNUC_INTERNAL gboolean
65 timeline_roll_object           (GESTimeline *timeline, GESTrackElement *obj,
66                                     GList * layers, GESEdge edge, guint64 position);
67
68 G_GNUC_INTERNAL gboolean
69 timeline_trim_object           (GESTimeline *timeline, GESTrackElement * object,
70                                     GList * layers, GESEdge edge, guint64 position);
71 G_GNUC_INTERNAL gboolean
72 ges_timeline_trim_object_simple (GESTimeline * timeline, GESTimelineElement * obj,
73                                  GList * layers, GESEdge edge, guint64 position, gboolean snapping);
74
75 G_GNUC_INTERNAL gboolean
76 ges_timeline_move_object_simple (GESTimeline * timeline, GESTimelineElement * object,
77                                  GList * layers, GESEdge edge, guint64 position);
78
79 G_GNUC_INTERNAL gboolean
80 timeline_move_object           (GESTimeline *timeline, GESTrackElement * object,
81                                     GList * layers, GESEdge edge, guint64 position);
82
83 G_GNUC_INTERNAL gboolean
84 timeline_context_to_layer      (GESTimeline *timeline, gint offset);
85
86 G_GNUC_INTERNAL void
87 timeline_add_group             (GESTimeline *timeline,
88                                 GESGroup *group);
89 G_GNUC_INTERNAL
90 void
91 timeline_remove_group          (GESTimeline *timeline,
92                                 GESGroup *group);
93
94 G_GNUC_INTERNAL
95 gboolean
96 timeline_add_element           (GESTimeline *timeline,
97                                 GESTimelineElement *element);
98 G_GNUC_INTERNAL
99 gboolean
100 timeline_remove_element       (GESTimeline *timeline,
101                                GESTimelineElement *element);
102
103 G_GNUC_INTERNAL
104 void
105 timeline_fill_gaps            (GESTimeline *timeline);
106
107 G_GNUC_INTERNAL GList *
108 timeline_get_groups           (GESTimeline * timeline);
109
110 G_GNUC_INTERNAL
111 void
112 track_resort_and_fill_gaps    (GESTrack *track);
113
114 G_GNUC_INTERNAL void
115 ges_asset_cache_init (void);
116
117 G_GNUC_INTERNAL void
118 ges_asset_set_id (GESAsset *asset, const gchar *id);
119
120 G_GNUC_INTERNAL void
121 ges_asset_cache_put (GESAsset * asset, GSimpleAsyncResult *res);
122
123 G_GNUC_INTERNAL gboolean
124 ges_asset_cache_set_loaded(GType extractable_type, const gchar * id, GError *error);
125
126 GESAsset*
127 ges_asset_cache_lookup(GType extractable_type, const gchar * id);
128
129 gboolean
130 ges_asset_set_proxy (GESAsset *asset, const gchar *new_id);
131
132 G_GNUC_INTERNAL gboolean
133 ges_asset_request_id_update (GESAsset *asset, gchar **proposed_id,
134     GError *error);
135
136 /* GESExtractable internall methods
137  *
138  * FIXME Check if that should be public later
139  */
140 G_GNUC_INTERNAL GType
141 ges_extractable_type_get_asset_type              (GType type);
142
143 G_GNUC_INTERNAL gchar *
144 ges_extractable_type_check_id                    (GType type, const gchar *id, GError **error);
145
146 G_GNUC_INTERNAL GParameter *
147 ges_extractable_type_get_parameters_from_id      (GType type, const gchar *id,
148                                                   guint *n_params);
149 G_GNUC_INTERNAL GType
150 ges_extractable_get_real_extractable_type_for_id (GType type, const gchar * id);
151
152 G_GNUC_INTERNAL gboolean
153 ges_extractable_register_metas                   (GType extractable_type, GESAsset *asset);
154
155 /************************************************
156  *                                              *
157  *        GESFormatter internal methods         *
158  *                                              *
159  ************************************************/
160 G_GNUC_INTERNAL void
161 ges_formatter_set_project                        (GESFormatter *formatter,
162                                                   GESProject *project);
163 G_GNUC_INTERNAL GESProject *
164 ges_formatter_get_project                        (GESFormatter *formatter);
165 G_GNUC_INTERNAL  GESAsset *
166 _find_formatter_asset_for_uri                    (const gchar *uri);
167
168
169
170 /************************************************
171  *                                              *
172  *        GESProject internal methods           *
173  *                                              *
174  ************************************************/
175
176 /* FIXME This should probably become public, but we need to make sure it
177  * is the right API before doing so */
178 G_GNUC_INTERNAL  gboolean ges_project_set_loaded                  (GESProject * project,
179                                                                    GESFormatter *formatter);
180 G_GNUC_INTERNAL  gchar * ges_project_try_updating_id              (GESProject *self,
181                                                                    GESAsset *asset,
182                                                                    GError *error);
183 G_GNUC_INTERNAL  void ges_project_add_loading_asset               (GESProject *project,
184                                                                    GType extractable_type,
185                                                                    const gchar *id);
186 /************************************************
187  *                                              *
188  *   GESBaseXmlFormatter internal methods       *
189  *                                              *
190  ************************************************/
191
192 /* FIXME GESBaseXmlFormatter is all internal for now, the API is not stable
193  * fo now, so do not expose it */
194 G_GNUC_INTERNAL void ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self,
195                                                                  const gchar *id,
196                                                                  const char *asset_id,
197                                                                  GType type,
198                                                                  GstClockTime start,
199                                                                  GstClockTime inpoint,
200                                                                  GstClockTime duration,
201                                                                  guint layer_prio,
202                                                                  GESTrackType track_types,
203                                                                  GstStructure *properties,
204                                                                  const gchar *metadatas,
205                                                                  GError **error);
206 G_GNUC_INTERNAL void ges_base_xml_formatter_add_asset        (GESBaseXmlFormatter * self,
207                                                                  const gchar * id,
208                                                                  GType extractable_type,
209                                                                  GstStructure *properties,
210                                                                  const gchar *metadatas,
211                                                                  GError **error);
212 G_GNUC_INTERNAL void ges_base_xml_formatter_add_layer           (GESBaseXmlFormatter *self,
213                                                                  GType extractable_type,
214                                                                  guint priority,
215                                                                  GstStructure *properties,
216                                                                  const gchar *metadatas,
217                                                                  GError **error);
218 G_GNUC_INTERNAL void ges_base_xml_formatter_add_track           (GESBaseXmlFormatter *self,
219                                                                  GESTrackType track_type,
220                                                                  GstCaps *caps,
221                                                                  const gchar *id,
222                                                                  GstStructure *properties,
223                                                                  const gchar *metadatas,
224                                                                  GError **error);
225 G_GNUC_INTERNAL void ges_base_xml_formatter_add_encoding_profile(GESBaseXmlFormatter * self,
226                                                                  const gchar *type,
227                                                                  const gchar *parent,
228                                                                  const gchar * name,
229                                                                  const gchar * description,
230                                                                  GstCaps * format,
231                                                                  const gchar * preset,
232                                                                  const gchar * preset_name,
233                                                                  guint id,
234                                                                  guint presence,
235                                                                  GstCaps * restriction,
236                                                                  guint pass,
237                                                                  gboolean variableframerate,
238                                                                  GstStructure * properties,
239                                                                  GError ** error);
240 G_GNUC_INTERNAL void ges_base_xml_formatter_add_track_element   (GESBaseXmlFormatter *self,
241                                                                  GType effect_type,
242                                                                  const gchar *asset_id,
243                                                                  const gchar * track_id,
244                                                                  const gchar *timeline_obj_id,
245                                                                  GstStructure *children_properties,
246                                                                  GstStructure *properties,
247                                                                  const gchar *metadatas,
248                                                                  GError **error);
249
250 G_GNUC_INTERNAL void ges_base_xml_formatter_add_source          (GESBaseXmlFormatter *self,
251                                                                  const gchar * track_id,
252                                                                  GstStructure *children_properties);
253
254 G_GNUC_INTERNAL void ges_base_xml_formatter_add_group           (GESBaseXmlFormatter *self,
255                                                                  const gchar *name,
256                                                                  const gchar *properties);
257
258 G_GNUC_INTERNAL void ges_base_xml_formatter_last_group_add_child(GESBaseXmlFormatter *self,
259                                                                  const gchar * id,
260                                                                  const gchar * name);
261
262 G_GNUC_INTERNAL void ges_base_xml_formatter_add_control_binding (GESBaseXmlFormatter * self,
263                                                                   const gchar * binding_type,
264                                                                   const gchar * source_type,
265                                                                   const gchar * property_name,
266                                                                   gint mode,
267                                                                   const gchar *track_id,
268                                                                   GSList * timed_values);
269
270 G_GNUC_INTERNAL void set_property_foreach                       (GQuark field_id,
271                                                                  const GValue * value,
272                                                                  GObject * object);;
273
274 /* Function to initialise GES */
275 G_GNUC_INTERNAL void _init_standard_transition_assets        (void);
276 G_GNUC_INTERNAL void _init_formatter_assets                  (void);
277
278 /* Utilities */
279 G_GNUC_INTERNAL gint element_start_compare                (GESTimelineElement * a,
280                                                            GESTimelineElement * b);
281 G_GNUC_INTERNAL gint element_end_compare                  (GESTimelineElement * a,
282                                                            GESTimelineElement * b);
283 G_GNUC_INTERNAL GstElementFactory *
284 ges_get_compositor_factory                                (void);
285
286 void
287 ges_base_xml_formatter_set_timeline_properties(GESBaseXmlFormatter * self,
288                                                GESTimeline *timeline,
289                                                const gchar *properties,
290                                                const gchar *metadatas);
291
292 /****************************************************
293  *              GESContainer                        *
294  ****************************************************/
295 G_GNUC_INTERNAL void _ges_container_sort_children         (GESContainer *container);
296 G_GNUC_INTERNAL void _ges_container_sort_children_by_end  (GESContainer *container);
297
298 /****************************************************
299  *                  GESClip                         *
300  ****************************************************/
301 void              ges_clip_set_layer              (GESClip *clip, GESLayer  *layer);
302 gboolean          ges_clip_is_moving_from_layer   (GESClip *clip);
303 guint32           ges_clip_get_layer_priority     (GESClip *clip);
304 void              ges_clip_set_moving_from_layer  (GESClip *clip, gboolean is_moving);
305 GESTrackElement*  ges_clip_create_track_element   (GESClip *clip, GESTrackType type);
306 GList*            ges_clip_create_track_elements  (GESClip *clip, GESTrackType type);
307
308
309 /****************************************************
310  *              GESTrackElement                     *
311  ****************************************************/
312 #define         NLE_OBJECT_TRACK_ELEMENT_QUARK                  (g_quark_from_string ("nle_object_track_element_quark"))
313 G_GNUC_INTERNAL gboolean  ges_track_element_set_track           (GESTrackElement * object, GESTrack * track);
314 G_GNUC_INTERNAL guint32   _ges_track_element_get_layer_priority (GESTrackElement * element);
315 G_GNUC_INTERNAL void ges_track_element_copy_properties          (GESTimelineElement * element,
316                                                                  GESTimelineElement * elementcopy);
317
318 G_GNUC_INTERNAL void ges_track_element_split_bindings (GESTrackElement *element,
319                                                        GESTrackElement *new_element,
320                                                        guint64 position);
321
322 G_GNUC_INTERNAL GstElement *ges_source_create_topbin (const gchar * bin_name, GstElement * sub_element, ...);
323
324 G_GNUC_INTERNAL void ges_track_set_caps (GESTrack *track, const GstCaps *caps);
325
326
327 /*********************************************
328  *  GESTrackElement subclasses contructores  *
329  ********************************************/
330 G_GNUC_INTERNAL GESAudioTestSource * ges_audio_test_source_new (void);
331 G_GNUC_INTERNAL GESAudioUriSource  * ges_audio_uri_source_new  (gchar *uri);
332 G_GNUC_INTERNAL GESVideoUriSource  * ges_video_uri_source_new  (gchar *uri);
333 G_GNUC_INTERNAL GESImageSource     * ges_image_source_new      (gchar *uri);
334 G_GNUC_INTERNAL GESTitleSource     * ges_title_source_new      (void);
335 G_GNUC_INTERNAL GESVideoTestSource * ges_video_test_source_new (void);
336
337 /******************************
338  *  GESMultiFile internal API *
339  ******************************/
340 typedef struct GESMultiFileURI
341 {
342   gchar *location;
343   gint start;
344   gint end;
345 } GESMultiFileURI;
346
347 G_GNUC_INTERNAL GESMultiFileURI * ges_multi_file_uri_new (const gchar * uri);
348
349 /************************
350  * Our property masks   *
351  ************************/
352 #define GES_PARAM_NO_SERIALIZATION (1 << (G_PARAM_USER_SHIFT + 1))
353
354 /********************
355  *  Gnonlin helpers *
356  ********************/
357
358 G_GNUC_INTERNAL gboolean nle_composition_add_object (GstElement *comp, GstElement *object);
359 G_GNUC_INTERNAL gboolean nle_composition_remove_object (GstElement *comp, GstElement *object);
360
361 #endif /* __GES_INTERNAL_H__ */