tools: Fix printing commands help
[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 G_BEGIN_DECLS
35
36 GST_DEBUG_CATEGORY_EXTERN (_ges_debug);
37 #define GST_CAT_DEFAULT _ges_debug
38
39 /*  The first 2 NLE priorities are used for:
40  *    0- The Mixing element
41  *    1- The Gaps
42  */
43 #define MIN_NLE_PRIO 2
44 #define LAYER_HEIGHT 1000
45
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
56
57 #define GES_TIMELINE_ELEMENT_FORMAT \
58     "s:%p" \
59     " start: %" GST_TIME_FORMAT \
60     " inpoint: %" GST_TIME_FORMAT \
61     " duration: %" GST_TIME_FORMAT
62
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))
68
69 G_GNUC_INTERNAL gboolean
70 timeline_ripple_object         (GESTimeline *timeline, GESTrackElement *obj,
71                                     GList * layers, GESEdge edge,
72                                     guint64 position);
73
74 G_GNUC_INTERNAL gboolean
75 timeline_slide_object          (GESTimeline *timeline, GESTrackElement *obj,
76                                     GList * layers, GESEdge edge, guint64 position);
77
78 G_GNUC_INTERNAL gboolean
79 timeline_roll_object           (GESTimeline *timeline, GESTrackElement *obj,
80                                     GList * layers, GESEdge edge, guint64 position);
81
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);
88
89 G_GNUC_INTERNAL gboolean
90 ges_timeline_move_object_simple (GESTimeline * timeline, GESTimelineElement * object,
91                                  GList * layers, GESEdge edge, guint64 position);
92
93 G_GNUC_INTERNAL gboolean
94 timeline_move_object           (GESTimeline *timeline, GESTrackElement * object,
95                                     GList * layers, GESEdge edge, guint64 position);
96
97 G_GNUC_INTERNAL gboolean
98 timeline_context_to_layer      (GESTimeline *timeline, gint offset);
99
100 G_GNUC_INTERNAL void
101 timeline_add_group             (GESTimeline *timeline,
102                                 GESGroup *group);
103 G_GNUC_INTERNAL
104 void
105 timeline_remove_group          (GESTimeline *timeline,
106                                 GESGroup *group);
107
108 G_GNUC_INTERNAL
109 gboolean
110 timeline_add_element           (GESTimeline *timeline,
111                                 GESTimelineElement *element);
112 G_GNUC_INTERNAL
113 gboolean
114 timeline_remove_element       (GESTimeline *timeline,
115                                GESTimelineElement *element);
116
117 G_GNUC_INTERNAL
118 void
119 timeline_fill_gaps            (GESTimeline *timeline);
120
121 G_GNUC_INTERNAL GList *
122 timeline_get_groups           (GESTimeline * timeline);
123
124 G_GNUC_INTERNAL void
125 timeline_emit_group_removed  (GESTimeline * timeline,
126                                GESGroup * group, GPtrArray * array);
127 G_GNUC_INTERNAL
128 void
129 track_resort_and_fill_gaps    (GESTrack *track);
130
131 G_GNUC_INTERNAL
132 void
133 track_disable_last_gap        (GESTrack *track, gboolean disabled);
134
135 G_GNUC_INTERNAL void
136 ges_asset_cache_init (void);
137
138 G_GNUC_INTERNAL void
139 ges_asset_set_id (GESAsset *asset, const gchar *id);
140
141 G_GNUC_INTERNAL void
142 ges_asset_cache_put (GESAsset * asset, GTask *task);
143
144 G_GNUC_INTERNAL gboolean
145 ges_asset_cache_set_loaded(GType extractable_type, const gchar * id, GError *error);
146
147 GESAsset*
148 ges_asset_cache_lookup(GType extractable_type, const gchar * id);
149
150 gboolean
151 ges_asset_try_proxy (GESAsset *asset, const gchar *new_id);
152
153 G_GNUC_INTERNAL gboolean
154 ges_asset_request_id_update (GESAsset *asset, gchar **proposed_id,
155     GError *error);
156 G_GNUC_INTERNAL gchar *
157 ges_effect_assect_id_get_type_and_bindesc (const char    *id,
158                                            GESTrackType  *track_type,
159                                            GError       **error);
160
161 /* GESExtractable internall methods
162  *
163  * FIXME Check if that should be public later
164  */
165 G_GNUC_INTERNAL GType
166 ges_extractable_type_get_asset_type              (GType type);
167
168 G_GNUC_INTERNAL gchar *
169 ges_extractable_type_check_id                    (GType type, const gchar *id, GError **error);
170
171 G_GNUC_INTERNAL GParameter *
172 ges_extractable_type_get_parameters_from_id      (GType type, const gchar *id,
173                                                   guint *n_params);
174 G_GNUC_INTERNAL GType
175 ges_extractable_get_real_extractable_type_for_id (GType type, const gchar * id);
176
177 G_GNUC_INTERNAL gboolean
178 ges_extractable_register_metas                   (GType extractable_type, GESAsset *asset);
179
180 /************************************************
181  *                                              *
182  *        GESFormatter internal methods         *
183  *                                              *
184  ************************************************/
185 G_GNUC_INTERNAL void
186 ges_formatter_set_project                        (GESFormatter *formatter,
187                                                   GESProject *project);
188 G_GNUC_INTERNAL GESProject *
189 ges_formatter_get_project                        (GESFormatter *formatter);
190 G_GNUC_INTERNAL  GESAsset *
191 _find_formatter_asset_for_id                     (const gchar *id);
192
193
194
195 /************************************************
196  *                                              *
197  *        GESProject internal methods           *
198  *                                              *
199  ************************************************/
200
201 /* FIXME This should probably become public, but we need to make sure it
202  * is the right API before doing so */
203 G_GNUC_INTERNAL  gboolean ges_project_set_loaded                  (GESProject * project,
204                                                                    GESFormatter *formatter);
205 G_GNUC_INTERNAL  gchar * ges_project_try_updating_id              (GESProject *self,
206                                                                    GESAsset *asset,
207                                                                    GError *error);
208 G_GNUC_INTERNAL  void ges_project_add_loading_asset               (GESProject *project,
209                                                                    GType extractable_type,
210                                                                    const gchar *id);
211 /************************************************
212  *                                              *
213  *   GESBaseXmlFormatter internal methods       *
214  *                                              *
215  ************************************************/
216
217 /* FIXME GESBaseXmlFormatter is all internal for now, the API is not stable
218  * fo now, so do not expose it */
219 G_GNUC_INTERNAL void ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self,
220                                                                  const gchar *id,
221                                                                  const char *asset_id,
222                                                                  GType type,
223                                                                  GstClockTime start,
224                                                                  GstClockTime inpoint,
225                                                                  GstClockTime duration,
226                                                                  guint layer_prio,
227                                                                  GESTrackType track_types,
228                                                                  GstStructure *properties,
229                                                                  const gchar *metadatas,
230                                                                  GError **error);
231 G_GNUC_INTERNAL void ges_base_xml_formatter_add_asset        (GESBaseXmlFormatter * self,
232                                                                  const gchar * id,
233                                                                  GType extractable_type,
234                                                                  GstStructure *properties,
235                                                                  const gchar *metadatas,
236                                                                  const gchar *proxy_id,
237                                                                  GError **error);
238 G_GNUC_INTERNAL void ges_base_xml_formatter_add_layer           (GESBaseXmlFormatter *self,
239                                                                  GType extractable_type,
240                                                                  guint priority,
241                                                                  GstStructure *properties,
242                                                                  const gchar *metadatas,
243                                                                  GError **error);
244 G_GNUC_INTERNAL void ges_base_xml_formatter_add_track           (GESBaseXmlFormatter *self,
245                                                                  GESTrackType track_type,
246                                                                  GstCaps *caps,
247                                                                  const gchar *id,
248                                                                  GstStructure *properties,
249                                                                  const gchar *metadatas,
250                                                                  GError **error);
251 G_GNUC_INTERNAL void ges_base_xml_formatter_add_encoding_profile(GESBaseXmlFormatter * self,
252                                                                  const gchar *type,
253                                                                  const gchar *parent,
254                                                                  const gchar * name,
255                                                                  const gchar * description,
256                                                                  GstCaps * format,
257                                                                  const gchar * preset,
258                                                                  const gchar * preset_name,
259                                                                  guint id,
260                                                                  guint presence,
261                                                                  GstCaps * restriction,
262                                                                  guint pass,
263                                                                  gboolean variableframerate,
264                                                                  GstStructure * properties,
265                                                                  gboolean enabled,
266                                                                  GError ** error);
267 G_GNUC_INTERNAL void ges_base_xml_formatter_add_track_element   (GESBaseXmlFormatter *self,
268                                                                  GType effect_type,
269                                                                  const gchar *asset_id,
270                                                                  const gchar * track_id,
271                                                                  const gchar *timeline_obj_id,
272                                                                  GstStructure *children_properties,
273                                                                  GstStructure *properties,
274                                                                  const gchar *metadatas,
275                                                                  GError **error);
276
277 G_GNUC_INTERNAL void ges_base_xml_formatter_add_source          (GESBaseXmlFormatter *self,
278                                                                  const gchar * track_id,
279                                                                  GstStructure *children_properties);
280
281 G_GNUC_INTERNAL void ges_base_xml_formatter_add_group           (GESBaseXmlFormatter *self,
282                                                                  const gchar *name,
283                                                                  const gchar *properties);
284
285 G_GNUC_INTERNAL void ges_base_xml_formatter_last_group_add_child(GESBaseXmlFormatter *self,
286                                                                  const gchar * id,
287                                                                  const gchar * name);
288
289 G_GNUC_INTERNAL void ges_base_xml_formatter_add_control_binding (GESBaseXmlFormatter * self,
290                                                                   const gchar * binding_type,
291                                                                   const gchar * source_type,
292                                                                   const gchar * property_name,
293                                                                   gint mode,
294                                                                   const gchar *track_id,
295                                                                   GSList * timed_values);
296
297 G_GNUC_INTERNAL gboolean set_property_foreach                   (GQuark field_id,
298                                                                  const GValue * value,
299                                                                  GObject * object);;
300
301 /* Function to initialise GES */
302 G_GNUC_INTERNAL void _init_standard_transition_assets        (void);
303 G_GNUC_INTERNAL void _init_formatter_assets                  (void);
304
305 /* Utilities */
306 G_GNUC_INTERNAL gint element_start_compare                (GESTimelineElement * a,
307                                                            GESTimelineElement * b);
308 G_GNUC_INTERNAL gint element_end_compare                  (GESTimelineElement * a,
309                                                            GESTimelineElement * b);
310 G_GNUC_INTERNAL GstElementFactory *
311 ges_get_compositor_factory                                (void);
312
313 G_GNUC_INTERNAL void
314 ges_base_xml_formatter_set_timeline_properties(GESBaseXmlFormatter * self,
315                                                GESTimeline *timeline,
316                                                const gchar *properties,
317                                                const gchar *metadatas);
318
319 /****************************************************
320  *              GESContainer                        *
321  ****************************************************/
322 G_GNUC_INTERNAL void _ges_container_sort_children         (GESContainer *container);
323 G_GNUC_INTERNAL void _ges_container_sort_children_by_end  (GESContainer *container);
324
325 /****************************************************
326  *                  GESClip                         *
327  ****************************************************/
328 G_GNUC_INTERNAL void              ges_clip_set_layer              (GESClip *clip, GESLayer  *layer);
329 G_GNUC_INTERNAL gboolean          ges_clip_is_moving_from_layer   (GESClip *clip);
330 G_GNUC_INTERNAL guint32           ges_clip_get_layer_priority     (GESClip *clip);
331 G_GNUC_INTERNAL void              ges_clip_set_moving_from_layer  (GESClip *clip, gboolean is_moving);
332 G_GNUC_INTERNAL GESTrackElement*  ges_clip_create_track_element   (GESClip *clip, GESTrackType type);
333 G_GNUC_INTERNAL GList*            ges_clip_create_track_elements  (GESClip *clip, GESTrackType type);
334
335
336 /****************************************************
337  *              GESTrackElement                     *
338  ****************************************************/
339 #define         NLE_OBJECT_TRACK_ELEMENT_QUARK                  (g_quark_from_string ("nle_object_track_element_quark"))
340 G_GNUC_INTERNAL gboolean  ges_track_element_set_track           (GESTrackElement * object, GESTrack * track);
341 G_GNUC_INTERNAL guint32   _ges_track_element_get_layer_priority (GESTrackElement * element);
342 G_GNUC_INTERNAL void ges_track_element_copy_properties          (GESTimelineElement * element,
343                                                                  GESTimelineElement * elementcopy);
344
345 G_GNUC_INTERNAL void ges_track_element_copy_bindings (GESTrackElement *element,
346                                                        GESTrackElement *new_element,
347                                                        guint64 position);
348
349 G_GNUC_INTERNAL GstElement *ges_source_create_topbin (const gchar * bin_name, GstElement * sub_element, ...);
350 G_GNUC_INTERNAL void ges_track_set_caps                (GESTrack *track,
351                                                         const GstCaps *caps);
352 G_GNUC_INTERNAL GstElement * ges_track_get_composition (GESTrack *track);
353
354
355 /*********************************************
356  *  GESTrackElement subclasses contructores  *
357  ********************************************/
358 G_GNUC_INTERNAL GESAudioTestSource * ges_audio_test_source_new (void);
359 G_GNUC_INTERNAL GESAudioUriSource  * ges_audio_uri_source_new  (gchar *uri);
360 G_GNUC_INTERNAL GESVideoUriSource  * ges_video_uri_source_new  (gchar *uri);
361 G_GNUC_INTERNAL GESImageSource     * ges_image_source_new      (gchar *uri);
362 G_GNUC_INTERNAL GESTitleSource     * ges_title_source_new      (void);
363 G_GNUC_INTERNAL GESVideoTestSource * ges_video_test_source_new (void);
364
365 /****************************************************
366  *              GESTimelineElement                  *
367  ****************************************************/
368 G_GNUC_INTERNAL gdouble ges_timeline_element_get_media_duration_factor(GESTimelineElement *self);
369
370 /******************************
371  *  GESMultiFile internal API *
372  ******************************/
373 typedef struct GESMultiFileURI
374 {
375   gchar *location;
376   gint start;
377   gint end;
378 } GESMultiFileURI;
379
380 G_GNUC_INTERNAL GESMultiFileURI * ges_multi_file_uri_new (const gchar * uri);
381
382 /************************
383  * Our property masks   *
384  ************************/
385 #define GES_PARAM_NO_SERIALIZATION (1 << (G_PARAM_USER_SHIFT + 1))
386
387 /********************
388  *  Gnonlin helpers *
389  ********************/
390
391 G_GNUC_INTERNAL gboolean ges_nle_composition_add_object (GstElement *comp, GstElement *object);
392 G_GNUC_INTERNAL gboolean ges_nle_composition_remove_object (GstElement *comp, GstElement *object);
393 G_GNUC_INTERNAL gboolean ges_nle_object_commit (GstElement * nlesource, gboolean recurse);
394
395 G_END_DECLS
396
397 #endif /* __GES_INTERNAL_H__ */