1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

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:
anish bhobe
2022-07-29 00:23:11 +02:00
committed by Lyuma
parent e9de988020
commit 42a9c33fad
10 changed files with 383 additions and 81 deletions

View File

@@ -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);