diff options
Diffstat (limited to 'modules/webm/video_stream_webm.h')
-rw-r--r-- | modules/webm/video_stream_webm.h | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h index e679196cf2..25675cb248 100644 --- a/modules/webm/video_stream_webm.h +++ b/modules/webm/video_stream_webm.h @@ -40,31 +40,30 @@ class VPXDecoder; class OpusVorbisDecoder; class VideoStreamPlaybackWebm : public VideoStreamPlayback { - GDCLASS(VideoStreamPlaybackWebm, VideoStreamPlayback); String file_name; - int audio_track; + int audio_track = 0; - WebMDemuxer *webm; - VPXDecoder *video; - OpusVorbisDecoder *audio; + WebMDemuxer *webm = nullptr; + VPXDecoder *video = nullptr; + OpusVorbisDecoder *audio = nullptr; - WebMFrame **video_frames, *audio_frame; - int video_frames_pos, video_frames_capacity; + WebMFrame **video_frames = nullptr, *audio_frame = nullptr; + int video_frames_pos = 0, video_frames_capacity = 0; - int num_decoded_samples, samples_offset; - AudioMixCallback mix_callback; - void *mix_udata; + int num_decoded_samples = 0, samples_offset = -1; + AudioMixCallback mix_callback = nullptr; + void *mix_udata = nullptr; - bool playing, paused; - double delay_compensation; - double time, video_frame_delay, video_pos; + bool playing = false, paused = false; + double delay_compensation = 0.0; + double time = 0.0, video_frame_delay = 0.0, video_pos = 0.0; - PoolVector<uint8_t> frame_data; + Vector<uint8_t> frame_data; Ref<ImageTexture> texture; - float *pcm; + float *pcm = nullptr; public: VideoStreamPlaybackWebm(); @@ -72,30 +71,30 @@ public: bool open_file(const String &p_file); - virtual void stop(); - virtual void play(); + virtual void stop() override; + virtual void play() override; - virtual bool is_playing() const; + virtual bool is_playing() const override; - virtual void set_paused(bool p_paused); - virtual bool is_paused() const; + virtual void set_paused(bool p_paused) override; + virtual bool is_paused() const override; - virtual void set_loop(bool p_enable); - virtual bool has_loop() const; + virtual void set_loop(bool p_enable) override; + virtual bool has_loop() const override; - virtual float get_length() const; + virtual float get_length() const override; - virtual float get_playback_position() const; - virtual void seek(float p_time); + virtual float get_playback_position() const override; + virtual void seek(float p_time) override; - virtual void set_audio_track(int p_idx); + virtual void set_audio_track(int p_idx) override; - virtual Ref<Texture> get_texture() const; - virtual void update(float p_delta); + virtual Ref<Texture2D> get_texture() const override; + virtual void update(float p_delta) override; - virtual void set_mix_callback(AudioMixCallback p_callback, void *p_userdata); - virtual int get_channels() const; - virtual int get_mix_rate() const; + 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; private: inline bool has_enough_video_frames() const; @@ -107,11 +106,10 @@ private: /**/ class VideoStreamWebm : public VideoStream { - GDCLASS(VideoStreamWebm, VideoStream); String file; - int audio_track; + int audio_track = 0; protected: static void _bind_methods(); @@ -119,16 +117,16 @@ protected: public: VideoStreamWebm(); - virtual Ref<VideoStreamPlayback> instance_playback(); + virtual Ref<VideoStreamPlayback> instance_playback() override; virtual void set_file(const String &p_file); String get_file(); - virtual void set_audio_track(int p_track); + virtual void set_audio_track(int p_track) override; }; class ResourceFormatLoaderWebm : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); + 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, bool p_no_cache = false); 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; |