1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
|
/* GStreamer
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
* 2009 Nokia Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _GST_DISCOVERER_H_
#define _GST_DISCOVERER_H_
#include <gst/gst.h>
#include <gst/pbutils/pbutils-prelude.h>
G_BEGIN_DECLS
#define GST_TYPE_DISCOVERER_STREAM_INFO \
(gst_discoverer_stream_info_get_type ())
#define GST_DISCOVERER_STREAM_INFO(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_STREAM_INFO, GstDiscovererStreamInfo))
#define GST_IS_DISCOVERER_STREAM_INFO(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_STREAM_INFO))
typedef struct _GstDiscovererStreamInfo GstDiscovererStreamInfo;
typedef GObjectClass GstDiscovererStreamInfoClass;
GST_PBUTILS_API
GType gst_discoverer_stream_info_get_type (void);
/**
* GstDiscovererStreamInfo:
*
* Base structure for information concerning a media stream. Depending on the
* stream type, one can find more media-specific information in
* #GstDiscovererAudioInfo, #GstDiscovererVideoInfo, and
* #GstDiscovererContainerInfo.
*
* The #GstDiscovererStreamInfo represents the topology of the stream. Siblings
* can be iterated over with gst_discoverer_stream_info_get_next() and
* gst_discoverer_stream_info_get_previous(). Children (sub-streams) of a
* stream can be accessed using the #GstDiscovererContainerInfo API.
*
* As a simple example, if you run #GstDiscoverer on an AVI file with one audio
* and one video stream, you will get a #GstDiscovererContainerInfo
* corresponding to the AVI container, which in turn will have a
* #GstDiscovererAudioInfo sub-stream and a #GstDiscovererVideoInfo sub-stream
* for the audio and video streams respectively.
*/
#define gst_discoverer_stream_info_ref(info) ((GstDiscovererStreamInfo*) g_object_ref((GObject*) info))
#define gst_discoverer_stream_info_unref(info) (g_object_unref((GObject*) info))
GST_PBUTILS_API
GstDiscovererStreamInfo* gst_discoverer_stream_info_get_previous(GstDiscovererStreamInfo* info);
GST_PBUTILS_API
GstDiscovererStreamInfo* gst_discoverer_stream_info_get_next(GstDiscovererStreamInfo* info);
GST_PBUTILS_API
GstCaps* gst_discoverer_stream_info_get_caps(GstDiscovererStreamInfo* info);
GST_PBUTILS_API
const GstTagList* gst_discoverer_stream_info_get_tags(GstDiscovererStreamInfo* info);
GST_PBUTILS_API
const GstToc* gst_discoverer_stream_info_get_toc(GstDiscovererStreamInfo* info);
GST_PBUTILS_API
const gchar* gst_discoverer_stream_info_get_stream_id(GstDiscovererStreamInfo* info);
GST_PBUTILS_DEPRECATED_FOR(gst_discoverer_info_get_missing_elements_installer_details)
const GstStructure* gst_discoverer_stream_info_get_misc(GstDiscovererStreamInfo* info);
GST_PBUTILS_API
const gchar * gst_discoverer_stream_info_get_stream_type_nick(GstDiscovererStreamInfo* info);
GST_PBUTILS_API
gint gst_discoverer_stream_info_get_stream_number(GstDiscovererStreamInfo *info);
/**
* GstDiscovererContainerInfo:
*
* #GstDiscovererStreamInfo specific to container streams.
*/
#define GST_TYPE_DISCOVERER_CONTAINER_INFO \
(gst_discoverer_container_info_get_type ())
#define GST_DISCOVERER_CONTAINER_INFO(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_CONTAINER_INFO, GstDiscovererContainerInfo))
#define GST_IS_DISCOVERER_CONTAINER_INFO(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_CONTAINER_INFO))
typedef struct _GstDiscovererContainerInfo GstDiscovererContainerInfo;
typedef GObjectClass GstDiscovererContainerInfoClass;
GST_PBUTILS_API
GType gst_discoverer_container_info_get_type (void);
GST_PBUTILS_API
GList *gst_discoverer_container_info_get_streams(GstDiscovererContainerInfo *info);
GST_PBUTILS_API
const GstTagList* gst_discoverer_container_info_get_tags(const GstDiscovererContainerInfo *info);
/**
* GstDiscovererAudioInfo:
*
* #GstDiscovererStreamInfo specific to audio streams.
*/
#define GST_TYPE_DISCOVERER_AUDIO_INFO \
(gst_discoverer_audio_info_get_type ())
#define GST_DISCOVERER_AUDIO_INFO(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_AUDIO_INFO, GstDiscovererAudioInfo))
#define GST_IS_DISCOVERER_AUDIO_INFO(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_AUDIO_INFO))
typedef struct _GstDiscovererAudioInfo GstDiscovererAudioInfo;
typedef GObjectClass GstDiscovererAudioInfoClass;
GST_PBUTILS_API
GType gst_discoverer_audio_info_get_type (void);
GST_PBUTILS_API
guint gst_discoverer_audio_info_get_channels(const GstDiscovererAudioInfo* info);
GST_PBUTILS_API
guint64 gst_discoverer_audio_info_get_channel_mask(const GstDiscovererAudioInfo* info);
GST_PBUTILS_API
guint gst_discoverer_audio_info_get_sample_rate(const GstDiscovererAudioInfo* info);
GST_PBUTILS_API
guint gst_discoverer_audio_info_get_depth(const GstDiscovererAudioInfo* info);
GST_PBUTILS_API
guint gst_discoverer_audio_info_get_bitrate(const GstDiscovererAudioInfo* info);
GST_PBUTILS_API
guint gst_discoverer_audio_info_get_max_bitrate(const GstDiscovererAudioInfo* info);
GST_PBUTILS_API
const gchar * gst_discoverer_audio_info_get_language(const GstDiscovererAudioInfo* info);
/**
* GstDiscovererVideoInfo:
*
* #GstDiscovererStreamInfo specific to video streams (this includes images).
*/
#define GST_TYPE_DISCOVERER_VIDEO_INFO \
(gst_discoverer_video_info_get_type ())
#define GST_DISCOVERER_VIDEO_INFO(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_VIDEO_INFO, GstDiscovererVideoInfo))
#define GST_IS_DISCOVERER_VIDEO_INFO(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_VIDEO_INFO))
typedef struct _GstDiscovererVideoInfo GstDiscovererVideoInfo;
typedef GObjectClass GstDiscovererVideoInfoClass;
GST_PBUTILS_API
GType gst_discoverer_video_info_get_type (void);
GST_PBUTILS_API
guint gst_discoverer_video_info_get_width(const GstDiscovererVideoInfo* info);
GST_PBUTILS_API
guint gst_discoverer_video_info_get_height(const GstDiscovererVideoInfo* info);
GST_PBUTILS_API
guint gst_discoverer_video_info_get_depth(const GstDiscovererVideoInfo* info);
GST_PBUTILS_API
guint gst_discoverer_video_info_get_framerate_num(const GstDiscovererVideoInfo* info);
GST_PBUTILS_API
guint gst_discoverer_video_info_get_framerate_denom(const GstDiscovererVideoInfo* info);
GST_PBUTILS_API
guint gst_discoverer_video_info_get_par_num(const GstDiscovererVideoInfo* info);
GST_PBUTILS_API
guint gst_discoverer_video_info_get_par_denom(const GstDiscovererVideoInfo* info);
GST_PBUTILS_API
gboolean gst_discoverer_video_info_is_interlaced(const GstDiscovererVideoInfo* info);
GST_PBUTILS_API
guint gst_discoverer_video_info_get_bitrate(const GstDiscovererVideoInfo* info);
GST_PBUTILS_API
guint gst_discoverer_video_info_get_max_bitrate(const GstDiscovererVideoInfo* info);
GST_PBUTILS_API
gboolean gst_discoverer_video_info_is_image(const GstDiscovererVideoInfo* info);
/**
* GstDiscovererSubtitleInfo:
*
* #GstDiscovererStreamInfo specific to subtitle streams (this includes text and
* image based ones).
*/
#define GST_TYPE_DISCOVERER_SUBTITLE_INFO \
(gst_discoverer_subtitle_info_get_type ())
#define GST_DISCOVERER_SUBTITLE_INFO(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_SUBTITLE_INFO, GstDiscovererSubtitleInfo))
#define GST_IS_DISCOVERER_SUBTITLE_INFO(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_SUBTITLE_INFO))
typedef struct _GstDiscovererSubtitleInfo GstDiscovererSubtitleInfo;
typedef GObjectClass GstDiscovererSubtitleInfoClass;
GST_PBUTILS_API
GType gst_discoverer_subtitle_info_get_type (void);
GST_PBUTILS_API
const gchar * gst_discoverer_subtitle_info_get_language(const GstDiscovererSubtitleInfo* info);
/**
* GstDiscovererResult:
* @GST_DISCOVERER_OK: The discovery was successful
* @GST_DISCOVERER_URI_INVALID: the URI is invalid
* @GST_DISCOVERER_ERROR: an error happened and the GError is set
* @GST_DISCOVERER_TIMEOUT: the discovery timed-out
* @GST_DISCOVERER_BUSY: the discoverer was already discovering a file
* @GST_DISCOVERER_MISSING_PLUGINS: Some plugins are missing for full discovery
*
* Result values for the discovery process.
*/
typedef enum {
GST_DISCOVERER_OK = 0,
GST_DISCOVERER_URI_INVALID = 1,
GST_DISCOVERER_ERROR = 2,
GST_DISCOVERER_TIMEOUT = 3,
GST_DISCOVERER_BUSY = 4,
GST_DISCOVERER_MISSING_PLUGINS = 5
} GstDiscovererResult;
/**
* GstDiscovererSerializeFlags:
* @GST_DISCOVERER_SERIALIZE_BASIC: Serialize only basic information, excluding
* caps, tags and miscellaneous information
* @GST_DISCOVERER_SERIALIZE_CAPS: Serialize the caps for each stream
* @GST_DISCOVERER_SERIALIZE_TAGS: Serialize the tags for each stream
* @GST_DISCOVERER_SERIALIZE_MISC: Serialize miscellaneous information for each stream
* @GST_DISCOVERER_SERIALIZE_ALL: Serialize all the available info, including
* caps, tags and miscellaneous information
*
* You can use these flags to control what is serialized by
* gst_discoverer_info_to_variant()
*
* Since: 1.6
*/
typedef enum {
GST_DISCOVERER_SERIALIZE_BASIC = 0,
GST_DISCOVERER_SERIALIZE_CAPS = 1 << 0,
GST_DISCOVERER_SERIALIZE_TAGS = 1 << 1,
GST_DISCOVERER_SERIALIZE_MISC = 1 << 2,
GST_DISCOVERER_SERIALIZE_ALL = GST_DISCOVERER_SERIALIZE_CAPS | GST_DISCOVERER_SERIALIZE_TAGS | GST_DISCOVERER_SERIALIZE_MISC
} GstDiscovererSerializeFlags;
/**
* GstDiscovererInfo:
*
* Structure containing the information of a URI analyzed by #GstDiscoverer.
*/
typedef struct _GstDiscovererInfo GstDiscovererInfo;
#define GST_TYPE_DISCOVERER_INFO \
(gst_discoverer_info_get_type ())
#define GST_DISCOVERER_INFO(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_INFO, GstDiscovererInfo))
#define GST_IS_DISCOVERER_INFO(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_INFO))
typedef GObjectClass GstDiscovererInfoClass;
GST_PBUTILS_API
GType gst_discoverer_info_get_type (void);
#define gst_discoverer_info_unref(info) (g_object_unref((GObject*)info))
#define gst_discoverer_info_ref(info) (g_object_ref((GObject*)info))
GST_PBUTILS_API
GstDiscovererInfo* gst_discoverer_info_copy (GstDiscovererInfo * ptr);
GST_PBUTILS_API
const gchar* gst_discoverer_info_get_uri(const GstDiscovererInfo* info);
GST_PBUTILS_API
GstDiscovererResult gst_discoverer_info_get_result(const GstDiscovererInfo* info);
GST_PBUTILS_API
GstDiscovererStreamInfo* gst_discoverer_info_get_stream_info(GstDiscovererInfo* info);
GST_PBUTILS_API
GList* gst_discoverer_info_get_stream_list(GstDiscovererInfo* info);
GST_PBUTILS_API
GstClockTime gst_discoverer_info_get_duration(const GstDiscovererInfo* info);
GST_PBUTILS_API
gboolean gst_discoverer_info_get_seekable(const GstDiscovererInfo* info);
GST_PBUTILS_API
gboolean gst_discoverer_info_get_live(const GstDiscovererInfo* info);
GST_PBUTILS_DEPRECATED_FOR(gst_discoverer_info_get_missing_elements_installer_details)
const GstStructure* gst_discoverer_info_get_misc(const GstDiscovererInfo* info);
GST_PBUTILS_DEPRECATED
const GstTagList* gst_discoverer_info_get_tags(const GstDiscovererInfo* info);
GST_PBUTILS_API
const GstToc* gst_discoverer_info_get_toc(const GstDiscovererInfo* info);
GST_PBUTILS_API
const gchar** gst_discoverer_info_get_missing_elements_installer_details(const GstDiscovererInfo* info);
GST_PBUTILS_API
GList * gst_discoverer_info_get_streams (GstDiscovererInfo *info,
GType streamtype);
GST_PBUTILS_API
GList * gst_discoverer_info_get_audio_streams (GstDiscovererInfo *info);
GST_PBUTILS_API
GList * gst_discoverer_info_get_video_streams (GstDiscovererInfo *info);
GST_PBUTILS_API
GList * gst_discoverer_info_get_subtitle_streams (GstDiscovererInfo *info);
GST_PBUTILS_API
GList * gst_discoverer_info_get_container_streams (GstDiscovererInfo *info);
GST_PBUTILS_API
GVariant * gst_discoverer_info_to_variant (GstDiscovererInfo *info,
GstDiscovererSerializeFlags flags);
GST_PBUTILS_API
GstDiscovererInfo * gst_discoverer_info_from_variant (GVariant *variant);
GST_PBUTILS_API
void gst_discoverer_stream_info_list_free (GList *infos);
#define GST_TYPE_DISCOVERER \
(gst_discoverer_get_type())
#define GST_DISCOVERER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER,GstDiscoverer))
#define GST_DISCOVERER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DISCOVERER,GstDiscovererClass))
#define GST_IS_DISCOVERER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER))
#define GST_IS_DISCOVERER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DISCOVERER))
typedef struct _GstDiscoverer GstDiscoverer;
typedef struct _GstDiscovererClass GstDiscovererClass;
typedef struct _GstDiscovererPrivate GstDiscovererPrivate;
/**
* GstDiscoverer:
*
* The #GstDiscoverer structure.
**/
struct _GstDiscoverer {
GObject parent;
/*< private >*/
GstDiscovererPrivate *priv;
gpointer _reserved[GST_PADDING];
};
struct _GstDiscovererClass {
GObjectClass parentclass;
/* signals */
void (*finished) (GstDiscoverer *discoverer);
void (*starting) (GstDiscoverer *discoverer);
void (*discovered) (GstDiscoverer *discoverer,
GstDiscovererInfo *info,
const GError *err);
void (*source_setup) (GstDiscoverer *discoverer,
GstElement *source);
gpointer _reserved[GST_PADDING];
};
GST_PBUTILS_API
GType gst_discoverer_get_type (void);
GST_PBUTILS_API
GstDiscoverer *gst_discoverer_new (GstClockTime timeout, GError **err);
/* Asynchronous API */
GST_PBUTILS_API
void gst_discoverer_start (GstDiscoverer *discoverer);
GST_PBUTILS_API
void gst_discoverer_stop (GstDiscoverer *discoverer);
GST_PBUTILS_API
gboolean gst_discoverer_discover_uri_async (GstDiscoverer *discoverer,
const gchar *uri);
/* Synchronous API */
GST_PBUTILS_API
GstDiscovererInfo *
gst_discoverer_discover_uri (GstDiscoverer * discoverer,
const gchar * uri,
GError ** err);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscoverer, gst_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscovererAudioInfo, gst_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscovererContainerInfo, gst_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscovererInfo, gst_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscovererStreamInfo, gst_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscovererSubtitleInfo, gst_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscovererVideoInfo, gst_object_unref)
G_END_DECLS
#endif /* _GST_DISCOVERER_H */
|