1 /* GStreamer
2  *
3  * Copyright (C) 2015 Brijesh Singh <brijesh.ksingh@gmail.com>
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 
21 #ifndef __GST_PLAYER_MEDIA_INFO_H__
22 #define __GST_PLAYER_MEDIA_INFO_H__
23 
24 #include <gst/gst.h>
25 #include <gst/player/player-prelude.h>
26 
27 G_BEGIN_DECLS
28 
29 #define GST_TYPE_PLAYER_STREAM_INFO \
30   (gst_player_stream_info_get_type ())
31 #define GST_PLAYER_STREAM_INFO(obj) \
32   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAYER_STREAM_INFO,GstPlayerStreamInfo))
33 #define GST_PLAYER_STREAM_INFO_CLASS(klass) \
34   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAYER_STREAM_INFO,GstPlayerStreamInfo))
35 #define GST_IS_PLAYER_STREAM_INFO(obj) \
36   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAYER_STREAM_INFO))
37 #define GST_IS_PLAYER_STREAM_INFO_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAYER_STREAM_INFO))
39 
40 /**
41  * GstPlayerStreamInfo:
42  *
43  * Base structure for information concering a media stream. Depending on
44  * the stream type, one can find more media-specific information in
45  * #GstPlayerVideoInfo, #GstPlayerAudioInfo, #GstPlayerSubtitleInfo.
46  */
47 typedef struct _GstPlayerStreamInfo GstPlayerStreamInfo;
48 typedef struct _GstPlayerStreamInfoClass GstPlayerStreamInfoClass;
49 
50 GST_PLAYER_API
51 GType         gst_player_stream_info_get_type (void);
52 
53 GST_PLAYER_API
54 gint          gst_player_stream_info_get_index (const GstPlayerStreamInfo *info);
55 
56 GST_PLAYER_API
57 const gchar*  gst_player_stream_info_get_stream_type (const GstPlayerStreamInfo *info);
58 
59 GST_PLAYER_API
60 GstTagList*   gst_player_stream_info_get_tags  (const GstPlayerStreamInfo *info);
61 
62 GST_PLAYER_API
63 GstCaps*      gst_player_stream_info_get_caps  (const GstPlayerStreamInfo *info);
64 
65 GST_PLAYER_API
66 const gchar*  gst_player_stream_info_get_codec (const GstPlayerStreamInfo *info);
67 
68 #define GST_TYPE_PLAYER_VIDEO_INFO \
69   (gst_player_video_info_get_type ())
70 #define GST_PLAYER_VIDEO_INFO(obj) \
71   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAYER_VIDEO_INFO, GstPlayerVideoInfo))
72 #define GST_PLAYER_VIDEO_INFO_CLASS(klass) \
73   (G_TYPE_CHECK_CLASS_CAST((obj),GST_TYPE_PLAYER_VIDEO_INFO, GstPlayerVideoInfoClass))
74 #define GST_IS_PLAYER_VIDEO_INFO(obj) \
75   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAYER_VIDEO_INFO))
76 #define GST_IS_PLAYER_VIDEO_INFO_CLASS(klass) \
77   (G_TYPE_CHECK_CLASS_TYPE((obj),GST_TYPE_PLAYER_VIDEO_INFO))
78 
79 /**
80  * GstPlayerVideoInfo:
81  *
82  * #GstPlayerStreamInfo specific to video streams.
83  */
84 typedef struct _GstPlayerVideoInfo GstPlayerVideoInfo;
85 typedef struct _GstPlayerVideoInfoClass GstPlayerVideoInfoClass;
86 
87 GST_PLAYER_API
88 GType         gst_player_video_info_get_type (void);
89 
90 GST_PLAYER_API
91 gint          gst_player_video_info_get_bitrate     (const GstPlayerVideoInfo * info);
92 
93 GST_PLAYER_API
94 gint          gst_player_video_info_get_max_bitrate (const GstPlayerVideoInfo * info);
95 
96 GST_PLAYER_API
97 gint          gst_player_video_info_get_width       (const GstPlayerVideoInfo * info);
98 
99 GST_PLAYER_API
100 gint          gst_player_video_info_get_height      (const GstPlayerVideoInfo * info);
101 
102 GST_PLAYER_API
103 void          gst_player_video_info_get_framerate   (const GstPlayerVideoInfo * info,
104                                                      gint * fps_n,
105                                                      gint * fps_d);
106 
107 GST_PLAYER_API
108 void          gst_player_video_info_get_pixel_aspect_ratio (const GstPlayerVideoInfo * info,
109                                                             guint * par_n,
110                                                             guint * par_d);
111 
112 #define GST_TYPE_PLAYER_AUDIO_INFO \
113   (gst_player_audio_info_get_type ())
114 #define GST_PLAYER_AUDIO_INFO(obj) \
115   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAYER_AUDIO_INFO, GstPlayerAudioInfo))
116 #define GST_PLAYER_AUDIO_INFO_CLASS(klass) \
117   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAYER_AUDIO_INFO, GstPlayerAudioInfoClass))
118 #define GST_IS_PLAYER_AUDIO_INFO(obj) \
119   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAYER_AUDIO_INFO))
120 #define GST_IS_PLAYER_AUDIO_INFO_CLASS(klass) \
121   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAYER_AUDIO_INFO))
122 
123 /**
124  * GstPlayerAudioInfo:
125  *
126  * #GstPlayerStreamInfo specific to audio streams.
127  */
128 typedef struct _GstPlayerAudioInfo GstPlayerAudioInfo;
129 typedef struct _GstPlayerAudioInfoClass GstPlayerAudioInfoClass;
130 
131 GST_PLAYER_API
132 GType         gst_player_audio_info_get_type (void);
133 
134 GST_PLAYER_API
135 gint          gst_player_audio_info_get_channels    (const GstPlayerAudioInfo* info);
136 
137 GST_PLAYER_API
138 gint          gst_player_audio_info_get_sample_rate (const GstPlayerAudioInfo* info);
139 
140 GST_PLAYER_API
141 gint          gst_player_audio_info_get_bitrate     (const GstPlayerAudioInfo* info);
142 
143 GST_PLAYER_API
144 gint          gst_player_audio_info_get_max_bitrate (const GstPlayerAudioInfo* info);
145 
146 GST_PLAYER_API
147 const gchar*  gst_player_audio_info_get_language    (const GstPlayerAudioInfo* info);
148 
149 #define GST_TYPE_PLAYER_SUBTITLE_INFO \
150   (gst_player_subtitle_info_get_type ())
151 #define GST_PLAYER_SUBTITLE_INFO(obj) \
152   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAYER_SUBTITLE_INFO, GstPlayerSubtitleInfo))
153 #define GST_PLAYER_SUBTITLE_INFO_CLASS(klass) \
154   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAYER_SUBTITLE_INFO,GstPlayerSubtitleInfoClass))
155 #define GST_IS_PLAYER_SUBTITLE_INFO(obj) \
156   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAYER_SUBTITLE_INFO))
157 #define GST_IS_PLAYER_SUBTITLE_INFO_CLASS(klass) \
158   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAYER_SUBTITLE_INFO))
159 
160 /**
161  * GstPlayerSubtitleInfo:
162  *
163  * #GstPlayerStreamInfo specific to subtitle streams.
164  */
165 typedef struct _GstPlayerSubtitleInfo GstPlayerSubtitleInfo;
166 typedef struct _GstPlayerSubtitleInfoClass GstPlayerSubtitleInfoClass;
167 
168 GST_PLAYER_API
169 GType         gst_player_subtitle_info_get_type (void);
170 
171 GST_PLAYER_API
172 const gchar * gst_player_subtitle_info_get_language (const GstPlayerSubtitleInfo* info);
173 
174 #define GST_TYPE_PLAYER_MEDIA_INFO \
175   (gst_player_media_info_get_type())
176 #define GST_PLAYER_MEDIA_INFO(obj) \
177   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAYER_MEDIA_INFO,GstPlayerMediaInfo))
178 #define GST_PLAYER_MEDIA_INFO_CLASS(klass) \
179   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAYER_MEDIA_INFO,GstPlayerMediaInfoClass))
180 #define GST_IS_PLAYER_MEDIA_INFO(obj) \
181   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAYER_MEDIA_INFO))
182 #define GST_IS_PLAYER_MEDIA_INFO_CLASS(klass) \
183   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAYER_MEDIA_INFO))
184 
185 /**
186  * GstPlayerMediaInfo:
187  *
188  * Structure containing the media information of a URI.
189  */
190 typedef struct _GstPlayerMediaInfo GstPlayerMediaInfo;
191 typedef struct _GstPlayerMediaInfoClass GstPlayerMediaInfoClass;
192 
193 GST_PLAYER_API
194 GType         gst_player_media_info_get_type (void);
195 
196 GST_PLAYER_API
197 const gchar * gst_player_media_info_get_uri (const GstPlayerMediaInfo *info);
198 
199 GST_PLAYER_API
200 gboolean      gst_player_media_info_is_seekable (const GstPlayerMediaInfo *info);
201 
202 GST_PLAYER_API
203 gboolean      gst_player_media_info_is_live (const GstPlayerMediaInfo *info);
204 
205 GST_PLAYER_API
206 GstClockTime  gst_player_media_info_get_duration (const GstPlayerMediaInfo *info);
207 
208 GST_PLAYER_API
209 GList*        gst_player_media_info_get_stream_list (const GstPlayerMediaInfo *info);
210 
211 GST_PLAYER_API
212 guint         gst_player_media_info_get_number_of_streams (const GstPlayerMediaInfo *info);
213 
214 GST_PLAYER_API
215 GList*        gst_player_media_info_get_video_streams (const GstPlayerMediaInfo *info);
216 
217 GST_PLAYER_API
218 guint         gst_player_media_info_get_number_of_video_streams (const GstPlayerMediaInfo *info);
219 
220 GST_PLAYER_API
221 GList*        gst_player_media_info_get_audio_streams (const GstPlayerMediaInfo *info);
222 
223 GST_PLAYER_API
224 guint         gst_player_media_info_get_number_of_audio_streams (const GstPlayerMediaInfo *info);
225 
226 GST_PLAYER_API
227 GList*        gst_player_media_info_get_subtitle_streams (const GstPlayerMediaInfo *info);
228 
229 GST_PLAYER_API
230 guint         gst_player_media_info_get_number_of_subtitle_streams (const GstPlayerMediaInfo *info);
231 
232 GST_PLAYER_API
233 GstTagList*   gst_player_media_info_get_tags (const GstPlayerMediaInfo *info);
234 
235 GST_PLAYER_API
236 const gchar*  gst_player_media_info_get_title (const GstPlayerMediaInfo *info);
237 
238 GST_PLAYER_API
239 const gchar*  gst_player_media_info_get_container_format (const GstPlayerMediaInfo *info);
240 
241 GST_PLAYER_API
242 GstSample*    gst_player_media_info_get_image_sample (const GstPlayerMediaInfo *info);
243 
244 GST_PLAYER_DEPRECATED_FOR(gst_player_media_info_get_video_streams)
245 GList*        gst_player_get_video_streams    (const GstPlayerMediaInfo *info);
246 
247 GST_PLAYER_DEPRECATED_FOR(gst_player_media_info_get_audio_streams)
248 GList*        gst_player_get_audio_streams    (const GstPlayerMediaInfo *info);
249 
250 GST_PLAYER_DEPRECATED_FOR(gst_player_media_info_get_subtitle_streams)
251 GList*        gst_player_get_subtitle_streams (const GstPlayerMediaInfo *info);
252 
253 G_END_DECLS
254 
255 #endif /* __GST_PLAYER_MEDIA_INFO_H */
256