Mark ges_formatter_save_to_uri as deprecated
[platform/upstream/gst-editing-services.git] / ges / ges-formatter.h
1 /* GStreamer Editing Services
2  * Copyright (C) 2010 Brandon Lewis <brandon.lewis@collabora.co.uk>
3  *               2010 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_FORMATTER
22 #define _GES_FORMATTER
23
24 #include <glib-object.h>
25 #include <ges/ges-timeline.h>
26
27 G_BEGIN_DECLS
28
29 #define GES_TYPE_FORMATTER ges_formatter_get_type()
30
31 #define GES_FORMATTER(obj) \
32   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_FORMATTER, GESFormatter))
33
34 #define GES_FORMATTER_CLASS(klass) \
35   (G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_FORMATTER, GESFormatterClass))
36
37 #define GES_IS_FORMATTER(obj) \
38   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_FORMATTER))
39
40 #define GES_IS_FORMATTER_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_FORMATTER))
42
43 #define GES_FORMATTER_GET_CLASS(obj) \
44   (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_FORMATTER, GESFormatterClass))
45
46 typedef struct _GESFormatterPrivate GESFormatterPrivate;
47
48 /**
49  * GESFormatter:
50  *
51  * Base class for timeline data serialization and deserialization.
52  */
53
54 struct _GESFormatter {
55   GInitiallyUnowned parent;
56
57   /*< private >*/
58   GESFormatterPrivate *priv;
59
60   /*< protected >*/
61   GESProject *project;
62   GESTimeline *timeline;
63
64   /* Padding for API extension */
65   gpointer _ges_reserved[GES_PADDING];
66 };
67
68 typedef gboolean (*GESFormatterCanLoadURIMethod) (GESFormatter *dummy_instance, const gchar * uri, GError **error);
69
70 /**
71  * GESFormatterLoadFromURIMethod:
72  * @formatter: a #GESFormatter
73  * @timeline: a #GESTimeline
74  * @uri: the URI to load from
75  * @error: (out) (allow-none): An error to be set in case something wrong happens or %NULL
76  *
77  * Virtual method for loading a timeline from a given URI.
78  *
79  * Every #GESFormatter subclass needs to implement this method.
80  *
81  * Returns: TRUE if the @timeline was properly loaded from the given @uri,
82  * else FALSE.
83  **/
84 typedef gboolean (*GESFormatterLoadFromURIMethod) (GESFormatter *formatter,
85                   GESTimeline *timeline,
86                   const gchar * uri,
87                   GError **error);
88
89 /**
90  * GESFormatterSaveToURIMethod:
91  * @formatter: a #GESFormatter
92  * @timeline: a #GESTimeline
93  * @uri: the URI to save to
94  * @overwrite: Whether the file should be overwritten in case it exists
95  * @error: (out) (allow-none): An error to be set in case something wrong happens or %NULL
96  *
97  * Virtual method for saving a timeline to a uri.
98  *
99  * Every #GESFormatter subclass needs to implement this method.
100  *
101  * Returns: TRUE if the @timeline was properly stored to the given @uri,
102  * else FALSE.
103  *
104  * Deprecated: Use #ges_timeline_save_to_uri
105  */
106 typedef gboolean (*GESFormatterSaveToURIMethod) (GESFormatter *formatter,
107                GESTimeline *timeline, const gchar * uri, gboolean overwrite,
108                GError **error);
109
110 /**
111  * GESFormatterClass:
112  * @parent_class: the parent class structure
113  * @can_load_uri: Whether the URI can be loaded
114  * @load_from_uri: class method to deserialize data from a URI
115  * @save_to_uri: class method to serialize data to a URI
116  *
117  * GES Formatter class. Override the vmethods to implement the formatter functionnality.
118  */
119
120 struct _GESFormatterClass {
121   GInitiallyUnownedClass parent_class;
122
123   /* TODO 2.0: Rename the loading method to can_load and load.
124    * Technically we just pass data to load, it should not necessarily
125    * be a URI */
126   GESFormatterCanLoadURIMethod can_load_uri;
127   GESFormatterLoadFromURIMethod load_from_uri;
128   GESFormatterSaveToURIMethod save_to_uri;
129
130   /* < private > */
131   const gchar *name;
132   const gchar *description;
133   const gchar *extension;
134   const gchar *mimetype;
135   gdouble version;
136   GstRank rank;
137
138
139   /* Padding for API extension */
140   gpointer _ges_reserved[GES_PADDING];
141 };
142
143 GES_API
144 GType ges_formatter_get_type (void);
145
146 GES_API
147 void ges_formatter_class_register_metas (GESFormatterClass * klass,
148                                          const gchar *name,
149                                          const gchar *description,
150                                          const gchar *extension,
151                                          const gchar *mimetype,
152                                          gdouble version,
153                                          GstRank rank);
154
155 GES_API
156 gboolean ges_formatter_can_load_uri     (const gchar * uri, GError **error);
157 GES_API
158 gboolean ges_formatter_can_save_uri     (const gchar * uri, GError **error);
159
160 GES_API
161 gboolean ges_formatter_load_from_uri    (GESFormatter * formatter,
162                                          GESTimeline  *timeline,
163                                          const gchar *uri,
164                                          GError **error);
165
166 GES_API
167 gboolean ges_formatter_save_to_uri      (GESFormatter * formatter,
168                                          GESTimeline *timeline,
169                                          const gchar *uri,
170                                          gboolean overwrite,
171                                          GError **error);
172
173 GES_API
174 GESAsset *ges_formatter_get_default    (void);
175
176 G_END_DECLS
177
178 #endif /* _GES_FORMATTER */