848c288d2d0f5e6a19ea8cd2a30137260cb3e709
[platform/upstream/gst-editing-services.git] / ges / ges-clip.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_CLIP
22 #define _GES_CLIP
23
24 #include <glib-object.h>
25 #include <gst/gst.h>
26 #include <ges/ges-timeline-element.h>
27 #include <ges/ges-container.h>
28 #include <ges/ges-types.h>
29 #include <ges/ges-track.h>
30
31 G_BEGIN_DECLS
32
33 #define GES_TYPE_CLIP             ges_clip_get_type()
34 #define GES_CLIP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_CLIP, GESClip))
35 #define GES_CLIP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_CLIP, GESClipClass))
36 #define GES_IS_CLIP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_CLIP))
37 #define GES_IS_CLIP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_CLIP))
38 #define GES_CLIP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_CLIP, GESClipClass))
39
40 typedef struct _GESClipPrivate GESClipPrivate;
41
42 /**
43  * GESFillTrackElementFunc:
44  * @clip: the #GESClip controlling the track elements
45  * @track_element: the #GESTrackElement
46  * @nleobj: the GNonLin object that needs to be filled.
47  *
48  * A function that will be called when the GNonLin object of a corresponding
49  * track element needs to be filled.
50  *
51  * The implementer of this function shall add the proper #GstElement to @nleobj
52  * using gst_bin_add().
53  *
54  * Returns: TRUE if the implementer succesfully filled the @nleobj, else #FALSE.
55  */
56 typedef gboolean (*GESFillTrackElementFunc) (GESClip *clip, GESTrackElement *track_element,
57                                              GstElement *nleobj);
58
59 /**
60  * GESCreateTrackElementFunc:
61  * @clip: a #GESClip
62  * @type: a #GESTrackType
63  *
64  * Creates the 'primary' track element for this @clip.
65  *
66  * Subclasses should implement this method if they only provide a
67  * single #GESTrackElement per track.
68  *
69  * If the subclass needs to create more than one #GESTrackElement for a
70  * given track, then it should implement the 'create_track_elements'
71  * method instead.
72  *
73  * The implementer of this function shall return the proper #GESTrackElement
74  * that should be controlled by @clip for the given @track.
75  *
76  * The returned #GESTrackElement will be automatically added to the list
77  * of objects controlled by the #GESClip.
78  *
79  * Returns: the #GESTrackElement to be used, or %NULL if it can't provide one
80  * for the given @track.
81  */
82 typedef GESTrackElement *(*GESCreateTrackElementFunc) (GESClip * clip, GESTrackType type);
83
84 /**
85  * GESCreateTrackElementsFunc:
86  * @clip: a #GESClip
87  * @type: a #GESTrackType
88  *
89  * Create all track elements this clip handles for this type of track.
90  *
91  * Subclasses should implement this method if they potentially need to
92  * return more than one #GESTrackElement(s) for a given #GESTrack.
93  *
94  * Returns: %TRUE on success %FALSE on failure.
95  */
96
97 typedef GList * (*GESCreateTrackElementsFunc) (GESClip * clip, GESTrackType type);
98
99 /**
100  * GESClip:
101  *
102  * The #GESClip base class.
103  */
104 struct _GESClip
105 {
106   GESContainer    parent;
107
108   /*< private >*/
109   GESClipPrivate *priv;
110
111   /* Padding for API extension */
112   gpointer       _ges_reserved[GES_PADDING_LARGE];
113 };
114
115 /**
116  * GESClipClass:
117  * @create_track_element: method to create a single #GESTrackElement for a given #GESTrack.
118  * @create_track_elements: method to create multiple #GESTrackElements for a
119  * #GESTrack.
120  *
121  * Subclasses can override the @create_track_element.
122  */
123 struct _GESClipClass
124 {
125   /*< private > */
126   GESContainerClass          parent_class;
127
128   /*< public > */
129   GESCreateTrackElementFunc  create_track_element;
130   GESCreateTrackElementsFunc create_track_elements;
131
132   /*< private >*/
133   /* Padding for API extension */
134   gpointer _ges_reserved[GES_PADDING_LARGE];
135 };
136
137 /****************************************************
138  *                  Standard                        *
139  ****************************************************/
140 GES_API
141 GType ges_clip_get_type (void);
142
143 /****************************************************
144  *                TrackElement handling             *
145  ****************************************************/
146 GES_API
147 GESTrackType      ges_clip_get_supported_formats  (GESClip *clip);
148 GES_API
149 void              ges_clip_set_supported_formats  (GESClip *clip, GESTrackType       supportedformats);
150 GES_API
151 GESTrackElement*  ges_clip_add_asset              (GESClip *clip, GESAsset *asset);
152 GES_API
153 GESTrackElement*  ges_clip_find_track_element     (GESClip *clip, GESTrack *track,
154                                                    GType type);
155 GES_API
156 GList *           ges_clip_find_track_elements    (GESClip * clip, GESTrack * track,
157                                                    GESTrackType track_type, GType type);
158
159 /****************************************************
160  *                     Layer                        *
161  ****************************************************/
162 GES_API
163 GESLayer* ges_clip_get_layer              (GESClip *clip);
164 GES_API
165 gboolean  ges_clip_move_to_layer          (GESClip *clip, GESLayer  *layer);
166 GES_API
167 guint32 ges_clip_get_layer_priority        (GESClip * clip);
168
169 /****************************************************
170  *                   Effects                        *
171  ****************************************************/
172 GES_API
173 GList*   ges_clip_get_top_effects           (GESClip *clip);
174 GES_API
175 gint     ges_clip_get_top_effect_position   (GESClip *clip, GESBaseEffect *effect);
176 GES_API
177 gint     ges_clip_get_top_effect_index   (GESClip *clip, GESBaseEffect *effect);
178 GES_API
179 gboolean ges_clip_set_top_effect_priority   (GESClip *clip, GESBaseEffect *effect,
180                                              guint newpriority);
181 GES_API
182 gboolean ges_clip_set_top_effect_index   (GESClip *clip, GESBaseEffect *effect,
183                                              guint newindex);
184
185 /****************************************************
186  *                   Editing                        *
187  ****************************************************/
188 GES_API
189 GESClip* ges_clip_split  (GESClip *clip, guint64  position);
190
191 G_END_DECLS
192 #endif /* _GES_CLIP */