mirror of https://github.com/godotengine/godot
Merge 7a2b8825d6 into 15ff450680
This commit is contained in:
commit
94c3822054
|
|
@ -33,6 +33,12 @@
|
|||
Return the current playback timestamp. Called in response to the [member VideoStreamPlayer.stream_position] getter.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_playback_speed" qualifiers="virtual const">
|
||||
<return type="float" />
|
||||
<description>
|
||||
Return the current playback speed.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_texture" qualifiers="virtual const">
|
||||
<return type="Texture2D" />
|
||||
<description>
|
||||
|
|
@ -78,6 +84,13 @@
|
|||
Set the paused status of video playback. [method _is_paused] must return [param paused]. Called in response to the [member VideoStreamPlayer.paused] setter.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_playback_speed" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="speed" type="float" />
|
||||
<description>
|
||||
Set playback speed.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_stop" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
|
|
|
|||
|
|
@ -81,6 +81,10 @@
|
|||
The current position of the stream, in seconds.
|
||||
[b]Note:[/b] Changing this value won't have any effect as seeking is not implemented yet, except in video formats implemented by a GDExtension add-on.
|
||||
</member>
|
||||
<member name="stream_speed" type="float" setter="set_stream_speed" getter="get_stream_speed">
|
||||
The current speed of the stream. 1.0 means the normal speed.
|
||||
[b]Note:[/b] Changing this value won't have any effect as there is no speed feature implemented yet, except in video formats implemented by a GDExtension add-on.
|
||||
</member>
|
||||
<member name="volume" type="float" setter="set_volume" getter="get_volume">
|
||||
Audio volume as a linear value.
|
||||
</member>
|
||||
|
|
|
|||
|
|
@ -488,6 +488,15 @@ double VideoStreamPlaybackTheora::get_length() const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
double VideoStreamPlaybackTheora::get_playback_speed() const {
|
||||
WARN_PRINT_ONCE("Video speed option in Theora videos is not implemented yet (it's only supported for GDExtension-provided video streams).");
|
||||
return 1;
|
||||
}
|
||||
|
||||
void VideoStreamPlaybackTheora::set_playback_speed(double p_speed) {
|
||||
WARN_PRINT_ONCE("Video speed option in Theora videos is not implemented yet (it's only supported for GDExtension-provided video streams).");
|
||||
}
|
||||
|
||||
double VideoStreamPlaybackTheora::get_playback_position() const {
|
||||
return get_time();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,6 +111,9 @@ public:
|
|||
|
||||
virtual double get_length() const override;
|
||||
|
||||
virtual double get_playback_speed() const override;
|
||||
virtual void set_playback_speed(double p_speed) override;
|
||||
|
||||
virtual double get_playback_position() const override;
|
||||
virtual void seek(double p_time) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -412,6 +412,19 @@ float VideoStreamPlayer::get_volume_db() const {
|
|||
}
|
||||
}
|
||||
|
||||
void VideoStreamPlayer::set_stream_speed(float p_speed) {
|
||||
if (playback.is_valid()) {
|
||||
playback->set_playback_speed(p_speed);
|
||||
}
|
||||
}
|
||||
|
||||
float VideoStreamPlayer::get_stream_speed() const {
|
||||
if (playback.is_null()) {
|
||||
return 1;
|
||||
}
|
||||
return playback->get_playback_speed();
|
||||
}
|
||||
|
||||
String VideoStreamPlayer::get_stream_name() const {
|
||||
if (stream.is_null()) {
|
||||
return "<No Stream>";
|
||||
|
|
@ -507,6 +520,9 @@ void VideoStreamPlayer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_volume_db", "db"), &VideoStreamPlayer::set_volume_db);
|
||||
ClassDB::bind_method(D_METHOD("get_volume_db"), &VideoStreamPlayer::get_volume_db);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_stream_speed", "speed"), &VideoStreamPlayer::set_stream_speed);
|
||||
ClassDB::bind_method(D_METHOD("get_stream_speed"), &VideoStreamPlayer::get_stream_speed);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_audio_track", "track"), &VideoStreamPlayer::set_audio_track);
|
||||
ClassDB::bind_method(D_METHOD("get_audio_track"), &VideoStreamPlayer::get_audio_track);
|
||||
|
||||
|
|
@ -536,6 +552,7 @@ void VideoStreamPlayer::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "VideoStream"), "set_stream", "get_stream");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volume_db", PROPERTY_HINT_RANGE, "-80,24,0.01,suffix:dB"), "set_volume_db", "get_volume_db");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volume", PROPERTY_HINT_RANGE, "0,15,0.01,exp", PROPERTY_USAGE_NONE), "set_volume", "get_volume");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "stream_speed", PROPERTY_HINT_RANGE, "0,1280000,0.1", PROPERTY_USAGE_NONE), "set_stream_speed", "get_stream_speed");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autoplay"), "set_autoplay", "has_autoplay");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "paused"), "set_paused", "is_paused");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "expand"), "set_expand", "has_expand");
|
||||
|
|
|
|||
|
|
@ -106,6 +106,9 @@ public:
|
|||
void set_volume_db(float p_db);
|
||||
float get_volume_db() const;
|
||||
|
||||
void set_stream_speed(float p_speed);
|
||||
float get_stream_speed() const;
|
||||
|
||||
String get_stream_name() const;
|
||||
double get_stream_length() const;
|
||||
double get_stream_position() const;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ void VideoStreamPlayback::_bind_methods() {
|
|||
GDVIRTUAL_BIND(_set_paused, "paused");
|
||||
GDVIRTUAL_BIND(_is_paused);
|
||||
GDVIRTUAL_BIND(_get_length);
|
||||
GDVIRTUAL_BIND(_get_playback_speed);
|
||||
GDVIRTUAL_BIND(_set_playback_speed, "speed");
|
||||
GDVIRTUAL_BIND(_get_playback_position);
|
||||
GDVIRTUAL_BIND(_seek, "time");
|
||||
GDVIRTUAL_BIND(_set_audio_track, "idx");
|
||||
|
|
@ -91,6 +93,18 @@ double VideoStreamPlayback::get_length() const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
double VideoStreamPlayback::get_playback_speed() const {
|
||||
double ret;
|
||||
if (GDVIRTUAL_CALL(_get_playback_speed, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void VideoStreamPlayback::set_playback_speed(double p_speed) {
|
||||
GDVIRTUAL_CALL(_set_playback_speed, p_speed);
|
||||
}
|
||||
|
||||
double VideoStreamPlayback::get_playback_position() const {
|
||||
double ret;
|
||||
if (GDVIRTUAL_CALL(_get_playback_position, ret)) {
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ protected:
|
|||
GDVIRTUAL1(_set_paused, bool);
|
||||
GDVIRTUAL0RC(bool, _is_paused);
|
||||
GDVIRTUAL0RC(double, _get_length);
|
||||
GDVIRTUAL0RC(double, _get_playback_speed);
|
||||
GDVIRTUAL1(_set_playback_speed, double);
|
||||
GDVIRTUAL0RC(double, _get_playback_position);
|
||||
GDVIRTUAL1(_seek, double);
|
||||
GDVIRTUAL1(_set_audio_track, int);
|
||||
|
|
@ -75,6 +77,9 @@ public:
|
|||
|
||||
virtual double get_length() const;
|
||||
|
||||
virtual double get_playback_speed() const;
|
||||
virtual void set_playback_speed(double p_speed);
|
||||
|
||||
virtual double get_playback_position() const;
|
||||
virtual void seek(double p_time);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue