summaryrefslogtreecommitdiff
path: root/modules/theora
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 13:23:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch)
treea27e497da7104dd0a64f98a04fa3067668735e91 /modules/theora
parent710b34b70227becdc652b4ae027fe0ac47409642 (diff)
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
Diffstat (limited to 'modules/theora')
-rw-r--r--modules/theora/register_types.cpp2
-rw-r--r--modules/theora/video_stream_theora.cpp39
-rw-r--r--modules/theora/video_stream_theora.h2
3 files changed, 0 insertions, 43 deletions
diff --git a/modules/theora/register_types.cpp b/modules/theora/register_types.cpp
index f58e27c855..0676cab5c5 100644
--- a/modules/theora/register_types.cpp
+++ b/modules/theora/register_types.cpp
@@ -35,7 +35,6 @@
static Ref<ResourceFormatLoaderTheora> resource_loader_theora;
void register_theora_types() {
-
resource_loader_theora.instance();
ResourceLoader::add_resource_format_loader(resource_loader_theora, true);
@@ -43,7 +42,6 @@ void register_theora_types() {
}
void unregister_theora_types() {
-
ResourceLoader::remove_resource_format_loader(resource_loader_theora);
resource_loader_theora.unref();
}
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 3163b60bb8..7df204ff51 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -36,7 +36,6 @@
#include "thirdparty/misc/yuv2rgb.h"
int VideoStreamPlaybackTheora::buffer_data() {
-
char *buffer = ogg_sync_buffer(&oy, 4096);
#ifdef THEORA_USE_THREAD_STREAMING
@@ -93,15 +92,12 @@ void VideoStreamPlaybackTheora::video_write() {
//uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y/2);
if (px_fmt == TH_PF_444) {
-
yuv444_2_rgb8888((uint8_t *)dst, (uint8_t *)yuv[0].data, (uint8_t *)yuv[1].data, (uint8_t *)yuv[2].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x << 2);
} else if (px_fmt == TH_PF_422) {
-
yuv422_2_rgb8888((uint8_t *)dst, (uint8_t *)yuv[0].data, (uint8_t *)yuv[1].data, (uint8_t *)yuv[2].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x << 2);
} else if (px_fmt == TH_PF_420) {
-
yuv420_2_rgb8888((uint8_t *)dst, (uint8_t *)yuv[0].data, (uint8_t *)yuv[1].data, (uint8_t *)yuv[2].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x << 2);
};
@@ -116,7 +112,6 @@ void VideoStreamPlaybackTheora::video_write() {
}
void VideoStreamPlaybackTheora::clear() {
-
if (!file)
return;
@@ -164,7 +159,6 @@ void VideoStreamPlaybackTheora::clear() {
};
void VideoStreamPlaybackTheora::set_file(const String &p_file) {
-
ERR_FAIL_COND(playing);
ogg_packet op;
th_setup_info *ts = nullptr;
@@ -232,7 +226,6 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
copymem(&to, &test, sizeof(test));
theora_p = 1;
} else if (!vorbis_p && vorbis_synthesis_headerin(&vi, &vc, &op) >= 0) {
-
/* it is vorbis */
if (audio_track_skip) {
vorbis_info_clear(&vi);
@@ -374,12 +367,10 @@ float VideoStreamPlaybackTheora::get_time() const {
};
Ref<Texture2D> VideoStreamPlaybackTheora::get_texture() const {
-
return texture;
}
void VideoStreamPlaybackTheora::update(float p_delta) {
-
if (!file)
return;
@@ -415,13 +406,11 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
/* if there's pending, decoded audio, grab it */
ret = vorbis_synthesis_pcmout(&vd, &pcm);
if (ret > 0) {
-
const int AUXBUF_LEN = 4096;
int to_read = ret;
float aux_buffer[AUXBUF_LEN];
while (to_read) {
-
int m = MIN(AUXBUF_LEN / vi.channels, to_read);
int count = 0;
@@ -449,7 +438,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
audio_frames_wrote += ret - to_read;
} else {
-
/* no pending audio; is there a pending packet to decode? */
if (ogg_stream_packetout(&vo, &op) > 0) {
if (vorbis_synthesis(&vb, &op) == 0) { /* test for success! */
@@ -469,7 +457,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
while (theora_p && !frame_done) {
/* theora is one in, one out... */
if (ogg_stream_packetout(&to, &op) > 0) {
-
if (false && pp_inc) {
pp_level += pp_inc;
th_decode_ctl(td, TH_DECCTL_SET_PPLEVEL, &pp_level,
@@ -536,7 +523,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
/* are we at or past time for this video frame? */
if (videobuf_ready && videobuf_time <= get_time()) {
-
//video_write();
//videobuf_ready=0;
} else {
@@ -556,7 +542,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
};
void VideoStreamPlaybackTheora::play() {
-
if (!playing)
time = 0;
else {
@@ -569,9 +554,7 @@ void VideoStreamPlaybackTheora::play() {
};
void VideoStreamPlaybackTheora::stop() {
-
if (playing) {
-
clear();
set_file(file_name); //reset
}
@@ -580,17 +563,14 @@ void VideoStreamPlaybackTheora::stop() {
};
bool VideoStreamPlaybackTheora::is_playing() const {
-
return playing;
};
void VideoStreamPlaybackTheora::set_paused(bool p_paused) {
-
paused = p_paused;
};
bool VideoStreamPlaybackTheora::is_paused() const {
-
return paused;
};
@@ -599,27 +579,22 @@ void VideoStreamPlaybackTheora::set_loop(bool p_enable){
};
bool VideoStreamPlaybackTheora::has_loop() const {
-
return false;
};
float VideoStreamPlaybackTheora::get_length() const {
-
return 0;
};
String VideoStreamPlaybackTheora::get_stream_name() const {
-
return "";
};
int VideoStreamPlaybackTheora::get_loop_count() const {
-
return 0;
};
float VideoStreamPlaybackTheora::get_playback_position() const {
-
return get_time();
};
@@ -629,37 +604,30 @@ void VideoStreamPlaybackTheora::seek(float p_time){
};
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;
}
void VideoStreamPlaybackTheora::set_audio_track(int p_idx) {
-
audio_track = p_idx;
}
int VideoStreamPlaybackTheora::get_mix_rate() const {
-
return vi.rate;
}
#ifdef THEORA_USE_THREAD_STREAMING
void VideoStreamPlaybackTheora::_streaming_thread(void *ud) {
-
VideoStreamPlaybackTheora *vs = (VideoStreamPlaybackTheora *)ud;
while (!vs->thread_exit) {
-
//just fill back the buffer
if (!vs->thread_eof) {
-
int to_read = vs->ring_buffer.space_left();
if (to_read) {
int read = vs->file->get_buffer(vs->read_buffer.ptr(), to_read);
@@ -675,7 +643,6 @@ void VideoStreamPlaybackTheora::_streaming_thread(void *ud) {
#endif
VideoStreamPlaybackTheora::VideoStreamPlaybackTheora() {
-
file = nullptr;
theora_p = 0;
vorbis_p = 0;
@@ -706,7 +673,6 @@ VideoStreamPlaybackTheora::VideoStreamPlaybackTheora() {
};
VideoStreamPlaybackTheora::~VideoStreamPlaybackTheora() {
-
#ifdef THEORA_USE_THREAD_STREAMING
memdelete(thread_sem);
@@ -718,7 +684,6 @@ VideoStreamPlaybackTheora::~VideoStreamPlaybackTheora() {
};
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);
@@ -728,7 +693,6 @@ void VideoStreamTheora::_bind_methods() {
////////////
RES ResourceFormatLoaderTheora::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
-
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
if (!f) {
if (r_error) {
@@ -752,17 +716,14 @@ RES ResourceFormatLoaderTheora::load(const String &p_path, const String &p_origi
}
void ResourceFormatLoaderTheora::get_recognized_extensions(List<String> *p_extensions) const {
-
p_extensions->push_back("ogv");
}
bool ResourceFormatLoaderTheora::handles_type(const String &p_type) const {
-
return ClassDB::is_parent_class(p_type, "VideoStream");
}
String ResourceFormatLoaderTheora::get_resource_type(const String &p_path) const {
-
String el = p_path.get_extension().to_lower();
if (el == "ogv")
return "VideoStreamTheora";
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index d5a2640794..f90c2465b4 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -45,7 +45,6 @@
//#define THEORA_USE_THREAD_STREAMING
class VideoStreamPlaybackTheora : public VideoStreamPlayback {
-
GDCLASS(VideoStreamPlaybackTheora, VideoStreamPlayback);
enum {
@@ -161,7 +160,6 @@ public:
};
class VideoStreamTheora : public VideoStream {
-
GDCLASS(VideoStreamTheora, VideoStream);
String file;