diff options
Diffstat (limited to 'modules/gdnative/videodecoder')
-rw-r--r-- | modules/gdnative/videodecoder/video_stream_gdnative.cpp | 48 | ||||
-rw-r--r-- | modules/gdnative/videodecoder/video_stream_gdnative.h | 8 |
2 files changed, 28 insertions, 28 deletions
diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp index f6e2bad739..fa9f6be5c1 100644 --- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp +++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp @@ -33,7 +33,7 @@ #include "core/project_settings.h" #include "servers/audio_server.h" -VideoDecoderServer *VideoDecoderServer::instance = NULL; +VideoDecoderServer *VideoDecoderServer::instance = nullptr; static VideoDecoderServer decoder_server; @@ -113,7 +113,7 @@ void GDAPI godot_videodecoder_register_decoder(const godot_videodecoder_interfac // VideoStreamPlaybackGDNative starts here. bool VideoStreamPlaybackGDNative::open_file(const String &p_file) { - ERR_FAIL_COND_V(interface == NULL, false); + ERR_FAIL_COND_V(interface == nullptr, false); file = FileAccess::open(p_file, FileAccess::READ); bool file_opened = interface->open_file(data_struct, file); @@ -150,7 +150,7 @@ void VideoStreamPlaybackGDNative::update(float p_delta) { return; } time += p_delta; - ERR_FAIL_COND(interface == NULL); + ERR_FAIL_COND(interface == nullptr); interface->update(data_struct, p_delta); // Don't mix if there's no audio (num_channels == 0). @@ -189,7 +189,7 @@ void VideoStreamPlaybackGDNative::update(float p_delta) { void VideoStreamPlaybackGDNative::update_texture() { PackedByteArray *pba = (PackedByteArray *)interface->get_videoframe(data_struct); - if (pba == NULL) { + if (pba == nullptr) { playing = false; return; } @@ -205,19 +205,19 @@ VideoStreamPlaybackGDNative::VideoStreamPlaybackGDNative() : texture(Ref<ImageTexture>(memnew(ImageTexture))), playing(false), paused(false), - mix_udata(NULL), - mix_callback(NULL), + mix_udata(nullptr), + mix_callback(nullptr), num_channels(-1), time(0), seek_backward(false), mix_rate(0), delay_compensation(0), - pcm(NULL), + pcm(nullptr), pcm_write_idx(0), samples_decoded(0), - file(NULL), - interface(NULL), - data_struct(NULL) {} + file(nullptr), + interface(nullptr), + data_struct(nullptr) {} VideoStreamPlaybackGDNative::~VideoStreamPlaybackGDNative() { cleanup(); @@ -228,16 +228,16 @@ void VideoStreamPlaybackGDNative::cleanup() { interface->destructor(data_struct); if (pcm) memfree(pcm); - pcm = NULL; + pcm = nullptr; time = 0; num_channels = -1; - interface = NULL; - data_struct = NULL; + interface = nullptr; + data_struct = nullptr; } void VideoStreamPlaybackGDNative::set_interface(const godot_videodecoder_interface_gdnative *p_interface) { - ERR_FAIL_COND(p_interface == NULL); - if (interface != NULL) { + ERR_FAIL_COND(p_interface == nullptr); + if (interface != nullptr) { cleanup(); } interface = p_interface; @@ -272,7 +272,7 @@ void VideoStreamPlaybackGDNative::stop() { } void VideoStreamPlaybackGDNative::seek(float p_time) { - ERR_FAIL_COND(interface == NULL); + ERR_FAIL_COND(interface == nullptr); interface->seek(data_struct, p_time); if (p_time < time) seek_backward = true; @@ -292,13 +292,13 @@ Ref<Texture2D> VideoStreamPlaybackGDNative::get_texture() const { } float VideoStreamPlaybackGDNative::get_length() const { - ERR_FAIL_COND_V(interface == NULL, 0); + ERR_FAIL_COND_V(interface == nullptr, 0); return interface->get_length(data_struct); } float VideoStreamPlaybackGDNative::get_playback_position() const { - ERR_FAIL_COND_V(interface == NULL, 0); + ERR_FAIL_COND_V(interface == nullptr, 0); return interface->get_playback_position(data_struct); } @@ -312,7 +312,7 @@ void VideoStreamPlaybackGDNative::set_loop(bool p_enable) { } void VideoStreamPlaybackGDNative::set_audio_track(int p_idx) { - ERR_FAIL_COND(interface == NULL); + ERR_FAIL_COND(interface == nullptr); interface->set_audio_track(data_struct, p_idx); } @@ -323,13 +323,13 @@ void VideoStreamPlaybackGDNative::set_mix_callback(AudioMixCallback p_callback, } int VideoStreamPlaybackGDNative::get_channels() const { - ERR_FAIL_COND_V(interface == NULL, 0); + ERR_FAIL_COND_V(interface == nullptr, 0); return (num_channels > 0) ? num_channels : 0; } int VideoStreamPlaybackGDNative::get_mix_rate() const { - ERR_FAIL_COND_V(interface == NULL, 0); + ERR_FAIL_COND_V(interface == nullptr, 0); return mix_rate; } @@ -339,13 +339,13 @@ int VideoStreamPlaybackGDNative::get_mix_rate() const { Ref<VideoStreamPlayback> VideoStreamGDNative::instance_playback() { Ref<VideoStreamPlaybackGDNative> pb = memnew(VideoStreamPlaybackGDNative); VideoDecoderGDNative *decoder = decoder_server.get_decoder(file.get_extension().to_lower()); - if (decoder == NULL) - return NULL; + if (decoder == nullptr) + return nullptr; pb->set_interface(decoder->interface); pb->set_audio_track(audio_track); if (pb->open_file(file)) return pb; - return NULL; + return nullptr; } void VideoStreamGDNative::set_file(const String &p_file) { diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.h b/modules/gdnative/videodecoder/video_stream_gdnative.h index 8eef6f9098..fbc0d4016f 100644 --- a/modules/gdnative/videodecoder/video_stream_gdnative.h +++ b/modules/gdnative/videodecoder/video_stream_gdnative.h @@ -42,7 +42,7 @@ struct VideoDecoderGDNative { Vector<String> supported_extensions; VideoDecoderGDNative() : - interface(NULL), + interface(nullptr), plugin_name("none") {} VideoDecoderGDNative(const godot_videodecoder_interface_gdnative *p_interface) : @@ -89,7 +89,7 @@ public: VideoDecoderGDNative *get_decoder(const String &extension) { if (extensions.size() == 0 || !extensions.has(extension)) - return NULL; + return nullptr; return decoders[extensions[extension]]; } @@ -102,7 +102,7 @@ public: memdelete(decoders[i]); } decoders.clear(); - instance = NULL; + instance = nullptr; } }; @@ -199,7 +199,7 @@ public: class ResourceFormatLoaderVideoStreamGDNative : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; |