| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="VideoStreamPlayback" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | Internal class used by [VideoStream] to manage playback state when played from a [VideoStreamPlayer]. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | This class is intended to be overridden by video decoder extensions with custom implementations of [VideoStream]. |
| 8 | </description> |
| 9 | <tutorials> |
| 10 | </tutorials> |
| 11 | <methods> |
| 12 | <method name="_get_channels" qualifiers="virtual const"> |
| 13 | <return type="int" /> |
| 14 | <description> |
| 15 | Returns the number of audio channels. |
| 16 | </description> |
| 17 | </method> |
| 18 | <method name="_get_length" qualifiers="virtual const"> |
| 19 | <return type="float" /> |
| 20 | <description> |
| 21 | Returns the video duration in seconds, if known, or 0 if unknown. |
| 22 | </description> |
| 23 | </method> |
| 24 | <method name="_get_mix_rate" qualifiers="virtual const"> |
| 25 | <return type="int" /> |
| 26 | <description> |
| 27 | Returns the audio sample rate used for mixing. |
| 28 | </description> |
| 29 | </method> |
| 30 | <method name="_get_playback_position" qualifiers="virtual const"> |
| 31 | <return type="float" /> |
| 32 | <description> |
| 33 | Return the current playback timestamp. Called in response to the [member VideoStreamPlayer.stream_position] getter. |
| 34 | </description> |
| 35 | </method> |
| 36 | <method name="_get_texture" qualifiers="virtual const"> |
| 37 | <return type="Texture2D" /> |
| 38 | <description> |
| 39 | Allocates a [Texture2D] in which decoded video frames will be drawn. |
| 40 | </description> |
| 41 | </method> |
| 42 | <method name="_is_paused" qualifiers="virtual const"> |
| 43 | <return type="bool" /> |
| 44 | <description> |
| 45 | Returns the paused status, as set by [method _set_paused]. |
| 46 | </description> |
| 47 | </method> |
| 48 | <method name="_is_playing" qualifiers="virtual const"> |
| 49 | <return type="bool" /> |
| 50 | <description> |
| 51 | Returns the playback state, as determined by calls to [method _play] and [method _stop]. |
| 52 | </description> |
| 53 | </method> |
| 54 | <method name="_play" qualifiers="virtual"> |
| 55 | <return type="void" /> |
| 56 | <description> |
| 57 | 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 [code]true[/code] once playing. |
| 58 | </description> |
| 59 | </method> |
| 60 | <method name="_seek" qualifiers="virtual"> |
| 61 | <return type="void" /> |
| 62 | <param index="0" name="time" type="float" /> |
| 63 | <description> |
| 64 | Seeks to [param time] seconds. Called in response to the [member VideoStreamPlayer.stream_position] setter. |
| 65 | </description> |
| 66 | </method> |
| 67 | <method name="_set_audio_track" qualifiers="virtual"> |
| 68 | <return type="void" /> |
| 69 | <param index="0" name="idx" type="int" /> |
| 70 | <description> |
| 71 | Select the audio track [param idx]. Called when playback starts, and in response to the [member VideoStreamPlayer.audio_track] setter. |
| 72 | </description> |
| 73 | </method> |
| 74 | <method name="_set_paused" qualifiers="virtual"> |
| 75 | <return type="void" /> |
| 76 | <param index="0" name="paused" type="bool" /> |
| 77 | <description> |
| 78 | Set the paused status of video playback. [method _is_paused] must return [param paused]. Called in response to the [member VideoStreamPlayer.paused] setter. |
| 79 | </description> |
| 80 | </method> |
| 81 | <method name="_stop" qualifiers="virtual"> |
| 82 | <return type="void" /> |
| 83 | <description> |
| 84 | Stops playback. May be called multiple times before [method _play], or in response to [method VideoStreamPlayer.stop]. [method _is_playing] should return [code]false[/code] once stopped. |
| 85 | </description> |
| 86 | </method> |
| 87 | <method name="_update" qualifiers="virtual required"> |
| 88 | <return type="void" /> |
| 89 | <param index="0" name="delta" type="float" /> |
| 90 | <description> |
| 91 | Ticks video playback for [param delta] seconds. Called every frame as long as both [method _is_paused] and [method _is_playing] return [code]true[/code]. |
| 92 | </description> |
| 93 | </method> |
| 94 | <method name="mix_audio"> |
| 95 | <return type="int" /> |
| 96 | <param index="0" name="num_frames" type="int" /> |
| 97 | <param index="1" name="buffer" type="PackedFloat32Array" default="PackedFloat32Array()" /> |
| 98 | <param index="2" name="offset" type="int" default="0" /> |
| 99 | <description> |
| 100 | Render [param num_frames] audio frames (of [method _get_channels] floats each) from [param buffer], starting from index [param offset] in the array. Returns the number of audio frames rendered, or -1 on error. |
| 101 | </description> |
| 102 | </method> |
| 103 | </methods> |
| 104 | </class> |