1 /* GStreamer Editing Services
2 * Copyright (C) 2010 Brandon Lewis <brandon.lewis@collabora.co.uk>
3 * 2010 Nokia Corporation
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.
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.
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.
21 #ifndef _GES_FORMATTER
22 #define _GES_FORMATTER
24 #include <glib-object.h>
25 #include <ges/ges-timeline.h>
29 #define GES_TYPE_FORMATTER ges_formatter_get_type()
31 #define GES_FORMATTER(obj) \
32 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_FORMATTER, GESFormatter))
34 #define GES_FORMATTER_CLASS(klass) \
35 (G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_FORMATTER, GESFormatterClass))
37 #define GES_IS_FORMATTER(obj) \
38 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_FORMATTER))
40 #define GES_IS_FORMATTER_CLASS(klass) \
41 (G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_FORMATTER))
43 #define GES_FORMATTER_GET_CLASS(obj) \
44 (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_FORMATTER, GESFormatterClass))
46 typedef struct _GESFormatterPrivate GESFormatterPrivate;
51 * Base class for timeline data serialization and deserialization.
54 struct _GESFormatter {
55 GInitiallyUnowned parent;
58 GESFormatterPrivate *priv;
62 GESTimeline *timeline;
64 /* Padding for API extension */
65 gpointer _ges_reserved[GES_PADDING];
68 typedef gboolean (*GESFormatterCanLoadURIMethod) (GESFormatter *dummy_instance, const gchar * uri, GError **error);
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
77 * Virtual method for loading a timeline from a given URI.
79 * Every #GESFormatter subclass needs to implement this method.
81 * Returns: TRUE if the @timeline was properly loaded from the given @uri,
84 typedef gboolean (*GESFormatterLoadFromURIMethod) (GESFormatter *formatter,
85 GESTimeline *timeline,
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
97 * Virtual method for saving a timeline to a uri.
99 * Every #GESFormatter subclass needs to implement this method.
101 * Returns: TRUE if the @timeline was properly stored to the given @uri,
104 * Deprecated: Use #ges_timeline_save_to_uri
106 typedef gboolean (*GESFormatterSaveToURIMethod) (GESFormatter *formatter,
107 GESTimeline *timeline, const gchar * uri, gboolean overwrite,
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
117 * GES Formatter class. Override the vmethods to implement the formatter functionnality.
120 struct _GESFormatterClass {
121 GInitiallyUnownedClass parent_class;
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
126 GESFormatterCanLoadURIMethod can_load_uri;
127 GESFormatterLoadFromURIMethod load_from_uri;
128 GESFormatterSaveToURIMethod save_to_uri;
132 const gchar *description;
133 const gchar *extension;
134 const gchar *mimetype;
139 /* Padding for API extension */
140 gpointer _ges_reserved[GES_PADDING];
144 GType ges_formatter_get_type (void);
147 void ges_formatter_class_register_metas (GESFormatterClass * klass,
149 const gchar *description,
150 const gchar *extension,
151 const gchar *mimetype,
156 gboolean ges_formatter_can_load_uri (const gchar * uri, GError **error);
158 gboolean ges_formatter_can_save_uri (const gchar * uri, GError **error);
161 gboolean ges_formatter_load_from_uri (GESFormatter * formatter,
162 GESTimeline *timeline,
167 gboolean ges_formatter_save_to_uri (GESFormatter * formatter,
168 GESTimeline *timeline,
174 GESAsset *ges_formatter_get_default (void);
178 #endif /* _GES_FORMATTER */