| 1 | /// <reference path="./gst-1.0.d.ts" /> |
| 2 | /// <reference path="./gobject-2.0.d.ts" /> |
| 3 | /// <reference path="./glib-2.0.d.ts" /> |
| 4 | /// <reference path="./gmodule-2.0.d.ts" /> |
| 5 | |
| 6 | /** |
| 7 | * Type Definitions for Gjs (https://gjs.guide/) |
| 8 | * |
| 9 | * These type definitions are automatically generated, do not edit them by hand. |
| 10 | * If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir |
| 11 | * |
| 12 | * The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ... |
| 13 | */ |
| 14 | |
| 15 | declare module 'gi://GstMse?version=1.0' { |
| 16 | // Module dependencies |
| 17 | import type Gst from 'gi://Gst?version=1.0'; |
| 18 | import type GObject from 'gi://GObject?version=2.0'; |
| 19 | import type GLib from 'gi://GLib?version=2.0'; |
| 20 | import type GModule from 'gi://GModule?version=2.0'; |
| 21 | |
| 22 | export namespace GstMse { |
| 23 | /** |
| 24 | * GstMse-1.0 |
| 25 | */ |
| 26 | |
| 27 | /** |
| 28 | * Reasons for ending a #GstMediaSource using gst_media_source_end_of_stream(). |
| 29 | * |
| 30 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-endofstreamerror) |
| 31 | */ |
| 32 | |
| 33 | /** |
| 34 | * Reasons for ending a #GstMediaSource using gst_media_source_end_of_stream(). |
| 35 | * |
| 36 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-endofstreamerror) |
| 37 | */ |
| 38 | export namespace MediaSourceEOSError { |
| 39 | export const $gtype: GObject.GType<MediaSourceEOSError>; |
| 40 | } |
| 41 | |
| 42 | enum MediaSourceEOSError { |
| 43 | /** |
| 44 | * End the stream successfully |
| 45 | */ |
| 46 | NONE, |
| 47 | /** |
| 48 | * End the stream due to a networking error |
| 49 | */ |
| 50 | NETWORK, |
| 51 | /** |
| 52 | * End the stream due to a decoding error |
| 53 | */ |
| 54 | DECODE, |
| 55 | } |
| 56 | /** |
| 57 | * Any error that can occur within #GstMediaSource or #GstSourceBuffer APIs. |
| 58 | * These values correspond directly to those in the Web IDL specification. |
| 59 | * |
| 60 | * [Specification](https://webidl.spec.whatwg.org/#idl-DOMException-error-names) |
| 61 | */ |
| 62 | class MediaSourceError extends GLib.Error { |
| 63 | static $gtype: GObject.GType<MediaSourceError>; |
| 64 | |
| 65 | // Static fields |
| 66 | |
| 67 | static INVALID_STATE: number; |
| 68 | static TYPE: number; |
| 69 | static NOT_SUPPORTED: number; |
| 70 | static NOT_FOUND: number; |
| 71 | static QUOTA_EXCEEDED: number; |
| 72 | |
| 73 | // Constructors |
| 74 | |
| 75 | constructor(options: { message: string; code: number }); |
| 76 | _init(...args: any[]): void; |
| 77 | |
| 78 | // Static methods |
| 79 | |
| 80 | /** |
| 81 | * Any error type that can be reported by the Media Source API. |
| 82 | */ |
| 83 | static quark(): GLib.Quark; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Describes the possible states of the Media Source. |
| 88 | * |
| 89 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-readystate) |
| 90 | */ |
| 91 | |
| 92 | /** |
| 93 | * Describes the possible states of the Media Source. |
| 94 | * |
| 95 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-readystate) |
| 96 | */ |
| 97 | export namespace MediaSourceReadyState { |
| 98 | export const $gtype: GObject.GType<MediaSourceReadyState>; |
| 99 | } |
| 100 | |
| 101 | enum MediaSourceReadyState { |
| 102 | /** |
| 103 | * The #GstMediaSource is not connected to |
| 104 | * any playback element. |
| 105 | */ |
| 106 | CLOSED, |
| 107 | /** |
| 108 | * The #GstMediaSource is connected to a |
| 109 | * playback element and ready to append data to its #GstSourceBuffer (s). |
| 110 | */ |
| 111 | OPEN, |
| 112 | /** |
| 113 | * gst_media_source_end_of_stream() has |
| 114 | * been called on the current #GstMediaSource |
| 115 | */ |
| 116 | ENDED, |
| 117 | } |
| 118 | /** |
| 119 | * Describes how much information a #GstMseSrc has about the media it is playing |
| 120 | * back at the current playback #GstMseSrc:position. This type corresponds |
| 121 | * directly to the ready state of a HTML Media Element and is a separate concept |
| 122 | * from #GstMediaSourceReadyState. |
| 123 | * |
| 124 | * [Specification](https://html.spec.whatwg.org/multipage/media.html#ready-states) |
| 125 | */ |
| 126 | |
| 127 | /** |
| 128 | * Describes how much information a #GstMseSrc has about the media it is playing |
| 129 | * back at the current playback #GstMseSrc:position. This type corresponds |
| 130 | * directly to the ready state of a HTML Media Element and is a separate concept |
| 131 | * from #GstMediaSourceReadyState. |
| 132 | * |
| 133 | * [Specification](https://html.spec.whatwg.org/multipage/media.html#ready-states) |
| 134 | */ |
| 135 | export namespace MseSrcReadyState { |
| 136 | export const $gtype: GObject.GType<MseSrcReadyState>; |
| 137 | } |
| 138 | |
| 139 | enum MseSrcReadyState { |
| 140 | /** |
| 141 | * No information is available about the |
| 142 | * stream |
| 143 | */ |
| 144 | NOTHING, |
| 145 | /** |
| 146 | * The duration is available and video |
| 147 | * dimensions are available if the stream contains video |
| 148 | */ |
| 149 | METADATA, |
| 150 | /** |
| 151 | * The current playback position can |
| 152 | * be presented but future information is not available |
| 153 | */ |
| 154 | CURRENT_DATA, |
| 155 | /** |
| 156 | * There is data for the current |
| 157 | * position and some amount in the future and any text tracks are ready. |
| 158 | */ |
| 159 | FUTURE_DATA, |
| 160 | /** |
| 161 | * Either there is enough data to |
| 162 | * play the stream through at the current playback and input rate or the input |
| 163 | * buffer is full. |
| 164 | */ |
| 165 | ENOUGH_DATA, |
| 166 | } |
| 167 | /** |
| 168 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-appendmode) |
| 169 | */ |
| 170 | |
| 171 | /** |
| 172 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-appendmode) |
| 173 | */ |
| 174 | export namespace SourceBufferAppendMode { |
| 175 | export const $gtype: GObject.GType<SourceBufferAppendMode>; |
| 176 | } |
| 177 | |
| 178 | enum SourceBufferAppendMode { |
| 179 | SEGMENTS, |
| 180 | SEQUENCE, |
| 181 | } |
| 182 | /** |
| 183 | * Any error type that can be reported by the Media Source API. |
| 184 | */ |
| 185 | function media_source_error_quark(): GLib.Quark; |
| 186 | namespace MediaSource { |
| 187 | // Signal callback interfaces |
| 188 | |
| 189 | interface OnSourceClose { |
| 190 | (): void; |
| 191 | } |
| 192 | |
| 193 | interface OnSourceEnded { |
| 194 | (): void; |
| 195 | } |
| 196 | |
| 197 | interface OnSourceOpen { |
| 198 | (): void; |
| 199 | } |
| 200 | |
| 201 | // Constructor properties interface |
| 202 | |
| 203 | interface ConstructorProps extends Gst.Object.ConstructorProps { |
| 204 | active_source_buffers: SourceBufferList; |
| 205 | activeSourceBuffers: SourceBufferList; |
| 206 | duration: number; |
| 207 | position: number; |
| 208 | ready_state: MediaSourceReadyState; |
| 209 | readyState: MediaSourceReadyState; |
| 210 | source_buffers: SourceBufferList; |
| 211 | sourceBuffers: SourceBufferList; |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * #GstMediaSource is the entry point into the W3C Media Source API. It offers |
| 217 | * functionality similar to #GstAppSrc for client-side web or JavaScript |
| 218 | * applications decoupling the source of media from its processing and playback. |
| 219 | * |
| 220 | * To interact with a Media Source, connect it to a #GstMseSrc that is in some |
| 221 | * #GstPipeline using gst_media_source_attach(). Then create at least one |
| 222 | * #GstSourceBuffer using gst_media_source_add_source_buffer(). Finally, feed |
| 223 | * some media data to the Source Buffer(s) using |
| 224 | * gst_source_buffer_append_buffer() and play the pipeline. |
| 225 | */ |
| 226 | class MediaSource extends Gst.Object { |
| 227 | static $gtype: GObject.GType<MediaSource>; |
| 228 | |
| 229 | // Properties |
| 230 | |
| 231 | /** |
| 232 | * A #GstSourceBufferList of every #GstSourceBuffer in this Media Source that |
| 233 | * is considered active |
| 234 | * |
| 235 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-activesourcebuffers) |
| 236 | */ |
| 237 | get active_source_buffers(): SourceBufferList; |
| 238 | /** |
| 239 | * A #GstSourceBufferList of every #GstSourceBuffer in this Media Source that |
| 240 | * is considered active |
| 241 | * |
| 242 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-activesourcebuffers) |
| 243 | */ |
| 244 | get activeSourceBuffers(): SourceBufferList; |
| 245 | /** |
| 246 | * The Duration of the Media Source as a #GstClockTime |
| 247 | * |
| 248 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-duration) |
| 249 | */ |
| 250 | get duration(): number; |
| 251 | set duration(val: number); |
| 252 | /** |
| 253 | * The position of the player consuming from the Media Source |
| 254 | */ |
| 255 | get position(): number; |
| 256 | set position(val: number); |
| 257 | /** |
| 258 | * The Ready State of the Media Source |
| 259 | * |
| 260 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-readystate) |
| 261 | */ |
| 262 | get ready_state(): MediaSourceReadyState; |
| 263 | /** |
| 264 | * The Ready State of the Media Source |
| 265 | * |
| 266 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-readystate) |
| 267 | */ |
| 268 | get readyState(): MediaSourceReadyState; |
| 269 | /** |
| 270 | * A #GstSourceBufferList of every #GstSourceBuffer in this Media Source |
| 271 | * |
| 272 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-sourcebuffers) |
| 273 | */ |
| 274 | get source_buffers(): SourceBufferList; |
| 275 | /** |
| 276 | * A #GstSourceBufferList of every #GstSourceBuffer in this Media Source |
| 277 | * |
| 278 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-sourcebuffers) |
| 279 | */ |
| 280 | get sourceBuffers(): SourceBufferList; |
| 281 | |
| 282 | // Constructors |
| 283 | |
| 284 | constructor(properties?: Partial<MediaSource.ConstructorProps>, ...args: any[]); |
| 285 | |
| 286 | _init(...args: any[]): void; |
| 287 | |
| 288 | static ['new'](): MediaSource; |
| 289 | |
| 290 | // Signals |
| 291 | |
| 292 | connect(id: string, callback: (...args: any[]) => any): number; |
| 293 | connect_after(id: string, callback: (...args: any[]) => any): number; |
| 294 | emit(id: string, ...args: any[]): void; |
| 295 | connect(signal: 'on-source-close', callback: (_source: this) => void): number; |
| 296 | connect_after(signal: 'on-source-close', callback: (_source: this) => void): number; |
| 297 | emit(signal: 'on-source-close'): void; |
| 298 | connect(signal: 'on-source-ended', callback: (_source: this) => void): number; |
| 299 | connect_after(signal: 'on-source-ended', callback: (_source: this) => void): number; |
| 300 | emit(signal: 'on-source-ended'): void; |
| 301 | connect(signal: 'on-source-open', callback: (_source: this) => void): number; |
| 302 | connect_after(signal: 'on-source-open', callback: (_source: this) => void): number; |
| 303 | emit(signal: 'on-source-open'): void; |
| 304 | |
| 305 | // Static methods |
| 306 | |
| 307 | /** |
| 308 | * Determines whether the current Media Source configuration can process media |
| 309 | * of the supplied `type`. |
| 310 | * @param type A MIME type value |
| 311 | */ |
| 312 | static is_type_supported(type: string): boolean; |
| 313 | |
| 314 | // Methods |
| 315 | |
| 316 | /** |
| 317 | * Add a #GstSourceBuffer to this #GstMediaSource of the specified media type. |
| 318 | * The Media Source must be in the #GstMediaSourceReadyState %GST_MEDIA_SOURCE_READY_STATE_OPEN. |
| 319 | * |
| 320 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-addsourcebuffer) |
| 321 | * @param type A MIME type describing the format of the incoming media |
| 322 | * @returns a new #GstSourceBuffer instance on success, otherwise `NULL` |
| 323 | */ |
| 324 | add_source_buffer(type: string): SourceBuffer; |
| 325 | /** |
| 326 | * Associates `self` with `element`. |
| 327 | * Normally, the Element will be part of a #GstPipeline that plays back the data |
| 328 | * submitted to the Media Source's Source Buffers. |
| 329 | * |
| 330 | * #GstMseSrc is a special source element that is designed to consume media from |
| 331 | * a #GstMediaSource. |
| 332 | * |
| 333 | * [Specification](https://www.w3.org/TR/media-source-2/#dfn-attaching-to-a-media-element) |
| 334 | * @param element #GstMseSrc source Element |
| 335 | */ |
| 336 | attach(element: MseSrc): void; |
| 337 | /** |
| 338 | * Clear the live seekable range for `self`. This will inform the component |
| 339 | * playing this Media Source that there is no seekable time range. |
| 340 | * |
| 341 | * If the ready state is not %GST_MEDIA_SOURCE_READY_STATE_OPEN, it will fail |
| 342 | * and set an error. |
| 343 | * |
| 344 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-clearliveseekablerange) |
| 345 | * @returns `TRUE` on success, `FALSE` otherwise |
| 346 | */ |
| 347 | clear_live_seekable_range(): boolean; |
| 348 | /** |
| 349 | * Detaches `self` from any #GstMseSrc element that it may be associated with. |
| 350 | */ |
| 351 | detach(): void; |
| 352 | /** |
| 353 | * Mark `self` as reaching the end of stream, disallowing new data inputs. |
| 354 | * |
| 355 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-endofstream) |
| 356 | * @param eos_error The error type, if any |
| 357 | * @returns `TRUE` on success, `FALSE` otherwise |
| 358 | */ |
| 359 | end_of_stream(eos_error: MediaSourceEOSError | null): boolean; |
| 360 | /** |
| 361 | * Gets a #GstSourceBufferList containing all the Source Buffers currently |
| 362 | * associated with this Media Source that are considered "active." |
| 363 | * For a Source Buffer to be considered active, either its video track is |
| 364 | * selected, its audio track is enabled, or its text track is visible or hidden. |
| 365 | * This object will reflect any future changes to the parent Media Source as |
| 366 | * well. |
| 367 | * |
| 368 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-activesourcebuffers) |
| 369 | * @returns a new #GstSourceBufferList instance |
| 370 | */ |
| 371 | get_active_source_buffers(): SourceBufferList; |
| 372 | /** |
| 373 | * Gets the current duration of `self`. |
| 374 | * |
| 375 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-duration) |
| 376 | * @returns the current duration as a #GstClockTime |
| 377 | */ |
| 378 | get_duration(): Gst.ClockTime; |
| 379 | /** |
| 380 | * Get the live seekable range of `self`. Will fill in the supplied `range` with |
| 381 | * the current live seekable range. |
| 382 | */ |
| 383 | get_live_seekable_range(): MediaSourceRange; |
| 384 | /** |
| 385 | * Gets the current playback position of the Media Source. |
| 386 | * @returns the current playback position as a #GstClockTime |
| 387 | */ |
| 388 | get_position(): Gst.ClockTime; |
| 389 | /** |
| 390 | * Gets the current Ready State of the Media Source. |
| 391 | * |
| 392 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-readystate) |
| 393 | * @returns the current #GstMediaSourceReadyState value |
| 394 | */ |
| 395 | get_ready_state(): MediaSourceReadyState; |
| 396 | /** |
| 397 | * Gets a #GstSourceBufferList containing all the Source Buffers currently |
| 398 | * associated with this Media Source. This object will reflect any future |
| 399 | * changes to the parent Media Source as well. |
| 400 | * |
| 401 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-sourcebuffers) |
| 402 | * @returns a #GstSourceBufferList instance |
| 403 | */ |
| 404 | get_source_buffers(): SourceBufferList; |
| 405 | /** |
| 406 | * Remove `buffer` from `self`. |
| 407 | * |
| 408 | * `buffer` must have been created as a child of `self` and `self` must be in the |
| 409 | * #GstMediaSourceReadyState %GST_MEDIA_SOURCE_READY_STATE_OPEN. |
| 410 | * |
| 411 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-removesourcebuffer) |
| 412 | * @param buffer #GstSourceBuffer instance |
| 413 | * @returns `TRUE` on success, `FALSE` otherwise |
| 414 | */ |
| 415 | remove_source_buffer(buffer: SourceBuffer): boolean; |
| 416 | /** |
| 417 | * Sets the duration of `self`. |
| 418 | * |
| 419 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-duration) |
| 420 | * @param duration The new duration to apply to @self. |
| 421 | * @returns `TRUE` on success, `FALSE` otherwise |
| 422 | */ |
| 423 | set_duration(duration: Gst.ClockTime): boolean; |
| 424 | /** |
| 425 | * Set the live seekable range for `self`. This range informs the component |
| 426 | * playing this Media Source what it can allow the user to seek through. |
| 427 | * |
| 428 | * If the ready state is not %GST_MEDIA_SOURCE_READY_STATE_OPEN, or the supplied |
| 429 | * `start` time is later than `end` it will fail and set an error. |
| 430 | * |
| 431 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-setliveseekablerange) |
| 432 | * @param start The earliest point in the stream considered seekable |
| 433 | * @param end The latest point in the stream considered seekable |
| 434 | * @returns `TRUE` on success, `FALSE` otherwise |
| 435 | */ |
| 436 | set_live_seekable_range(start: Gst.ClockTime, end: Gst.ClockTime): boolean; |
| 437 | } |
| 438 | |
| 439 | namespace MseSrc { |
| 440 | // Constructor properties interface |
| 441 | |
| 442 | interface ConstructorProps extends Gst.Element.ConstructorProps, Gst.URIHandler.ConstructorProps { |
| 443 | duration: number; |
| 444 | n_audio: number; |
| 445 | nAudio: number; |
| 446 | n_text: number; |
| 447 | nText: number; |
| 448 | n_video: number; |
| 449 | nVideo: number; |
| 450 | position: number; |
| 451 | ready_state: MseSrcReadyState; |
| 452 | readyState: MseSrcReadyState; |
| 453 | } |
| 454 | } |
| 455 | |
| 456 | /** |
| 457 | * #GstMseSrc is a source Element that interacts with a #GstMediaSource to |
| 458 | * consume #GstSample<!-- -->s processed by the Media Source and supplies them |
| 459 | * to the containing #GstPipeline. In the perspective of the Media Source API, |
| 460 | * this element fulfills the basis of the Media Element's role relating to |
| 461 | * working with a Media Source. The remaining responsibilities are meant to be |
| 462 | * fulfilled by the application and #GstPlay can be used to satisfy many of |
| 463 | * them. |
| 464 | * |
| 465 | * Once added to a Pipeline, this element should be attached to a Media Source |
| 466 | * using gst_media_source_attach(). |
| 467 | */ |
| 468 | class MseSrc extends Gst.Element implements Gst.URIHandler { |
| 469 | static $gtype: GObject.GType<MseSrc>; |
| 470 | |
| 471 | // Properties |
| 472 | |
| 473 | /** |
| 474 | * The duration of the stream as a #GstClockTime |
| 475 | * |
| 476 | * [Specification](https://html.spec.whatwg.org/multipage/media.html#dom-media-duration) |
| 477 | */ |
| 478 | get duration(): number; |
| 479 | set duration(val: number); |
| 480 | /** |
| 481 | * The number of audio tracks in the Media Source |
| 482 | */ |
| 483 | get n_audio(): number; |
| 484 | /** |
| 485 | * The number of audio tracks in the Media Source |
| 486 | */ |
| 487 | get nAudio(): number; |
| 488 | /** |
| 489 | * The number of text tracks in the Media Source |
| 490 | */ |
| 491 | get n_text(): number; |
| 492 | /** |
| 493 | * The number of text tracks in the Media Source |
| 494 | */ |
| 495 | get nText(): number; |
| 496 | /** |
| 497 | * The number of video tracks in the Media Source |
| 498 | */ |
| 499 | get n_video(): number; |
| 500 | /** |
| 501 | * The number of video tracks in the Media Source |
| 502 | */ |
| 503 | get nVideo(): number; |
| 504 | /** |
| 505 | * The playback position as a #GstClockTime |
| 506 | * |
| 507 | * [Specification](https://html.spec.whatwg.org/multipage/media.html#current-playback-position) |
| 508 | */ |
| 509 | get position(): number; |
| 510 | /** |
| 511 | * The Ready State of this element, describing to what level it can supply |
| 512 | * content for the current #GstMseSrc:position. This is a separate concept |
| 513 | * from #GstMediaSource:ready-state: and corresponds to the HTML Media |
| 514 | * Element's Ready State. |
| 515 | * |
| 516 | * [Specification](https://html.spec.whatwg.org/multipage/media.html#ready-states) |
| 517 | */ |
| 518 | get ready_state(): MseSrcReadyState; |
| 519 | /** |
| 520 | * The Ready State of this element, describing to what level it can supply |
| 521 | * content for the current #GstMseSrc:position. This is a separate concept |
| 522 | * from #GstMediaSource:ready-state: and corresponds to the HTML Media |
| 523 | * Element's Ready State. |
| 524 | * |
| 525 | * [Specification](https://html.spec.whatwg.org/multipage/media.html#ready-states) |
| 526 | */ |
| 527 | get readyState(): MseSrcReadyState; |
| 528 | |
| 529 | // Constructors |
| 530 | |
| 531 | constructor(properties?: Partial<MseSrc.ConstructorProps>, ...args: any[]); |
| 532 | |
| 533 | _init(...args: any[]): void; |
| 534 | |
| 535 | // Methods |
| 536 | |
| 537 | /** |
| 538 | * Gets the duration of `self`. |
| 539 | * |
| 540 | * [Specification](https://html.spec.whatwg.org/multipage/media.html#dom-media-duration) |
| 541 | * @returns The duration of this stream as a #GstClockTime |
| 542 | */ |
| 543 | get_duration(): Gst.ClockTime; |
| 544 | get_n_audio(): number; |
| 545 | get_n_text(): number; |
| 546 | get_n_video(): number; |
| 547 | /** |
| 548 | * Gets the current playback position of `self`. |
| 549 | * |
| 550 | * [Specification](https://html.spec.whatwg.org/multipage/media.html#current-playback-position) |
| 551 | * @returns The playback position of this Element as a #GstClockTime |
| 552 | */ |
| 553 | get_position(): Gst.ClockTime; |
| 554 | /** |
| 555 | * The Ready State of `self,` describing to what level it can supply content for |
| 556 | * the current #GstMseSrc:position. This is a separate concept from |
| 557 | * #GstMediaSource:ready-state: and corresponds to the HTML Media Element's |
| 558 | * Ready State. |
| 559 | * |
| 560 | * [Specification](https://html.spec.whatwg.org/multipage/media.html#ready-states) |
| 561 | * @returns the current #GstMseSrcReadyState |
| 562 | */ |
| 563 | get_ready_state(): MseSrcReadyState; |
| 564 | |
| 565 | // Inherited methods |
| 566 | /** |
| 567 | * Gets the list of protocols supported by `handler`. This list may not be |
| 568 | * modified. |
| 569 | * @returns the supported protocols. Returns %NULL if the @handler isn't implemented properly, or the @handler doesn't support any protocols. |
| 570 | */ |
| 571 | get_protocols(): string[] | null; |
| 572 | /** |
| 573 | * Gets the currently handled URI. |
| 574 | * @returns the URI currently handled by the @handler. Returns %NULL if there are no URI currently handled. The returned string must be freed with g_free() when no longer needed. |
| 575 | */ |
| 576 | get_uri(): string | null; |
| 577 | /** |
| 578 | * Gets the type of the given URI handler |
| 579 | * @returns the #GstURIType of the URI handler. Returns #GST_URI_UNKNOWN if the @handler isn't implemented correctly. |
| 580 | */ |
| 581 | get_uri_type(): Gst.URIType; |
| 582 | /** |
| 583 | * Tries to set the URI of the given handler. |
| 584 | * @param uri URI to set |
| 585 | * @returns %TRUE if the URI was set successfully, else %FALSE. |
| 586 | */ |
| 587 | set_uri(uri: string): boolean; |
| 588 | /** |
| 589 | * Gets the currently handled URI. |
| 590 | */ |
| 591 | vfunc_get_uri(): string | null; |
| 592 | /** |
| 593 | * Tries to set the URI of the given handler. |
| 594 | * @param uri URI to set |
| 595 | */ |
| 596 | vfunc_set_uri(uri: string): boolean; |
| 597 | /** |
| 598 | * Creates a binding between `source_property` on `source` and `target_property` |
| 599 | * on `target`. |
| 600 | * |
| 601 | * Whenever the `source_property` is changed the `target_property` is |
| 602 | * updated using the same value. For instance: |
| 603 | * |
| 604 | * |
| 605 | * ```c |
| 606 | * g_object_bind_property (action, "active", widget, "sensitive", 0); |
| 607 | * ``` |
| 608 | * |
| 609 | * |
| 610 | * Will result in the "sensitive" property of the widget #GObject instance to be |
| 611 | * updated with the same value of the "active" property of the action #GObject |
| 612 | * instance. |
| 613 | * |
| 614 | * If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual: |
| 615 | * if `target_property` on `target` changes then the `source_property` on `source` |
| 616 | * will be updated as well. |
| 617 | * |
| 618 | * The binding will automatically be removed when either the `source` or the |
| 619 | * `target` instances are finalized. To remove the binding without affecting the |
| 620 | * `source` and the `target` you can just call g_object_unref() on the returned |
| 621 | * #GBinding instance. |
| 622 | * |
| 623 | * Removing the binding by calling g_object_unref() on it must only be done if |
| 624 | * the binding, `source` and `target` are only used from a single thread and it |
| 625 | * is clear that both `source` and `target` outlive the binding. Especially it |
| 626 | * is not safe to rely on this if the binding, `source` or `target` can be |
| 627 | * finalized from different threads. Keep another reference to the binding and |
| 628 | * use g_binding_unbind() instead to be on the safe side. |
| 629 | * |
| 630 | * A #GObject can have multiple bindings. |
| 631 | * @param source_property the property on @source to bind |
| 632 | * @param target the target #GObject |
| 633 | * @param target_property the property on @target to bind |
| 634 | * @param flags flags to pass to #GBinding |
| 635 | * @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero. |
| 636 | */ |
| 637 | bind_property( |
| 638 | source_property: string, |
| 639 | target: GObject.Object, |
| 640 | target_property: string, |
| 641 | flags: GObject.BindingFlags | null, |
| 642 | ): GObject.Binding; |
| 643 | /** |
| 644 | * Complete version of g_object_bind_property(). |
| 645 | * |
| 646 | * Creates a binding between `source_property` on `source` and `target_property` |
| 647 | * on `target,` allowing you to set the transformation functions to be used by |
| 648 | * the binding. |
| 649 | * |
| 650 | * If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual: |
| 651 | * if `target_property` on `target` changes then the `source_property` on `source` |
| 652 | * will be updated as well. The `transform_from` function is only used in case |
| 653 | * of bidirectional bindings, otherwise it will be ignored |
| 654 | * |
| 655 | * The binding will automatically be removed when either the `source` or the |
| 656 | * `target` instances are finalized. This will release the reference that is |
| 657 | * being held on the #GBinding instance; if you want to hold on to the |
| 658 | * #GBinding instance, you will need to hold a reference to it. |
| 659 | * |
| 660 | * To remove the binding, call g_binding_unbind(). |
| 661 | * |
| 662 | * A #GObject can have multiple bindings. |
| 663 | * |
| 664 | * The same `user_data` parameter will be used for both `transform_to` |
| 665 | * and `transform_from` transformation functions; the `notify` function will |
| 666 | * be called once, when the binding is removed. If you need different data |
| 667 | * for each transformation function, please use |
| 668 | * g_object_bind_property_with_closures() instead. |
| 669 | * @param source_property the property on @source to bind |
| 670 | * @param target the target #GObject |
| 671 | * @param target_property the property on @target to bind |
| 672 | * @param flags flags to pass to #GBinding |
| 673 | * @param transform_to the transformation function from the @source to the @target, or %NULL to use the default |
| 674 | * @param transform_from the transformation function from the @target to the @source, or %NULL to use the default |
| 675 | * @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required |
| 676 | * @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero. |
| 677 | */ |
| 678 | bind_property_full( |
| 679 | source_property: string, |
| 680 | target: GObject.Object, |
| 681 | target_property: string, |
| 682 | flags: GObject.BindingFlags | null, |
| 683 | transform_to?: GObject.BindingTransformFunc | null, |
| 684 | transform_from?: GObject.BindingTransformFunc | null, |
| 685 | notify?: GLib.DestroyNotify | null, |
| 686 | ): GObject.Binding; |
| 687 | // Conflicted with GObject.Object.bind_property_full |
| 688 | bind_property_full(...args: never[]): any; |
| 689 | /** |
| 690 | * This function is intended for #GObject implementations to re-enforce |
| 691 | * a [floating][floating-ref] object reference. Doing this is seldom |
| 692 | * required: all #GInitiallyUnowneds are created with a floating reference |
| 693 | * which usually just needs to be sunken by calling g_object_ref_sink(). |
| 694 | */ |
| 695 | force_floating(): void; |
| 696 | /** |
| 697 | * Increases the freeze count on `object`. If the freeze count is |
| 698 | * non-zero, the emission of "notify" signals on `object` is |
| 699 | * stopped. The signals are queued until the freeze count is decreased |
| 700 | * to zero. Duplicate notifications are squashed so that at most one |
| 701 | * #GObject::notify signal is emitted for each property modified while the |
| 702 | * object is frozen. |
| 703 | * |
| 704 | * This is necessary for accessors that modify multiple properties to prevent |
| 705 | * premature notification while the object is still being modified. |
| 706 | */ |
| 707 | freeze_notify(): void; |
| 708 | /** |
| 709 | * Gets a named field from the objects table of associations (see g_object_set_data()). |
| 710 | * @param key name of the key for that association |
| 711 | * @returns the data if found, or %NULL if no such data exists. |
| 712 | */ |
| 713 | get_data(key: string): any | null; |
| 714 | /** |
| 715 | * Gets a property of an object. |
| 716 | * |
| 717 | * The value can be: |
| 718 | * - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60) |
| 719 | * - a GObject.Value initialized with the expected type of the property |
| 720 | * - a GObject.Value initialized with a type to which the expected type of the property can be transformed |
| 721 | * |
| 722 | * In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset. |
| 723 | * |
| 724 | * Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming. |
| 725 | * @param property_name The name of the property to get |
| 726 | * @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type |
| 727 | */ |
| 728 | get_property(property_name: string, value: GObject.Value | any): any; |
| 729 | /** |
| 730 | * This function gets back user data pointers stored via |
| 731 | * g_object_set_qdata(). |
| 732 | * @param quark A #GQuark, naming the user data pointer |
| 733 | * @returns The user data pointer set, or %NULL |
| 734 | */ |
| 735 | get_qdata(quark: GLib.Quark): any | null; |
| 736 | /** |
| 737 | * Gets `n_properties` properties for an `object`. |
| 738 | * Obtained properties will be set to `values`. All properties must be valid. |
| 739 | * Warnings will be emitted and undefined behaviour may result if invalid |
| 740 | * properties are passed in. |
| 741 | * @param names the names of each property to get |
| 742 | * @param values the values of each property to get |
| 743 | */ |
| 744 | getv(names: string[], values: (GObject.Value | any)[]): void; |
| 745 | /** |
| 746 | * Checks whether `object` has a [floating][floating-ref] reference. |
| 747 | * @returns %TRUE if @object has a floating reference |
| 748 | */ |
| 749 | is_floating(): boolean; |
| 750 | /** |
| 751 | * Emits a "notify" signal for the property `property_name` on `object`. |
| 752 | * |
| 753 | * When possible, eg. when signaling a property change from within the class |
| 754 | * that registered the property, you should use g_object_notify_by_pspec() |
| 755 | * instead. |
| 756 | * |
| 757 | * Note that emission of the notify signal may be blocked with |
| 758 | * g_object_freeze_notify(). In this case, the signal emissions are queued |
| 759 | * and will be emitted (in reverse order) when g_object_thaw_notify() is |
| 760 | * called. |
| 761 | * @param property_name the name of a property installed on the class of @object. |
| 762 | */ |
| 763 | notify(property_name: string): void; |
| 764 | /** |
| 765 | * Emits a "notify" signal for the property specified by `pspec` on `object`. |
| 766 | * |
| 767 | * This function omits the property name lookup, hence it is faster than |
| 768 | * g_object_notify(). |
| 769 | * |
| 770 | * One way to avoid using g_object_notify() from within the |
| 771 | * class that registered the properties, and using g_object_notify_by_pspec() |
| 772 | * instead, is to store the GParamSpec used with |
| 773 | * g_object_class_install_property() inside a static array, e.g.: |
| 774 | * |
| 775 | * |
| 776 | * ```c |
| 777 | * typedef enum |
| 778 | * { |
| 779 | * PROP_FOO = 1, |
| 780 | * PROP_LAST |
| 781 | * } MyObjectProperty; |
| 782 | * |
| 783 | * static GParamSpec *properties[PROP_LAST]; |
| 784 | * |
| 785 | * static void |
| 786 | * my_object_class_init (MyObjectClass *klass) |
| 787 | * { |
| 788 | * properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL, |
| 789 | * 0, 100, |
| 790 | * 50, |
| 791 | * G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 792 | * g_object_class_install_property (gobject_class, |
| 793 | * PROP_FOO, |
| 794 | * properties[PROP_FOO]); |
| 795 | * } |
| 796 | * ``` |
| 797 | * |
| 798 | * |
| 799 | * and then notify a change on the "foo" property with: |
| 800 | * |
| 801 | * |
| 802 | * ```c |
| 803 | * g_object_notify_by_pspec (self, properties[PROP_FOO]); |
| 804 | * ``` |
| 805 | * |
| 806 | * @param pspec the #GParamSpec of a property installed on the class of @object. |
| 807 | */ |
| 808 | notify_by_pspec(pspec: GObject.ParamSpec): void; |
| 809 | /** |
| 810 | * Increases the reference count of `object`. |
| 811 | * |
| 812 | * Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type |
| 813 | * of `object` will be propagated to the return type (using the GCC typeof() |
| 814 | * extension), so any casting the caller needs to do on the return type must be |
| 815 | * explicit. |
| 816 | * @returns the same @object |
| 817 | */ |
| 818 | ref(): GObject.Object; |
| 819 | // Conflicted with Gst.Object.ref |
| 820 | ref(...args: never[]): any; |
| 821 | /** |
| 822 | * Increase the reference count of `object,` and possibly remove the |
| 823 | * [floating][floating-ref] reference, if `object` has a floating reference. |
| 824 | * |
| 825 | * In other words, if the object is floating, then this call "assumes |
| 826 | * ownership" of the floating reference, converting it to a normal |
| 827 | * reference by clearing the floating flag while leaving the reference |
| 828 | * count unchanged. If the object is not floating, then this call |
| 829 | * adds a new normal reference increasing the reference count by one. |
| 830 | * |
| 831 | * Since GLib 2.56, the type of `object` will be propagated to the return type |
| 832 | * under the same conditions as for g_object_ref(). |
| 833 | * @returns @object |
| 834 | */ |
| 835 | ref_sink(): GObject.Object; |
| 836 | /** |
| 837 | * Releases all references to other objects. This can be used to break |
| 838 | * reference cycles. |
| 839 | * |
| 840 | * This function should only be called from object system implementations. |
| 841 | */ |
| 842 | run_dispose(): void; |
| 843 | /** |
| 844 | * Each object carries around a table of associations from |
| 845 | * strings to pointers. This function lets you set an association. |
| 846 | * |
| 847 | * If the object already had an association with that name, |
| 848 | * the old association will be destroyed. |
| 849 | * |
| 850 | * Internally, the `key` is converted to a #GQuark using g_quark_from_string(). |
| 851 | * This means a copy of `key` is kept permanently (even after `object` has been |
| 852 | * finalized) — so it is recommended to only use a small, bounded set of values |
| 853 | * for `key` in your program, to avoid the #GQuark storage growing unbounded. |
| 854 | * @param key name of the key |
| 855 | * @param data data to associate with that key |
| 856 | */ |
| 857 | set_data(key: string, data?: any | null): void; |
| 858 | /** |
| 859 | * Sets a property on an object. |
| 860 | * @param property_name The name of the property to set |
| 861 | * @param value The value to set the property to |
| 862 | */ |
| 863 | set_property(property_name: string, value: GObject.Value | any): void; |
| 864 | /** |
| 865 | * Remove a specified datum from the object's data associations, |
| 866 | * without invoking the association's destroy handler. |
| 867 | * @param key name of the key |
| 868 | * @returns the data if found, or %NULL if no such data exists. |
| 869 | */ |
| 870 | steal_data(key: string): any | null; |
| 871 | /** |
| 872 | * This function gets back user data pointers stored via |
| 873 | * g_object_set_qdata() and removes the `data` from object |
| 874 | * without invoking its destroy() function (if any was |
| 875 | * set). |
| 876 | * Usually, calling this function is only required to update |
| 877 | * user data pointers with a destroy notifier, for example: |
| 878 | * |
| 879 | * ```c |
| 880 | * void |
| 881 | * object_add_to_user_list (GObject *object, |
| 882 | * const gchar *new_string) |
| 883 | * { |
| 884 | * // the quark, naming the object data |
| 885 | * GQuark quark_string_list = g_quark_from_static_string ("my-string-list"); |
| 886 | * // retrieve the old string list |
| 887 | * GList *list = g_object_steal_qdata (object, quark_string_list); |
| 888 | * |
| 889 | * // prepend new string |
| 890 | * list = g_list_prepend (list, g_strdup (new_string)); |
| 891 | * // this changed 'list', so we need to set it again |
| 892 | * g_object_set_qdata_full (object, quark_string_list, list, free_string_list); |
| 893 | * } |
| 894 | * static void |
| 895 | * free_string_list (gpointer data) |
| 896 | * { |
| 897 | * GList *node, *list = data; |
| 898 | * |
| 899 | * for (node = list; node; node = node->next) |
| 900 | * g_free (node->data); |
| 901 | * g_list_free (list); |
| 902 | * } |
| 903 | * ``` |
| 904 | * |
| 905 | * Using g_object_get_qdata() in the above example, instead of |
| 906 | * g_object_steal_qdata() would have left the destroy function set, |
| 907 | * and thus the partial string list would have been freed upon |
| 908 | * g_object_set_qdata_full(). |
| 909 | * @param quark A #GQuark, naming the user data pointer |
| 910 | * @returns The user data pointer set, or %NULL |
| 911 | */ |
| 912 | steal_qdata(quark: GLib.Quark): any | null; |
| 913 | /** |
| 914 | * Reverts the effect of a previous call to |
| 915 | * g_object_freeze_notify(). The freeze count is decreased on `object` |
| 916 | * and when it reaches zero, queued "notify" signals are emitted. |
| 917 | * |
| 918 | * Duplicate notifications for each property are squashed so that at most one |
| 919 | * #GObject::notify signal is emitted for each property, in the reverse order |
| 920 | * in which they have been queued. |
| 921 | * |
| 922 | * It is an error to call this function when the freeze count is zero. |
| 923 | */ |
| 924 | thaw_notify(): void; |
| 925 | /** |
| 926 | * Decreases the reference count of `object`. When its reference count |
| 927 | * drops to 0, the object is finalized (i.e. its memory is freed). |
| 928 | * |
| 929 | * If the pointer to the #GObject may be reused in future (for example, if it is |
| 930 | * an instance variable of another object), it is recommended to clear the |
| 931 | * pointer to %NULL rather than retain a dangling pointer to a potentially |
| 932 | * invalid #GObject instance. Use g_clear_object() for this. |
| 933 | */ |
| 934 | unref(): void; |
| 935 | /** |
| 936 | * This function essentially limits the life time of the `closure` to |
| 937 | * the life time of the object. That is, when the object is finalized, |
| 938 | * the `closure` is invalidated by calling g_closure_invalidate() on |
| 939 | * it, in order to prevent invocations of the closure with a finalized |
| 940 | * (nonexisting) object. Also, g_object_ref() and g_object_unref() are |
| 941 | * added as marshal guards to the `closure,` to ensure that an extra |
| 942 | * reference count is held on `object` during invocation of the |
| 943 | * `closure`. Usually, this function will be called on closures that |
| 944 | * use this `object` as closure data. |
| 945 | * @param closure #GClosure to watch |
| 946 | */ |
| 947 | watch_closure(closure: GObject.Closure): void; |
| 948 | /** |
| 949 | * the `constructed` function is called by g_object_new() as the |
| 950 | * final step of the object creation process. At the point of the call, all |
| 951 | * construction properties have been set on the object. The purpose of this |
| 952 | * call is to allow for object initialisation steps that can only be performed |
| 953 | * after construction properties have been set. `constructed` implementors |
| 954 | * should chain up to the `constructed` call of their parent class to allow it |
| 955 | * to complete its initialisation. |
| 956 | */ |
| 957 | vfunc_constructed(): void; |
| 958 | /** |
| 959 | * emits property change notification for a bunch |
| 960 | * of properties. Overriding `dispatch_properties_changed` should be rarely |
| 961 | * needed. |
| 962 | * @param n_pspecs |
| 963 | * @param pspecs |
| 964 | */ |
| 965 | vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void; |
| 966 | /** |
| 967 | * the `dispose` function is supposed to drop all references to other |
| 968 | * objects, but keep the instance otherwise intact, so that client method |
| 969 | * invocations still work. It may be run multiple times (due to reference |
| 970 | * loops). Before returning, `dispose` should chain up to the `dispose` method |
| 971 | * of the parent class. |
| 972 | */ |
| 973 | vfunc_dispose(): void; |
| 974 | /** |
| 975 | * instance finalization function, should finish the finalization of |
| 976 | * the instance begun in `dispose` and chain up to the `finalize` method of the |
| 977 | * parent class. |
| 978 | */ |
| 979 | vfunc_finalize(): void; |
| 980 | /** |
| 981 | * the generic getter for all properties of this type. Should be |
| 982 | * overridden for every type with properties. |
| 983 | * @param property_id |
| 984 | * @param value |
| 985 | * @param pspec |
| 986 | */ |
| 987 | vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void; |
| 988 | /** |
| 989 | * Emits a "notify" signal for the property `property_name` on `object`. |
| 990 | * |
| 991 | * When possible, eg. when signaling a property change from within the class |
| 992 | * that registered the property, you should use g_object_notify_by_pspec() |
| 993 | * instead. |
| 994 | * |
| 995 | * Note that emission of the notify signal may be blocked with |
| 996 | * g_object_freeze_notify(). In this case, the signal emissions are queued |
| 997 | * and will be emitted (in reverse order) when g_object_thaw_notify() is |
| 998 | * called. |
| 999 | * @param pspec |
| 1000 | */ |
| 1001 | vfunc_notify(pspec: GObject.ParamSpec): void; |
| 1002 | /** |
| 1003 | * the generic setter for all properties of this type. Should be |
| 1004 | * overridden for every type with properties. If implementations of |
| 1005 | * `set_property` don't emit property change notification explicitly, this will |
| 1006 | * be done implicitly by the type system. However, if the notify signal is |
| 1007 | * emitted explicitly, the type system will not emit it a second time. |
| 1008 | * @param property_id |
| 1009 | * @param value |
| 1010 | * @param pspec |
| 1011 | */ |
| 1012 | vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void; |
| 1013 | /** |
| 1014 | * Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to. |
| 1015 | * @param id Handler ID of the handler to be disconnected |
| 1016 | */ |
| 1017 | disconnect(id: number): void; |
| 1018 | /** |
| 1019 | * Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values. |
| 1020 | * @param properties Object containing the properties to set |
| 1021 | */ |
| 1022 | set(properties: { [key: string]: any }): void; |
| 1023 | /** |
| 1024 | * Blocks a handler of an instance so it will not be called during any signal emissions |
| 1025 | * @param id Handler ID of the handler to be blocked |
| 1026 | */ |
| 1027 | block_signal_handler(id: number): void; |
| 1028 | /** |
| 1029 | * Unblocks a handler so it will be called again during any signal emissions |
| 1030 | * @param id Handler ID of the handler to be unblocked |
| 1031 | */ |
| 1032 | unblock_signal_handler(id: number): void; |
| 1033 | /** |
| 1034 | * Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked. |
| 1035 | * @param detailedName Name of the signal to stop emission of |
| 1036 | */ |
| 1037 | stop_emission_by_name(detailedName: string): void; |
| 1038 | } |
| 1039 | |
| 1040 | namespace MseSrcPad { |
| 1041 | // Constructor properties interface |
| 1042 | |
| 1043 | interface ConstructorProps extends Gst.Pad.ConstructorProps {} |
| 1044 | } |
| 1045 | |
| 1046 | class MseSrcPad extends Gst.Pad { |
| 1047 | static $gtype: GObject.GType<MseSrcPad>; |
| 1048 | |
| 1049 | // Constructors |
| 1050 | |
| 1051 | constructor(properties?: Partial<MseSrcPad.ConstructorProps>, ...args: any[]); |
| 1052 | |
| 1053 | _init(...args: any[]): void; |
| 1054 | } |
| 1055 | |
| 1056 | namespace SourceBuffer { |
| 1057 | // Signal callback interfaces |
| 1058 | |
| 1059 | interface OnAbort { |
| 1060 | (): void; |
| 1061 | } |
| 1062 | |
| 1063 | interface OnError { |
| 1064 | (): void; |
| 1065 | } |
| 1066 | |
| 1067 | interface OnUpdate { |
| 1068 | (): void; |
| 1069 | } |
| 1070 | |
| 1071 | interface OnUpdateEnd { |
| 1072 | (): void; |
| 1073 | } |
| 1074 | |
| 1075 | interface OnUpdateStart { |
| 1076 | (): void; |
| 1077 | } |
| 1078 | |
| 1079 | // Constructor properties interface |
| 1080 | |
| 1081 | interface ConstructorProps extends Gst.Object.ConstructorProps { |
| 1082 | append_mode: SourceBufferAppendMode; |
| 1083 | appendMode: SourceBufferAppendMode; |
| 1084 | append_window_end: number; |
| 1085 | appendWindowEnd: number; |
| 1086 | append_window_start: number; |
| 1087 | appendWindowStart: number; |
| 1088 | buffered: any[]; |
| 1089 | content_type: string; |
| 1090 | contentType: string; |
| 1091 | timestamp_offset: number; |
| 1092 | timestampOffset: number; |
| 1093 | updating: boolean; |
| 1094 | } |
| 1095 | } |
| 1096 | |
| 1097 | /** |
| 1098 | * The Source Buffer is the primary means of data flow between an application |
| 1099 | * and the Media Source API. It represents a single timeline of media, |
| 1100 | * containing some combination of audio, video, and text tracks. |
| 1101 | * An application is responsible for feeding raw data into the Source Buffer |
| 1102 | * using gst_source_buffer_append_buffer() and the Source Buffer will |
| 1103 | * asynchronously process the data into tracks of time-coded multimedia samples. |
| 1104 | * |
| 1105 | * The application as well as the associated playback component can then select |
| 1106 | * to play media from any subset of tracks across all Source Buffers of a Media |
| 1107 | * Source. |
| 1108 | * |
| 1109 | * A few control points are also provided to customize the behavior. |
| 1110 | * |
| 1111 | * - #GstSourceBuffer:append-mode controls how timestamps of processed samples are |
| 1112 | * interpreted. They are either inserted in the timeline directly where the |
| 1113 | * decoded media states they should, or inserted directly after the previously |
| 1114 | * encountered sample. |
| 1115 | * |
| 1116 | * - #GstSourceBuffer:append-window-start / #GstSourceBuffer:append-window-end |
| 1117 | * control the planned time window where media from appended data can be added |
| 1118 | * to the current timeline. Any samples outside that range may be ignored. |
| 1119 | * |
| 1120 | * - #GstSourceBuffer:timestamp-offset is added to the start time of any sample |
| 1121 | * processed. |
| 1122 | */ |
| 1123 | class SourceBuffer extends Gst.Object { |
| 1124 | static $gtype: GObject.GType<SourceBuffer>; |
| 1125 | |
| 1126 | // Properties |
| 1127 | |
| 1128 | /** |
| 1129 | * Affects how timestamps of processed media segments are interpreted. |
| 1130 | * In %GST_SOURCE_BUFFER_APPEND_MODE_SEGMENTS, the start timestamp of a |
| 1131 | * processed media segment is used directly along with |
| 1132 | * #GstSourceBuffer:timestamp-offset . |
| 1133 | * In %GST_SOURCE_BUFFER_APPEND_MODE_SEQUENCE, the timestamp of a |
| 1134 | * processed media segment is ignored and replaced with the end time of the |
| 1135 | * most recently appended segment. |
| 1136 | * |
| 1137 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-mode) |
| 1138 | */ |
| 1139 | get append_mode(): SourceBufferAppendMode; |
| 1140 | set append_mode(val: SourceBufferAppendMode); |
| 1141 | /** |
| 1142 | * Affects how timestamps of processed media segments are interpreted. |
| 1143 | * In %GST_SOURCE_BUFFER_APPEND_MODE_SEGMENTS, the start timestamp of a |
| 1144 | * processed media segment is used directly along with |
| 1145 | * #GstSourceBuffer:timestamp-offset . |
| 1146 | * In %GST_SOURCE_BUFFER_APPEND_MODE_SEQUENCE, the timestamp of a |
| 1147 | * processed media segment is ignored and replaced with the end time of the |
| 1148 | * most recently appended segment. |
| 1149 | * |
| 1150 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-mode) |
| 1151 | */ |
| 1152 | get appendMode(): SourceBufferAppendMode; |
| 1153 | set appendMode(val: SourceBufferAppendMode); |
| 1154 | /** |
| 1155 | * Any segments processed which have a start time greater than this value will |
| 1156 | * be ignored by this Source Buffer. |
| 1157 | * |
| 1158 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowend) |
| 1159 | */ |
| 1160 | get append_window_end(): number; |
| 1161 | /** |
| 1162 | * Any segments processed which have a start time greater than this value will |
| 1163 | * be ignored by this Source Buffer. |
| 1164 | * |
| 1165 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowend) |
| 1166 | */ |
| 1167 | get appendWindowEnd(): number; |
| 1168 | /** |
| 1169 | * Any segments processed which end before this value will be ignored by this |
| 1170 | * Source Buffer. |
| 1171 | * |
| 1172 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowstart) |
| 1173 | */ |
| 1174 | get append_window_start(): number; |
| 1175 | /** |
| 1176 | * Any segments processed which end before this value will be ignored by this |
| 1177 | * Source Buffer. |
| 1178 | * |
| 1179 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowstart) |
| 1180 | */ |
| 1181 | get appendWindowStart(): number; |
| 1182 | /** |
| 1183 | * The set of Time Intervals that have been loaded into the current Source |
| 1184 | * Buffer |
| 1185 | * |
| 1186 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-buffered) |
| 1187 | */ |
| 1188 | get buffered(): any[]; |
| 1189 | /** |
| 1190 | * The MIME content-type of the data stream |
| 1191 | */ |
| 1192 | get content_type(): string; |
| 1193 | set content_type(val: string); |
| 1194 | /** |
| 1195 | * The MIME content-type of the data stream |
| 1196 | */ |
| 1197 | get contentType(): string; |
| 1198 | set contentType(val: string); |
| 1199 | /** |
| 1200 | * The next media segment appended to the current Source Buffer will have its |
| 1201 | * start timestamp increased by this amount. |
| 1202 | * |
| 1203 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-timestampoffset) |
| 1204 | */ |
| 1205 | get timestamp_offset(): number; |
| 1206 | set timestamp_offset(val: number); |
| 1207 | /** |
| 1208 | * The next media segment appended to the current Source Buffer will have its |
| 1209 | * start timestamp increased by this amount. |
| 1210 | * |
| 1211 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-timestampoffset) |
| 1212 | */ |
| 1213 | get timestampOffset(): number; |
| 1214 | set timestampOffset(val: number); |
| 1215 | /** |
| 1216 | * Whether the current source buffer is still asynchronously processing |
| 1217 | * previously issued commands. |
| 1218 | * |
| 1219 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-updating) |
| 1220 | */ |
| 1221 | get updating(): boolean; |
| 1222 | |
| 1223 | // Constructors |
| 1224 | |
| 1225 | constructor(properties?: Partial<SourceBuffer.ConstructorProps>, ...args: any[]); |
| 1226 | |
| 1227 | _init(...args: any[]): void; |
| 1228 | |
| 1229 | // Signals |
| 1230 | |
| 1231 | connect(id: string, callback: (...args: any[]) => any): number; |
| 1232 | connect_after(id: string, callback: (...args: any[]) => any): number; |
| 1233 | emit(id: string, ...args: any[]): void; |
| 1234 | connect(signal: 'on-abort', callback: (_source: this) => void): number; |
| 1235 | connect_after(signal: 'on-abort', callback: (_source: this) => void): number; |
| 1236 | emit(signal: 'on-abort'): void; |
| 1237 | connect(signal: 'on-error', callback: (_source: this) => void): number; |
| 1238 | connect_after(signal: 'on-error', callback: (_source: this) => void): number; |
| 1239 | emit(signal: 'on-error'): void; |
| 1240 | connect(signal: 'on-update', callback: (_source: this) => void): number; |
| 1241 | connect_after(signal: 'on-update', callback: (_source: this) => void): number; |
| 1242 | emit(signal: 'on-update'): void; |
| 1243 | connect(signal: 'on-update-end', callback: (_source: this) => void): number; |
| 1244 | connect_after(signal: 'on-update-end', callback: (_source: this) => void): number; |
| 1245 | emit(signal: 'on-update-end'): void; |
| 1246 | connect(signal: 'on-update-start', callback: (_source: this) => void): number; |
| 1247 | connect_after(signal: 'on-update-start', callback: (_source: this) => void): number; |
| 1248 | emit(signal: 'on-update-start'): void; |
| 1249 | |
| 1250 | // Methods |
| 1251 | |
| 1252 | /** |
| 1253 | * Attempts to end any processing of the currently pending data and reset the |
| 1254 | * media parser. |
| 1255 | * |
| 1256 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-abort) |
| 1257 | * @returns `TRUE` on success, `FALSE` otherwise |
| 1258 | */ |
| 1259 | abort(): boolean; |
| 1260 | /** |
| 1261 | * Schedules the bytes inside `buf` to be processed by `self`. When it is possible |
| 1262 | * to accept the supplied data, it will be processed asynchronously and fill in |
| 1263 | * the track buffers for playback purposes. |
| 1264 | * |
| 1265 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendbuffer) |
| 1266 | * @param buf The media data to append |
| 1267 | * @returns `TRUE` on success, `FALSE` otherwise |
| 1268 | */ |
| 1269 | append_buffer(buf: Gst.Buffer): boolean; |
| 1270 | /** |
| 1271 | * Attempts to change the content type of `self` to `type`. Any new data appended |
| 1272 | * to the Source Buffer must be of the supplied `type` afterward. |
| 1273 | * @param type the desired content type |
| 1274 | * @returns `TRUE` on success, `FALSE` otherwise |
| 1275 | */ |
| 1276 | change_content_type(type: string): boolean; |
| 1277 | /** |
| 1278 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-mode) |
| 1279 | * @returns The current #GstSourceBufferAppendMode |
| 1280 | */ |
| 1281 | get_append_mode(): SourceBufferAppendMode; |
| 1282 | /** |
| 1283 | * Returns the current append window end time. Any segment processed that starts |
| 1284 | * after this value will be ignored. |
| 1285 | * |
| 1286 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowend) |
| 1287 | * @returns The current Append Window end time as a #GstClockTime |
| 1288 | */ |
| 1289 | get_append_window_end(): Gst.ClockTime; |
| 1290 | /** |
| 1291 | * Returns the current append window start time. Any segment processed that ends |
| 1292 | * earlier than this value will be ignored. |
| 1293 | * |
| 1294 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowstart) |
| 1295 | * @returns The current Append Window start time as a #GstClockTime |
| 1296 | */ |
| 1297 | get_append_window_start(): Gst.ClockTime; |
| 1298 | /** |
| 1299 | * Returns a sequence of #GstMediaSourceRange values representing which segments |
| 1300 | * of `self` are buffered in memory. |
| 1301 | * |
| 1302 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-buffered) |
| 1303 | * @returns a #GArray of #GstMediaSourceRange values. |
| 1304 | */ |
| 1305 | get_buffered(): MediaSourceRange[]; |
| 1306 | /** |
| 1307 | * Returns the current content type of `self`. |
| 1308 | * @returns a string representing the content type |
| 1309 | */ |
| 1310 | get_content_type(): string; |
| 1311 | /** |
| 1312 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-timestampoffset) |
| 1313 | * @returns The current timestamp offset as a #GstClockTime |
| 1314 | */ |
| 1315 | get_timestamp_offset(): Gst.ClockTime; |
| 1316 | /** |
| 1317 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-updating) |
| 1318 | * @returns Whether @self is currently adding or removing media content. |
| 1319 | */ |
| 1320 | get_updating(): boolean; |
| 1321 | /** |
| 1322 | * Attempts to remove any parsed data between `start` and `end` from `self`. |
| 1323 | * |
| 1324 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-remove) |
| 1325 | * @param start The beginning timestamp of data to remove |
| 1326 | * @param end The end timestamp of data to remove |
| 1327 | * @returns `TRUE` on success, `FALSE` otherwise |
| 1328 | */ |
| 1329 | remove(start: Gst.ClockTime, end: Gst.ClockTime): boolean; |
| 1330 | /** |
| 1331 | * Changes the Append Mode of `self`. This influences what timestamps will be |
| 1332 | * assigned to media processed by this Source Buffer. In Segment mode, the |
| 1333 | * timestamps in each segment determine the position of each sample after it |
| 1334 | * is processed. In Sequence mode, the timestamp of each processed sample is |
| 1335 | * generated based on the end of the most recently processed segment. |
| 1336 | * |
| 1337 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-mode) |
| 1338 | * @param mode #GstSourceBufferAppendMode the desired Append Mode |
| 1339 | * @returns `TRUE` on success, `FALSE` otherwise |
| 1340 | */ |
| 1341 | set_append_mode(mode: SourceBufferAppendMode | null): boolean; |
| 1342 | /** |
| 1343 | * Modifies the current append window end of `self`. If successful, samples |
| 1344 | * processed after setting this value that start after this point will be |
| 1345 | * ignored. |
| 1346 | * |
| 1347 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowend) |
| 1348 | * @param end the append window end |
| 1349 | * @returns `TRUE` on success, `FALSE` otherwise |
| 1350 | */ |
| 1351 | set_append_window_end(end: Gst.ClockTime): boolean; |
| 1352 | /** |
| 1353 | * Modifies the current append window start of `self`. If successful, samples |
| 1354 | * processed after setting this value that end before this point will be |
| 1355 | * ignored. |
| 1356 | * |
| 1357 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowstart) |
| 1358 | * @param start the append window start |
| 1359 | * @returns `TRUE` on success, `FALSE` otherwise |
| 1360 | */ |
| 1361 | set_append_window_start(start: Gst.ClockTime): boolean; |
| 1362 | /** |
| 1363 | * Attempt to set the timestamp offset of `self`. Any media processed after this |
| 1364 | * value is set will have this value added to its start time. |
| 1365 | * |
| 1366 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-timestampoffset) |
| 1367 | * @param offset The new timestamp offset |
| 1368 | * @returns `TRUE` on success, `FALSE` otherwise |
| 1369 | */ |
| 1370 | set_timestamp_offset(offset: Gst.ClockTime): boolean; |
| 1371 | } |
| 1372 | |
| 1373 | namespace SourceBufferList { |
| 1374 | // Signal callback interfaces |
| 1375 | |
| 1376 | interface OnSourcebufferAdded { |
| 1377 | (): void; |
| 1378 | } |
| 1379 | |
| 1380 | interface OnSourcebufferRemoved { |
| 1381 | (): void; |
| 1382 | } |
| 1383 | |
| 1384 | // Constructor properties interface |
| 1385 | |
| 1386 | interface ConstructorProps extends Gst.Object.ConstructorProps { |
| 1387 | length: number; |
| 1388 | } |
| 1389 | } |
| 1390 | |
| 1391 | /** |
| 1392 | * The Source Buffer List is a list of #GstSourceBuffer<!-- -->s that can be |
| 1393 | * indexed numerically and monitored for changes. The list itself cannot be |
| 1394 | * modified through this interface, though the Source Buffers it holds can be |
| 1395 | * modified after retrieval. |
| 1396 | * |
| 1397 | * It is used by #GstMediaSource to provide direct access to its child |
| 1398 | * #GstSourceBuffer<!-- -->s through #GstMediaSource:source-buffers as well as |
| 1399 | * informing clients which of the Source Buffers are active through |
| 1400 | * #GstMediaSource:active-source-buffers. |
| 1401 | */ |
| 1402 | class SourceBufferList extends Gst.Object { |
| 1403 | static $gtype: GObject.GType<SourceBufferList>; |
| 1404 | |
| 1405 | // Properties |
| 1406 | |
| 1407 | /** |
| 1408 | * The number of #GstSourceBuffer<!-- -->s contained by this structure |
| 1409 | * |
| 1410 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebufferlist-length) |
| 1411 | */ |
| 1412 | get length(): number; |
| 1413 | |
| 1414 | // Constructors |
| 1415 | |
| 1416 | constructor(properties?: Partial<SourceBufferList.ConstructorProps>, ...args: any[]); |
| 1417 | |
| 1418 | _init(...args: any[]): void; |
| 1419 | |
| 1420 | // Signals |
| 1421 | |
| 1422 | connect(id: string, callback: (...args: any[]) => any): number; |
| 1423 | connect_after(id: string, callback: (...args: any[]) => any): number; |
| 1424 | emit(id: string, ...args: any[]): void; |
| 1425 | connect(signal: 'on-sourcebuffer-added', callback: (_source: this) => void): number; |
| 1426 | connect_after(signal: 'on-sourcebuffer-added', callback: (_source: this) => void): number; |
| 1427 | emit(signal: 'on-sourcebuffer-added'): void; |
| 1428 | connect(signal: 'on-sourcebuffer-removed', callback: (_source: this) => void): number; |
| 1429 | connect_after(signal: 'on-sourcebuffer-removed', callback: (_source: this) => void): number; |
| 1430 | emit(signal: 'on-sourcebuffer-removed'): void; |
| 1431 | |
| 1432 | // Methods |
| 1433 | |
| 1434 | /** |
| 1435 | * [Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebufferlist-length) |
| 1436 | * @returns The number of #GstSourceBuffer objects in the list |
| 1437 | */ |
| 1438 | get_length(): number; |
| 1439 | /** |
| 1440 | * Retrieves the #GstSourceBuffer at `index` from `self`. If `index` is greater than |
| 1441 | * the highest index in the list, it will return `NULL`. |
| 1442 | * |
| 1443 | * [Specification](https://www.w3.org/TR/media-source-2/#dfn-sourcebufferlist-getter) |
| 1444 | * @param index index of requested Source Buffer |
| 1445 | * @returns The requested #GstSourceBuffer or `NULL` |
| 1446 | */ |
| 1447 | index(index: number): SourceBuffer | null; |
| 1448 | } |
| 1449 | |
| 1450 | type MediaSourceClass = typeof MediaSource; |
| 1451 | /** |
| 1452 | * A structure describing a simplified version of the TimeRanges concept in the |
| 1453 | * HTML specification, only representing a single `start` and `end` time. |
| 1454 | * |
| 1455 | * [Specification](https://html.spec.whatwg.org/multipage/media.html#timeranges) |
| 1456 | */ |
| 1457 | class MediaSourceRange { |
| 1458 | static $gtype: GObject.GType<MediaSourceRange>; |
| 1459 | |
| 1460 | // Fields |
| 1461 | |
| 1462 | start: Gst.ClockTime; |
| 1463 | end: Gst.ClockTime; |
| 1464 | |
| 1465 | // Constructors |
| 1466 | |
| 1467 | constructor( |
| 1468 | properties?: Partial<{ |
| 1469 | start: Gst.ClockTime; |
| 1470 | end: Gst.ClockTime; |
| 1471 | }>, |
| 1472 | ); |
| 1473 | _init(...args: any[]): void; |
| 1474 | } |
| 1475 | |
| 1476 | type MseSrcClass = typeof MseSrc; |
| 1477 | type MseSrcPadClass = typeof MseSrcPad; |
| 1478 | type SourceBufferClass = typeof SourceBuffer; |
| 1479 | class SourceBufferInterval { |
| 1480 | static $gtype: GObject.GType<SourceBufferInterval>; |
| 1481 | |
| 1482 | // Fields |
| 1483 | |
| 1484 | start: Gst.ClockTime; |
| 1485 | end: Gst.ClockTime; |
| 1486 | |
| 1487 | // Constructors |
| 1488 | |
| 1489 | constructor( |
| 1490 | properties?: Partial<{ |
| 1491 | start: Gst.ClockTime; |
| 1492 | end: Gst.ClockTime; |
| 1493 | }>, |
| 1494 | ); |
| 1495 | _init(...args: any[]): void; |
| 1496 | } |
| 1497 | |
| 1498 | type SourceBufferListClass = typeof SourceBufferList; |
| 1499 | /** |
| 1500 | * Name of the imported GIR library |
| 1501 | * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188 |
| 1502 | */ |
| 1503 | const __name__: string; |
| 1504 | /** |
| 1505 | * Version of the imported GIR library |
| 1506 | * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189 |
| 1507 | */ |
| 1508 | const __version__: string; |
| 1509 | } |
| 1510 | |
| 1511 | export default GstMse; |
| 1512 | } |
| 1513 | |
| 1514 | declare module 'gi://GstMse' { |
| 1515 | import GstMse10 from 'gi://GstMse?version=1.0'; |
| 1516 | export default GstMse10; |
| 1517 | } |
| 1518 | // END |