1/* GStreamer
2 *
3 * Copyright (C) 2014-2015 Sebastian Dröge <sebastian@centricular.com>
4 * Copyright (C) 2019-2020 Stephan Hesse <stephan@emliri.com>
5 * Copyright (C) 2020 Philippe Normand <philn@igalia.com>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef __GST_PLAY_H__
24#define __GST_PLAY_H__
25
26#include <gst/gst.h>
27#include <gst/video/video.h>
28#include <gst/play/play-prelude.h>
29#include <gst/play/gstplay-types.h>
30#include <gst/play/gstplay-video-renderer.h>
31#include <gst/play/gstplay-media-info.h>
32
33G_BEGIN_DECLS
34
35GST_PLAY_API
36GType gst_play_state_get_type (void);
37
38/**
39 * GST_TYPE_PLAY_STATE:
40 * Since: 1.20
41 */
42#define GST_TYPE_PLAY_STATE (gst_play_state_get_type ())
43
44GST_PLAY_API
45GType gst_play_message_get_type (void);
46
47/**
48 * GST_TYPE_PLAY_MESSAGE:
49 * Since: 1.20
50 */
51#define GST_TYPE_PLAY_MESSAGE (gst_play_message_get_type ())
52
53/**
54 * GstPlayState:
55 * @GST_PLAY_STATE_STOPPED: the play is stopped.
56 * @GST_PLAY_STATE_BUFFERING: the play is buffering.
57 * @GST_PLAY_STATE_PAUSED: the play is paused.
58 * @GST_PLAY_STATE_PLAYING: the play is currently playing a
59 * stream.
60 *
61 * Since: 1.20
62 */
63typedef enum
64{
65 GST_PLAY_STATE_STOPPED,
66 GST_PLAY_STATE_BUFFERING,
67 GST_PLAY_STATE_PAUSED,
68 GST_PLAY_STATE_PLAYING
69} GstPlayState;
70
71/**
72 * GstPlayMessage:
73 * @GST_PLAY_MESSAGE_URI_LOADED: Source element was initalized for set URI
74 * @GST_PLAY_MESSAGE_POSITION_UPDATED: Sink position changed
75 * @GST_PLAY_MESSAGE_DURATION_CHANGED: Duration of stream changed
76 * @GST_PLAY_MESSAGE_STATE_CHANGED: State changed, see #GstPlayState
77 * @GST_PLAY_MESSAGE_BUFFERING: Pipeline is in buffering state, message contains the percentage value of the decoding buffer
78 * @GST_PLAY_MESSAGE_END_OF_STREAM: Sink has received EOS
79 * @GST_PLAY_MESSAGE_ERROR: Message contains an error
80 * @GST_PLAY_MESSAGE_WARNING: Message contains an error
81 * @GST_PLAY_MESSAGE_VIDEO_DIMENSIONS_CHANGED: Video sink received format in different dimensions than before
82 * @GST_PLAY_MESSAGE_MEDIA_INFO_UPDATED: A media-info property has changed, message contains current #GstPlayMediaInfo
83 * @GST_PLAY_MESSAGE_VOLUME_CHANGED: The volume of the audio ouput has changed
84 * @GST_PLAY_MESSAGE_MUTE_CHANGED: Audio muting flag has been toggled
85 * @GST_PLAY_MESSAGE_SEEK_DONE: Any pending seeking operation has been completed
86 *
87 * Since: 1.20
88 *
89 * Types of messages that will be posted on the play API bus.
90 *
91 * See also #gst_play_get_message_bus()
92 *
93 */
94typedef enum
95{
96 GST_PLAY_MESSAGE_URI_LOADED,
97 GST_PLAY_MESSAGE_POSITION_UPDATED,
98 GST_PLAY_MESSAGE_DURATION_CHANGED,
99 GST_PLAY_MESSAGE_STATE_CHANGED,
100 GST_PLAY_MESSAGE_BUFFERING,
101 GST_PLAY_MESSAGE_END_OF_STREAM,
102 GST_PLAY_MESSAGE_ERROR,
103 GST_PLAY_MESSAGE_WARNING,
104 GST_PLAY_MESSAGE_VIDEO_DIMENSIONS_CHANGED,
105 GST_PLAY_MESSAGE_MEDIA_INFO_UPDATED,
106 GST_PLAY_MESSAGE_VOLUME_CHANGED,
107 GST_PLAY_MESSAGE_MUTE_CHANGED,
108 GST_PLAY_MESSAGE_SEEK_DONE
109} GstPlayMessage;
110
111GST_PLAY_API
112const gchar *gst_play_state_get_name (GstPlayState state);
113
114GST_PLAY_API
115const gchar *gst_play_message_get_name (GstPlayMessage message_type);
116
117GST_PLAY_API
118GQuark gst_play_error_quark (void);
119
120GST_PLAY_API
121GType gst_play_error_get_type (void);
122
123/**
124 * GST_PLAY_ERROR:
125 *
126 * Since: 1.20
127 */
128#define GST_PLAY_ERROR (gst_play_error_quark ())
129
130/**
131 * GST_TYPE_PLAY_ERROR:
132 *
133 * Since: 1.20
134 */
135#define GST_TYPE_PLAY_ERROR (gst_play_error_get_type ())
136
137/**
138 * GstPlayError:
139 * @GST_PLAY_ERROR_FAILED: generic error.
140 *
141 * Since: 1.20
142 */
143typedef enum {
144 GST_PLAY_ERROR_FAILED = 0
145} GstPlayError;
146
147GST_PLAY_API
148const gchar *gst_play_error_get_name (GstPlayError error);
149
150GST_PLAY_API
151GType gst_play_color_balance_type_get_type (void);
152
153/**
154 * GST_TYPE_PLAY_COLOR_BALANCE_TYPE:
155 *
156 * Since: 1.20
157 */
158#define GST_TYPE_PLAY_COLOR_BALANCE_TYPE (gst_play_color_balance_type_get_type ())
159
160/**
161 * GstPlayColorBalanceType:
162 * @GST_PLAY_COLOR_BALANCE_BRIGHTNESS: brightness or black level.
163 * @GST_PLAY_COLOR_BALANCE_CONTRAST: contrast or luma gain.
164 * @GST_PLAY_COLOR_BALANCE_SATURATION: color saturation or chroma
165 * gain.
166 * @GST_PLAY_COLOR_BALANCE_HUE: hue or color balance.
167 *
168 * Since: 1.20
169 */
170typedef enum
171{
172 GST_PLAY_COLOR_BALANCE_BRIGHTNESS,
173 GST_PLAY_COLOR_BALANCE_CONTRAST,
174 GST_PLAY_COLOR_BALANCE_SATURATION,
175 GST_PLAY_COLOR_BALANCE_HUE,
176} GstPlayColorBalanceType;
177
178GST_PLAY_API
179const gchar *gst_play_color_balance_type_get_name (GstPlayColorBalanceType type);
180
181#define GST_TYPE_PLAY (gst_play_get_type ())
182#define GST_IS_PLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAY))
183#define GST_IS_PLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAY))
184#define GST_PLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLAY, GstPlayClass))
185#define GST_PLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAY, GstPlay))
186#define GST_PLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAY, GstPlayClass))
187
188/**
189 * GST_PLAY_CAST:
190 * Since: 1.20
191 */
192#define GST_PLAY_CAST(obj) ((GstPlay*)(obj))
193
194#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
195G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPlay, gst_object_unref)
196#endif
197
198GST_PLAY_API
199GType gst_play_get_type (void);
200
201GST_PLAY_API
202GstPlay * gst_play_new (GstPlayVideoRenderer * video_renderer);
203
204GST_PLAY_API
205GstBus * gst_play_get_message_bus (GstPlay * play);
206
207GST_PLAY_API
208void gst_play_play (GstPlay * play);
209
210GST_PLAY_API
211void gst_play_pause (GstPlay * play);
212
213GST_PLAY_API
214void gst_play_stop (GstPlay * play);
215
216GST_PLAY_API
217void gst_play_seek (GstPlay * play,
218 GstClockTime position);
219
220GST_PLAY_API
221void gst_play_set_rate (GstPlay * play,
222 gdouble rate);
223
224GST_PLAY_API
225gdouble gst_play_get_rate (GstPlay * play);
226
227GST_PLAY_API
228gchar * gst_play_get_uri (GstPlay * play);
229
230GST_PLAY_API
231void gst_play_set_uri (GstPlay * play,
232 const gchar * uri);
233
234GST_PLAY_API
235gchar * gst_play_get_subtitle_uri (GstPlay * play);
236
237GST_PLAY_API
238void gst_play_set_subtitle_uri (GstPlay * play,
239 const gchar *uri);
240
241GST_PLAY_API
242GstClockTime gst_play_get_position (GstPlay * play);
243
244GST_PLAY_API
245GstClockTime gst_play_get_duration (GstPlay * play);
246
247GST_PLAY_API
248gdouble gst_play_get_volume (GstPlay * play);
249
250GST_PLAY_API
251void gst_play_set_volume (GstPlay * play,
252 gdouble val);
253
254GST_PLAY_API
255gboolean gst_play_get_mute (GstPlay * play);
256
257GST_PLAY_API
258void gst_play_set_mute (GstPlay * play,
259 gboolean val);
260
261GST_PLAY_API
262GstElement * gst_play_get_pipeline (GstPlay * play);
263
264GST_PLAY_API
265void gst_play_set_video_track_enabled (GstPlay * play,
266 gboolean enabled);
267
268GST_PLAY_API
269void gst_play_set_audio_track_enabled (GstPlay * play,
270 gboolean enabled);
271
272GST_PLAY_API
273void gst_play_set_subtitle_track_enabled (GstPlay * play,
274 gboolean enabled);
275
276GST_PLAY_API
277gboolean gst_play_set_audio_track (GstPlay *play,
278 gint stream_index);
279
280GST_PLAY_API
281gboolean gst_play_set_video_track (GstPlay *play,
282 gint stream_index);
283
284GST_PLAY_API
285gboolean gst_play_set_subtitle_track (GstPlay *play,
286 gint stream_index);
287
288GST_PLAY_API
289GstPlayMediaInfo * gst_play_get_media_info (GstPlay * play);
290
291GST_PLAY_API
292GstPlayAudioInfo * gst_play_get_current_audio_track (GstPlay * play);
293
294GST_PLAY_API
295GstPlayVideoInfo * gst_play_get_current_video_track (GstPlay * play);
296
297GST_PLAY_API
298GstPlaySubtitleInfo * gst_play_get_current_subtitle_track (GstPlay * play);
299
300GST_PLAY_API
301gboolean gst_play_set_visualization (GstPlay * play,
302 const gchar *name);
303
304GST_PLAY_API
305void gst_play_set_visualization_enabled (GstPlay * play,
306 gboolean enabled);
307
308GST_PLAY_API
309gchar * gst_play_get_current_visualization (GstPlay * play);
310
311GST_PLAY_API
312gboolean gst_play_has_color_balance (GstPlay * play);
313
314GST_PLAY_API
315void gst_play_set_color_balance (GstPlay * play,
316 GstPlayColorBalanceType type,
317 gdouble value);
318
319GST_PLAY_API
320gdouble gst_play_get_color_balance (GstPlay * play,
321 GstPlayColorBalanceType type);
322
323
324GST_PLAY_API
325GstVideoMultiviewFramePacking gst_play_get_multiview_mode (GstPlay * play);
326
327GST_PLAY_API
328void gst_play_set_multiview_mode (GstPlay * play,
329 GstVideoMultiviewFramePacking mode);
330
331GST_PLAY_API
332GstVideoMultiviewFlags gst_play_get_multiview_flags (GstPlay * play);
333
334GST_PLAY_API
335void gst_play_set_multiview_flags (GstPlay * play,
336 GstVideoMultiviewFlags flags);
337
338GST_PLAY_API
339gint64 gst_play_get_audio_video_offset (GstPlay * play);
340
341GST_PLAY_API
342void gst_play_set_audio_video_offset (GstPlay * play,
343 gint64 offset);
344
345GST_PLAY_API
346gint64 gst_play_get_subtitle_video_offset (GstPlay * play);
347
348GST_PLAY_API
349void gst_play_set_subtitle_video_offset (GstPlay * play,
350 gint64 offset);
351
352GST_PLAY_API
353gboolean gst_play_set_config (GstPlay * play,
354 GstStructure * config);
355
356GST_PLAY_API
357GstStructure * gst_play_get_config (GstPlay * play);
358
359/* helpers for configuring the config structure */
360
361GST_PLAY_API
362void gst_play_config_set_user_agent (GstStructure * config,
363 const gchar * agent);
364
365GST_PLAY_API
366gchar * gst_play_config_get_user_agent (const GstStructure * config);
367
368GST_PLAY_API
369void gst_play_config_set_position_update_interval (GstStructure * config,
370 guint interval);
371
372GST_PLAY_API
373guint gst_play_config_get_position_update_interval (const GstStructure * config);
374
375GST_PLAY_API
376void gst_play_config_set_seek_accurate (GstStructure * config, gboolean accurate);
377
378GST_PLAY_API
379gboolean gst_play_config_get_seek_accurate (const GstStructure * config);
380
381/**
382 * GstPlaySnapshotFormat:
383 * @GST_PLAY_THUMBNAIL_RAW_NATIVE: raw native format.
384 * @GST_PLAY_THUMBNAIL_RAW_xRGB: raw xRGB format.
385 * @GST_PLAY_THUMBNAIL_RAW_BGRx: raw BGRx format.
386 * @GST_PLAY_THUMBNAIL_JPG: jpeg format.
387 * @GST_PLAY_THUMBNAIL_PNG: png format.
388 *
389 * Since: 1.20
390 */
391typedef enum
392{
393 GST_PLAY_THUMBNAIL_RAW_NATIVE = 0,
394 GST_PLAY_THUMBNAIL_RAW_xRGB,
395 GST_PLAY_THUMBNAIL_RAW_BGRx,
396 GST_PLAY_THUMBNAIL_JPG,
397 GST_PLAY_THUMBNAIL_PNG
398} GstPlaySnapshotFormat;
399
400GST_PLAY_API
401GstSample * gst_play_get_video_snapshot (GstPlay * play,
402 GstPlaySnapshotFormat format, const GstStructure * config);
403
404GST_PLAY_API
405gboolean gst_play_is_play_message (GstMessage *msg);
406
407GST_PLAY_API
408void gst_play_message_parse_type (GstMessage *msg, GstPlayMessage *type);
409
410GST_PLAY_API
411void gst_play_message_parse_duration_updated (GstMessage *msg, GstClockTime *duration);
412
413GST_PLAY_API
414void gst_play_message_parse_position_updated (GstMessage *msg, GstClockTime *position);
415
416GST_PLAY_API
417void gst_play_message_parse_state_changed (GstMessage *msg, GstPlayState *state);
418
419GST_PLAY_API
420void gst_play_message_parse_buffering_percent (GstMessage *msg, guint *percent);
421
422GST_PLAY_API
423void gst_play_message_parse_error (GstMessage *msg, GError **error, GstStructure **details);
424
425GST_PLAY_API
426void gst_play_message_parse_warning (GstMessage *msg, GError **error, GstStructure **details);
427
428GST_PLAY_API
429void gst_play_message_parse_video_dimensions_changed (GstMessage *msg, guint *width, guint *height);
430
431GST_PLAY_API
432void gst_play_message_parse_media_info_updated (GstMessage *msg, GstPlayMediaInfo **info);
433
434GST_PLAY_API
435void gst_play_message_parse_volume_changed (GstMessage *msg, gdouble *volume);
436
437GST_PLAY_API
438void gst_play_message_parse_muted_changed (GstMessage *msg, gboolean *muted);
439
440G_END_DECLS
441
442#endif /* __GST_PLAY_H__ */
443

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of include/gstreamer-1.0/gst/play/gstplay.h