Macro qtTrIdx() replaced by tr() and QT_TRANSLATE_NOOP()
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / gst-libs / gst / pbutils / gstdiscoverer.h
1 /* GStreamer
2  * Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
3  *               2009 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., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef _GST_DISCOVERER_H_
22 #define _GST_DISCOVERER_H_
23
24 #include <gst/gst.h>
25
26 G_BEGIN_DECLS
27
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 GstMiniObjectClass GstDiscovererStreamInfoClass;
36 GType gst_discoverer_stream_info_get_type (void);
37
38 /**
39  * GstDiscovererStreamInfo:
40  *
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.
45  *
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.
50  *
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.
56  *
57  * Since: 0.10.31
58  */
59 #define gst_discoverer_stream_info_ref(info) ((GstDiscovererStreamInfo*) gst_mini_object_ref((GstMiniObject*) info))
60 #define gst_discoverer_stream_info_unref(info) (gst_mini_object_unref((GstMiniObject*) info))
61
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 GstStructure*      gst_discoverer_stream_info_get_misc(GstDiscovererStreamInfo* info);
67 const gchar *            gst_discoverer_stream_info_get_stream_type_nick(GstDiscovererStreamInfo* info);
68
69 /**
70  * GstDiscovererContainerInfo:
71  *
72  * #GstDiscovererStreamInfo specific to container streams.
73  *
74  * Since: 0.10.31
75  */
76 #define GST_TYPE_DISCOVERER_CONTAINER_INFO \
77   (gst_discoverer_container_info_get_type ())
78 #define GST_DISCOVERER_CONTAINER_INFO(obj) \
79   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_CONTAINER_INFO, GstDiscovererContainerInfo))
80 #define GST_IS_DISCOVERER_CONTAINER_INFO(obj) \
81   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_CONTAINER_INFO))
82 typedef struct _GstDiscovererContainerInfo GstDiscovererContainerInfo;
83 typedef GstMiniObjectClass GstDiscovererContainerInfoClass;
84
85 GType gst_discoverer_container_info_get_type (void);
86
87 GList *gst_discoverer_container_info_get_streams(GstDiscovererContainerInfo *info);
88
89
90 /**
91  * GstDiscovererAudioInfo:
92  *
93  * #GstDiscovererStreamInfo specific to audio streams.
94  *
95  * Since: 0.10.31
96  */
97 #define GST_TYPE_DISCOVERER_AUDIO_INFO \
98   (gst_discoverer_audio_info_get_type ())
99 #define GST_DISCOVERER_AUDIO_INFO(obj) \
100   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_AUDIO_INFO, GstDiscovererAudioInfo))
101 #define GST_IS_DISCOVERER_AUDIO_INFO(obj) \
102   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_AUDIO_INFO))
103 typedef struct _GstDiscovererAudioInfo GstDiscovererAudioInfo;
104 typedef GstMiniObjectClass GstDiscovererAudioInfoClass;
105
106 GType gst_discoverer_audio_info_get_type (void);
107
108 guint gst_discoverer_audio_info_get_channels(const GstDiscovererAudioInfo* info);
109 guint gst_discoverer_audio_info_get_sample_rate(const GstDiscovererAudioInfo* info);
110 guint gst_discoverer_audio_info_get_depth(const GstDiscovererAudioInfo* info);
111 guint gst_discoverer_audio_info_get_bitrate(const GstDiscovererAudioInfo* info);
112 guint gst_discoverer_audio_info_get_max_bitrate(const GstDiscovererAudioInfo* info);
113
114 /**
115  * GstDiscovererVideoInfo:
116  *
117  * #GstDiscovererStreamInfo specific to video streams (this includes images).
118  *
119  * Since: 0.10.31
120  */
121 #define GST_TYPE_DISCOVERER_VIDEO_INFO \
122   (gst_discoverer_video_info_get_type ())
123 #define GST_DISCOVERER_VIDEO_INFO(obj) \
124   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_VIDEO_INFO, GstDiscovererVideoInfo))
125 #define GST_IS_DISCOVERER_VIDEO_INFO(obj) \
126   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_VIDEO_INFO))
127 typedef struct _GstDiscovererVideoInfo GstDiscovererVideoInfo;
128 typedef GstMiniObjectClass GstDiscovererVideoInfoClass;
129 GType gst_discoverer_video_info_get_type (void);
130
131 guint           gst_discoverer_video_info_get_width(const GstDiscovererVideoInfo* info);
132 guint           gst_discoverer_video_info_get_height(const GstDiscovererVideoInfo* info);
133 guint           gst_discoverer_video_info_get_depth(const GstDiscovererVideoInfo* info);
134 guint           gst_discoverer_video_info_get_framerate_num(const GstDiscovererVideoInfo* info);
135 guint           gst_discoverer_video_info_get_framerate_denom(const GstDiscovererVideoInfo* info);
136 guint           gst_discoverer_video_info_get_par_num(const GstDiscovererVideoInfo* info);
137 guint           gst_discoverer_video_info_get_par_denom(const GstDiscovererVideoInfo* info);
138 gboolean        gst_discoverer_video_info_is_interlaced(const GstDiscovererVideoInfo* info);
139 guint           gst_discoverer_video_info_get_bitrate(const GstDiscovererVideoInfo* info);
140 guint           gst_discoverer_video_info_get_max_bitrate(const GstDiscovererVideoInfo* info);
141 gboolean        gst_discoverer_video_info_is_image(const GstDiscovererVideoInfo* info);
142
143 /**
144  * GstDiscovererResult:
145  * @GST_DISCOVERER_OK: The discovery was successful
146  * @GST_DISCOVERER_URI_INVALID: the URI is invalid
147  * @GST_DISCOVERER_ERROR: an error happened and the GError is set
148  * @GST_DISCOVERER_TIMEOUT: the discovery timed-out
149  * @GST_DISCOVERER_BUSY: the discoverer was already discovering a file
150  * @GST_DISCOVERER_MISSING_PLUGINS: Some plugins are missing for full discovery
151  *
152  * Result values for the discovery process.
153  *
154  * Since: 0.10.31
155  */
156 typedef enum {
157   GST_DISCOVERER_OK               = 0,
158   GST_DISCOVERER_URI_INVALID      = 1,
159   GST_DISCOVERER_ERROR            = 2,
160   GST_DISCOVERER_TIMEOUT          = 3,
161   GST_DISCOVERER_BUSY             = 4,
162   GST_DISCOVERER_MISSING_PLUGINS  = 5
163 } GstDiscovererResult;
164
165
166 /**
167  * GstDiscovererInfo:
168  *
169  * Structure containing the information of a URI analyzed by #GstDiscoverer.
170  *
171  * Since: 0.10.31
172  */
173 typedef struct _GstDiscovererInfo GstDiscovererInfo;
174
175 #define GST_TYPE_DISCOVERER_INFO \
176   (gst_discoverer_info_get_type ())
177 #define GST_DISCOVERER_INFO(obj) \
178   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_INFO, GstDiscovererInfo))
179 #define GST_IS_DISCOVERER_INFO(obj) \
180   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_INFO))
181 typedef GstMiniObjectClass GstDiscovererInfoClass;
182 GType gst_discoverer_info_get_type (void);
183
184 #define gst_discoverer_info_unref(info) (gst_mini_object_unref((GstMiniObject*)info))
185 #define gst_discoverer_info_ref(info) (gst_mini_object_ref((GstMiniObject*)info))
186
187 GstDiscovererInfo*        gst_discoverer_info_copy (GstDiscovererInfo * ptr);
188
189 const gchar*              gst_discoverer_info_get_uri(const GstDiscovererInfo* info);
190 GstDiscovererResult       gst_discoverer_info_get_result(const GstDiscovererInfo* info);
191 GstDiscovererStreamInfo*  gst_discoverer_info_get_stream_info(GstDiscovererInfo* info);
192 GList*                    gst_discoverer_info_get_stream_list(GstDiscovererInfo* info);
193 GstClockTime              gst_discoverer_info_get_duration(const GstDiscovererInfo* info);
194 gboolean                  gst_discoverer_info_get_seekable(const GstDiscovererInfo* info);
195 const GstStructure*       gst_discoverer_info_get_misc(const GstDiscovererInfo* info);
196 const GstTagList*         gst_discoverer_info_get_tags(const GstDiscovererInfo* info);
197
198 GList *                   gst_discoverer_info_get_streams (GstDiscovererInfo *info,
199                                                            GType streamtype);
200 GList *                   gst_discoverer_info_get_audio_streams (GstDiscovererInfo *info);
201 GList *                   gst_discoverer_info_get_video_streams (GstDiscovererInfo *info);
202 GList *                   gst_discoverer_info_get_container_streams (GstDiscovererInfo *info);
203
204 void                      gst_discoverer_stream_info_list_free (GList *infos);
205
206 #define GST_TYPE_DISCOVERER \
207   (gst_discoverer_get_type())
208 #define GST_DISCOVERER(obj) \
209   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER,GstDiscoverer))
210 #define GST_DISCOVERER_CLASS(klass) \
211   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DISCOVERER,GstDiscovererClass))
212 #define GST_IS_DISCOVERER(obj) \
213   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER))
214 #define GST_IS_DISCOVERER_CLASS(klass) \
215   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DISCOVERER))
216
217 typedef struct _GstDiscoverer GstDiscoverer;
218 typedef struct _GstDiscovererClass GstDiscovererClass;
219 typedef struct _GstDiscovererPrivate GstDiscovererPrivate;
220
221 /**
222  * GstDiscoverer:
223  *
224  * The #GstDiscoverer structure.
225  *
226  * Since: 0.10.31
227  **/
228 struct _GstDiscoverer {
229   GObject parent;
230
231   GstDiscovererPrivate *priv;
232
233   gpointer _reserved[GST_PADDING];
234 };
235
236 struct _GstDiscovererClass {
237   GObjectClass parentclass;
238
239   /*< signals >*/
240   void        (*finished)        (GstDiscoverer *discoverer);
241   void        (*starting)        (GstDiscoverer *discoverer);
242   void        (*discovered)      (GstDiscoverer *discoverer,
243                                   GstDiscovererInfo *info,
244                                   const GError *err);
245
246   gpointer _reserved[GST_PADDING];
247 };
248
249 GType          gst_discoverer_get_type (void);
250 GstDiscoverer *gst_discoverer_new (GstClockTime timeout, GError **err);
251
252 /* Asynchronous API */
253 void           gst_discoverer_start (GstDiscoverer *discoverer);
254 void           gst_discoverer_stop (GstDiscoverer *discoverer);
255 gboolean       gst_discoverer_discover_uri_async (GstDiscoverer *discoverer,
256                                                   const gchar *uri);
257
258 /* Synchronous API */
259 GstDiscovererInfo *
260 gst_discoverer_discover_uri (GstDiscoverer * discoverer,
261                              const gchar * uri,
262                              GError ** err);
263
264 G_END_DECLS
265
266 #endif /* _GST_DISCOVERER_H */