From 42a9c33fadec66f82f30e32e3d780814d64dd7c9 Mon Sep 17 00:00:00 2001 From: anish bhobe Date: Fri, 29 Jul 2022 00:23:11 +0200 Subject: Updates VideoDecoder plugin API to GDExtension. Adds VideoStream and relevant resource loaders to migrate external GDNative plugins to GDExtension. Adds a VideoStreamLoader as a specialization of ResourceFormatLoader as ClassDB::is_parent_class is inaccessible from GDExtension currently. Using Object* instead of Ref in order to avoid the refcount bug (godotengine/godot-cpp#652) Also another bug is in ResourceLoader in use on the extension side that requires fixing. --- doc/classes/VideoStream.xml | 14 +++++ doc/classes/VideoStreamPlayback.xml | 104 ++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 doc/classes/VideoStreamPlayback.xml (limited to 'doc') diff --git a/doc/classes/VideoStream.xml b/doc/classes/VideoStream.xml index 2797ad3513..648c3edd73 100644 --- a/doc/classes/VideoStream.xml +++ b/doc/classes/VideoStream.xml @@ -8,4 +8,18 @@ + + + + + Called when the video starts playing, to initialize and return a subclass of [VideoStreamPlayback]. + + + + + + The video file path or URI that this [VideoStream] resource handles. + For [VideoStreamTheora], this filename should be an Ogg Theora video file with the [code].ogv[/code] extension. + + diff --git a/doc/classes/VideoStreamPlayback.xml b/doc/classes/VideoStreamPlayback.xml new file mode 100644 index 0000000000..8d8b4fe5b1 --- /dev/null +++ b/doc/classes/VideoStreamPlayback.xml @@ -0,0 +1,104 @@ + + + + Internal class used by [VideoStream] to manage playback state when played from a [VideoStreamPlayer]. + + + This class is intended to be overridden by video decoder extensions with custom implementations of [VideoStream]. + + + + + + + + Returns the number of audio channels. + + + + + + Returns the video duration in seconds, if known, or 0 if unknown. + + + + + + Returns the audio sample rate used for mixing. + + + + + + Return the current playback timestamp. Called in response to the [member VideoStreamPlayer.stream_position] getter. + + + + + + Allocates a [Texture2D] in which decoded video frames will be drawn. + + + + + + Returns the paused status, as set by [method _set_paused]. + + + + + + Returns the playback state, as determined by calls to [method _play] and [method _stop]. + + + + + + Called in response to [member VideoStreamPlayer.autoplay] or [method VideoStreamPlayer.play]. Note that manual playback may also invoke [method _stop] multiple times before this method is called. [method _is_playing] should return true once playing. + + + + + + + Seeks to [code]time[/code] seconds. Called in response to the [member VideoStreamPlayer.stream_position] setter. + + + + + + + Select the audio track [code]idx[/code]. Called when playback starts, and in response to the [member VideoStreamPlayer.audio_track] setter. + + + + + + + Set the paused status of video playback. [method _is_paused] must return [code]paused[/code]. Called in response to the [member VideoStreamPlayer.paused] setter. + + + + + + Stops playback. May be called multiple times before [method _play], or in response to [method VideoStreamPlayer.stop]. [method _is_playing] should return false once stopped. + + + + + + + Ticks video playback for [code]delta[/code] seconds. Called every frame as long as [method _is_paused] and [method _is_playing] return true. + + + + + + + + + Render [code]num_frames[/code] audio frames (of [method _get_channels] floats each) from [code]buffer[/code], starting from index [code]offset[/code] in the array. Returns the number of audio frames rendered, or -1 on error. + + + + -- cgit v1.2.3