Debian Codegraph @

gst-libs/gst/mse/gstmediasource.h

raw symbols SCIP
1 /* GStreamer
2 *
3 * SPDX-License-Identifier: LGPL-2.1
4 *
5 * Copyright (C) 2013 Google Inc. All rights reserved.
6 * Copyright (C) 2013 Orange
7 * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
8 * Copyright (C) 2014 Sebastian Dröge <[email protected]>
9 * Copyright (C) 2015, 2016 Igalia, S.L
10 * Copyright (C) 2015, 2016 Metrological Group B.V.
11 * Copyright (C) 2022, 2023 Collabora Ltd.
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details.
22 *
23 * You should have received a copy of the GNU Library General Public
24 * License along with this library; if not, write to the
25 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
26 * Boston, MA 02110-1301, USA.
27 */
28
29 #pragma once
30
31 #include <gst/gst.h>
32 #include <gst/mse/mse-prelude.h>
33 #include <gst/mse/gstmsesrc.h>
34
35 #include "gstsourcebufferlist.h"
36
37 G_BEGIN_DECLS
38
39 /**
40 * GstMediaSourceReadyState:
41 * @GST_MEDIA_SOURCE_READY_STATE_CLOSED: The #GstMediaSource is not connected to
42 * any playback element.
43 * @GST_MEDIA_SOURCE_READY_STATE_OPEN: The #GstMediaSource is connected to a
44 * playback element and ready to append data to its #GstSourceBuffer (s).
45 * @GST_MEDIA_SOURCE_READY_STATE_ENDED: gst_media_source_end_of_stream() has
46 * been called on the current #GstMediaSource
47 *
48 * Describes the possible states of the Media Source.
49 *
50 * [Specification](https://www.w3.org/TR/media-source-2/#dom-readystate)
51 *
52 * Since: 1.24
53 */
54 typedef enum
55 {
56 GST_MEDIA_SOURCE_READY_STATE_CLOSED,
57 GST_MEDIA_SOURCE_READY_STATE_OPEN,
58 GST_MEDIA_SOURCE_READY_STATE_ENDED,
59 } GstMediaSourceReadyState;
60
61 /**
62 * GstMediaSourceError:
63 * @GST_MEDIA_SOURCE_ERROR_INVALID_STATE:
64 * @GST_MEDIA_SOURCE_ERROR_TYPE:
65 * @GST_MEDIA_SOURCE_ERROR_NOT_SUPPORTED:
66 * @GST_MEDIA_SOURCE_ERROR_NOT_FOUND:
67 * @GST_MEDIA_SOURCE_ERROR_QUOTA_EXCEEDED:
68 *
69 * Any error that can occur within #GstMediaSource or #GstSourceBuffer APIs.
70 * These values correspond directly to those in the Web IDL specification.
71 *
72 * [Specification](https://webidl.spec.whatwg.org/#idl-DOMException-error-names)
73 *
74 * Since: 1.24
75 */
76 typedef enum
77 {
78 GST_MEDIA_SOURCE_ERROR_INVALID_STATE,
79 GST_MEDIA_SOURCE_ERROR_TYPE,
80 GST_MEDIA_SOURCE_ERROR_NOT_SUPPORTED,
81 GST_MEDIA_SOURCE_ERROR_NOT_FOUND,
82 GST_MEDIA_SOURCE_ERROR_QUOTA_EXCEEDED,
83 } GstMediaSourceError;
84
85 /**
86 * GstMediaSourceEOSError:
87 * @GST_MEDIA_SOURCE_EOS_ERROR_NONE: End the stream successfully
88 * @GST_MEDIA_SOURCE_EOS_ERROR_NETWORK: End the stream due to a networking error
89 * @GST_MEDIA_SOURCE_EOS_ERROR_DECODE: End the stream due to a decoding error
90 *
91 * Reasons for ending a #GstMediaSource using gst_media_source_end_of_stream().
92 *
93 * [Specification](https://www.w3.org/TR/media-source-2/#dom-endofstreamerror)
94 *
95 * Since: 1.24
96 */
97 typedef enum
98 {
99 GST_MEDIA_SOURCE_EOS_ERROR_NONE,
100 GST_MEDIA_SOURCE_EOS_ERROR_NETWORK,
101 GST_MEDIA_SOURCE_EOS_ERROR_DECODE,
102 } GstMediaSourceEOSError;
103
104 /**
105 * GstMediaSourceRange:
106 * @start: The start of this range.
107 * @end: The end of this range.
108 *
109 * A structure describing a simplified version of the TimeRanges concept in the
110 * HTML specification, only representing a single @start and @end time.
111 *
112 * [Specification](https://html.spec.whatwg.org/multipage/media.html#timeranges)
113 *
114 * Since: 1.24
115 */
116 typedef struct
117 {
118 GstClockTime start;
119 GstClockTime end;
120 } GstMediaSourceRange;
121
122 GST_MSE_API
123 gboolean gst_media_source_is_type_supported (const gchar * type);
124
125 #define GST_TYPE_MEDIA_SOURCE (gst_media_source_get_type())
126 #define GST_MEDIA_SOURCE_ERROR (gst_media_source_error_quark())
127
128 /**
129 * gst_media_source_error_quark:
130 *
131 * Any error type that can be reported by the Media Source API.
132 *
133 * Since: 1.24
134 */
135 GST_MSE_API
136 GQuark gst_media_source_error_quark (void);
137
138 GST_MSE_API
139 G_DECLARE_FINAL_TYPE (GstMediaSource, gst_media_source, GST, MEDIA_SOURCE,
140 GstObject);
141
142 GST_MSE_API
143 GstMediaSource *gst_media_source_new (void) G_GNUC_WARN_UNUSED_RESULT;
144
145 GST_MSE_API
146 void gst_media_source_attach (GstMediaSource * self, GstMseSrc * element);
147
148 GST_MSE_API
149 void gst_media_source_detach (GstMediaSource * self);
150
151 GST_MSE_API
152 GstSourceBufferList * gst_media_source_get_source_buffers (
153 GstMediaSource * self) G_GNUC_WARN_UNUSED_RESULT;
154
155 GST_MSE_API
156 GstSourceBufferList * gst_media_source_get_active_source_buffers (
157 GstMediaSource * self) G_GNUC_WARN_UNUSED_RESULT;
158
159 GST_MSE_API
160 GstMediaSourceReadyState gst_media_source_get_ready_state (
161 GstMediaSource * self);
162
163 GST_MSE_API
164 GstClockTime gst_media_source_get_position (GstMediaSource * self);
165
166 GST_MSE_API
167 GstClockTime gst_media_source_get_duration (GstMediaSource * self);
168
169 GST_MSE_API
170 gboolean gst_media_source_set_duration (GstMediaSource * self,
171 GstClockTime duration,
172 GError ** error);
173
174 GST_MSE_API
175 GstSourceBuffer * gst_media_source_add_source_buffer (GstMediaSource * self,
176 const gchar * type,
177 GError ** error) G_GNUC_WARN_UNUSED_RESULT;
178
179 GST_MSE_API
180 gboolean gst_media_source_remove_source_buffer (GstMediaSource * self,
181 GstSourceBuffer * buffer,
182 GError ** error);
183
184 GST_MSE_API
185 gboolean gst_media_source_end_of_stream (GstMediaSource * self,
186 GstMediaSourceEOSError eos_error,
187 GError ** error);
188
189 GST_MSE_API
190 gboolean gst_media_source_set_live_seekable_range (GstMediaSource * self,
191 GstClockTime start,
192 GstClockTime end,
193 GError ** error);
194
195 GST_MSE_API
196 gboolean gst_media_source_clear_live_seekable_range (GstMediaSource * self,
197 GError ** error);
198
199 GST_MSE_API
200 void gst_media_source_get_live_seekable_range (GstMediaSource * self,
201 GstMediaSourceRange * range);
202
203 G_END_DECLS