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.
23 #include <glib-object.h>
24 #include <ges/ges-timeline.h>
28 #define GES_TYPE_FORMATTER ges_formatter_get_type()
29 GES_DECLARE_TYPE(Formatter, formatter, FORMATTER);
34 * Base class for timeline data serialization and deserialization.
39 GInitiallyUnowned parent;
42 GESFormatterPrivate *priv;
46 GESTimeline *timeline;
48 /* Padding for API extension */
49 gpointer _ges_reserved[GES_PADDING];
52 typedef gboolean (*GESFormatterCanLoadURIMethod) (GESFormatter *dummy_instance, const gchar * uri, GError **error);
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
61 * Virtual method for loading a timeline from a given URI.
63 * Every #GESFormatter subclass needs to implement this method.
65 * Returns: TRUE if the @timeline was properly loaded from the given @uri,
68 typedef gboolean (*GESFormatterLoadFromURIMethod) (GESFormatter *formatter,
69 GESTimeline *timeline,
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
81 * Virtual method for saving a timeline to a uri.
83 * Every #GESFormatter subclass needs to implement this method.
85 * Returns: TRUE if the @timeline was properly stored to the given @uri,
88 typedef gboolean (*GESFormatterSaveToURIMethod) (GESFormatter *formatter,
89 GESTimeline *timeline, const gchar * uri, gboolean overwrite,
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
99 * GES Formatter class. Override the vmethods to implement the formatter functionnality.
102 struct _GESFormatterClass {
103 GInitiallyUnownedClass parent_class;
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
108 GESFormatterCanLoadURIMethod can_load_uri;
109 GESFormatterLoadFromURIMethod load_from_uri;
110 GESFormatterSaveToURIMethod save_to_uri;
121 /* Padding for API extension */
122 gpointer _ges_reserved[GES_PADDING];
126 void ges_formatter_class_register_metas (GESFormatterClass * klass,
128 const gchar *description,
129 const gchar *extensions,
135 gboolean ges_formatter_can_load_uri (const gchar * uri, GError **error);
137 gboolean ges_formatter_can_save_uri (const gchar * uri, GError **error);
139 GES_DEPRECATED_FOR(ges_timeline_load_from_uri)
140 gboolean ges_formatter_load_from_uri (GESFormatter * formatter,
141 GESTimeline *timeline,
145 GES_DEPRECATED_FOR(ges_timeline_save_to_uri)
146 gboolean ges_formatter_save_to_uri (GESFormatter * formatter,
147 GESTimeline *timeline,
153 GESAsset *ges_formatter_get_default (void);
156 GESAsset *ges_find_formatter_for_uri (const gchar *uri);