2 * Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
3 * 2009 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., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #ifndef _GST_DISCOVERER_H_
22 #define _GST_DISCOVERER_H_
28 #define GST_TYPE_DISCOVERER_STREAM_INFO \
29 (gst_discoverer_stream_info_get_type ())
30 #define GST_DISCOVERER_STREAM_INFO(obj) \
31 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_STREAM_INFO, GstDiscovererStreamInfo))
32 #define GST_IS_DISCOVERER_STREAM_INFO(obj) \
33 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_STREAM_INFO))
34 typedef struct _GstDiscovererStreamInfo GstDiscovererStreamInfo;
35 typedef GObjectClass GstDiscovererStreamInfoClass;
36 GType gst_discoverer_stream_info_get_type (void);
39 * GstDiscovererStreamInfo:
41 * Base structure for information concerning a media stream. Depending on the
42 * stream type, one can find more media-specific information in
43 * #GstDiscovererAudioInfo, #GstDiscovererVideoInfo, and
44 * #GstDiscovererContainerInfo.
46 * The #GstDiscovererStreamInfo represents the topology of the stream. Siblings
47 * can be iterated over with gst_discoverer_stream_info_get_next() and
48 * gst_discoverer_stream_info_get_previous(). Children (sub-streams) of a
49 * stream can be accessed using the #GstDiscovererContainerInfo API.
51 * As a simple example, if you run #GstDiscoverer on an AVI file with one audio
52 * and one video stream, you will get a #GstDiscovererContainerInfo
53 * corresponding to the AVI container, which in turn will have a
54 * #GstDiscovererAudioInfo sub-stream and a #GstDiscovererVideoInfo sub-stream
55 * for the audio and video streams respectively.
59 #define gst_discoverer_stream_info_ref(info) ((GstDiscovererStreamInfo*) g_object_ref((GObject*) info))
60 #define gst_discoverer_stream_info_unref(info) (g_object_unref((GObject*) info))
62 GstDiscovererStreamInfo* gst_discoverer_stream_info_get_previous(GstDiscovererStreamInfo* info);
63 GstDiscovererStreamInfo* gst_discoverer_stream_info_get_next(GstDiscovererStreamInfo* info);
64 GstCaps* gst_discoverer_stream_info_get_caps(GstDiscovererStreamInfo* info);
65 const GstTagList* gst_discoverer_stream_info_get_tags(GstDiscovererStreamInfo* info);
66 const GstToc* gst_discoverer_stream_info_get_toc(GstDiscovererStreamInfo* info);
67 const GstStructure* gst_discoverer_stream_info_get_misc(GstDiscovererStreamInfo* info);
68 const gchar * gst_discoverer_stream_info_get_stream_type_nick(GstDiscovererStreamInfo* info);
71 * GstDiscovererContainerInfo:
73 * #GstDiscovererStreamInfo specific to container streams.
77 #define GST_TYPE_DISCOVERER_CONTAINER_INFO \
78 (gst_discoverer_container_info_get_type ())
79 #define GST_DISCOVERER_CONTAINER_INFO(obj) \
80 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_CONTAINER_INFO, GstDiscovererContainerInfo))
81 #define GST_IS_DISCOVERER_CONTAINER_INFO(obj) \
82 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_CONTAINER_INFO))
83 typedef struct _GstDiscovererContainerInfo GstDiscovererContainerInfo;
84 typedef GObjectClass GstDiscovererContainerInfoClass;
86 GType gst_discoverer_container_info_get_type (void);
88 GList *gst_discoverer_container_info_get_streams(GstDiscovererContainerInfo *info);
92 * GstDiscovererAudioInfo:
94 * #GstDiscovererStreamInfo specific to audio streams.
98 #define GST_TYPE_DISCOVERER_AUDIO_INFO \
99 (gst_discoverer_audio_info_get_type ())
100 #define GST_DISCOVERER_AUDIO_INFO(obj) \
101 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_AUDIO_INFO, GstDiscovererAudioInfo))
102 #define GST_IS_DISCOVERER_AUDIO_INFO(obj) \
103 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_AUDIO_INFO))
104 typedef struct _GstDiscovererAudioInfo GstDiscovererAudioInfo;
105 typedef GObjectClass GstDiscovererAudioInfoClass;
107 GType gst_discoverer_audio_info_get_type (void);
109 guint gst_discoverer_audio_info_get_channels(const GstDiscovererAudioInfo* info);
110 guint gst_discoverer_audio_info_get_sample_rate(const GstDiscovererAudioInfo* info);
111 guint gst_discoverer_audio_info_get_depth(const GstDiscovererAudioInfo* info);
112 guint gst_discoverer_audio_info_get_bitrate(const GstDiscovererAudioInfo* info);
113 guint gst_discoverer_audio_info_get_max_bitrate(const GstDiscovererAudioInfo* info);
114 const gchar * gst_discoverer_audio_info_get_language(const GstDiscovererAudioInfo* info);
117 * GstDiscovererVideoInfo:
119 * #GstDiscovererStreamInfo specific to video streams (this includes images).
123 #define GST_TYPE_DISCOVERER_VIDEO_INFO \
124 (gst_discoverer_video_info_get_type ())
125 #define GST_DISCOVERER_VIDEO_INFO(obj) \
126 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_VIDEO_INFO, GstDiscovererVideoInfo))
127 #define GST_IS_DISCOVERER_VIDEO_INFO(obj) \
128 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_VIDEO_INFO))
129 typedef struct _GstDiscovererVideoInfo GstDiscovererVideoInfo;
130 typedef GObjectClass GstDiscovererVideoInfoClass;
131 GType gst_discoverer_video_info_get_type (void);
133 guint gst_discoverer_video_info_get_width(const GstDiscovererVideoInfo* info);
134 guint gst_discoverer_video_info_get_height(const GstDiscovererVideoInfo* info);
135 guint gst_discoverer_video_info_get_depth(const GstDiscovererVideoInfo* info);
136 guint gst_discoverer_video_info_get_framerate_num(const GstDiscovererVideoInfo* info);
137 guint gst_discoverer_video_info_get_framerate_denom(const GstDiscovererVideoInfo* info);
138 guint gst_discoverer_video_info_get_par_num(const GstDiscovererVideoInfo* info);
139 guint gst_discoverer_video_info_get_par_denom(const GstDiscovererVideoInfo* info);
140 gboolean gst_discoverer_video_info_is_interlaced(const GstDiscovererVideoInfo* info);
141 guint gst_discoverer_video_info_get_bitrate(const GstDiscovererVideoInfo* info);
142 guint gst_discoverer_video_info_get_max_bitrate(const GstDiscovererVideoInfo* info);
143 gboolean gst_discoverer_video_info_is_image(const GstDiscovererVideoInfo* info);
146 * GstDiscovererSubtitleInfo:
148 * #GstDiscovererStreamInfo specific to subtitle streams (this includes text and
153 #define GST_TYPE_DISCOVERER_SUBTITLE_INFO \
154 (gst_discoverer_subtitle_info_get_type ())
155 #define GST_DISCOVERER_SUBTITLE_INFO(obj) \
156 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_SUBTITLE_INFO, GstDiscovererSubtitleInfo))
157 #define GST_IS_DISCOVERER_SUBTITLE_INFO(obj) \
158 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_SUBTITLE_INFO))
159 typedef struct _GstDiscovererSubtitleInfo GstDiscovererSubtitleInfo;
160 typedef GObjectClass GstDiscovererSubtitleInfoClass;
161 GType gst_discoverer_subtitle_info_get_type (void);
163 const gchar * gst_discoverer_subtitle_info_get_language(const GstDiscovererSubtitleInfo* info);
166 * GstDiscovererResult:
167 * @GST_DISCOVERER_OK: The discovery was successful
168 * @GST_DISCOVERER_URI_INVALID: the URI is invalid
169 * @GST_DISCOVERER_ERROR: an error happened and the GError is set
170 * @GST_DISCOVERER_TIMEOUT: the discovery timed-out
171 * @GST_DISCOVERER_BUSY: the discoverer was already discovering a file
172 * @GST_DISCOVERER_MISSING_PLUGINS: Some plugins are missing for full discovery
174 * Result values for the discovery process.
179 GST_DISCOVERER_OK = 0,
180 GST_DISCOVERER_URI_INVALID = 1,
181 GST_DISCOVERER_ERROR = 2,
182 GST_DISCOVERER_TIMEOUT = 3,
183 GST_DISCOVERER_BUSY = 4,
184 GST_DISCOVERER_MISSING_PLUGINS = 5
185 } GstDiscovererResult;
191 * Structure containing the information of a URI analyzed by #GstDiscoverer.
195 typedef struct _GstDiscovererInfo GstDiscovererInfo;
197 #define GST_TYPE_DISCOVERER_INFO \
198 (gst_discoverer_info_get_type ())
199 #define GST_DISCOVERER_INFO(obj) \
200 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_INFO, GstDiscovererInfo))
201 #define GST_IS_DISCOVERER_INFO(obj) \
202 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_INFO))
203 typedef GObjectClass GstDiscovererInfoClass;
204 GType gst_discoverer_info_get_type (void);
206 #define gst_discoverer_info_unref(info) (g_object_unref((GObject*)info))
207 #define gst_discoverer_info_ref(info) (g_object_ref((Gbject*)info))
209 GstDiscovererInfo* gst_discoverer_info_copy (GstDiscovererInfo * ptr);
211 const gchar* gst_discoverer_info_get_uri(const GstDiscovererInfo* info);
212 GstDiscovererResult gst_discoverer_info_get_result(const GstDiscovererInfo* info);
213 GstDiscovererStreamInfo* gst_discoverer_info_get_stream_info(GstDiscovererInfo* info);
214 GList* gst_discoverer_info_get_stream_list(GstDiscovererInfo* info);
215 GstClockTime gst_discoverer_info_get_duration(const GstDiscovererInfo* info);
216 gboolean gst_discoverer_info_get_seekable(const GstDiscovererInfo* info);
217 const GstStructure* gst_discoverer_info_get_misc(const GstDiscovererInfo* info);
218 const GstTagList* gst_discoverer_info_get_tags(const GstDiscovererInfo* info);
219 const GstToc* gst_discoverer_info_get_toc(const GstDiscovererInfo* info);
221 GList * gst_discoverer_info_get_streams (GstDiscovererInfo *info,
223 GList * gst_discoverer_info_get_audio_streams (GstDiscovererInfo *info);
224 GList * gst_discoverer_info_get_video_streams (GstDiscovererInfo *info);
225 GList * gst_discoverer_info_get_subtitle_streams (GstDiscovererInfo *info);
226 GList * gst_discoverer_info_get_container_streams (GstDiscovererInfo *info);
228 void gst_discoverer_stream_info_list_free (GList *infos);
230 #define GST_TYPE_DISCOVERER \
231 (gst_discoverer_get_type())
232 #define GST_DISCOVERER(obj) \
233 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER,GstDiscoverer))
234 #define GST_DISCOVERER_CLASS(klass) \
235 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DISCOVERER,GstDiscovererClass))
236 #define GST_IS_DISCOVERER(obj) \
237 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER))
238 #define GST_IS_DISCOVERER_CLASS(klass) \
239 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DISCOVERER))
241 typedef struct _GstDiscoverer GstDiscoverer;
242 typedef struct _GstDiscovererClass GstDiscovererClass;
243 typedef struct _GstDiscovererPrivate GstDiscovererPrivate;
248 * The #GstDiscoverer structure.
252 struct _GstDiscoverer {
255 GstDiscovererPrivate *priv;
257 gpointer _reserved[GST_PADDING];
260 struct _GstDiscovererClass {
261 GObjectClass parentclass;
264 void (*finished) (GstDiscoverer *discoverer);
265 void (*starting) (GstDiscoverer *discoverer);
266 void (*discovered) (GstDiscoverer *discoverer,
267 GstDiscovererInfo *info,
270 gpointer _reserved[GST_PADDING];
273 GType gst_discoverer_get_type (void);
274 GstDiscoverer *gst_discoverer_new (GstClockTime timeout, GError **err);
276 /* Asynchronous API */
277 void gst_discoverer_start (GstDiscoverer *discoverer);
278 void gst_discoverer_stop (GstDiscoverer *discoverer);
279 gboolean gst_discoverer_discover_uri_async (GstDiscoverer *discoverer,
282 /* Synchronous API */
284 gst_discoverer_discover_uri (GstDiscoverer * discoverer,
290 #endif /* _GST_DISCOVERER_H */