Debian Codegraph @

gst-libs/gst/play/gstplay.h

raw symbols SCIP
1 /* GStreamer
2 *
3 * Copyright (C) 2014-2015 Sebastian Dröge <[email protected]>
4 * Copyright (C) 2019-2020 Stephan Hesse <[email protected]>
5 * Copyright (C) 2020 Philippe Normand <[email protected]>
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
33 G_BEGIN_DECLS
34
35 GST_PLAY_API
36 GType 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
44 GST_PLAY_API
45 GType 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 GST_PLAY_API
54 GType gst_play_loop_get_type (void);
55
56 /**
57 * GST_TYPE_PLAY_LOOP:
58 * Since: 1.28
59 */
60 #define GST_TYPE_PLAY_LOOP (gst_play_loop_get_type ())
61
62 /**
63 * GstPlayState:
64 * @GST_PLAY_STATE_STOPPED: the play is stopped.
65 * @GST_PLAY_STATE_BUFFERING: the play is buffering.
66 * @GST_PLAY_STATE_PAUSED: the play is paused.
67 * @GST_PLAY_STATE_PLAYING: the play is currently playing a
68 * stream.
69 *
70 * Since: 1.20
71 */
72 typedef enum
73 {
74 GST_PLAY_STATE_STOPPED,
75 GST_PLAY_STATE_BUFFERING,
76 GST_PLAY_STATE_PAUSED,
77 GST_PLAY_STATE_PLAYING
78 } GstPlayState;
79
80 /**
81 * GstPlayMessage:
82 * @GST_PLAY_MESSAGE_URI_LOADED: Source element was initalized for set URI
83 * @GST_PLAY_MESSAGE_POSITION_UPDATED: Sink position changed
84 * @GST_PLAY_MESSAGE_DURATION_CHANGED: Duration of stream changed
85 * @GST_PLAY_MESSAGE_STATE_CHANGED: State changed, see #GstPlayState
86 * @GST_PLAY_MESSAGE_BUFFERING: Pipeline is in buffering state, message contains the percentage value of the decoding buffer
87 * @GST_PLAY_MESSAGE_END_OF_STREAM: Sink has received EOS
88 * @GST_PLAY_MESSAGE_ERROR: Message contains an error
89 * @GST_PLAY_MESSAGE_WARNING: Message contains an error
90 * @GST_PLAY_MESSAGE_VIDEO_DIMENSIONS_CHANGED: Video sink received format in different dimensions than before
91 * @GST_PLAY_MESSAGE_MEDIA_INFO_UPDATED: A media-info property has changed, message contains current #GstPlayMediaInfo
92 * @GST_PLAY_MESSAGE_VOLUME_CHANGED: The volume of the audio ouput has changed
93 * @GST_PLAY_MESSAGE_MUTE_CHANGED: Audio muting flag has been toggled
94 * @GST_PLAY_MESSAGE_SEEK_DONE: Any pending seeking operation has been completed
95 *
96 * Since: 1.20
97 *
98 * Types of messages that will be posted on the play API bus.
99 *
100 * See also #gst_play_get_message_bus()
101 *
102 */
103 typedef enum
104 {
105 GST_PLAY_MESSAGE_URI_LOADED,
106 GST_PLAY_MESSAGE_POSITION_UPDATED,
107 GST_PLAY_MESSAGE_DURATION_CHANGED,
108 GST_PLAY_MESSAGE_STATE_CHANGED,
109 GST_PLAY_MESSAGE_BUFFERING,
110 GST_PLAY_MESSAGE_END_OF_STREAM,
111 GST_PLAY_MESSAGE_ERROR,
112 GST_PLAY_MESSAGE_WARNING,
113 GST_PLAY_MESSAGE_VIDEO_DIMENSIONS_CHANGED,
114 GST_PLAY_MESSAGE_MEDIA_INFO_UPDATED,
115 GST_PLAY_MESSAGE_VOLUME_CHANGED,
116 GST_PLAY_MESSAGE_MUTE_CHANGED,
117 GST_PLAY_MESSAGE_SEEK_DONE
118 } GstPlayMessage;
119
120 /**
121 * GstPlayLoop:
122 * @GST_PLAY_LOOP_NONE: Don't loop.
123 * @GST_PLAY_LOOP_TRACK: Loop over the current track.
124 *
125 * Since: 1.28
126 */
127 typedef enum
128 {
129 GST_PLAY_LOOP_NONE,
130 GST_PLAY_LOOP_TRACK,
131 } GstPlayLoop;
132
133 GST_PLAY_API
134 const gchar *gst_play_state_get_name (GstPlayState state);
135
136 GST_PLAY_API
137 const gchar *gst_play_message_get_name (GstPlayMessage message_type);
138
139 GST_PLAY_API
140 const gchar *gst_play_loop_get_name (GstPlayLoop loop);
141
142 GST_PLAY_API
143 GQuark gst_play_error_quark (void);
144
145 GST_PLAY_API
146 GType gst_play_error_get_type (void);
147
148 /**
149 * GST_PLAY_ERROR:
150 *
151 * Since: 1.20
152 */
153 #define GST_PLAY_ERROR (gst_play_error_quark ())
154
155 /**
156 * GST_TYPE_PLAY_ERROR:
157 *
158 * Since: 1.20
159 */
160 #define GST_TYPE_PLAY_ERROR (gst_play_error_get_type ())
161
162 /**
163 * GstPlayError:
164 * @GST_PLAY_ERROR_FAILED: generic error.
165 * @GST_PLAY_ERROR_MISSING_PLUGIN: playback requires additional plugins (Since: 1.26).
166 *
167 * Since: 1.20
168 */
169 typedef enum {
170 GST_PLAY_ERROR_FAILED = 0,
171
172 /**
173 * GST_PLAY_ERROR_MISSING_PLUGIN:
174 *
175 * Playback requires additional plugins. Information about the missing
176 * plugins can be retrieved from the message details.
177 *
178 * The details will contain the the missing plugin details in a field of
179 * type %GstArray named "missing-plugin-details". This array will contain
180 * %GstStructure with string "description" and a string "installer-details".
181 *
182 * The "installer-details" can be passed to gst_install_plugins_async().
183 *
184 * Since: 1.26
185 */
186 GST_PLAY_ERROR_MISSING_PLUGIN
187 } GstPlayError;
188
189 GST_PLAY_API
190 const gchar *gst_play_error_get_name (GstPlayError error);
191
192 GST_PLAY_API
193 GType gst_play_color_balance_type_get_type (void);
194
195 /**
196 * GST_TYPE_PLAY_COLOR_BALANCE_TYPE:
197 *
198 * Since: 1.20
199 */
200 #define GST_TYPE_PLAY_COLOR_BALANCE_TYPE (gst_play_color_balance_type_get_type ())
201
202 /**
203 * GstPlayColorBalanceType:
204 * @GST_PLAY_COLOR_BALANCE_BRIGHTNESS: brightness or black level.
205 * @GST_PLAY_COLOR_BALANCE_CONTRAST: contrast or luma gain.
206 * @GST_PLAY_COLOR_BALANCE_SATURATION: color saturation or chroma
207 * gain.
208 * @GST_PLAY_COLOR_BALANCE_HUE: hue or color balance.
209 *
210 * Since: 1.20
211 */
212 typedef enum
213 {
214 GST_PLAY_COLOR_BALANCE_BRIGHTNESS,
215 GST_PLAY_COLOR_BALANCE_CONTRAST,
216 GST_PLAY_COLOR_BALANCE_SATURATION,
217 GST_PLAY_COLOR_BALANCE_HUE,
218 } GstPlayColorBalanceType;
219
220 GST_PLAY_API
221 const gchar *gst_play_color_balance_type_get_name (GstPlayColorBalanceType type);
222
223 #define GST_TYPE_PLAY (gst_play_get_type ())
224 #define GST_IS_PLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAY))
225 #define GST_IS_PLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAY))
226 #define GST_PLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLAY, GstPlayClass))
227 #define GST_PLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAY, GstPlay))
228 #define GST_PLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAY, GstPlayClass))
229
230 /**
231 * GST_PLAY_CAST:
232 * Since: 1.20
233 */
234 #define GST_PLAY_CAST(obj) ((GstPlay*)(obj))
235
236 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
237 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPlay, gst_object_unref)
238 #endif
239
240 GST_PLAY_API
241 GType gst_play_get_type (void);
242
243 GST_PLAY_API
244 GstPlay * gst_play_new (GstPlayVideoRenderer * video_renderer) G_GNUC_WARN_UNUSED_RESULT;
245
246 GST_PLAY_API
247 GstBus * gst_play_get_message_bus (GstPlay * play) G_GNUC_WARN_UNUSED_RESULT;
248
249 GST_PLAY_API
250 void gst_play_play (GstPlay * play);
251
252 GST_PLAY_API
253 void gst_play_pause (GstPlay * play);
254
255 GST_PLAY_API
256 void gst_play_stop (GstPlay * play);
257
258 GST_PLAY_API
259 void gst_play_seek (GstPlay * play,
260 GstClockTime position);
261
262 GST_PLAY_API
263 void gst_play_set_rate (GstPlay * play,
264 gdouble rate);
265
266 GST_PLAY_API
267 gdouble gst_play_get_rate (GstPlay * play);
268
269 GST_PLAY_API
270 gchar * gst_play_get_uri (GstPlay * play) G_GNUC_WARN_UNUSED_RESULT;
271
272 GST_PLAY_API
273 void gst_play_set_uri (GstPlay * play,
274 const gchar * uri);
275
276 GST_PLAY_API
277 gchar * gst_play_get_subtitle_uri (GstPlay * play) G_GNUC_WARN_UNUSED_RESULT;
278
279 GST_PLAY_API
280 void gst_play_set_subtitle_uri (GstPlay * play,
281 const gchar *uri);
282
283 GST_PLAY_API
284 GstClockTime gst_play_get_position (GstPlay * play);
285
286 GST_PLAY_API
287 GstClockTime gst_play_get_duration (GstPlay * play);
288
289 GST_PLAY_API
290 gdouble gst_play_get_volume (GstPlay * play);
291
292 GST_PLAY_API
293 void gst_play_set_volume (GstPlay * play,
294 gdouble val);
295
296 GST_PLAY_API
297 gboolean gst_play_get_mute (GstPlay * play);
298
299 GST_PLAY_API
300 void gst_play_set_mute (GstPlay * play,
301 gboolean val);
302
303 GST_PLAY_API
304 GstElement * gst_play_get_pipeline (GstPlay * play) G_GNUC_WARN_UNUSED_RESULT;
305
306 GST_PLAY_API
307 void gst_play_set_video_track_enabled (GstPlay * play,
308 gboolean enabled);
309
310 GST_PLAY_API
311 void gst_play_set_audio_track_enabled (GstPlay * play,
312 gboolean enabled);
313
314 GST_PLAY_API
315 void gst_play_set_subtitle_track_enabled (GstPlay * play,
316 gboolean enabled);
317
318 GST_PLAY_DEPRECATED_FOR(gst_play_set_audio_track_id)
319 gboolean gst_play_set_audio_track (GstPlay *play,
320 gint stream_index);
321
322 GST_PLAY_DEPRECATED_FOR(gst_play_set_video_track_id)
323 gboolean gst_play_set_video_track (GstPlay *play,
324 gint stream_index);
325
326 GST_PLAY_DEPRECATED_FOR(gst_play_set_subtitle_track_id)
327 gboolean gst_play_set_subtitle_track (GstPlay *play,
328 gint stream_index);
329 GST_PLAY_API
330 gboolean gst_play_set_audio_track_id (GstPlay *play,
331 const gchar *stream_id);
332
333 GST_PLAY_API
334 gboolean gst_play_set_video_track_id (GstPlay *play,
335 const gchar *stream_id);
336
337 GST_PLAY_API
338 gboolean gst_play_set_subtitle_track_id (GstPlay *play,
339 const gchar *stream_id);
340
341 GST_PLAY_API
342 gboolean gst_play_set_track_ids (GstPlay *play,
343 const gchar *audio_stream_id,
344 const gchar *video_stream_id,
345 const gchar *subtitle_stream_id);
346
347 GST_PLAY_API
348 GstPlayMediaInfo * gst_play_get_media_info (GstPlay * play) G_GNUC_WARN_UNUSED_RESULT;
349
350 GST_PLAY_API
351 GstPlayAudioInfo * gst_play_get_current_audio_track (GstPlay * play) G_GNUC_WARN_UNUSED_RESULT;
352
353 GST_PLAY_API
354 GstPlayVideoInfo * gst_play_get_current_video_track (GstPlay * play) G_GNUC_WARN_UNUSED_RESULT;
355
356 GST_PLAY_API
357 GstPlaySubtitleInfo * gst_play_get_current_subtitle_track (GstPlay * play) G_GNUC_WARN_UNUSED_RESULT;
358
359 GST_PLAY_API
360 gboolean gst_play_set_visualization (GstPlay * play,
361 const gchar *name);
362
363 GST_PLAY_API
364 void gst_play_set_visualization_enabled (GstPlay * play,
365 gboolean enabled);
366
367 GST_PLAY_API
368 gchar * gst_play_get_current_visualization (GstPlay * play) G_GNUC_WARN_UNUSED_RESULT;
369
370 GST_PLAY_API
371 gboolean gst_play_has_color_balance (GstPlay * play);
372
373 GST_PLAY_API
374 void gst_play_set_color_balance (GstPlay * play,
375 GstPlayColorBalanceType type,
376 gdouble value);
377
378 GST_PLAY_API
379 gdouble gst_play_get_color_balance (GstPlay * play,
380 GstPlayColorBalanceType type);
381
382
383 GST_PLAY_API
384 GstVideoMultiviewFramePacking gst_play_get_multiview_mode (GstPlay * play);
385
386 GST_PLAY_API
387 void gst_play_set_multiview_mode (GstPlay * play,
388 GstVideoMultiviewFramePacking mode);
389
390 GST_PLAY_API
391 GstVideoMultiviewFlags gst_play_get_multiview_flags (GstPlay * play);
392
393 GST_PLAY_API
394 void gst_play_set_multiview_flags (GstPlay * play,
395 GstVideoMultiviewFlags flags);
396
397 GST_PLAY_API
398 gint64 gst_play_get_audio_video_offset (GstPlay * play);
399
400 GST_PLAY_API
401 void gst_play_set_audio_video_offset (GstPlay * play,
402 gint64 offset);
403
404 GST_PLAY_API
405 gint64 gst_play_get_subtitle_video_offset (GstPlay * play);
406
407 GST_PLAY_API
408 void gst_play_set_subtitle_video_offset (GstPlay * play,
409 gint64 offset);
410
411 GST_PLAY_API
412 gboolean gst_play_set_config (GstPlay * play,
413 GstStructure * config);
414
415 GST_PLAY_API
416 GstStructure * gst_play_get_config (GstPlay * play) G_GNUC_WARN_UNUSED_RESULT;
417
418 /* helpers for configuring the config structure */
419
420 GST_PLAY_API
421 void gst_play_config_set_user_agent (GstStructure * config,
422 const gchar * agent);
423
424 GST_PLAY_API
425 gchar * gst_play_config_get_user_agent (const GstStructure * config);
426
427 GST_PLAY_API
428 void gst_play_config_set_position_update_interval (GstStructure * config,
429 guint interval);
430
431 GST_PLAY_API
432 guint gst_play_config_get_position_update_interval (const GstStructure * config);
433
434 GST_PLAY_API
435 void gst_play_config_set_seek_accurate (GstStructure * config, gboolean accurate);
436
437 GST_PLAY_API
438 gboolean gst_play_config_get_seek_accurate (const GstStructure * config);
439
440 GST_PLAY_API
441 void gst_play_config_set_loop (GstStructure *config,
442 GstPlayLoop loop);
443
444 GST_PLAY_API
445 GstPlayLoop gst_play_config_get_loop (const GstStructure * config);
446
447 GST_PLAY_API
448 void gst_play_config_set_pipeline_dump_in_error_details (GstStructure * config,
449 gboolean value);
450
451 GST_PLAY_API
452 gboolean gst_play_config_get_pipeline_dump_in_error_details (const GstStructure * config);
453
454 /**
455 * GstPlaySnapshotFormat:
456 * @GST_PLAY_THUMBNAIL_RAW_NATIVE: raw native format.
457 * @GST_PLAY_THUMBNAIL_RAW_xRGB: raw xRGB format.
458 * @GST_PLAY_THUMBNAIL_RAW_BGRx: raw BGRx format.
459 * @GST_PLAY_THUMBNAIL_JPG: jpeg format.
460 * @GST_PLAY_THUMBNAIL_PNG: png format.
461 *
462 * Since: 1.20
463 */
464 typedef enum
465 {
466 GST_PLAY_THUMBNAIL_RAW_NATIVE = 0,
467 GST_PLAY_THUMBNAIL_RAW_xRGB,
468 GST_PLAY_THUMBNAIL_RAW_BGRx,
469 GST_PLAY_THUMBNAIL_JPG,
470 GST_PLAY_THUMBNAIL_PNG
471 } GstPlaySnapshotFormat;
472
473 GST_PLAY_API
474 GstSample * gst_play_get_video_snapshot (GstPlay * play,
475 GstPlaySnapshotFormat format, const GstStructure * config) G_GNUC_WARN_UNUSED_RESULT;
476
477 GST_PLAY_API
478 gboolean gst_play_is_play_message (GstMessage *msg);
479
480 GST_PLAY_API
481 void gst_play_message_parse_type (GstMessage *msg, GstPlayMessage *type);
482
483 GST_PLAY_API
484 const gchar * gst_play_message_get_uri (GstMessage *msg);
485
486 GST_PLAY_API
487 const gchar * gst_play_message_get_stream_id (GstMessage *msg);
488
489 GST_PLAY_API
490 void gst_play_message_parse_uri_loaded (GstMessage *msg, gchar **uri);
491
492 GST_PLAY_DEPRECATED_FOR(gst_play_message_parse_duration_changed)
493 void gst_play_message_parse_duration_updated (GstMessage *msg, GstClockTime *duration);
494
495 GST_PLAY_API
496 void gst_play_message_parse_duration_changed (GstMessage *msg, GstClockTime *duration);
497
498 GST_PLAY_API
499 void gst_play_message_parse_position_updated (GstMessage *msg, GstClockTime *position);
500
501 GST_PLAY_API
502 void gst_play_message_parse_state_changed (GstMessage *msg, GstPlayState *state);
503
504 GST_PLAY_DEPRECATED_FOR(gst_play_message_parse_buffering_percent)
505 void gst_play_message_parse_buffering_percent (GstMessage *msg, guint *percent);
506
507 GST_PLAY_API
508 void gst_play_message_parse_buffering (GstMessage *msg, guint *percent);
509
510 GST_PLAY_API
511 void gst_play_message_parse_error (GstMessage *msg, GError **error, GstStructure **details);
512
513 GST_PLAY_API
514 gboolean gst_play_message_parse_error_missing_plugin (GstMessage *msg, gchar *** descriptions, gchar *** installer_details);
515
516 GST_PLAY_API
517 void gst_play_message_parse_warning (GstMessage *msg, GError **error, GstStructure **details);
518
519 GST_PLAY_API
520 gboolean gst_play_message_parse_warning_missing_plugin (GstMessage *msg, gchar *** descriptions, gchar *** installer_details);
521
522 GST_PLAY_API
523 void gst_play_message_parse_video_dimensions_changed (GstMessage *msg, guint *width, guint *height);
524
525 GST_PLAY_API
526 void gst_play_message_parse_media_info_updated (GstMessage *msg, GstPlayMediaInfo **info);
527
528 GST_PLAY_API
529 void gst_play_message_parse_volume_changed (GstMessage *msg, gdouble *volume);
530
531 GST_PLAY_API
532 void gst_play_message_parse_muted_changed (GstMessage *msg, gboolean *muted);
533
534 GST_PLAY_API
535 void gst_play_message_parse_seek_done (GstMessage *msg, GstClockTime *position);
536
537 G_END_DECLS
538
539 #endif /* __GST_PLAY_H__ */