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<T> 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.
This commit is contained in:
@ -9,19 +9,4 @@
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="get_file">
|
||||
<return type="String" />
|
||||
<description>
|
||||
Returns the Ogg Theora video file handled by this [VideoStreamTheora].
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_file">
|
||||
<return type="void" />
|
||||
<param index="0" name="file" type="String" />
|
||||
<description>
|
||||
Sets the Ogg Theora video file that this [VideoStreamTheora] resource handles. The [code]file[/code] name should have the [code].ogv[/code] extension.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
</class>
|
||||
|
||||
@ -574,25 +574,10 @@ bool VideoStreamPlaybackTheora::is_paused() const {
|
||||
return paused;
|
||||
}
|
||||
|
||||
void VideoStreamPlaybackTheora::set_loop(bool p_enable) {
|
||||
}
|
||||
|
||||
bool VideoStreamPlaybackTheora::has_loop() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
double VideoStreamPlaybackTheora::get_length() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
String VideoStreamPlaybackTheora::get_stream_name() const {
|
||||
return "";
|
||||
}
|
||||
|
||||
int VideoStreamPlaybackTheora::get_loop_count() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
double VideoStreamPlaybackTheora::get_playback_position() const {
|
||||
return get_time();
|
||||
}
|
||||
@ -601,11 +586,6 @@ void VideoStreamPlaybackTheora::seek(double p_time) {
|
||||
WARN_PRINT_ONCE("Seeking in Theora videos is not implemented yet (it's only supported for GDExtension-provided video streams).");
|
||||
}
|
||||
|
||||
void VideoStreamPlaybackTheora::set_mix_callback(AudioMixCallback p_callback, void *p_userdata) {
|
||||
mix_callback = p_callback;
|
||||
mix_udata = p_userdata;
|
||||
}
|
||||
|
||||
int VideoStreamPlaybackTheora::get_channels() const {
|
||||
return vi.channels;
|
||||
}
|
||||
@ -657,16 +637,9 @@ VideoStreamPlaybackTheora::~VideoStreamPlaybackTheora() {
|
||||
memdelete(thread_sem);
|
||||
#endif
|
||||
clear();
|
||||
}
|
||||
};
|
||||
|
||||
void VideoStreamTheora::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_file", "file"), &VideoStreamTheora::set_file);
|
||||
ClassDB::bind_method(D_METHOD("get_file"), &VideoStreamTheora::get_file);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "file", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL), "set_file", "get_file");
|
||||
}
|
||||
|
||||
////////////
|
||||
void VideoStreamTheora::_bind_methods() {}
|
||||
|
||||
Ref<Resource> ResourceFormatLoaderTheora::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) {
|
||||
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
|
||||
|
||||
@ -99,8 +99,6 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
|
||||
|
||||
Ref<ImageTexture> texture;
|
||||
|
||||
AudioMixCallback mix_callback = nullptr;
|
||||
void *mix_udata = nullptr;
|
||||
bool paused = false;
|
||||
|
||||
#ifdef THEORA_USE_THREAD_STREAMING
|
||||
@ -133,15 +131,8 @@ public:
|
||||
virtual void set_paused(bool p_paused) override;
|
||||
virtual bool is_paused() const override;
|
||||
|
||||
virtual void set_loop(bool p_enable) override;
|
||||
virtual bool has_loop() const override;
|
||||
|
||||
virtual double get_length() const override;
|
||||
|
||||
virtual String get_stream_name() const;
|
||||
|
||||
virtual int get_loop_count() const;
|
||||
|
||||
virtual double get_playback_position() const override;
|
||||
virtual void seek(double p_time) override;
|
||||
|
||||
@ -150,7 +141,6 @@ public:
|
||||
virtual Ref<Texture2D> get_texture() const override;
|
||||
virtual void update(double p_delta) override;
|
||||
|
||||
virtual void set_mix_callback(AudioMixCallback p_callback, void *p_userdata) override;
|
||||
virtual int get_channels() const override;
|
||||
virtual int get_mix_rate() const override;
|
||||
|
||||
@ -163,9 +153,6 @@ public:
|
||||
class VideoStreamTheora : public VideoStream {
|
||||
GDCLASS(VideoStreamTheora, VideoStream);
|
||||
|
||||
String file;
|
||||
int audio_track;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
@ -177,8 +164,6 @@ public:
|
||||
return pb;
|
||||
}
|
||||
|
||||
void set_file(const String &p_file) { file = p_file; }
|
||||
String get_file() { return file; }
|
||||
void set_audio_track(int p_track) override { audio_track = p_track; }
|
||||
|
||||
VideoStreamTheora() { audio_track = 0; }
|
||||
|
||||
Reference in New Issue
Block a user