gstdiscoverer.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. /* GStreamer
  2. * Copyright (C) 2009 Edward Hervey <[email protected]>
  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., 51 Franklin St, Fifth Floor,
  18. * Boston, MA 02110-1301, USA.
  19. */
  20. #ifndef _GST_DISCOVERER_H_
  21. #define _GST_DISCOVERER_H_
  22. #include <gst/gst.h>
  23. G_BEGIN_DECLS
  24. #define GST_TYPE_DISCOVERER_STREAM_INFO \
  25. (gst_discoverer_stream_info_get_type ())
  26. #define GST_DISCOVERER_STREAM_INFO(obj) \
  27. (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_STREAM_INFO, GstDiscovererStreamInfo))
  28. #define GST_IS_DISCOVERER_STREAM_INFO(obj) \
  29. (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_STREAM_INFO))
  30. typedef struct _GstDiscovererStreamInfo GstDiscovererStreamInfo;
  31. typedef GObjectClass GstDiscovererStreamInfoClass;
  32. GType gst_discoverer_stream_info_get_type (void);
  33. /**
  34. * GstDiscovererStreamInfo:
  35. *
  36. * Base structure for information concerning a media stream. Depending on the
  37. * stream type, one can find more media-specific information in
  38. * #GstDiscovererAudioInfo, #GstDiscovererVideoInfo, and
  39. * #GstDiscovererContainerInfo.
  40. *
  41. * The #GstDiscovererStreamInfo represents the topology of the stream. Siblings
  42. * can be iterated over with gst_discoverer_stream_info_get_next() and
  43. * gst_discoverer_stream_info_get_previous(). Children (sub-streams) of a
  44. * stream can be accessed using the #GstDiscovererContainerInfo API.
  45. *
  46. * As a simple example, if you run #GstDiscoverer on an AVI file with one audio
  47. * and one video stream, you will get a #GstDiscovererContainerInfo
  48. * corresponding to the AVI container, which in turn will have a
  49. * #GstDiscovererAudioInfo sub-stream and a #GstDiscovererVideoInfo sub-stream
  50. * for the audio and video streams respectively.
  51. */
  52. #define gst_discoverer_stream_info_ref(info) ((GstDiscovererStreamInfo*) g_object_ref((GObject*) info))
  53. #define gst_discoverer_stream_info_unref(info) (g_object_unref((GObject*) info))
  54. GstDiscovererStreamInfo* gst_discoverer_stream_info_get_previous(GstDiscovererStreamInfo* info);
  55. GstDiscovererStreamInfo* gst_discoverer_stream_info_get_next(GstDiscovererStreamInfo* info);
  56. GstCaps* gst_discoverer_stream_info_get_caps(GstDiscovererStreamInfo* info);
  57. const GstTagList* gst_discoverer_stream_info_get_tags(GstDiscovererStreamInfo* info);
  58. const GstToc* gst_discoverer_stream_info_get_toc(GstDiscovererStreamInfo* info);
  59. const gchar* gst_discoverer_stream_info_get_stream_id(GstDiscovererStreamInfo* info);
  60. const GstStructure* gst_discoverer_stream_info_get_misc(GstDiscovererStreamInfo* info);
  61. const gchar * gst_discoverer_stream_info_get_stream_type_nick(GstDiscovererStreamInfo* info);
  62. /**
  63. * GstDiscovererContainerInfo:
  64. *
  65. * #GstDiscovererStreamInfo specific to container streams.
  66. */
  67. #define GST_TYPE_DISCOVERER_CONTAINER_INFO \
  68. (gst_discoverer_container_info_get_type ())
  69. #define GST_DISCOVERER_CONTAINER_INFO(obj) \
  70. (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_CONTAINER_INFO, GstDiscovererContainerInfo))
  71. #define GST_IS_DISCOVERER_CONTAINER_INFO(obj) \
  72. (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_CONTAINER_INFO))
  73. typedef struct _GstDiscovererContainerInfo GstDiscovererContainerInfo;
  74. typedef GObjectClass GstDiscovererContainerInfoClass;
  75. GType gst_discoverer_container_info_get_type (void);
  76. GList *gst_discoverer_container_info_get_streams(GstDiscovererContainerInfo *info);
  77. /**
  78. * GstDiscovererAudioInfo:
  79. *
  80. * #GstDiscovererStreamInfo specific to audio streams.
  81. */
  82. #define GST_TYPE_DISCOVERER_AUDIO_INFO \
  83. (gst_discoverer_audio_info_get_type ())
  84. #define GST_DISCOVERER_AUDIO_INFO(obj) \
  85. (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_AUDIO_INFO, GstDiscovererAudioInfo))
  86. #define GST_IS_DISCOVERER_AUDIO_INFO(obj) \
  87. (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_AUDIO_INFO))
  88. typedef struct _GstDiscovererAudioInfo GstDiscovererAudioInfo;
  89. typedef GObjectClass GstDiscovererAudioInfoClass;
  90. GType gst_discoverer_audio_info_get_type (void);
  91. guint gst_discoverer_audio_info_get_channels(const GstDiscovererAudioInfo* info);
  92. guint gst_discoverer_audio_info_get_sample_rate(const GstDiscovererAudioInfo* info);
  93. guint gst_discoverer_audio_info_get_depth(const GstDiscovererAudioInfo* info);
  94. guint gst_discoverer_audio_info_get_bitrate(const GstDiscovererAudioInfo* info);
  95. guint gst_discoverer_audio_info_get_max_bitrate(const GstDiscovererAudioInfo* info);
  96. const gchar * gst_discoverer_audio_info_get_language(const GstDiscovererAudioInfo* info);
  97. /**
  98. * GstDiscovererVideoInfo:
  99. *
  100. * #GstDiscovererStreamInfo specific to video streams (this includes images).
  101. */
  102. #define GST_TYPE_DISCOVERER_VIDEO_INFO \
  103. (gst_discoverer_video_info_get_type ())
  104. #define GST_DISCOVERER_VIDEO_INFO(obj) \
  105. (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_VIDEO_INFO, GstDiscovererVideoInfo))
  106. #define GST_IS_DISCOVERER_VIDEO_INFO(obj) \
  107. (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_VIDEO_INFO))
  108. typedef struct _GstDiscovererVideoInfo GstDiscovererVideoInfo;
  109. typedef GObjectClass GstDiscovererVideoInfoClass;
  110. GType gst_discoverer_video_info_get_type (void);
  111. guint gst_discoverer_video_info_get_width(const GstDiscovererVideoInfo* info);
  112. guint gst_discoverer_video_info_get_height(const GstDiscovererVideoInfo* info);
  113. guint gst_discoverer_video_info_get_depth(const GstDiscovererVideoInfo* info);
  114. guint gst_discoverer_video_info_get_framerate_num(const GstDiscovererVideoInfo* info);
  115. guint gst_discoverer_video_info_get_framerate_denom(const GstDiscovererVideoInfo* info);
  116. guint gst_discoverer_video_info_get_par_num(const GstDiscovererVideoInfo* info);
  117. guint gst_discoverer_video_info_get_par_denom(const GstDiscovererVideoInfo* info);
  118. gboolean gst_discoverer_video_info_is_interlaced(const GstDiscovererVideoInfo* info);
  119. guint gst_discoverer_video_info_get_bitrate(const GstDiscovererVideoInfo* info);
  120. guint gst_discoverer_video_info_get_max_bitrate(const GstDiscovererVideoInfo* info);
  121. gboolean gst_discoverer_video_info_is_image(const GstDiscovererVideoInfo* info);
  122. /**
  123. * GstDiscovererSubtitleInfo:
  124. *
  125. * #GstDiscovererStreamInfo specific to subtitle streams (this includes text and
  126. * image based ones).
  127. */
  128. #define GST_TYPE_DISCOVERER_SUBTITLE_INFO \
  129. (gst_discoverer_subtitle_info_get_type ())
  130. #define GST_DISCOVERER_SUBTITLE_INFO(obj) \
  131. (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_SUBTITLE_INFO, GstDiscovererSubtitleInfo))
  132. #define GST_IS_DISCOVERER_SUBTITLE_INFO(obj) \
  133. (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_SUBTITLE_INFO))
  134. typedef struct _GstDiscovererSubtitleInfo GstDiscovererSubtitleInfo;
  135. typedef GObjectClass GstDiscovererSubtitleInfoClass;
  136. GType gst_discoverer_subtitle_info_get_type (void);
  137. const gchar * gst_discoverer_subtitle_info_get_language(const GstDiscovererSubtitleInfo* info);
  138. /**
  139. * GstDiscovererResult:
  140. * @GST_DISCOVERER_OK: The discovery was successful
  141. * @GST_DISCOVERER_URI_INVALID: the URI is invalid
  142. * @GST_DISCOVERER_ERROR: an error happened and the GError is set
  143. * @GST_DISCOVERER_TIMEOUT: the discovery timed-out
  144. * @GST_DISCOVERER_BUSY: the discoverer was already discovering a file
  145. * @GST_DISCOVERER_MISSING_PLUGINS: Some plugins are missing for full discovery
  146. *
  147. * Result values for the discovery process.
  148. */
  149. typedef enum {
  150. GST_DISCOVERER_OK = 0,
  151. GST_DISCOVERER_URI_INVALID = 1,
  152. GST_DISCOVERER_ERROR = 2,
  153. GST_DISCOVERER_TIMEOUT = 3,
  154. GST_DISCOVERER_BUSY = 4,
  155. GST_DISCOVERER_MISSING_PLUGINS = 5
  156. } GstDiscovererResult;
  157. /**
  158. * GstDiscovererInfo:
  159. *
  160. * Structure containing the information of a URI analyzed by #GstDiscoverer.
  161. */
  162. typedef struct _GstDiscovererInfo GstDiscovererInfo;
  163. #define GST_TYPE_DISCOVERER_INFO \
  164. (gst_discoverer_info_get_type ())
  165. #define GST_DISCOVERER_INFO(obj) \
  166. (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_INFO, GstDiscovererInfo))
  167. #define GST_IS_DISCOVERER_INFO(obj) \
  168. (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_INFO))
  169. typedef GObjectClass GstDiscovererInfoClass;
  170. GType gst_discoverer_info_get_type (void);
  171. #define gst_discoverer_info_unref(info) (g_object_unref((GObject*)info))
  172. #define gst_discoverer_info_ref(info) (g_object_ref((GObject*)info))
  173. GstDiscovererInfo* gst_discoverer_info_copy (GstDiscovererInfo * ptr);
  174. const gchar* gst_discoverer_info_get_uri(const GstDiscovererInfo* info);
  175. GstDiscovererResult gst_discoverer_info_get_result(const GstDiscovererInfo* info);
  176. GstDiscovererStreamInfo* gst_discoverer_info_get_stream_info(GstDiscovererInfo* info);
  177. GList* gst_discoverer_info_get_stream_list(GstDiscovererInfo* info);
  178. GstClockTime gst_discoverer_info_get_duration(const GstDiscovererInfo* info);
  179. gboolean gst_discoverer_info_get_seekable(const GstDiscovererInfo* info);
  180. const GstStructure* gst_discoverer_info_get_misc(const GstDiscovererInfo* info);
  181. const GstTagList* gst_discoverer_info_get_tags(const GstDiscovererInfo* info);
  182. const GstToc* gst_discoverer_info_get_toc(const GstDiscovererInfo* info);
  183. const gchar** gst_discoverer_info_get_missing_elements_installer_details(const GstDiscovererInfo* info);
  184. GList * gst_discoverer_info_get_streams (GstDiscovererInfo *info,
  185. GType streamtype);
  186. GList * gst_discoverer_info_get_audio_streams (GstDiscovererInfo *info);
  187. GList * gst_discoverer_info_get_video_streams (GstDiscovererInfo *info);
  188. GList * gst_discoverer_info_get_subtitle_streams (GstDiscovererInfo *info);
  189. GList * gst_discoverer_info_get_container_streams (GstDiscovererInfo *info);
  190. void gst_discoverer_stream_info_list_free (GList *infos);
  191. #define GST_TYPE_DISCOVERER \
  192. (gst_discoverer_get_type())
  193. #define GST_DISCOVERER(obj) \
  194. (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER,GstDiscoverer))
  195. #define GST_DISCOVERER_CLASS(klass) \
  196. (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DISCOVERER,GstDiscovererClass))
  197. #define GST_IS_DISCOVERER(obj) \
  198. (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER))
  199. #define GST_IS_DISCOVERER_CLASS(klass) \
  200. (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DISCOVERER))
  201. typedef struct _GstDiscoverer GstDiscoverer;
  202. typedef struct _GstDiscovererClass GstDiscovererClass;
  203. typedef struct _GstDiscovererPrivate GstDiscovererPrivate;
  204. /**
  205. * GstDiscoverer:
  206. *
  207. * The #GstDiscoverer structure.
  208. **/
  209. struct _GstDiscoverer {
  210. GObject parent;
  211. /*< private >*/
  212. GstDiscovererPrivate *priv;
  213. gpointer _reserved[GST_PADDING];
  214. };
  215. struct _GstDiscovererClass {
  216. GObjectClass parentclass;
  217. /* signals */
  218. void (*finished) (GstDiscoverer *discoverer);
  219. void (*starting) (GstDiscoverer *discoverer);
  220. void (*discovered) (GstDiscoverer *discoverer,
  221. GstDiscovererInfo *info,
  222. const GError *err);
  223. void (*source_setup) (GstDiscoverer *discoverer,
  224. GstElement *source);
  225. gpointer _reserved[GST_PADDING];
  226. };
  227. GType gst_discoverer_get_type (void);
  228. GstDiscoverer *gst_discoverer_new (GstClockTime timeout, GError **err);
  229. /* Asynchronous API */
  230. void gst_discoverer_start (GstDiscoverer *discoverer);
  231. void gst_discoverer_stop (GstDiscoverer *discoverer);
  232. gboolean gst_discoverer_discover_uri_async (GstDiscoverer *discoverer,
  233. const gchar *uri);
  234. /* Synchronous API */
  235. GstDiscovererInfo *
  236. gst_discoverer_discover_uri (GstDiscoverer * discoverer,
  237. const gchar * uri,
  238. GError ** err);
  239. G_END_DECLS
  240. #endif /* _GST_DISCOVERER_H */