diff options
author | Rafał Mikrut <mikrutrafal@protonmail.com> | 2021-02-08 10:57:18 +0100 |
---|---|---|
committer | Rafał Mikrut <mikrutrafal@protonmail.com> | 2021-02-08 10:57:18 +0100 |
commit | f7209b459b4faaae9d93bfb6ac5346eb41787f92 (patch) | |
tree | 790808a314837cd3f16c9d229401882046bd6fae /modules/theora | |
parent | 57e2822a05c29db3980ad243c37a34acf6c4d14b (diff) |
Initialize class/struct variables with default values in modules/
Diffstat (limited to 'modules/theora')
-rw-r--r-- | modules/theora/video_stream_theora.cpp | 17 | ||||
-rw-r--r-- | modules/theora/video_stream_theora.h | 48 |
2 files changed, 24 insertions, 41 deletions
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index 1026d58b85..afe26d4a5f 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -645,30 +645,13 @@ void VideoStreamPlaybackTheora::_streaming_thread(void *ud) { #endif VideoStreamPlaybackTheora::VideoStreamPlaybackTheora() { - file = nullptr; - theora_p = 0; - vorbis_p = 0; - videobuf_ready = 0; - playing = false; - frames_pending = 0; - videobuf_time = 0; - paused = false; - - buffering = false; texture = Ref<ImageTexture>(memnew(ImageTexture)); - mix_callback = nullptr; - mix_udata = nullptr; - audio_track = 0; - delay_compensation = 0; - audio_frames_wrote = 0; #ifdef THEORA_USE_THREAD_STREAMING int rb_power = nearest_shift(RB_SIZE_KB * 1024); ring_buffer.resize(rb_power); read_buffer.resize(RB_SIZE_KB * 1024); thread_sem = Semaphore::create(); - thread_exit = false; - thread_eof = false; #endif }; diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h index c315d682da..71e56e2ee8 100644 --- a/modules/theora/video_stream_theora.h +++ b/modules/theora/video_stream_theora.h @@ -52,12 +52,12 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback { }; //Image frames[MAX_FRAMES]; - Image::Format format; + Image::Format format = Image::Format::FORMAT_L8; Vector<uint8_t> frame_data; - int frames_pending; - FileAccess *file; + int frames_pending = 0; + FileAccess *file = nullptr; String file_name; - int audio_frames_wrote; + int audio_frames_wrote = 0; Point2i size; int buffer_data(); @@ -65,8 +65,8 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback { void video_write(); float get_time() const; - bool theora_eos; - bool vorbis_eos; + bool theora_eos = false; + bool vorbis_eos = false; ogg_sync_state oy; ogg_page og; @@ -74,33 +74,33 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback { ogg_stream_state to; th_info ti; th_comment tc; - th_dec_ctx *td; + th_dec_ctx *td = nullptr; vorbis_info vi; vorbis_dsp_state vd; vorbis_block vb; vorbis_comment vc; th_pixel_fmt px_fmt; - double videobuf_time; - int pp_inc; + double videobuf_time = 0; + int pp_inc = 0; - int theora_p; - int vorbis_p; - int pp_level_max; - int pp_level; - int videobuf_ready; + int theora_p = 0; + int vorbis_p = 0; + int pp_level_max = 0; + int pp_level = 0; + int videobuf_ready = 0; - bool playing; - bool buffering; + bool playing = false; + bool buffering = false; - double last_update_time; - double time; - double delay_compensation; + double last_update_time = 0; + double time = 0; + double delay_compensation = 0; Ref<ImageTexture> texture; AudioMixCallback mix_callback; - void *mix_udata; - bool paused; + void *mix_udata = nullptr; + bool paused = false; #ifdef THEORA_USE_THREAD_STREAMING @@ -110,16 +110,16 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback { RingBuffer<uint8_t> ring_buffer; Vector<uint8_t> read_buffer; - bool thread_eof; + bool thread_eof = false; Semaphore *thread_sem; Thread thread; - volatile bool thread_exit; + volatile bool thread_exit = false; static void _streaming_thread(void *ud); #endif - int audio_track; + int audio_track = 0; protected: void clear(); |