class_videostreamplayback.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/VideoStreamPlayback.xml.
  6. .. _class_VideoStreamPlayback:
  7. VideoStreamPlayback
  8. ===================
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Internal class used by :ref:`VideoStream<class_VideoStream>` to manage playback state when played from a :ref:`VideoStreamPlayer<class_VideoStreamPlayer>`.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. This class is intended to be overridden by video decoder extensions with custom implementations of :ref:`VideoStream<class_VideoStream>`.
  15. .. rst-class:: classref-reftable-group
  16. Methods
  17. -------
  18. .. table::
  19. :widths: auto
  20. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`int<class_int>` | :ref:`_get_channels<class_VideoStreamPlayback_private_method__get_channels>` **(** **)** |virtual| |const| |
  22. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`float<class_float>` | :ref:`_get_length<class_VideoStreamPlayback_private_method__get_length>` **(** **)** |virtual| |const| |
  24. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`int<class_int>` | :ref:`_get_mix_rate<class_VideoStreamPlayback_private_method__get_mix_rate>` **(** **)** |virtual| |const| |
  26. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`float<class_float>` | :ref:`_get_playback_position<class_VideoStreamPlayback_private_method__get_playback_position>` **(** **)** |virtual| |const| |
  28. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`Texture2D<class_Texture2D>` | :ref:`_get_texture<class_VideoStreamPlayback_private_method__get_texture>` **(** **)** |virtual| |const| |
  30. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`_is_paused<class_VideoStreamPlayback_private_method__is_paused>` **(** **)** |virtual| |const| |
  32. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`bool<class_bool>` | :ref:`_is_playing<class_VideoStreamPlayback_private_method__is_playing>` **(** **)** |virtual| |const| |
  34. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`_play<class_VideoStreamPlayback_private_method__play>` **(** **)** |virtual| |
  36. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`_seek<class_VideoStreamPlayback_private_method__seek>` **(** :ref:`float<class_float>` time **)** |virtual| |
  38. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`_set_audio_track<class_VideoStreamPlayback_private_method__set_audio_track>` **(** :ref:`int<class_int>` idx **)** |virtual| |
  40. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`_set_paused<class_VideoStreamPlayback_private_method__set_paused>` **(** :ref:`bool<class_bool>` paused **)** |virtual| |
  42. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`_stop<class_VideoStreamPlayback_private_method__stop>` **(** **)** |virtual| |
  44. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | void | :ref:`_update<class_VideoStreamPlayback_private_method__update>` **(** :ref:`float<class_float>` delta **)** |virtual| |
  46. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`mix_audio<class_VideoStreamPlayback_method_mix_audio>` **(** :ref:`int<class_int>` num_frames, :ref:`PackedFloat32Array<class_PackedFloat32Array>` buffer=PackedFloat32Array(), :ref:`int<class_int>` offset=0 **)** |
  48. +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. .. rst-class:: classref-section-separator
  50. ----
  51. .. rst-class:: classref-descriptions-group
  52. Method Descriptions
  53. -------------------
  54. .. _class_VideoStreamPlayback_private_method__get_channels:
  55. .. rst-class:: classref-method
  56. :ref:`int<class_int>` **_get_channels** **(** **)** |virtual| |const|
  57. Returns the number of audio channels.
  58. .. rst-class:: classref-item-separator
  59. ----
  60. .. _class_VideoStreamPlayback_private_method__get_length:
  61. .. rst-class:: classref-method
  62. :ref:`float<class_float>` **_get_length** **(** **)** |virtual| |const|
  63. Returns the video duration in seconds, if known, or 0 if unknown.
  64. .. rst-class:: classref-item-separator
  65. ----
  66. .. _class_VideoStreamPlayback_private_method__get_mix_rate:
  67. .. rst-class:: classref-method
  68. :ref:`int<class_int>` **_get_mix_rate** **(** **)** |virtual| |const|
  69. Returns the audio sample rate used for mixing.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_VideoStreamPlayback_private_method__get_playback_position:
  73. .. rst-class:: classref-method
  74. :ref:`float<class_float>` **_get_playback_position** **(** **)** |virtual| |const|
  75. Return the current playback timestamp. Called in response to the :ref:`VideoStreamPlayer.stream_position<class_VideoStreamPlayer_property_stream_position>` getter.
  76. .. rst-class:: classref-item-separator
  77. ----
  78. .. _class_VideoStreamPlayback_private_method__get_texture:
  79. .. rst-class:: classref-method
  80. :ref:`Texture2D<class_Texture2D>` **_get_texture** **(** **)** |virtual| |const|
  81. Allocates a :ref:`Texture2D<class_Texture2D>` in which decoded video frames will be drawn.
  82. .. rst-class:: classref-item-separator
  83. ----
  84. .. _class_VideoStreamPlayback_private_method__is_paused:
  85. .. rst-class:: classref-method
  86. :ref:`bool<class_bool>` **_is_paused** **(** **)** |virtual| |const|
  87. Returns the paused status, as set by :ref:`_set_paused<class_VideoStreamPlayback_private_method__set_paused>`.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_VideoStreamPlayback_private_method__is_playing:
  91. .. rst-class:: classref-method
  92. :ref:`bool<class_bool>` **_is_playing** **(** **)** |virtual| |const|
  93. Returns the playback state, as determined by calls to :ref:`_play<class_VideoStreamPlayback_private_method__play>` and :ref:`_stop<class_VideoStreamPlayback_private_method__stop>`.
  94. .. rst-class:: classref-item-separator
  95. ----
  96. .. _class_VideoStreamPlayback_private_method__play:
  97. .. rst-class:: classref-method
  98. void **_play** **(** **)** |virtual|
  99. Called in response to :ref:`VideoStreamPlayer.autoplay<class_VideoStreamPlayer_property_autoplay>` or :ref:`VideoStreamPlayer.play<class_VideoStreamPlayer_method_play>`. Note that manual playback may also invoke :ref:`_stop<class_VideoStreamPlayback_private_method__stop>` multiple times before this method is called. :ref:`_is_playing<class_VideoStreamPlayback_private_method__is_playing>` should return true once playing.
  100. .. rst-class:: classref-item-separator
  101. ----
  102. .. _class_VideoStreamPlayback_private_method__seek:
  103. .. rst-class:: classref-method
  104. void **_seek** **(** :ref:`float<class_float>` time **)** |virtual|
  105. Seeks to ``time`` seconds. Called in response to the :ref:`VideoStreamPlayer.stream_position<class_VideoStreamPlayer_property_stream_position>` setter.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _class_VideoStreamPlayback_private_method__set_audio_track:
  109. .. rst-class:: classref-method
  110. void **_set_audio_track** **(** :ref:`int<class_int>` idx **)** |virtual|
  111. Select the audio track ``idx``. Called when playback starts, and in response to the :ref:`VideoStreamPlayer.audio_track<class_VideoStreamPlayer_property_audio_track>` setter.
  112. .. rst-class:: classref-item-separator
  113. ----
  114. .. _class_VideoStreamPlayback_private_method__set_paused:
  115. .. rst-class:: classref-method
  116. void **_set_paused** **(** :ref:`bool<class_bool>` paused **)** |virtual|
  117. Set the paused status of video playback. :ref:`_is_paused<class_VideoStreamPlayback_private_method__is_paused>` must return ``paused``. Called in response to the :ref:`VideoStreamPlayer.paused<class_VideoStreamPlayer_property_paused>` setter.
  118. .. rst-class:: classref-item-separator
  119. ----
  120. .. _class_VideoStreamPlayback_private_method__stop:
  121. .. rst-class:: classref-method
  122. void **_stop** **(** **)** |virtual|
  123. Stops playback. May be called multiple times before :ref:`_play<class_VideoStreamPlayback_private_method__play>`, or in response to :ref:`VideoStreamPlayer.stop<class_VideoStreamPlayer_method_stop>`. :ref:`_is_playing<class_VideoStreamPlayback_private_method__is_playing>` should return false once stopped.
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_VideoStreamPlayback_private_method__update:
  127. .. rst-class:: classref-method
  128. void **_update** **(** :ref:`float<class_float>` delta **)** |virtual|
  129. Ticks video playback for ``delta`` seconds. Called every frame as long as :ref:`_is_paused<class_VideoStreamPlayback_private_method__is_paused>` and :ref:`_is_playing<class_VideoStreamPlayback_private_method__is_playing>` return true.
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _class_VideoStreamPlayback_method_mix_audio:
  133. .. rst-class:: classref-method
  134. :ref:`int<class_int>` **mix_audio** **(** :ref:`int<class_int>` num_frames, :ref:`PackedFloat32Array<class_PackedFloat32Array>` buffer=PackedFloat32Array(), :ref:`int<class_int>` offset=0 **)**
  135. Render ``num_frames`` audio frames (of :ref:`_get_channels<class_VideoStreamPlayback_private_method__get_channels>` floats each) from ``buffer``, starting from index ``offset`` in the array. Returns the number of audio frames rendered, or -1 on error.
  136. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  137. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  138. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  139. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  140. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  141. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  142. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`