command-line-formatter: Stop uselessly looping over options
[platform/upstream/gstreamer.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 #pragma once
22
23 #include <glib-object.h>
24 #include <ges/ges-timeline.h>
25
26 G_BEGIN_DECLS
27
28 #define GES_TYPE_FORMATTER ges_formatter_get_type()
29 GES_DECLARE_TYPE(Formatter, formatter, FORMATTER);
30
31 /**
32  * GESFormatter:
33  *
34  * Base class for timeline data serialization and deserialization.
35  */
36
37 struct _GESFormatter
38 {
39   GInitiallyUnowned parent;
40
41   /*< private >*/
42   GESFormatterPrivate *priv;
43
44   /*< protected >*/
45   GESProject *project;
46   GESTimeline *timeline;
47
48   /* Padding for API extension */
49   gpointer _ges_reserved[GES_PADDING];
50 };
51
52 typedef gboolean (*GESFormatterCanLoadURIMethod) (GESFormatter *dummy_instance, const gchar * uri, GError **error);
53
54 /**
55  * GESFormatterLoadFromURIMethod:
56  * @formatter: a #GESFormatter
57  * @timeline: a #GESTimeline
58  * @uri: the URI to load from
59  * @error: (out) (allow-none): An error to be set in case something wrong happens or %NULL
60  *
61  * Virtual method for loading a timeline from a given URI.
62  *
63  * Every #GESFormatter subclass needs to implement this method.
64  *
65  * Returns: TRUE if the @timeline was properly loaded from the given @uri,
66  * else FALSE.
67  **/
68 typedef gboolean (*GESFormatterLoadFromURIMethod) (GESFormatter *formatter,
69                   GESTimeline *timeline,
70                   const gchar * uri,
71                   GError **error);
72
73 /**
74  * GESFormatterSaveToURIMethod:
75  * @formatter: a #GESFormatter
76  * @timeline: a #GESTimeline
77  * @uri: the URI to save to
78  * @overwrite: Whether the file should be overwritten in case it exists
79  * @error: (out) (allow-none): An error to be set in case something wrong happens or %NULL
80  *
81  * Virtual method for saving a timeline to a uri.
82  *
83  * Every #GESFormatter subclass needs to implement this method.
84  *
85  * Returns: TRUE if the @timeline was properly stored to the given @uri,
86  * else FALSE.
87  */
88 typedef gboolean (*GESFormatterSaveToURIMethod) (GESFormatter *formatter,
89                GESTimeline *timeline, const gchar * uri, gboolean overwrite,
90                GError **error);
91
92 /**
93  * GESFormatterClass:
94  * @parent_class: the parent class structure
95  * @can_load_uri: Whether the URI can be loaded
96  * @load_from_uri: class method to deserialize data from a URI
97  * @save_to_uri: class method to serialize data to a URI
98  *
99  * GES Formatter class. Override the vmethods to implement the formatter functionnality.
100  */
101
102 struct _GESFormatterClass {
103   GInitiallyUnownedClass parent_class;
104
105   /* TODO 2.0: Rename the loading method to can_load and load.
106    * Technically we just pass data to load, it should not necessarily
107    * be a URI */
108   GESFormatterCanLoadURIMethod can_load_uri;
109   GESFormatterLoadFromURIMethod load_from_uri;
110   GESFormatterSaveToURIMethod save_to_uri;
111
112   /* < private > */
113   gchar *name;
114   gchar *description;
115   gchar *extension;
116   gchar *mimetype;
117   gdouble version;
118   GstRank rank;
119
120
121   /* Padding for API extension */
122   gpointer _ges_reserved[GES_PADDING];
123 };
124
125 GES_API
126 void ges_formatter_class_register_metas (GESFormatterClass * klass,
127                                          const gchar *name,
128                                          const gchar *description,
129                                          const gchar *extensions,
130                                          const gchar *caps,
131                                          gdouble version,
132                                          GstRank rank);
133
134 GES_API
135 gboolean ges_formatter_can_load_uri     (const gchar * uri, GError **error);
136 GES_API
137 gboolean ges_formatter_can_save_uri     (const gchar * uri, GError **error);
138
139 GES_DEPRECATED_FOR(ges_timeline_load_from_uri)
140 gboolean ges_formatter_load_from_uri    (GESFormatter * formatter,
141                                          GESTimeline  *timeline,
142                                          const gchar *uri,
143                                          GError **error);
144
145 GES_DEPRECATED_FOR(ges_timeline_save_to_uri)
146 gboolean ges_formatter_save_to_uri      (GESFormatter * formatter,
147                                          GESTimeline *timeline,
148                                          const gchar *uri,
149                                          gboolean overwrite,
150                                          GError **error);
151
152 GES_API
153 GESAsset *ges_formatter_get_default    (void);
154
155 GES_API
156 GESAsset *ges_find_formatter_for_uri   (const gchar *uri);
157
158 G_END_DECLS