mirror of
https://github.com/godotengine/godot.git
synced 2024-11-25 05:33:11 +00:00
Fix MSVC warning C4706: assignment within conditional expression
Part of #66537.
This commit is contained in:
parent
14e1f36e61
commit
0e53dd642c
@ -2624,10 +2624,11 @@ double String::to_float() const {
|
|||||||
|
|
||||||
uint32_t String::hash(const char *p_cstr) {
|
uint32_t String::hash(const char *p_cstr) {
|
||||||
uint32_t hashv = 5381;
|
uint32_t hashv = 5381;
|
||||||
uint32_t c;
|
uint32_t c = *p_cstr++;
|
||||||
|
|
||||||
while ((c = *p_cstr++)) {
|
while (c) {
|
||||||
hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */
|
hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */
|
||||||
|
c = *p_cstr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashv;
|
return hashv;
|
||||||
@ -2653,10 +2654,11 @@ uint32_t String::hash(const wchar_t *p_cstr, int p_len) {
|
|||||||
|
|
||||||
uint32_t String::hash(const wchar_t *p_cstr) {
|
uint32_t String::hash(const wchar_t *p_cstr) {
|
||||||
uint32_t hashv = 5381;
|
uint32_t hashv = 5381;
|
||||||
uint32_t c;
|
uint32_t c = *p_cstr++;
|
||||||
|
|
||||||
while ((c = *p_cstr++)) {
|
while (c) {
|
||||||
hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */
|
hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */
|
||||||
|
c = *p_cstr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashv;
|
return hashv;
|
||||||
@ -2673,10 +2675,11 @@ uint32_t String::hash(const char32_t *p_cstr, int p_len) {
|
|||||||
|
|
||||||
uint32_t String::hash(const char32_t *p_cstr) {
|
uint32_t String::hash(const char32_t *p_cstr) {
|
||||||
uint32_t hashv = 5381;
|
uint32_t hashv = 5381;
|
||||||
uint32_t c;
|
uint32_t c = *p_cstr++;
|
||||||
|
|
||||||
while ((c = *p_cstr++)) {
|
while (c) {
|
||||||
hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */
|
hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */
|
||||||
|
c = *p_cstr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashv;
|
return hashv;
|
||||||
@ -2687,10 +2690,11 @@ uint32_t String::hash() const {
|
|||||||
|
|
||||||
const char32_t *chr = get_data();
|
const char32_t *chr = get_data();
|
||||||
uint32_t hashv = 5381;
|
uint32_t hashv = 5381;
|
||||||
uint32_t c;
|
uint32_t c = *chr++;
|
||||||
|
|
||||||
while ((c = *chr++)) {
|
while (c) {
|
||||||
hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */
|
hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */
|
||||||
|
c = *chr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashv;
|
return hashv;
|
||||||
@ -2701,10 +2705,11 @@ uint64_t String::hash64() const {
|
|||||||
|
|
||||||
const char32_t *chr = get_data();
|
const char32_t *chr = get_data();
|
||||||
uint64_t hashv = 5381;
|
uint64_t hashv = 5381;
|
||||||
uint64_t c;
|
uint64_t c = *chr++;
|
||||||
|
|
||||||
while ((c = *chr++)) {
|
while (c) {
|
||||||
hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */
|
hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */
|
||||||
|
c = *chr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashv;
|
return hashv;
|
||||||
|
@ -61,10 +61,11 @@
|
|||||||
static _FORCE_INLINE_ uint32_t hash_djb2(const char *p_cstr) {
|
static _FORCE_INLINE_ uint32_t hash_djb2(const char *p_cstr) {
|
||||||
const unsigned char *chr = (const unsigned char *)p_cstr;
|
const unsigned char *chr = (const unsigned char *)p_cstr;
|
||||||
uint32_t hash = 5381;
|
uint32_t hash = 5381;
|
||||||
uint32_t c;
|
uint32_t c = *chr++;
|
||||||
|
|
||||||
while ((c = *chr++)) {
|
while (c) {
|
||||||
hash = ((hash << 5) + hash) ^ c; /* hash * 33 ^ c */
|
hash = ((hash << 5) + hash) ^ c; /* hash * 33 ^ c */
|
||||||
|
c = *chr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
|
@ -2535,30 +2535,32 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
|
|||||||
bool release_lmb = (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT); // Required to properly release some stuff (e.g. selection box) while panning.
|
bool release_lmb = (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT); // Required to properly release some stuff (e.g. selection box) while panning.
|
||||||
|
|
||||||
if (EditorSettings::get_singleton()->get("editors/panning/simple_panning") || !pan_pressed || release_lmb) {
|
if (EditorSettings::get_singleton()->get("editors/panning/simple_panning") || !pan_pressed || release_lmb) {
|
||||||
if ((accepted = _gui_input_rulers_and_guides(p_event))) {
|
accepted = true;
|
||||||
|
if (_gui_input_rulers_and_guides(p_event)) {
|
||||||
// print_line("Rulers and guides");
|
// print_line("Rulers and guides");
|
||||||
} else if ((accepted = EditorNode::get_singleton()->get_editor_plugins_over()->forward_gui_input(p_event))) {
|
} else if (EditorNode::get_singleton()->get_editor_plugins_over()->forward_gui_input(p_event)) {
|
||||||
// print_line("Plugin");
|
// print_line("Plugin");
|
||||||
} else if ((accepted = _gui_input_open_scene_on_double_click(p_event))) {
|
} else if (_gui_input_open_scene_on_double_click(p_event)) {
|
||||||
// print_line("Open scene on double click");
|
// print_line("Open scene on double click");
|
||||||
} else if ((accepted = _gui_input_scale(p_event))) {
|
} else if (_gui_input_scale(p_event)) {
|
||||||
// print_line("Set scale");
|
// print_line("Set scale");
|
||||||
} else if ((accepted = _gui_input_pivot(p_event))) {
|
} else if (_gui_input_pivot(p_event)) {
|
||||||
// print_line("Set pivot");
|
// print_line("Set pivot");
|
||||||
} else if ((accepted = _gui_input_resize(p_event))) {
|
} else if (_gui_input_resize(p_event)) {
|
||||||
// print_line("Resize");
|
// print_line("Resize");
|
||||||
} else if ((accepted = _gui_input_rotate(p_event))) {
|
} else if (_gui_input_rotate(p_event)) {
|
||||||
// print_line("Rotate");
|
// print_line("Rotate");
|
||||||
} else if ((accepted = _gui_input_move(p_event))) {
|
} else if (_gui_input_move(p_event)) {
|
||||||
// print_line("Move");
|
// print_line("Move");
|
||||||
} else if ((accepted = _gui_input_anchors(p_event))) {
|
} else if (_gui_input_anchors(p_event)) {
|
||||||
// print_line("Anchors");
|
// print_line("Anchors");
|
||||||
} else if ((accepted = _gui_input_select(p_event))) {
|
} else if (_gui_input_select(p_event)) {
|
||||||
// print_line("Selection");
|
// print_line("Selection");
|
||||||
} else if ((accepted = _gui_input_ruler_tool(p_event))) {
|
} else if (_gui_input_ruler_tool(p_event)) {
|
||||||
// print_line("Measure");
|
// print_line("Measure");
|
||||||
} else {
|
} else {
|
||||||
// print_line("Not accepted");
|
// print_line("Not accepted");
|
||||||
|
accepted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,8 +91,6 @@ void VideoStreamPlaybackTheora::video_write() {
|
|||||||
uint8_t *w = frame_data.ptrw();
|
uint8_t *w = frame_data.ptrw();
|
||||||
char *dst = (char *)w;
|
char *dst = (char *)w;
|
||||||
|
|
||||||
//uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y/2);
|
|
||||||
|
|
||||||
if (px_fmt == TH_PF_444) {
|
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);
|
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);
|
||||||
|
|
||||||
@ -101,7 +99,7 @@ void VideoStreamPlaybackTheora::video_write() {
|
|||||||
|
|
||||||
} else if (px_fmt == TH_PF_420) {
|
} 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);
|
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);
|
||||||
};
|
}
|
||||||
|
|
||||||
format = Image::FORMAT_RGBA8;
|
format = Image::FORMAT_RGBA8;
|
||||||
}
|
}
|
||||||
@ -123,7 +121,7 @@ void VideoStreamPlaybackTheora::clear() {
|
|||||||
if (vorbis_p >= 3) {
|
if (vorbis_p >= 3) {
|
||||||
vorbis_block_clear(&vb);
|
vorbis_block_clear(&vb);
|
||||||
vorbis_dsp_clear(&vd);
|
vorbis_dsp_clear(&vd);
|
||||||
};
|
}
|
||||||
vorbis_comment_clear(&vc);
|
vorbis_comment_clear(&vc);
|
||||||
vorbis_info_clear(&vi);
|
vorbis_info_clear(&vi);
|
||||||
vorbis_p = 0;
|
vorbis_p = 0;
|
||||||
@ -154,7 +152,7 @@ void VideoStreamPlaybackTheora::clear() {
|
|||||||
|
|
||||||
file.unref();
|
file.unref();
|
||||||
playing = false;
|
playing = false;
|
||||||
};
|
}
|
||||||
|
|
||||||
void VideoStreamPlaybackTheora::set_file(const String &p_file) {
|
void VideoStreamPlaybackTheora::set_file(const String &p_file) {
|
||||||
ERR_FAIL_COND(playing);
|
ERR_FAIL_COND(playing);
|
||||||
@ -174,7 +172,6 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
|
|||||||
ring_buffer.write(read_buffer.ptr(), read);
|
ring_buffer.write(read_buffer.ptr(), read);
|
||||||
|
|
||||||
thread.start(_streaming_thread, this);
|
thread.start(_streaming_thread, this);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ogg_sync_init(&oy);
|
ogg_sync_init(&oy);
|
||||||
@ -245,6 +242,12 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
|
|||||||
|
|
||||||
/* we're expecting more header packets. */
|
/* we're expecting more header packets. */
|
||||||
while ((theora_p && theora_p < 3) || (vorbis_p && vorbis_p < 3)) {
|
while ((theora_p && theora_p < 3) || (vorbis_p && vorbis_p < 3)) {
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// Make exception for these assignments in conditional expression.
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4706)
|
||||||
|
#endif
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* look for further theora headers */
|
/* look for further theora headers */
|
||||||
@ -281,6 +284,10 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* The header pages/packets will arrive before anything else we
|
/* The header pages/packets will arrive before anything else we
|
||||||
care about, or the stream is not obeying spec */
|
care about, or the stream is not obeying spec */
|
||||||
|
|
||||||
@ -355,14 +362,14 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
|
|||||||
buffering = true;
|
buffering = true;
|
||||||
time = 0;
|
time = 0;
|
||||||
audio_frames_wrote = 0;
|
audio_frames_wrote = 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
double VideoStreamPlaybackTheora::get_time() const {
|
double VideoStreamPlaybackTheora::get_time() const {
|
||||||
// FIXME: AudioServer output latency was fixed in af9bb0e, previously it used to
|
// FIXME: AudioServer output latency was fixed in af9bb0e, previously it used to
|
||||||
// systematically return 0. Now that it gives a proper latency, it broke this
|
// systematically return 0. Now that it gives a proper latency, it broke this
|
||||||
// code where the delay compensation likely never really worked.
|
// code where the delay compensation likely never really worked.
|
||||||
return time - /* AudioServer::get_singleton()->get_output_latency() - */ delay_compensation;
|
return time - /* AudioServer::get_singleton()->get_output_latency() - */ delay_compensation;
|
||||||
};
|
}
|
||||||
|
|
||||||
Ref<Texture2D> VideoStreamPlaybackTheora::get_texture() const {
|
Ref<Texture2D> VideoStreamPlaybackTheora::get_texture() const {
|
||||||
return texture;
|
return texture;
|
||||||
@ -376,7 +383,7 @@ void VideoStreamPlaybackTheora::update(double p_delta) {
|
|||||||
if (!playing || paused) {
|
if (!playing || paused) {
|
||||||
//printf("not playing\n");
|
//printf("not playing\n");
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
#ifdef THEORA_USE_THREAD_STREAMING
|
#ifdef THEORA_USE_THREAD_STREAMING
|
||||||
thread_sem->post();
|
thread_sem->post();
|
||||||
@ -444,7 +451,7 @@ void VideoStreamPlaybackTheora::update(double p_delta) {
|
|||||||
}
|
}
|
||||||
} else { /* we need more data; break out to suck in another page */
|
} else { /* we need more data; break out to suck in another page */
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
audio_done = videobuf_time < (audio_frames_wrote / float(vi.rate));
|
audio_done = videobuf_time < (audio_frames_wrote / float(vi.rate));
|
||||||
@ -507,7 +514,7 @@ void VideoStreamPlaybackTheora::update(double p_delta) {
|
|||||||
//printf("video done, stopping\n");
|
//printf("video done, stopping\n");
|
||||||
stop();
|
stop();
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
if (!frame_done || !audio_done) {
|
if (!frame_done || !audio_done) {
|
||||||
//what's the point of waiting for audio to grab a page?
|
//what's the point of waiting for audio to grab a page?
|
||||||
@ -539,7 +546,7 @@ void VideoStreamPlaybackTheora::update(double p_delta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
video_write();
|
video_write();
|
||||||
};
|
}
|
||||||
|
|
||||||
void VideoStreamPlaybackTheora::play() {
|
void VideoStreamPlaybackTheora::play() {
|
||||||
if (!playing) {
|
if (!playing) {
|
||||||
@ -551,7 +558,7 @@ void VideoStreamPlaybackTheora::play() {
|
|||||||
playing = true;
|
playing = true;
|
||||||
delay_compensation = ProjectSettings::get_singleton()->get("audio/video/video_delay_compensation_ms");
|
delay_compensation = ProjectSettings::get_singleton()->get("audio/video/video_delay_compensation_ms");
|
||||||
delay_compensation /= 1000.0;
|
delay_compensation /= 1000.0;
|
||||||
};
|
}
|
||||||
|
|
||||||
void VideoStreamPlaybackTheora::stop() {
|
void VideoStreamPlaybackTheora::stop() {
|
||||||
if (playing) {
|
if (playing) {
|
||||||
@ -560,42 +567,42 @@ void VideoStreamPlaybackTheora::stop() {
|
|||||||
}
|
}
|
||||||
playing = false;
|
playing = false;
|
||||||
time = 0;
|
time = 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool VideoStreamPlaybackTheora::is_playing() const {
|
bool VideoStreamPlaybackTheora::is_playing() const {
|
||||||
return playing;
|
return playing;
|
||||||
};
|
}
|
||||||
|
|
||||||
void VideoStreamPlaybackTheora::set_paused(bool p_paused) {
|
void VideoStreamPlaybackTheora::set_paused(bool p_paused) {
|
||||||
paused = p_paused;
|
paused = p_paused;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool VideoStreamPlaybackTheora::is_paused() const {
|
bool VideoStreamPlaybackTheora::is_paused() const {
|
||||||
return paused;
|
return paused;
|
||||||
};
|
}
|
||||||
|
|
||||||
void VideoStreamPlaybackTheora::set_loop(bool p_enable) {
|
void VideoStreamPlaybackTheora::set_loop(bool p_enable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoStreamPlaybackTheora::has_loop() const {
|
bool VideoStreamPlaybackTheora::has_loop() const {
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
|
||||||
double VideoStreamPlaybackTheora::get_length() const {
|
double VideoStreamPlaybackTheora::get_length() const {
|
||||||
return 0;
|
return 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
String VideoStreamPlaybackTheora::get_stream_name() const {
|
String VideoStreamPlaybackTheora::get_stream_name() const {
|
||||||
return "";
|
return "";
|
||||||
};
|
}
|
||||||
|
|
||||||
int VideoStreamPlaybackTheora::get_loop_count() const {
|
int VideoStreamPlaybackTheora::get_loop_count() const {
|
||||||
return 0;
|
return 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
double VideoStreamPlaybackTheora::get_playback_position() const {
|
double VideoStreamPlaybackTheora::get_playback_position() const {
|
||||||
return get_time();
|
return get_time();
|
||||||
};
|
}
|
||||||
|
|
||||||
void VideoStreamPlaybackTheora::seek(double p_time) {
|
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).");
|
WARN_PRINT_ONCE("Seeking in Theora videos is not implemented yet (it's only supported for GDExtension-provided video streams).");
|
||||||
@ -650,15 +657,14 @@ VideoStreamPlaybackTheora::VideoStreamPlaybackTheora() {
|
|||||||
thread_sem = Semaphore::create();
|
thread_sem = Semaphore::create();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
};
|
}
|
||||||
|
|
||||||
VideoStreamPlaybackTheora::~VideoStreamPlaybackTheora() {
|
VideoStreamPlaybackTheora::~VideoStreamPlaybackTheora() {
|
||||||
#ifdef THEORA_USE_THREAD_STREAMING
|
#ifdef THEORA_USE_THREAD_STREAMING
|
||||||
|
|
||||||
memdelete(thread_sem);
|
memdelete(thread_sem);
|
||||||
#endif
|
#endif
|
||||||
clear();
|
clear();
|
||||||
};
|
}
|
||||||
|
|
||||||
void VideoStreamTheora::_bind_methods() {
|
void VideoStreamTheora::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_file", "file"), &VideoStreamTheora::set_file);
|
ClassDB::bind_method(D_METHOD("set_file", "file"), &VideoStreamTheora::set_file);
|
||||||
|
@ -153,8 +153,11 @@ int AudioStreamPlaybackOggVorbis::_mix_frames_vorbis(AudioFrame *p_buffer, int p
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ERR_FAIL_COND_V_MSG((err = vorbis_synthesis(&block, packet)), 0, "Error during vorbis synthesis " + itos(err));
|
err = vorbis_synthesis(&block, packet);
|
||||||
ERR_FAIL_COND_V_MSG((err = vorbis_synthesis_blockin(&dsp_state, &block)), 0, "Error during vorbis block processing " + itos(err));
|
ERR_FAIL_COND_V_MSG(err != 0, 0, "Error during vorbis synthesis " + itos(err));
|
||||||
|
|
||||||
|
err = vorbis_synthesis_blockin(&dsp_state, &block);
|
||||||
|
ERR_FAIL_COND_V_MSG(err != 0, 0, "Error during vorbis block processing " + itos(err));
|
||||||
|
|
||||||
have_packets_left = !packet->e_o_s;
|
have_packets_left = !packet->e_o_s;
|
||||||
}
|
}
|
||||||
@ -290,11 +293,15 @@ void AudioStreamPlaybackOggVorbis::seek(double p_time) {
|
|||||||
headers_remaining = 3;
|
headers_remaining = 3;
|
||||||
}
|
}
|
||||||
if (!headers_remaining) {
|
if (!headers_remaining) {
|
||||||
ERR_FAIL_COND_MSG((err = vorbis_synthesis(&block, packet)), "Error during vorbis synthesis " + itos(err));
|
err = vorbis_synthesis(&block, packet);
|
||||||
ERR_FAIL_COND_MSG((err = vorbis_synthesis_blockin(&dsp_state, &block)), "Error during vorbis block processing " + itos(err));
|
ERR_FAIL_COND_MSG(err != 0, "Error during vorbis synthesis " + itos(err));
|
||||||
|
|
||||||
|
err = vorbis_synthesis_blockin(&dsp_state, &block);
|
||||||
|
ERR_FAIL_COND_MSG(err != 0, "Error during vorbis block processing " + itos(err));
|
||||||
|
|
||||||
int samples_out = vorbis_synthesis_pcmout(&dsp_state, nullptr);
|
int samples_out = vorbis_synthesis_pcmout(&dsp_state, nullptr);
|
||||||
ERR_FAIL_COND_MSG((err = vorbis_synthesis_read(&dsp_state, samples_out)), "Error during vorbis read updating " + itos(err));
|
err = vorbis_synthesis_read(&dsp_state, samples_out);
|
||||||
|
ERR_FAIL_COND_MSG(err != 0, "Error during vorbis read updating " + itos(err));
|
||||||
|
|
||||||
samples_in_page += samples_out;
|
samples_in_page += samples_out;
|
||||||
|
|
||||||
@ -341,12 +348,16 @@ void AudioStreamPlaybackOggVorbis::seek(double p_time) {
|
|||||||
headers_remaining = 3;
|
headers_remaining = 3;
|
||||||
}
|
}
|
||||||
if (!headers_remaining) {
|
if (!headers_remaining) {
|
||||||
ERR_FAIL_COND_MSG((err = vorbis_synthesis(&block, packet)), "Error during vorbis synthesis " + itos(err));
|
err = vorbis_synthesis(&block, packet);
|
||||||
ERR_FAIL_COND_MSG((err = vorbis_synthesis_blockin(&dsp_state, &block)), "Error during vorbis block processing " + itos(err));
|
ERR_FAIL_COND_MSG(err != 0, "Error during vorbis synthesis " + itos(err));
|
||||||
|
|
||||||
|
err = vorbis_synthesis_blockin(&dsp_state, &block);
|
||||||
|
ERR_FAIL_COND_MSG(err != 0, "Error during vorbis block processing " + itos(err));
|
||||||
|
|
||||||
int samples_out = vorbis_synthesis_pcmout(&dsp_state, nullptr);
|
int samples_out = vorbis_synthesis_pcmout(&dsp_state, nullptr);
|
||||||
int read_samples = samples_to_burn > samples_out ? samples_out : samples_to_burn;
|
int read_samples = samples_to_burn > samples_out ? samples_out : samples_to_burn;
|
||||||
ERR_FAIL_COND_MSG((err = vorbis_synthesis_read(&dsp_state, samples_out)), "Error during vorbis read updating " + itos(err));
|
err = vorbis_synthesis_read(&dsp_state, samples_out);
|
||||||
|
ERR_FAIL_COND_MSG(err != 0, "Error during vorbis read updating " + itos(err));
|
||||||
samples_to_burn -= read_samples;
|
samples_to_burn -= read_samples;
|
||||||
|
|
||||||
if (samples_to_burn <= 0) {
|
if (samples_to_burn <= 0) {
|
||||||
|
@ -110,15 +110,18 @@ Ref<AudioStreamOggVorbis> ResourceImporterOggVorbis::import_ogg_vorbis(const Str
|
|||||||
size_t packet_count = 0;
|
size_t packet_count = 0;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref<AudioStreamOggVorbis>(), "Ogg sync error " + itos(err));
|
err = ogg_sync_check(&sync_state);
|
||||||
|
ERR_FAIL_COND_V_MSG(err != 0, Ref<AudioStreamOggVorbis>(), "Ogg sync error " + itos(err));
|
||||||
while (ogg_sync_pageout(&sync_state, &page) != 1) {
|
while (ogg_sync_pageout(&sync_state, &page) != 1) {
|
||||||
if (cursor >= len) {
|
if (cursor >= len) {
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref<AudioStreamOggVorbis>(), "Ogg sync error " + itos(err));
|
err = ogg_sync_check(&sync_state);
|
||||||
|
ERR_FAIL_COND_V_MSG(err != 0, Ref<AudioStreamOggVorbis>(), "Ogg sync error " + itos(err));
|
||||||
char *sync_buf = ogg_sync_buffer(&sync_state, OGG_SYNC_BUFFER_SIZE);
|
char *sync_buf = ogg_sync_buffer(&sync_state, OGG_SYNC_BUFFER_SIZE);
|
||||||
ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref<AudioStreamOggVorbis>(), "Ogg sync error " + itos(err));
|
err = ogg_sync_check(&sync_state);
|
||||||
|
ERR_FAIL_COND_V_MSG(err != 0, Ref<AudioStreamOggVorbis>(), "Ogg sync error " + itos(err));
|
||||||
ERR_FAIL_COND_V(cursor > len, Ref<AudioStreamOggVorbis>());
|
ERR_FAIL_COND_V(cursor > len, Ref<AudioStreamOggVorbis>());
|
||||||
size_t copy_size = len - cursor;
|
size_t copy_size = len - cursor;
|
||||||
if (copy_size > OGG_SYNC_BUFFER_SIZE) {
|
if (copy_size > OGG_SYNC_BUFFER_SIZE) {
|
||||||
@ -127,12 +130,14 @@ Ref<AudioStreamOggVorbis> ResourceImporterOggVorbis::import_ogg_vorbis(const Str
|
|||||||
memcpy(sync_buf, &file_data[cursor], copy_size);
|
memcpy(sync_buf, &file_data[cursor], copy_size);
|
||||||
ogg_sync_wrote(&sync_state, copy_size);
|
ogg_sync_wrote(&sync_state, copy_size);
|
||||||
cursor += copy_size;
|
cursor += copy_size;
|
||||||
ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref<AudioStreamOggVorbis>(), "Ogg sync error " + itos(err));
|
err = ogg_sync_check(&sync_state);
|
||||||
|
ERR_FAIL_COND_V_MSG(err != 0, Ref<AudioStreamOggVorbis>(), "Ogg sync error " + itos(err));
|
||||||
}
|
}
|
||||||
if (done) {
|
if (done) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ERR_FAIL_COND_V_MSG((err = ogg_sync_check(&sync_state)), Ref<AudioStreamOggVorbis>(), "Ogg sync error " + itos(err));
|
err = ogg_sync_check(&sync_state);
|
||||||
|
ERR_FAIL_COND_V_MSG(err != 0, Ref<AudioStreamOggVorbis>(), "Ogg sync error " + itos(err));
|
||||||
|
|
||||||
// Have a page now.
|
// Have a page now.
|
||||||
if (!initialized_stream) {
|
if (!initialized_stream) {
|
||||||
@ -142,7 +147,8 @@ Ref<AudioStreamOggVorbis> ResourceImporterOggVorbis::import_ogg_vorbis(const Str
|
|||||||
initialized_stream = true;
|
initialized_stream = true;
|
||||||
}
|
}
|
||||||
ogg_stream_pagein(&stream_state, &page);
|
ogg_stream_pagein(&stream_state, &page);
|
||||||
ERR_FAIL_COND_V_MSG((err = ogg_stream_check(&stream_state)), Ref<AudioStreamOggVorbis>(), "Ogg stream error " + itos(err));
|
err = ogg_stream_check(&stream_state);
|
||||||
|
ERR_FAIL_COND_V_MSG(err != 0, Ref<AudioStreamOggVorbis>(), "Ogg stream error " + itos(err));
|
||||||
int desync_iters = 0;
|
int desync_iters = 0;
|
||||||
|
|
||||||
Vector<Vector<uint8_t>> packet_data;
|
Vector<Vector<uint8_t>> packet_data;
|
||||||
|
@ -87,7 +87,8 @@ CommandLineToArgvA(
|
|||||||
i = 0;
|
i = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
|
|
||||||
while ((a = CmdLine[i])) {
|
a = CmdLine[i];
|
||||||
|
while (a) {
|
||||||
if (in_QM) {
|
if (in_QM) {
|
||||||
if (a == '\"') {
|
if (a == '\"') {
|
||||||
in_QM = FALSE;
|
in_QM = FALSE;
|
||||||
@ -130,6 +131,7 @@ CommandLineToArgvA(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
a = CmdLine[i];
|
||||||
}
|
}
|
||||||
_argv[j] = '\0';
|
_argv[j] = '\0';
|
||||||
argv[argc] = nullptr;
|
argv[argc] = nullptr;
|
||||||
|
@ -172,18 +172,20 @@ void FileDialog::shortcut_input(const Ref<InputEvent> &p_event) {
|
|||||||
|
|
||||||
void FileDialog::set_enable_multiple_selection(bool p_enable) {
|
void FileDialog::set_enable_multiple_selection(bool p_enable) {
|
||||||
tree->set_select_mode(p_enable ? Tree::SELECT_MULTI : Tree::SELECT_SINGLE);
|
tree->set_select_mode(p_enable ? Tree::SELECT_MULTI : Tree::SELECT_SINGLE);
|
||||||
};
|
}
|
||||||
|
|
||||||
Vector<String> FileDialog::get_selected_files() const {
|
Vector<String> FileDialog::get_selected_files() const {
|
||||||
Vector<String> list;
|
Vector<String> list;
|
||||||
|
|
||||||
TreeItem *item = tree->get_root();
|
TreeItem *item = tree->get_root();
|
||||||
while ((item = tree->get_next_selected(item))) {
|
item = tree->get_next_selected(item);
|
||||||
|
while (item) {
|
||||||
list.push_back(dir_access->get_current_dir().path_join(item->get_text(0)));
|
list.push_back(dir_access->get_current_dir().path_join(item->get_text(0)));
|
||||||
};
|
item = tree->get_next_selected(item);
|
||||||
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
};
|
}
|
||||||
|
|
||||||
void FileDialog::update_dir() {
|
void FileDialog::update_dir() {
|
||||||
if (root_prefix.is_empty()) {
|
if (root_prefix.is_empty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user