From dfed79567746043d4da0e40f6cdf1a1edd8a5e62 Mon Sep 17 00:00:00 2001 From: mikepkes Date: Mon, 22 Jul 2024 15:04:01 -0700 Subject: [PATCH] Ran clang-format on src and includes Signed-off-by: Michael Kessler --- include/xstudio/audio/audio_output.hpp | 19 +- include/xstudio/audio/audio_output_actor.hpp | 241 +++++++++--------- include/xstudio/audio/audio_output_device.hpp | 2 +- .../audio/linux_audio_output_device.hpp | 1 - .../audio/windows_audio_output_device.hpp | 13 +- include/xstudio/global_store/global_store.hpp | 5 +- include/xstudio/media/media_actor.hpp | 1 - include/xstudio/media_reader/buffer.hpp | 6 +- include/xstudio/module/module.hpp | 3 +- .../xstudio/plugin_manager/plugin_base.hpp | 2 +- .../ui/model_data/model_data_actor.hpp | 3 +- .../ui/opengl/opengl_offscreen_renderer.hpp | 2 +- include/xstudio/ui/opengl/texture.hpp | 2 +- include/xstudio/ui/qml/actor_object.hpp | 7 +- .../xstudio/ui/qml/global_store_model_ui.hpp | 3 +- include/xstudio/ui/qml/hotkey_ui.hpp | 3 +- include/xstudio/ui/qml/model_data_ui.hpp | 2 +- .../xstudio/ui/qml/qml_viewport_renderer.hpp | 2 +- include/xstudio/ui/qml/studio_ui.hpp | 1 - include/xstudio/ui/qt/offscreen_viewport.hpp | 33 +-- include/xstudio/ui/viewport/viewport.hpp | 7 +- include/xstudio/utility/caf_helpers.hpp | 9 +- include/xstudio/utility/chrono.hpp | 10 +- include/xstudio/utility/edit_list.hpp | 2 +- include/xstudio/utility/frame_rate.hpp | 2 +- .../utility/frame_rate_and_duration.hpp | 2 +- include/xstudio/utility/helpers.hpp | 91 ++++--- include/xstudio/utility/lock_file.hpp | 4 +- include/xstudio/utility/sequence.hpp | 2 +- include/xstudio/utility/string_helpers.hpp | 8 +- src/audio/src/audio_output.cpp | 61 ++--- src/audio/src/audio_output_actor.cpp | 18 +- src/audio/src/linux_audio_output_device.cpp | 3 +- src/audio/src/windows_audio_output_device.cpp | 43 ++-- src/colour_pipeline/src/colour_pipeline.cpp | 6 +- src/embedded_python/src/embedded_python.cpp | 2 +- .../src/embedded_python_actor.cpp | 2 +- src/global/src/global_actor.cpp | 4 +- src/global_store/src/global_store.cpp | 20 +- src/json_store/src/json_store_actor.cpp | 15 +- src/launch/xstudio/src/xstudio.cpp | 25 +- src/media/src/media_actor.cpp | 15 +- src/media/src/media_source_actor.cpp | 53 ++-- src/media_cache/src/media_cache_actor.cpp | 2 +- src/media_hook/src/media_hook_actor.cpp | 6 +- src/module/src/module.cpp | 64 ++--- src/playhead/src/playhead.cpp | 1 - src/playhead/src/playhead_actor.cpp | 2 +- .../src/playhead_global_events_actor.cpp | 28 +- src/playhead/src/sub_playhead.cpp | 52 ++-- src/playlist/src/playlist_actor.cpp | 13 +- .../grading/src/grading_colour_op.cpp | 4 +- src/plugin/colour_pipeline/ocio/src/ocio.cpp | 20 +- .../colour_pipeline/ocio/src/ocio_ui.cpp | 8 +- .../src/data_source_shotgun_worker.cpp | 1 - .../media_hook/dneg/dnhook/src/dneg.cpp | 6 +- .../ffprobe/src/ffprobe_lib.cpp | 4 +- src/plugin/media_reader/ffmpeg/src/ffmpeg.cpp | 5 +- .../media_reader/ffmpeg/src/ffmpeg_stream.cpp | 8 +- src/plugin/utility/dneg/dnrun/src/dnrun.cpp | 2 +- src/plugin_manager/src/plugin_manager.cpp | 3 +- .../src/plugin_manager_actor.cpp | 2 +- src/scanner/src/scanner_actor.cpp | 4 +- src/session/src/session_actor.cpp | 3 +- .../src/shotgun_client_actor.cpp | 7 +- src/thumbnail/src/thumbnail_manager_actor.cpp | 2 +- src/timeline/src/item.cpp | 34 +-- src/timeline/src/timeline_actor.cpp | 60 +++-- src/ui/model_data/src/model_data_actor.cpp | 14 +- .../opengl/src/opengl_viewport_renderer.cpp | 2 +- src/ui/opengl/src/texture.cpp | 49 ++-- src/ui/qml/bookmark/src/bookmark_model_ui.cpp | 6 +- .../src/global_store_model_ui.cpp | 2 +- src/ui/qml/helper/src/model_data_ui.cpp | 9 +- src/ui/qml/playhead/src/playhead_ui.cpp | 2 +- .../session/src/session_model_methods_ui.cpp | 8 +- src/ui/qml/studio/src/studio_ui.cpp | 22 +- .../viewport/src/qml_viewport_renderer.cpp | 11 +- .../src/offscreen_viewport.cpp | 179 ++++++------- src/ui/viewport/src/viewport.cpp | 99 ++++--- .../src/viewport_frame_queue_actor.cpp | 41 +-- src/utility/src/chrono.cpp | 2 +- src/utility/src/frame_list.cpp | 2 +- src/utility/src/helpers.cpp | 6 +- src/utility/src/json_store.cpp | 4 +- src/utility/src/logging.cpp | 2 +- src/utility/src/remote_session_file.cpp | 10 +- src/utility/src/sequence.cpp | 3 +- 88 files changed, 753 insertions(+), 816 deletions(-) diff --git a/include/xstudio/audio/audio_output.hpp b/include/xstudio/audio/audio_output.hpp index 133c8f5d7..70338b38b 100644 --- a/include/xstudio/audio/audio_output.hpp +++ b/include/xstudio/audio/audio_output.hpp @@ -75,16 +75,14 @@ class AudioOutputControl { const float volume, const bool muted, const bool audio_repitch, - const bool audio_scrubbing) - { - volume_ = volume; - muted_ = muted; - audio_repitch_ = audio_repitch; - audio_scrubbing_ = audio_scrubbing; + const bool audio_scrubbing) { + volume_ = volume; + muted_ = muted; + audio_repitch_ = audio_repitch; + audio_scrubbing_ = audio_scrubbing; } private: - media_reader::AudioBufPtr pick_audio_buffer(const utility::clock::time_point &tp, const bool drop_old_buffers); @@ -101,10 +99,9 @@ class AudioOutputControl { int fade_in_out_ = {NoFade}; - bool audio_repitch_ = {false}; + bool audio_repitch_ = {false}; bool audio_scrubbing_ = {false}; - float volume_ = {100.0f}; - bool muted_ = {false}; - + float volume_ = {100.0f}; + bool muted_ = {false}; }; } // namespace xstudio::audio diff --git a/include/xstudio/audio/audio_output_actor.hpp b/include/xstudio/audio/audio_output_actor.hpp index 96e99752f..0ff730b0b 100644 --- a/include/xstudio/audio/audio_output_actor.hpp +++ b/include/xstudio/audio/audio_output_actor.hpp @@ -12,103 +12,101 @@ template class AudioOutputDeviceActor : public caf::event_based_actor { public: + AudioOutputDeviceActor(caf::actor_config &cfg, caf::actor samples_actor) + : caf::event_based_actor(cfg), + playing_(false), + waiting_for_samples_(false), + audio_samples_actor_(samples_actor) { + + // spdlog::info("Created {} {}", "AudioOutputDeviceActor", OutputClassType::name()); + // utility::print_on_exit(this, OutputClassType::name()); + + try { + auto prefs = global_store::GlobalStoreHelper(system()); + utility::JsonStore j; + utility::join_broadcast(this, prefs.get_group(j)); + open_output_device(j); + } catch (...) { + open_output_device(utility::JsonStore()); + } + + behavior_.assign( + + [=](xstudio::broadcast::broadcast_down_atom, const caf::actor_addr &) {}, + + [=](json_store::update_atom, + const utility::JsonStore & /*change*/, + const std::string & /*path*/, + const utility::JsonStore &full) { + delegate(actor_cast(this), json_store::update_atom_v, full); + }, + [=](json_store::update_atom, const utility::JsonStore & /*j*/) { + // TODO: restart soundcard connection with new prefs + if (output_device_) { + output_device_->initialize_sound_card(); + } + }, + [=](utility::event_atom, playhead::play_atom, const bool is_playing) { + if (!is_playing && output_device_) { + // this stops the loop pushing samples to the soundcard + playing_ = false; + output_device_->disconnect_from_soundcard(); + } else if (is_playing && !playing_) { + // start loop + playing_ = true; + if (output_device_) + output_device_->connect_to_soundcard(); + anon_send(actor_cast(this), push_samples_atom_v); + } + }, + [=](push_samples_atom) { + if (!output_device_) + return; + // The 'waiting_for_samples_' flag allows us to ensure that we + // don't have multiple requests for samples to play in flight - + // since each response to a request then sends another + // 'push_samples_atom' atom (to keep playback running), having multiple + // requests in flight completely messes up the audio playback as + // essentially we have two loops running within the single actor. + if (waiting_for_samples_ || !playing_) + return; + waiting_for_samples_ = true; + + const long num_samps_soundcard_wants = (long)output_device_->desired_samples(); + auto tt = utility::clock::now(); + request( + audio_samples_actor_, + infinite, + get_samples_for_soundcard_atom_v, + num_samps_soundcard_wants, + (long)output_device_->latency_microseconds(), + (int)output_device_->num_channels(), + (int)output_device_->sample_rate()) + .then( + [=](const std::vector &samples_to_play) mutable { + waiting_for_samples_ = false; + output_device_->push_samples( + (const void *)samples_to_play.data(), samples_to_play.size()); + + + if (playing_) { + anon_send(actor_cast(this), push_samples_atom_v); + } + }, + [=](caf::error &err) mutable { waiting_for_samples_ = false; }); + } + + ); + } - AudioOutputDeviceActor( - caf::actor_config &cfg, - caf::actor samples_actor) - : caf::event_based_actor(cfg), - playing_(false), - waiting_for_samples_(false), - audio_samples_actor_(samples_actor) { - - //spdlog::info("Created {} {}", "AudioOutputDeviceActor", OutputClassType::name()); - //utility::print_on_exit(this, OutputClassType::name()); - - try { - auto prefs = global_store::GlobalStoreHelper(system()); - utility::JsonStore j; - utility::join_broadcast(this, prefs.get_group(j)); - open_output_device(j); - } catch (...) { - open_output_device(utility::JsonStore()); - } - - behavior_.assign( - - [=](xstudio::broadcast::broadcast_down_atom, const caf::actor_addr &) {}, - - [=](json_store::update_atom, - const utility::JsonStore & /*change*/, - const std::string & /*path*/, - const utility::JsonStore &full) { - delegate(actor_cast(this), json_store::update_atom_v, full); - }, - [=](json_store::update_atom, const utility::JsonStore & /*j*/) { - // TODO: restart soundcard connection with new prefs - if (output_device_) { - output_device_->initialize_sound_card(); - } - }, - [=](utility::event_atom, playhead::play_atom, const bool is_playing) { - if (!is_playing && output_device_) { - // this stops the loop pushing samples to the soundcard - playing_ = false; - output_device_->disconnect_from_soundcard(); - } else if (is_playing && !playing_) { - // start loop - playing_ = true; - if (output_device_) output_device_->connect_to_soundcard(); - anon_send(actor_cast(this), push_samples_atom_v); - } - }, - [=](push_samples_atom) { - if (!output_device_) return; - // The 'waiting_for_samples_' flag allows us to ensure that we - // don't have multiple requests for samples to play in flight - - // since each response to a request then sends another - // 'push_samples_atom' atom (to keep playback running), having multiple - // requests in flight completely messes up the audio playback as - // essentially we have two loops running within the single actor. - if (waiting_for_samples_ || !playing_) - return; - waiting_for_samples_ = true; - - const long num_samps_soundcard_wants = (long)output_device_->desired_samples(); - auto tt = utility::clock::now(); - request( - audio_samples_actor_, - infinite, - get_samples_for_soundcard_atom_v, - num_samps_soundcard_wants, - (long)output_device_->latency_microseconds(), - (int)output_device_->num_channels(), - (int)output_device_->sample_rate()) - .then( - [=](const std::vector &samples_to_play) mutable { - waiting_for_samples_ = false; - output_device_->push_samples( - (const void *)samples_to_play.data(), samples_to_play.size()); - - - - if (playing_) { - anon_send(actor_cast(this), push_samples_atom_v); - } - }, - [=](caf::error &err) mutable { waiting_for_samples_ = false; }); - } - - ); - } - - void open_output_device(const utility::JsonStore &prefs) { - try { - output_device_ = std::make_unique(prefs); - } catch (std::exception &e) { - spdlog::error( - "{} Failed to connect to an audio device: {}", __PRETTY_FUNCTION__, e.what()); - } - } + void open_output_device(const utility::JsonStore &prefs) { + try { + output_device_ = std::make_unique(prefs); + } catch (std::exception &e) { + spdlog::error( + "{} Failed to connect to an audio device: {}", __PRETTY_FUNCTION__, e.what()); + } + } ~AudioOutputDeviceActor() override = default; @@ -117,11 +115,9 @@ class AudioOutputDeviceActor : public caf::event_based_actor { const char *name() const override { return name_.c_str(); } protected: - std::unique_ptr output_device_; private: - caf::behavior behavior_; std::string name_; bool playing_; @@ -133,18 +129,13 @@ template class AudioOutputActor : public caf::event_based_actor, AudioOutputControl { public: - AudioOutputActor( - caf::actor_config &cfg) - : caf::event_based_actor(cfg) { - init(); - } + AudioOutputActor(caf::actor_config &cfg) : caf::event_based_actor(cfg) { init(); } ~AudioOutputActor() override = default; caf::behavior make_behavior() override { return behavior_; } private: - caf::actor audio_output_device_; void init(); @@ -160,43 +151,43 @@ class AudioOutputActor : public caf::event_based_actor, AudioOutputControl { utility::Uuid sub_playhead_uuid_; }; -/* Singleton class that receives audio sample buffers from the current +/* Singleton class that receives audio sample buffers from the current playhead during playback. It re-broadcasts these samples to any AudioOutputActor that has been instanced. */ class GlobalAudioOutputActor : public caf::event_based_actor, module::Module { public: - GlobalAudioOutputActor( - caf::actor_config &cfg); + GlobalAudioOutputActor(caf::actor_config &cfg); ~GlobalAudioOutputActor() override = default; void on_exit() override; void attribute_changed(const utility::Uuid &attr_uuid, const int role); - caf::behavior make_behavior() override { return behavior_.or_else(module::Module::message_handler()); } + caf::behavior make_behavior() override { + return behavior_.or_else(module::Module::message_handler()); + } private: - caf::actor event_group_; caf::message_handler behavior_; module::BooleanAttribute *audio_repitch_; module::BooleanAttribute *audio_scrubbing_; module::FloatAttribute *volume_; module::BooleanAttribute *muted_; - }; -template -void AudioOutputActor::init() { +template void AudioOutputActor::init() { - //spdlog::debug("Created AudioOutputControlActor {}", OutputClassType::name()); + // spdlog::debug("Created AudioOutputControlActor {}", OutputClassType::name()); utility::print_on_exit(this, "AudioOutputControlActor"); - audio_output_device_ = spawn>(caf::actor_cast(this)); + audio_output_device_ = + spawn>(caf::actor_cast(this)); link_to(audio_output_device_); - auto global_audio_actor = system().registry().template get(audio_output_registry); + auto global_audio_actor = + system().registry().template get(audio_output_registry); utility::join_event_group(this, global_audio_actor); behavior_.assign( @@ -204,7 +195,8 @@ void AudioOutputActor::init() { [=](xstudio::broadcast::broadcast_down_atom, const caf::actor_addr &) {}, [=](utility::event_atom, playhead::play_atom, const bool is_playing) { - send(audio_output_device_, utility::event_atom_v, playhead::play_atom_v, is_playing); + send( + audio_output_device_, utility::event_atom_v, playhead::play_atom_v, is_playing); }, [=](get_samples_for_soundcard_atom, @@ -224,15 +216,12 @@ void AudioOutputActor::init() { } return samples; }, - [=]( - utility::event_atom, - module::change_attribute_event_atom, - const float volume, - const bool muted, - const bool repitch, - const bool scrubbing) { - set_attrs(volume, muted, repitch, scrubbing); - }, + [=](utility::event_atom, + module::change_attribute_event_atom, + const float volume, + const bool muted, + const bool repitch, + const bool scrubbing) { set_attrs(volume, muted, repitch, scrubbing); }, [=](utility::event_atom, playhead::sound_audio_atom, const std::vector &audio_buffers, @@ -240,7 +229,6 @@ void AudioOutputActor::init() { const bool playing, const bool forwards, const float velocity) { - if (!playing) { clear_queued_samples(); } else { @@ -255,7 +243,6 @@ void AudioOutputActor::init() { } ); - } } // namespace xstudio::audio diff --git a/include/xstudio/audio/audio_output_device.hpp b/include/xstudio/audio/audio_output_device.hpp index ca92875c0..c0b86f8b1 100644 --- a/include/xstudio/audio/audio_output_device.hpp +++ b/include/xstudio/audio/audio_output_device.hpp @@ -32,7 +32,7 @@ class AudioOutputDevice { * @brief Configure the sound card. * * @details Should be called any time the sound card should be set up or changed - */ + */ virtual void initialize_sound_card() = 0; /** diff --git a/include/xstudio/audio/linux_audio_output_device.hpp b/include/xstudio/audio/linux_audio_output_device.hpp index 7964b472a..2ff0005d1 100644 --- a/include/xstudio/audio/linux_audio_output_device.hpp +++ b/include/xstudio/audio/linux_audio_output_device.hpp @@ -40,7 +40,6 @@ namespace audio { static std::string name() { return "LinuxAudioOutputDevice"; } private: - void initialize_sound_card() override {} long sample_rate_ = {44100}; diff --git a/include/xstudio/audio/windows_audio_output_device.hpp b/include/xstudio/audio/windows_audio_output_device.hpp index 9a1eabe3a..ec06390b7 100644 --- a/include/xstudio/audio/windows_audio_output_device.hpp +++ b/include/xstudio/audio/windows_audio_output_device.hpp @@ -40,24 +40,21 @@ namespace audio { [[nodiscard]] SampleFormat sample_format() const override { return sample_format_; } private: - long sample_rate_ = {48000}; - int num_channels_ = {2}; - long buffer_size_ = {2048}; + long sample_rate_ = {48000}; + int num_channels_ = {2}; + long buffer_size_ = {2048}; SampleFormat sample_format_ = {SampleFormat::INT16}; CComPtr audio_client_; CComPtr render_client_; CComPtr render_clock_adjustment_; - + const utility::JsonStore config_; const utility::JsonStore prefs_; void initialize_sound_card(); HRESULT initializeAudioClient( - const std::string &sound_card = "", - long sample_rate = 48000, - int num_channels = 2); - + const std::string &sound_card = "", long sample_rate = 48000, int num_channels = 2); }; } // namespace audio } // namespace xstudio diff --git a/include/xstudio/global_store/global_store.hpp b/include/xstudio/global_store/global_store.hpp index fa43910e4..1fea8d83b 100644 --- a/include/xstudio/global_store/global_store.hpp +++ b/include/xstudio/global_store/global_store.hpp @@ -232,7 +232,7 @@ namespace global_store { const bool broacast_change = true) { JsonStoreHelper::set(value, path + "/value", async, broacast_change); } - + /*If a preference is found at path return the value. Otherwise build a preference at path and return default.*/ utility::JsonStore get_existing_or_create_new_preference( @@ -240,8 +240,7 @@ namespace global_store { const utility::JsonStore &default_, const bool async = true, const bool broacast_change = true, - const std::string &context="APPLICATION" - ); + const std::string &context = "APPLICATION"); void set(const GlobalStoreDef &gsd, const bool async = true); bool save(const std::string &context); diff --git a/include/xstudio/media/media_actor.hpp b/include/xstudio/media/media_actor.hpp index a787d3710..7fe34ac0b 100644 --- a/include/xstudio/media/media_actor.hpp +++ b/include/xstudio/media/media_actor.hpp @@ -96,7 +96,6 @@ namespace media { const char *name() const override { return NAME.c_str(); } private: - void update_media_status(); void update_media_detail(); diff --git a/include/xstudio/media_reader/buffer.hpp b/include/xstudio/media_reader/buffer.hpp index 7cde442d6..7bd8b0c5e 100644 --- a/include/xstudio/media_reader/buffer.hpp +++ b/include/xstudio/media_reader/buffer.hpp @@ -63,9 +63,11 @@ namespace media_reader { error_state_ = HAS_ERROR; } - struct BufferData { + struct BufferData { struct BufferDeleter { - void operator()(byte *ptr) const { operator delete[](ptr, std::align_val_t(1024)); } + void operator()(byte *ptr) const { + operator delete[](ptr, std::align_val_t(1024)); + } }; BufferData(byte *d) : data_(d, BufferDeleter()) {} diff --git a/include/xstudio/module/module.hpp b/include/xstudio/module/module.hpp index b4c81aa98..d538dd9e0 100644 --- a/include/xstudio/module/module.hpp +++ b/include/xstudio/module/module.hpp @@ -123,8 +123,7 @@ namespace module { const bool both_ways, const bool initial_push_sync); - void unlink_module( - caf::actor other_module); + void unlink_module(caf::actor other_module); /* If this Module instance is linked to another Module instance, only attributes that have been registered with this function will be synced diff --git a/include/xstudio/plugin_manager/plugin_base.hpp b/include/xstudio/plugin_manager/plugin_base.hpp index dac633740..3189e2ff2 100644 --- a/include/xstudio/plugin_manager/plugin_base.hpp +++ b/include/xstudio/plugin_manager/plugin_base.hpp @@ -55,7 +55,7 @@ namespace plugin { const Imath::M44f &transform_viewport_to_image_space, const float viewport_du_dpixel, const xstudio::media_reader::ImageBufPtr &frame, - const bool have_alpha_buffer){}; + const bool have_alpha_buffer) {}; [[nodiscard]] virtual RenderPass preferred_render_pass() const { return AfterImage; } }; diff --git a/include/xstudio/ui/model_data/model_data_actor.hpp b/include/xstudio/ui/model_data/model_data_actor.hpp index c1219fe26..91f509932 100644 --- a/include/xstudio/ui/model_data/model_data_actor.hpp +++ b/include/xstudio/ui/model_data/model_data_actor.hpp @@ -97,7 +97,8 @@ namespace ui { void push_to_prefs(const std::string &model_name, const bool actually_push = false); - void remove_attribute_from_model(const std::string &model_name, const utility::Uuid &attr_uuid); + void remove_attribute_from_model( + const std::string &model_name, const utility::Uuid &attr_uuid); void node_activated(const std::string &model_name, const std::string &path); diff --git a/include/xstudio/ui/opengl/opengl_offscreen_renderer.hpp b/include/xstudio/ui/opengl/opengl_offscreen_renderer.hpp index e428cf0be..1d09c7c91 100644 --- a/include/xstudio/ui/opengl/opengl_offscreen_renderer.hpp +++ b/include/xstudio/ui/opengl/opengl_offscreen_renderer.hpp @@ -13,7 +13,7 @@ namespace ui { class OpenGLOffscreenRenderer { public: explicit OpenGLOffscreenRenderer(GLint color_format); - OpenGLOffscreenRenderer(const OpenGLOffscreenRenderer &) = delete; + OpenGLOffscreenRenderer(const OpenGLOffscreenRenderer &) = delete; OpenGLOffscreenRenderer &operator=(const OpenGLOffscreenRenderer &) = delete; ~OpenGLOffscreenRenderer(); diff --git a/include/xstudio/ui/opengl/texture.hpp b/include/xstudio/ui/opengl/texture.hpp index d30e88065..30b0671a4 100644 --- a/include/xstudio/ui/opengl/texture.hpp +++ b/include/xstudio/ui/opengl/texture.hpp @@ -10,7 +10,7 @@ #include "xstudio/colour_pipeline/colour_pipeline.hpp" #include "xstudio/utility/uuid.hpp" -//#define USE_SSBO +// #define USE_SSBO namespace xstudio { namespace ui { diff --git a/include/xstudio/ui/qml/actor_object.hpp b/include/xstudio/ui/qml/actor_object.hpp index 6a3e3fe94..2c5f6e943 100644 --- a/include/xstudio/ui/qml/actor_object.hpp +++ b/include/xstudio/ui/qml/actor_object.hpp @@ -54,9 +54,10 @@ class actor_object : public Base { } }; - //TODO: Ahead This is a bad hack for windows to make it compile currently, possible solution is to pass - // JsonTreeModel as a reference or a pointer. - template < + // TODO: Ahead This is a bad hack for windows to make it compile currently, possible + // solution is to pass + // JsonTreeModel as a reference or a pointer. + template < typename... Ts, std::enable_if_t<(std::is_move_constructible_v && ...), int> = 0> actor_object(Ts &&...xs) : Base(std::forward(xs)...) { diff --git a/include/xstudio/ui/qml/global_store_model_ui.hpp b/include/xstudio/ui/qml/global_store_model_ui.hpp index c01332a6f..e09ba4c8d 100644 --- a/include/xstudio/ui/qml/global_store_model_ui.hpp +++ b/include/xstudio/ui/qml/global_store_model_ui.hpp @@ -22,7 +22,8 @@ class GlobalStoreHelper; namespace xstudio::ui::qml { using namespace caf; -class GLOBAL_STORE_QML_EXPORT GlobalStoreModel : public caf::mixin::actor_object { +class GLOBAL_STORE_QML_EXPORT GlobalStoreModel + : public caf::mixin::actor_object { Q_OBJECT Q_PROPERTY(bool autosave READ autosave WRITE setAutosave NOTIFY autosaveChanged) diff --git a/include/xstudio/ui/qml/hotkey_ui.hpp b/include/xstudio/ui/qml/hotkey_ui.hpp index 9d798825d..3c309f5c5 100644 --- a/include/xstudio/ui/qml/hotkey_ui.hpp +++ b/include/xstudio/ui/qml/hotkey_ui.hpp @@ -24,7 +24,8 @@ namespace utility { namespace ui { namespace qml { - class VIEWPORT_QML_EXPORT HotkeysUI : public caf::mixin::actor_object { + class VIEWPORT_QML_EXPORT HotkeysUI + : public caf::mixin::actor_object { Q_OBJECT diff --git a/include/xstudio/ui/qml/model_data_ui.hpp b/include/xstudio/ui/qml/model_data_ui.hpp index 0ad95e8da..8b1bad14c 100644 --- a/include/xstudio/ui/qml/model_data_ui.hpp +++ b/include/xstudio/ui/qml/model_data_ui.hpp @@ -5,7 +5,7 @@ #include "xstudio/ui/qml/helper_ui.hpp" #include "xstudio/ui/qml/json_tree_model_ui.hpp" -//#include "xstudio/ui/qml/tag_ui.hpp" +// #include "xstudio/ui/qml/tag_ui.hpp" CAF_PUSH_WARNINGS diff --git a/include/xstudio/ui/qml/qml_viewport_renderer.hpp b/include/xstudio/ui/qml/qml_viewport_renderer.hpp index c917ef90f..b59d6c210 100644 --- a/include/xstudio/ui/qml/qml_viewport_renderer.hpp +++ b/include/xstudio/ui/qml/qml_viewport_renderer.hpp @@ -79,7 +79,7 @@ namespace ui { [[nodiscard]] QString name() const { return QStringFromStd(viewport_renderer_->name()); } - + void linkToViewport(QMLViewportRenderer *other_viewport); void renderImageToFile( diff --git a/include/xstudio/ui/qml/studio_ui.hpp b/include/xstudio/ui/qml/studio_ui.hpp index d42c09d26..48e71eb66 100644 --- a/include/xstudio/ui/qml/studio_ui.hpp +++ b/include/xstudio/ui/qml/studio_ui.hpp @@ -81,7 +81,6 @@ namespace ui { std::vector offscreen_viewports_; std::vector video_output_plugins_; xstudio::ui::qt::OffscreenViewport *snapshot_offscreen_viewport_ = nullptr; - }; } // namespace qml } // namespace ui diff --git a/include/xstudio/ui/qt/offscreen_viewport.hpp b/include/xstudio/ui/qt/offscreen_viewport.hpp index 6f111ecf1..7cb1ed5d8 100644 --- a/include/xstudio/ui/qt/offscreen_viewport.hpp +++ b/include/xstudio/ui/qt/offscreen_viewport.hpp @@ -7,7 +7,7 @@ #include #include #include -//#include +// #include #include #include #include @@ -36,12 +36,12 @@ namespace ui { void setPlayhead(const QString &playheadAddress); std::string name() { return viewport_renderer_->name(); } - + void stop(); - + public slots: - void autoDelete(); + void autoDelete(); private: void receive_change_notification(viewport::Viewport::ChangeCallbackId id); @@ -61,7 +61,10 @@ namespace ui { const thumbnail::THUMBNAIL_FORMAT format, const int width, const int height); void renderToImageBuffer( - const int w, const int h, media_reader::ImageBufPtr &image, const viewport::ImageFormat format); + const int w, + const int h, + media_reader::ImageBufPtr &image, + const viewport::ImageFormat format); void initGL(); @@ -80,7 +83,8 @@ namespace ui { const caf::uri path, const std::string &ext); - void setupTextureAndFrameBuffer(const int width, const int height, const viewport::ImageFormat format); + void setupTextureAndFrameBuffer( + const int width, const int height, const viewport::ImageFormat format); void make_conversion_lut(); @@ -95,23 +99,22 @@ namespace ui { // TODO: will remove once everything done const char *formatSuffixes[4] = {"EXR", "JPG", "PNG", "TIFF"}; - int tex_width_ = 0; - int tex_height_ = 0; - int pix_buf_size_ = 0; - GLuint texId_ = 0; - GLuint fboId_ = 0; - GLuint depth_texId_ = 0; + int tex_width_ = 0; + int tex_height_ = 0; + int pix_buf_size_ = 0; + GLuint texId_ = 0; + GLuint fboId_ = 0; + GLuint depth_texId_ = 0; GLuint pixel_buffer_object_ = 0; - int vid_out_width_ = 0; - int vid_out_height_ = 0; + int vid_out_width_ = 0; + int vid_out_height_ = 0; viewport::ImageFormat vid_out_format_ = viewport::ImageFormat::RGBA_16; caf::actor video_output_actor_; std::vector output_buffers_; std::vector half_to_int_32_lut_; caf::actor local_playhead_; - }; } // namespace qt } // namespace ui diff --git a/include/xstudio/ui/viewport/viewport.hpp b/include/xstudio/ui/viewport/viewport.hpp index b3051673d..384a78843 100644 --- a/include/xstudio/ui/viewport/viewport.hpp +++ b/include/xstudio/ui/viewport/viewport.hpp @@ -38,7 +38,7 @@ namespace ui { caf::actor parent_actor, const int viewport_index, ViewportRendererPtr the_renderer, - const std::string & name = std::string()); + const std::string &name = std::string()); virtual ~Viewport(); bool process_pointer_event(PointerEvent &); @@ -138,7 +138,7 @@ namespace ui { const Imath::V2f topright, const Imath::V2f bottomright, const Imath::V2f bottomleft, - const Imath::V2i scene_size, + const Imath::V2i scene_size, const float devicePixelRatio); /** @@ -289,7 +289,8 @@ namespace ui { media_reader::ImageBufPtr get_onscreen_image(); - void set_aux_shader_uniforms(const utility::JsonStore & j, const bool clear_and_overwrite = false); + void set_aux_shader_uniforms( + const utility::JsonStore &j, const bool clear_and_overwrite = false); protected: void register_hotkeys() override; diff --git a/include/xstudio/utility/caf_helpers.hpp b/include/xstudio/utility/caf_helpers.hpp index 075c65fee..447ff961c 100644 --- a/include/xstudio/utility/caf_helpers.hpp +++ b/include/xstudio/utility/caf_helpers.hpp @@ -29,17 +29,18 @@ namespace utility { struct absolute_receive_timeout { public: - using ms = std::chrono::milliseconds; + using ms = std::chrono::milliseconds; #ifdef _WIN32 - using clock_type = std::chrono::high_resolution_clock;; + using clock_type = std::chrono::high_resolution_clock; + ; #else using clock_type = std::chrono::system_clock; // using clock_type = std::chrono::high_resolution_clock; #endif absolute_receive_timeout(int msec) { x_ = clock_type::now() + ms(msec); } - absolute_receive_timeout() = default; - absolute_receive_timeout(const absolute_receive_timeout &) = default; + absolute_receive_timeout() = default; + absolute_receive_timeout(const absolute_receive_timeout &) = default; absolute_receive_timeout &operator=(const absolute_receive_timeout &) = default; [[nodiscard]] const clock_type::time_point &value() const { return x_; } diff --git a/include/xstudio/utility/chrono.hpp b/include/xstudio/utility/chrono.hpp index a053a614c..68b4f3d45 100644 --- a/include/xstudio/utility/chrono.hpp +++ b/include/xstudio/utility/chrono.hpp @@ -27,11 +27,11 @@ namespace utility { inline std::string to_string(const sys_time_point &tp) { #ifdef _WIN32 - std::stringstream ss; - //TODO: Ahead Fix - //ss << std::put_time(std::localtime(in_time_t), "%Y-%m-%d %X"); - return ss.str(); -#else + std::stringstream ss; + // TODO: Ahead Fix + // ss << std::put_time(std::localtime(in_time_t), "%Y-%m-%d %X"); + return ss.str(); +#else auto in_time_t = std::chrono::system_clock::to_time_t(tp); std::stringstream ss; diff --git a/include/xstudio/utility/edit_list.hpp b/include/xstudio/utility/edit_list.hpp index e2f7af978..6b0f3c484 100644 --- a/include/xstudio/utility/edit_list.hpp +++ b/include/xstudio/utility/edit_list.hpp @@ -15,7 +15,7 @@ namespace utility { virtual ~EditList() = default; EditList &operator=(const EditList &) = default; - EditList &operator=(EditList &&) = default; + EditList &operator=(EditList &&) = default; void extend(const EditList &o); diff --git a/include/xstudio/utility/frame_rate.hpp b/include/xstudio/utility/frame_rate.hpp index b634e2c5a..98781359f 100644 --- a/include/xstudio/utility/frame_rate.hpp +++ b/include/xstudio/utility/frame_rate.hpp @@ -39,7 +39,7 @@ namespace utility { [[nodiscard]] timebase::flicks to_flicks() const { return *this; } FrameRate &operator=(const FrameRate &) = default; - FrameRate &operator=(FrameRate &&) = default; + FrameRate &operator=(FrameRate &&) = default; // Rational& operator+= (const Rational& other); // Rational& operator-= (const Rational& other); diff --git a/include/xstudio/utility/frame_rate_and_duration.hpp b/include/xstudio/utility/frame_rate_and_duration.hpp index 2c3f05860..25c3986df 100644 --- a/include/xstudio/utility/frame_rate_and_duration.hpp +++ b/include/xstudio/utility/frame_rate_and_duration.hpp @@ -27,7 +27,7 @@ namespace utility { // const int den) : rate_(num, den), count_(timebase_ * frames) {} FrameRateDuration &operator=(const FrameRateDuration &) = default; - FrameRateDuration &operator=(FrameRateDuration &&) = default; + FrameRateDuration &operator=(FrameRateDuration &&) = default; FrameRateDuration operator-(const FrameRateDuration &); diff --git a/include/xstudio/utility/helpers.hpp b/include/xstudio/utility/helpers.hpp index cfdcb426f..ea4535d0c 100644 --- a/include/xstudio/utility/helpers.hpp +++ b/include/xstudio/utility/helpers.hpp @@ -90,7 +90,8 @@ namespace utility { namespace fs = std::filesystem; - // Centralizing the Path to String conversions in case we run into encoding problems down the line. + // Centralizing the Path to String conversions in case we run into encoding problems down + // the line. inline std::string path_to_string(fs::path path) { #ifdef _WIN32 return path.string(); @@ -270,7 +271,7 @@ namespace utility { auto root = get_env("XSTUDIO_ROOT"); std::string fallback_root; - #ifdef _WIN32 +#ifdef _WIN32 char filename[MAX_PATH]; DWORD nSize = _countof(filename); DWORD result = GetModuleFileNameA(NULL, filename, nSize); @@ -280,73 +281,72 @@ namespace utility { } else { auto exePath = fs::path(filename); - // The first parent path gets us to the bin directory, the second gets us to the level above bin. + // The first parent path gets us to the bin directory, the second gets us to the + // level above bin. auto xstudio_root = exePath.parent_path().parent_path(); fallback_root = xstudio_root.string(); } - #else - //TODO: This could inspect the current running process and look one directory up. - fallback_root = std::string(BINARY_DIR); - #endif +#else + // TODO: This could inspect the current running process and look one directory up. + fallback_root = std::string(BINARY_DIR); +#endif - std::string path = - (root ? (*root) + append_path : fallback_root + append_path); + std::string path = (root ? (*root) + append_path : fallback_root + append_path); return path; } -inline std::string remote_session_path() { - const char* root; + inline std::string remote_session_path() { + const char *root; #ifdef _WIN32 - root = std::getenv("USERPROFILE"); + root = std::getenv("USERPROFILE"); #else - root = std::getenv("HOME"); + root = std::getenv("HOME"); #endif - std::filesystem::path path; - if (root) - { - path = std::filesystem::path(root) / ".config" / "DNEG" / "xstudio" / "sessions"; - } + std::filesystem::path path; + if (root) { + path = std::filesystem::path(root) / ".config" / "DNEG" / "xstudio" / "sessions"; + } - return path.string(); -} + return path.string(); + } -inline std::string preference_path(const std::string &append_path = "") { - const char *root; + inline std::string preference_path(const std::string &append_path = "") { + const char *root; #ifdef _WIN32 - root = std::getenv("USERPROFILE"); + root = std::getenv("USERPROFILE"); #else - root = std::getenv("HOME"); + root = std::getenv("HOME"); #endif - std::filesystem::path path; - if (root) { - path = std::filesystem::path(root) / ".config" / "DNEG" / "xstudio" / "preferences"; - if (!append_path.empty()) { - path /= append_path; + std::filesystem::path path; + if (root) { + path = std::filesystem::path(root) / ".config" / "DNEG" / "xstudio" / "preferences"; + if (!append_path.empty()) { + path /= append_path; + } } - } - return path.string(); -} + return path.string(); + } -inline std::string snippets_path(const std::string &append_path = "") { - const char *root; + inline std::string snippets_path(const std::string &append_path = "") { + const char *root; #ifdef _WIN32 - root = std::getenv("USERPROFILE"); + root = std::getenv("USERPROFILE"); #else - root = std::getenv("HOME"); + root = std::getenv("HOME"); #endif - std::filesystem::path path; - if (root) { - path = std::filesystem::path(root) / ".config" / "DNEG" / "xstudio" / "snippets"; - if (!append_path.empty()) { - path /= append_path; + std::filesystem::path path; + if (root) { + path = std::filesystem::path(root) / ".config" / "DNEG" / "xstudio" / "snippets"; + if (!append_path.empty()) { + path /= append_path; + } } - } - return path.string(); -} + return path.string(); + } inline std::string preference_path_context(const std::string &context) { return preference_path(to_lower(context) + ".json"); @@ -377,8 +377,7 @@ inline std::string snippets_path(const std::string &append_path = "") { return get_file_mtime(uri_to_posix_path(path)); } - inline std::string get_path_extension(const fs::path p) - { + inline std::string get_path_extension(const fs::path p) { const std::string sp = p.string(); #ifdef _WIN32 std::string sanitized; diff --git a/include/xstudio/utility/lock_file.hpp b/include/xstudio/utility/lock_file.hpp index c6d2cb479..115138718 100644 --- a/include/xstudio/utility/lock_file.hpp +++ b/include/xstudio/utility/lock_file.hpp @@ -53,7 +53,7 @@ inline struct passwd *getpwuid(uid_t uid) { } #else // For Linux or non-Windows platforms -using uid_t = uid_t; +using uid_t = uid_t; using gid_t = gid_t; #include #endif @@ -116,7 +116,7 @@ namespace utility { lpath = fs::canonical(lpath); return posix_path_to_uri(lpath + ".lock"); -#endif +#endif } [[nodiscard]] bool locked() const { return locked_; } [[nodiscard]] bool owned() const { return owned_; } diff --git a/include/xstudio/utility/sequence.hpp b/include/xstudio/utility/sequence.hpp index c2e0e7a92..fcbc48a8b 100644 --- a/include/xstudio/utility/sequence.hpp +++ b/include/xstudio/utility/sequence.hpp @@ -7,7 +7,7 @@ using uid_t = DWORD; // Use DWORD type for user ID using gid_t = DWORD; // Use DWORD type for group ID #else // For Linux or non-Windows platforms -using uid_t = uid_t; +using uid_t = uid_t; using gid_t = gid_t; #endif diff --git a/include/xstudio/utility/string_helpers.hpp b/include/xstudio/utility/string_helpers.hpp index d3d5f5248..ef21c8cbc 100644 --- a/include/xstudio/utility/string_helpers.hpp +++ b/include/xstudio/utility/string_helpers.hpp @@ -183,7 +183,7 @@ namespace utility { return result; } - inline std::wstring to_upper(const std::wstring& str) { + inline std::wstring to_upper(const std::wstring &str) { static std::locale loc; std::wstring result; result.reserve(str.size()); @@ -204,9 +204,9 @@ namespace utility { return result; } - - //TODO: Ahead to refactor - inline std::string to_upper_path(const std::filesystem::path &path) { + + // TODO: Ahead to refactor + inline std::string to_upper_path(const std::filesystem::path &path) { static std::locale loc; std::string result; result.reserve(path.string().size()); diff --git a/src/audio/src/audio_output.cpp b/src/audio/src/audio_output.cpp index c06968578..1b4d2a37f 100644 --- a/src/audio/src/audio_output.cpp +++ b/src/audio/src/audio_output.cpp @@ -131,7 +131,7 @@ void AudioOutputControl::prepare_samples_for_soundcard( try { - v.resize(num_samps_to_push * num_channels); + v.resize(num_samps_to_push * num_channels); memset(v.data(), 0, v.size() * sizeof(int16_t)); @@ -173,14 +173,16 @@ void AudioOutputControl::prepare_samples_for_soundcard( current_buf_, next_buf, previous_buf_); } else { - //spdlog::warn("Break hit because current_buf_ is null after trying to pick " - // "an audio buffer."); + // spdlog::warn("Break hit because current_buf_ is null after trying to pick + // " + // "an audio buffer."); fade_in_out_ = DoFadeHeadAndTail; break; } } else if (!current_buf_ && sample_data_.empty()) { - //spdlog::warn("Break hit because both current_buf_ and sample_data_ are empty."); + // spdlog::warn("Break hit because both current_buf_ and sample_data_ are + // empty."); break; } @@ -195,11 +197,11 @@ void AudioOutputControl::prepare_samples_for_soundcard( if (current_buf_pos_ == (long)current_buf_->num_samples()) { // current buf is exhausted - //spdlog::info("Current buffer is exhausted."); + // spdlog::info("Current buffer is exhausted."); previous_buf_ = current_buf_; current_buf_.reset(); } else { - //spdlog::warn("Break hit due to unspecified condition."); + // spdlog::warn("Break hit due to unspecified condition."); break; } } @@ -230,32 +232,30 @@ void AudioOutputControl::queue_samples_for_playing( } playback_velocity_ = audio_repitch_ ? std::max(0.1f, velocity) : 1.0f; - + /* - // Earlier attempt at resampling in queue; needs a more reliable sample rate info and needs sample rate from output device. - if (audio_frames.size()) { - auto audio_sample_rate = audio_frames.front()->sample_rate(); - if (audio_sample_rate == 0) { - audio_sample_rate = audio_frames.back()->sample_rate(); + // Earlier attempt at resampling in queue; needs a more reliable sample rate info and needs + sample rate from output device. if (audio_frames.size()) { auto audio_sample_rate = + audio_frames.front()->sample_rate(); if (audio_sample_rate == 0) { audio_sample_rate = + audio_frames.back()->sample_rate(); } if (audio_sample_rate == 0) { // If we can't get the sample rate from anything, use the last best guess. - // This seems to happen + // This seems to happen audio_sample_rate = last_sample_rate_; } else { last_sample_rate_ = audio_sample_rate; } - // If our audio card does not match the source rate, we need to respeed/repitch the samples. - if (audio_sample_rate and audio_sample_rate != 96000L) { - double sample_respeed = (double)audio_sample_rate / 96000.0; - playback_velocity_ *= sample_respeed; - audio_repitch_ = true; + // If our audio card does not match the source rate, we need to respeed/repitch the + samples. if (audio_sample_rate and audio_sample_rate != 96000L) { double sample_respeed = + (double)audio_sample_rate / 96000.0; playback_velocity_ *= sample_respeed; audio_repitch_ = + true; } } */ - + for (const auto &a : audio_frames) { @@ -267,16 +267,17 @@ void AudioOutputControl::queue_samples_for_playing( if (!audio_frame || (previous_buf_ && previous_buf_->media_key() == audio_frame->media_key()) || (current_buf_ && current_buf_->media_key() == audio_frame->media_key()) || - !audio_frame->num_samples()) - { + !audio_frame->num_samples()) { - //spdlog::info("Audio frame skipped due to either being null, matching " - // "previous/current buffer or having no samples."); + // spdlog::info("Audio frame skipped due to either being null, matching " + // "previous/current buffer or having no samples."); continue; - } - - //spdlog::info("Processing audio frame with media key: {}, num samples: {}, sample rate: {}, num channels: {}", - // audio_frame->media_key(), audio_frame->num_samples(), audio_frame->sample_rate(), audio_frame->num_channels()); + } + + // spdlog::info("Processing audio frame with media key: {}, num samples: {}, sample + // rate: {}, num channels: {}", + // audio_frame->media_key(), audio_frame->num_samples(), + // audio_frame->sample_rate(), audio_frame->num_channels()); // xstudio stores a frame of audio samples for every video frame for any // given source (if the source has no video it is assigned a 'virtual' video @@ -292,8 +293,9 @@ void AudioOutputControl::queue_samples_for_playing( if (false) { for (auto p = sample_data_.begin(); p != sample_data_.end(); ++p) { if (p->second->media_key() == audio_frame->media_key()) { - //spdlog::info("Found and erasing existing audio sample from queue with the " - // "same media key."); + // spdlog::info("Found and erasing existing audio sample from queue with the + // " + // "same media key."); sample_data_.erase(p); break; } @@ -301,7 +303,6 @@ void AudioOutputControl::queue_samples_for_playing( } - if (audio_repitch_ && playback_velocity_ != 1.0f) { audio_frame = super_simple_respeed_audio_buffer( audio_frame, fabs(playback_velocity_)); diff --git a/src/audio/src/audio_output_actor.cpp b/src/audio/src/audio_output_actor.cpp index 1c836a252..cfbdd1da7 100644 --- a/src/audio/src/audio_output_actor.cpp +++ b/src/audio/src/audio_output_actor.cpp @@ -25,8 +25,7 @@ using namespace xstudio::utility; using namespace xstudio; GlobalAudioOutputActor::GlobalAudioOutputActor(caf::actor_config &cfg) - : caf::event_based_actor(cfg), module::Module("GlobalAudioOutputActor") -{ + : caf::event_based_actor(cfg), module::Module("GlobalAudioOutputActor") { audio_repitch_ = add_boolean_attribute("Audio Repitch", "Audio Repitch", false); audio_repitch_->set_role_data( @@ -58,9 +57,7 @@ GlobalAudioOutputActor::GlobalAudioOutputActor(caf::actor_config &cfg) behavior_.assign( - [=](utility::get_event_group_atom) -> caf::actor { - return event_group_; - }, + [=](utility::get_event_group_atom) -> caf::actor { return event_group_; }, [=](xstudio::broadcast::broadcast_down_atom, const caf::actor_addr &) {}, @@ -73,8 +70,8 @@ GlobalAudioOutputActor::GlobalAudioOutputActor(caf::actor_config &cfg) const bool playing, const bool forwards, const float velocity) { - - send(event_group_, + send( + event_group_, utility::event_atom_v, playhead::sound_audio_atom_v, audio_buffers, @@ -82,15 +79,11 @@ GlobalAudioOutputActor::GlobalAudioOutputActor(caf::actor_config &cfg) playing, forwards, velocity); - } ); connect_to_ui(); - - - } void GlobalAudioOutputActor::on_exit() { system().registry().erase(audio_output_registry); } @@ -98,7 +91,8 @@ void GlobalAudioOutputActor::on_exit() { system().registry().erase(audio_output_ void GlobalAudioOutputActor::attribute_changed(const utility::Uuid &attr_uuid, const int role) { // update and audio output clients with volume, mute etc. - send(event_group_, + send( + event_group_, utility::event_atom_v, module::change_attribute_event_atom_v, volume_->value(), diff --git a/src/audio/src/linux_audio_output_device.cpp b/src/audio/src/linux_audio_output_device.cpp index 4af41a8d3..9dc3e7e0c 100644 --- a/src/audio/src/linux_audio_output_device.cpp +++ b/src/audio/src/linux_audio_output_device.cpp @@ -92,8 +92,7 @@ void LinuxAudioOutputDevice::push_samples(const void *sample_data, const long nu // TODO: * 2 below is because we ASSUME 16bits per sample. Need to handle different // bitdepths if (playback_handle_ && - pa_simple_write(playback_handle_, sample_data, (size_t)num_samples * 2, &error) < - 0) { + pa_simple_write(playback_handle_, sample_data, (size_t)num_samples * 2, &error) < 0) { std::stringstream ss; ss << __FILE__ ": pa_simple_write() failed: " << pa_strerror(error); throw std::runtime_error(ss.str().c_str()); diff --git a/src/audio/src/windows_audio_output_device.cpp b/src/audio/src/windows_audio_output_device.cpp index f0e2890b2..fb6771638 100644 --- a/src/audio/src/windows_audio_output_device.cpp +++ b/src/audio/src/windows_audio_output_device.cpp @@ -20,16 +20,11 @@ using namespace xstudio::global_store; WindowsAudioOutputDevice::WindowsAudioOutputDevice(const utility::JsonStore &prefs) - : AudioOutputDevice(), prefs_(prefs) { -} + : AudioOutputDevice(), prefs_(prefs) {} -WindowsAudioOutputDevice::~WindowsAudioOutputDevice() { - disconnect_from_soundcard(); -} +WindowsAudioOutputDevice::~WindowsAudioOutputDevice() { disconnect_from_soundcard(); } -void WindowsAudioOutputDevice::disconnect_from_soundcard() { - return; -} +void WindowsAudioOutputDevice::disconnect_from_soundcard() { return; } HRESULT WindowsAudioOutputDevice::initializeAudioClient( const std::string &sound_card /* = L"" */, @@ -67,7 +62,7 @@ HRESULT WindowsAudioOutputDevice::initializeAudioClient( return hr; } - #if false +#if false // Print the device name CComPtr property_store; hr = audio_device->OpenPropertyStore(STGM_READ, &property_store); @@ -82,7 +77,7 @@ HRESULT WindowsAudioOutputDevice::initializeAudioClient( // memory it might've allocated } } - #endif +#endif // Get an IAudioClient3 instance hr = audio_device->Activate( @@ -104,7 +99,7 @@ HRESULT WindowsAudioOutputDevice::initializeAudioClient( sample_rate_ = pMixFormat->nSamplesPerSec; - #if false +#if false // Print the mix format details spdlog::info("Mix Format Details:"); spdlog::info("Format Tag: {}", pMixFormat->wFormatTag); @@ -136,7 +131,7 @@ HRESULT WindowsAudioOutputDevice::initializeAudioClient( ); } - #endif +#endif // Fetch the currently active shared mode format WAVEFORMATEX *wavefmt = NULL; @@ -174,12 +169,11 @@ HRESULT WindowsAudioOutputDevice::initializeAudioClient( CoTaskMemFree(wavefmt); return hr; - } void WindowsAudioOutputDevice::initialize_sound_card() { - sample_rate_ = 48000; //default values + sample_rate_ = 48000; // default values num_channels_ = 2; std::string sound_card("default"); buffer_size_ = 2048; // Adjust to match your preferences @@ -190,7 +184,8 @@ void WindowsAudioOutputDevice::initialize_sound_card() { preference_value(prefs_, "/core/audio/windows_audio_prefs/sample_rate"); buffer_size_ = preference_value(prefs_, "/core/audio/windows_audio_prefs/buffer_size"); - num_channels_ = preference_value(prefs_, "/core/audio/windows_audio_prefs/channels"); + num_channels_ = + preference_value(prefs_, "/core/audio/windows_audio_prefs/channels"); sound_card = preference_value(prefs_, "/core/audio/windows_audio_prefs/sound_card"); } catch (std::exception &e) { @@ -199,20 +194,20 @@ void WindowsAudioOutputDevice::initialize_sound_card() { HRESULT hr = initializeAudioClient(sound_card, sample_rate_, num_channels_); if (FAILED(hr)) { - spdlog::error("{} Failed to initialize audio client: HRESULT=0x{:08x}", __PRETTY_FUNCTION__, hr); + spdlog::error( + "{} Failed to initialize audio client: HRESULT=0x{:08x}", __PRETTY_FUNCTION__, hr); return; // or handle the error as appropriate } // Get an IAudioRenderClient instance - hr = audio_client_->GetService(__uuidof(IAudioRenderClient), - reinterpret_cast(&render_client_)); + hr = audio_client_->GetService( + __uuidof(IAudioRenderClient), reinterpret_cast(&render_client_)); if (FAILED(hr)) { spdlog::error("Failed to get IAudioRenderClient: HRESULT=0x{:08x}", hr); return; // or handle the error as appropriate } audio_client_->Start(); - } void WindowsAudioOutputDevice::connect_to_soundcard() { @@ -224,7 +219,7 @@ long WindowsAudioOutputDevice::desired_samples() { // value for the duration of a playback session UINT32 bufferSize = 0; // initialize to 0 HRESULT hr = audio_client_->GetBufferSize(&bufferSize); - + if (FAILED(hr)) { spdlog::error("Failed to get buffer size from WASAPI with HRESULT: 0x{:08x}", hr); throw std::runtime_error("Failed to get buffer size"); @@ -251,8 +246,7 @@ long WindowsAudioOutputDevice::latency_microseconds() { return defaultDevicePeriod / 10; // convert 100-nanosecond units to microseconds } -void WindowsAudioOutputDevice::push_samples( - const void *sample_data, const long num_samples) { +void WindowsAudioOutputDevice::push_samples(const void *sample_data, const long num_samples) { int channel_count = num_channels_; @@ -266,7 +260,7 @@ void WindowsAudioOutputDevice::push_samples( // Ensure we have a valid render_client_ if (!render_client_) { - //spdlog::error("Invalid Render Client"); + // spdlog::error("Invalid Render Client"); return; // Exit if no render client is set } @@ -326,7 +320,4 @@ void WindowsAudioOutputDevice::push_samples( // Avoid tight loop thrashing when we are out of samples. std::this_thread::sleep_for(std::chrono::milliseconds(1)); } - - - } diff --git a/src/colour_pipeline/src/colour_pipeline.cpp b/src/colour_pipeline/src/colour_pipeline.cpp index 2bd322c75..75d41569a 100644 --- a/src/colour_pipeline/src/colour_pipeline.cpp +++ b/src/colour_pipeline/src/colour_pipeline.cpp @@ -65,9 +65,9 @@ caf::message_handler ColourPipeline::message_handler_extensions() { if (worker) { link_to_module( worker, - true, // link_all_attrs - false, // both_ways - true // initial_push_sync + true, // link_all_attrs + false, // both_ways + true // initial_push_sync ); workers_.push_back(worker); } diff --git a/src/embedded_python/src/embedded_python.cpp b/src/embedded_python/src/embedded_python.cpp index dd78eb7e5..d4df3741a 100644 --- a/src/embedded_python/src/embedded_python.cpp +++ b/src/embedded_python/src/embedded_python.cpp @@ -15,7 +15,7 @@ using namespace xstudio::utility; using namespace pybind11::literals; namespace py = pybind11; -//EmbeddedPython *EmbeddedPython::s_instance_ = nullptr; +// EmbeddedPython *EmbeddedPython::s_instance_ = nullptr; EmbeddedPython::EmbeddedPython(const std::string &name, EmbeddedPythonActor *parent) : Container(name, "EmbeddedPython"), parent_(parent) { diff --git a/src/embedded_python/src/embedded_python_actor.cpp b/src/embedded_python/src/embedded_python_actor.cpp index bad1d2dcb..d194fde59 100644 --- a/src/embedded_python/src/embedded_python_actor.cpp +++ b/src/embedded_python/src/embedded_python_actor.cpp @@ -26,7 +26,7 @@ using namespace nlohmann; using namespace caf; using namespace pybind11::literals; -namespace py = pybind11; +namespace py = pybind11; #ifdef BUILD_OTIO namespace otio = opentimelineio::OPENTIMELINEIO_VERSION; diff --git a/src/global/src/global_actor.cpp b/src/global/src/global_actor.cpp index a81f0bb12..b53db7dbe 100644 --- a/src/global/src/global_actor.cpp +++ b/src/global/src/global_actor.cpp @@ -133,13 +133,13 @@ void GlobalActor::init(const utility::JsonStore &prefs) { link_to(thumbnail); link_to(ui_models); - + // Make default audio output #ifdef __linux__ auto audio_out = spawn>(); link_to(audio_out); #elif __APPLE__ - // TO DO + // TO DO #elif _WIN32 auto audio_out = spawn>(); link_to(audio_out); diff --git a/src/global_store/src/global_store.cpp b/src/global_store/src/global_store.cpp index 247ff8d1a..5b6d583d4 100644 --- a/src/global_store/src/global_store.cpp +++ b/src/global_store/src/global_store.cpp @@ -124,8 +124,7 @@ void load_from_list(const std::string &path, std::vector &overrides) { tmp = fs::canonical(rpath / tmp); } - if (fs::is_regular_file(tmp) and - get_path_extension(tmp) == ".json") { + if (fs::is_regular_file(tmp) and get_path_extension(tmp) == ".json") { overrides.push_back(tmp); } else { spdlog::warn("Invalid pref entry {}", tmp.string()); @@ -192,7 +191,8 @@ void load_override(utility::JsonStore &json, const fs::path &path) { "Property overriden {} {} {}", it.key(), to_string(it.value()), path.string()); // tag it. set_preference_overridden_path(json, path.string(), property); - if (set_as_overridden) json.set(it.value(), property + "/overridden_value"); + if (set_as_overridden) + json.set(it.value(), property + "/overridden_value"); } catch (const std::exception &err) { spdlog::warn("{} {} {}", err.what(), it.key(), to_string(it.value())); @@ -363,15 +363,14 @@ utility::JsonStore GlobalStoreHelper::get_existing_or_create_new_preference( const utility::JsonStore &default_, const bool async, const bool broacast_change, - const std::string &context) -{ + const std::string &context) { try { utility::JsonStore v = get(path); if (!v.contains("overridden_value")) { v["overridden_value"] = default_; - v["path"] = path; - v["context"] = std::vector({"APPLICATION"}); + v["path"] = path; + v["context"] = std::vector({"APPLICATION"}); JsonStoreHelper::set(v, path, async, broacast_change); } return v["value"]; @@ -379,12 +378,11 @@ utility::JsonStore GlobalStoreHelper::get_existing_or_create_new_preference( } catch (...) { utility::JsonStore v; - v["value"] = default_; + v["value"] = default_; v["overridden_value"] = default_; - v["path"] = path; - v["context"] = std::vector({"APPLICATION"}); + v["path"] = path; + v["context"] = std::vector({"APPLICATION"}); JsonStoreHelper::set(v, path, async, broacast_change); } return default_; - } \ No newline at end of file diff --git a/src/json_store/src/json_store_actor.cpp b/src/json_store/src/json_store_actor.cpp index c6fa2be83..cc3e873fa 100644 --- a/src/json_store/src/json_store_actor.cpp +++ b/src/json_store/src/json_store_actor.cpp @@ -53,7 +53,7 @@ JsonStoreActor::JsonStoreActor( [=](erase_json_atom, const std::string &path) -> bool { std::string p = path; - auto result = json_store_.remove(path); + auto result = json_store_.remove(path); if (result) broadcast_change(); return result; @@ -61,7 +61,7 @@ JsonStoreActor::JsonStoreActor( [=](patch_atom, const JsonStore &json) -> bool { const JsonStore j = json; - json_store_ = json_store_.patch(j); + json_store_ = json_store_.patch(j); broadcast_change(); return true; }, @@ -91,7 +91,7 @@ JsonStoreActor::JsonStoreActor( [=](set_json_atom, const JsonStore &json, const std::string &path, const bool async) -> bool { // is it a subset - std::string p = path; + std::string p = path; const JsonStore j = json; try { json_store_.set(j, p); @@ -124,12 +124,11 @@ JsonStoreActor::JsonStoreActor( [=](subscribe_atom, const std::string &path, caf::actor _actor) -> caf::result { // delegate to reader, return promise ? - std::string p = path; - auto rp = make_response_promise(); + std::string p = path; + auto rp = make_response_promise(); this->request(_actor, caf::infinite, utility::get_group_atom_v) .then( - [&, p, _actor, rp]( - const std::pair &data) mutable { + [&, p, _actor, rp](const std::pair &data) mutable { const auto [grp, json] = data; actor_group_[actor_cast(_actor)] = grp; group_path_[grp] = p; @@ -191,7 +190,7 @@ caf::message_handler JsonStoreActor::default_event_handler() { void JsonStoreActor::broadcast_change( const JsonStore &change, const std::string &path, const bool async) { - std::string p = path; + std::string p = path; if (broadcast_delay_.count() and async) { if (not update_pending_) { delayed_anon_send(this, broadcast_delay_, jsonstore_change_atom_v); diff --git a/src/launch/xstudio/src/xstudio.cpp b/src/launch/xstudio/src/xstudio.cpp index a04634894..76501dc46 100644 --- a/src/launch/xstudio/src/xstudio.cpp +++ b/src/launch/xstudio/src/xstudio.cpp @@ -124,14 +124,13 @@ struct ExitTimeoutKiller { void stop() { #ifdef _WIN32 - spdlog::debug("ExitTimeoutKiller stop ignored"); - } + spdlog::debug("ExitTimeoutKiller stop ignored"); + } #else // unlock the mutex so exit_timeout won't time-out clean_actor_system_exit.unlock(); if (exit_timeout.joinable()) exit_timeout.join(); - } std::timed_mutex clean_actor_system_exit; @@ -548,7 +547,7 @@ struct Launcher { // prefs files *might* be located in a 'preference' subfolder under XSTUDIO_PLUGIN_PATH // folders - char * plugin_path = std::getenv("XSTUDIO_PLUGIN_PATH"); + char *plugin_path = std::getenv("XSTUDIO_PLUGIN_PATH"); if (plugin_path) { for (const auto &p : xstudio::utility::split(plugin_path, ':')) { if (fs::is_directory(p + "/preferences")) @@ -681,10 +680,8 @@ struct Launcher { media_rate); } catch (const std::exception &e) { spdlog::error("Failed to load media '{}'", e.what()); - - } - + } else { spdlog::warn("Invalid URI {}", p); } @@ -898,14 +895,14 @@ int main(int argc, char **argv) { if (l.actions["headless"]) { system.await_actors_before_shutdown(true); - //TODO: Ahead Fix - //struct sigaction sigIntHandler; + // TODO: Ahead Fix + // struct sigaction sigIntHandler; - //sigIntHandler.sa_handler = my_handler; - //sigemptyset(&sigIntHandler.sa_mask); - //sigIntHandler.sa_flags = 0; + // sigIntHandler.sa_handler = my_handler; + // sigemptyset(&sigIntHandler.sa_mask); + // sigIntHandler.sa_flags = 0; - //sigaction(SIGINT, &sigIntHandler, nullptr); + // sigaction(SIGINT, &sigIntHandler, nullptr); while (not shutdown_xstudio) { // we should be able to shutdown via a API call.. @@ -1051,7 +1048,7 @@ int main(int argc, char **argv) { engine.addImportPath(QStringFromStd(xstudio_root("/plugin/qml"))); engine.addPluginPath(QStringFromStd(xstudio_root("/plugin/qml"))); - char * plugin_path = std::getenv("XSTUDIO_PLUGIN_PATH"); + char *plugin_path = std::getenv("XSTUDIO_PLUGIN_PATH"); if (plugin_path) { for (const auto &p : xstudio::utility::split(plugin_path, ':')) { engine.addPluginPath(QStringFromStd(p + "/qml")); diff --git a/src/media/src/media_actor.cpp b/src/media/src/media_actor.cpp index d3fb2f313..11f3997f4 100644 --- a/src/media/src/media_actor.cpp +++ b/src/media/src/media_actor.cpp @@ -331,8 +331,8 @@ void MediaActor::init() { const utility::FrameRate &rate) -> result { auto rp = make_response_promise(); - std::string ext = ltrim_char( - to_upper(get_path_extension(fs::path(uri_to_posix_path(uri)))), '.'); + std::string ext = + ltrim_char(to_upper(get_path_extension(fs::path(uri_to_posix_path(uri)))), '.'); const auto source_uuid = Uuid::generate(); auto source = @@ -1467,7 +1467,7 @@ void MediaActor::auto_set_current_source(const media::MediaType media_type) { // TODO: do these requests asynchronously, as it could be heavy and slow // loading of big playlists etc - + std::set sources_matching_media_type; caf::scoped_actor sys(system()); @@ -1477,16 +1477,13 @@ void MediaActor::auto_set_current_source(const media::MediaType media_type) { try { auto stream_details = request_receive>( - *sys, - source_actor, - detail_atom_v, - media_type); + *sys, source_actor, detail_atom_v, media_type); if (stream_details.size()) sources_matching_media_type.insert(source_uuid); - } catch (...) {} + } catch (...) { + } } auto_set_sources_mt(sources_matching_media_type); - } diff --git a/src/media/src/media_source_actor.cpp b/src/media/src/media_source_actor.cpp index 855abd8ac..f4dd3db09 100644 --- a/src/media/src/media_source_actor.cpp +++ b/src/media/src/media_source_actor.cpp @@ -439,15 +439,17 @@ void MediaSourceActor::init() { [=](current_media_stream_atom, const MediaType media_type) -> result { auto rp = make_response_promise(); - request(caf::actor_cast(this), infinite, acquire_media_detail_atom_v).then( - [=](bool) mutable { - if (media_streams_.count(base_.current(media_type))) - rp.deliver(UuidActor( - base_.current(media_type), media_streams_.at(base_.current(media_type)))); - rp.deliver(make_error(xstudio_error::error, "No streams")); - }, - [=](const error &err) mutable { rp.deliver(err); }); - return rp; + request(caf::actor_cast(this), infinite, acquire_media_detail_atom_v) + .then( + [=](bool) mutable { + if (media_streams_.count(base_.current(media_type))) + rp.deliver(UuidActor( + base_.current(media_type), + media_streams_.at(base_.current(media_type)))); + rp.deliver(make_error(xstudio_error::error, "No streams")); + }, + [=](const error &err) mutable { rp.deliver(err); }); + return rp; }, [=](current_media_stream_atom, const MediaType media_type, const Uuid &uuid) -> bool { @@ -518,27 +520,26 @@ void MediaSourceActor::init() { [=](get_edit_list_atom, const MediaType media_type, const Uuid &uuid) -> result { - auto rp = make_response_promise(); - request(caf::actor_cast(this), infinite, acquire_media_detail_atom_v).then( - [=](bool) mutable { - if (base_.current(media_type).is_null()) { - rp.deliver(make_error(xstudio_error::error, "No streams")); - } + request(caf::actor_cast(this), infinite, acquire_media_detail_atom_v) + .then( + [=](bool) mutable { + if (base_.current(media_type).is_null()) { + rp.deliver(make_error(xstudio_error::error, "No streams")); + } - if (uuid.is_null()) - rp.deliver(utility::EditList({EditListSection( - base_.uuid(), + if (uuid.is_null()) + rp.deliver(utility::EditList({EditListSection( + base_.uuid(), + base_.media_reference(base_.current(media_type)).duration(), + base_.media_reference(base_.current(media_type)).timecode())})); + return rp.deliver(utility::EditList({EditListSection( + uuid, base_.media_reference(base_.current(media_type)).duration(), base_.media_reference(base_.current(media_type)).timecode())})); - return rp.deliver(utility::EditList({EditListSection( - uuid, - base_.media_reference(base_.current(media_type)).duration(), - base_.media_reference(base_.current(media_type)).timecode())})); - }, - [=](const error &err) mutable { rp.deliver(err); }); - return rp; - + }, + [=](const error &err) mutable { rp.deliver(err); }); + return rp; }, [=](get_media_pointer_atom, diff --git a/src/media_cache/src/media_cache_actor.cpp b/src/media_cache/src/media_cache_actor.cpp index 0285e181f..bdd51ad06 100644 --- a/src/media_cache/src/media_cache_actor.cpp +++ b/src/media_cache/src/media_cache_actor.cpp @@ -36,7 +36,7 @@ class TrimActor : public caf::event_based_actor { TrimActor::TrimActor(caf::actor_config &cfg) : caf::event_based_actor(cfg) { behavior_.assign([=](unpreserve_atom, const size_t count) { - // spdlog::stopwatch sw; + // spdlog::stopwatch sw; #ifdef _WIN32 _heapmin(); #else diff --git a/src/media_hook/src/media_hook_actor.cpp b/src/media_hook/src/media_hook_actor.cpp index 545eca3cf..a5c44caa8 100644 --- a/src/media_hook/src/media_hook_actor.cpp +++ b/src/media_hook/src/media_hook_actor.cpp @@ -94,10 +94,10 @@ MediaHookWorkerActor::MediaHookWorkerActor(caf::actor_config &cfg) }, [=](get_media_hook_atom, caf::actor media_source) -> result { - auto rp = make_response_promise(); + auto rp = make_response_promise(); - if (hooks.empty()){ - rp.deliver(true); + if (hooks.empty()) { + rp.deliver(true); return rp; } diff --git a/src/module/src/module.cpp b/src/module/src/module.cpp index 04fb70dd6..1e6d9f576 100644 --- a/src/module/src/module.cpp +++ b/src/module/src/module.cpp @@ -146,10 +146,9 @@ void Module::link_to_module( } } -void Module::unlink_module(caf::actor other_module) -{ +void Module::unlink_module(caf::actor other_module) { auto addr = caf::actor_cast(other_module); - auto p = std::find(fully_linked_modules_.begin(), fully_linked_modules_.end(), addr); + auto p = std::find(fully_linked_modules_.begin(), fully_linked_modules_.end(), addr); bool found_link = false; if (p != fully_linked_modules_.end()) { fully_linked_modules_.erase(p); @@ -162,8 +161,7 @@ void Module::unlink_module(caf::actor other_module) } if (found_link) { - anon_send( - other_module, module::link_module_atom_v, self(), false); + anon_send(other_module, module::link_module_atom_v, self(), false); } } @@ -305,13 +303,10 @@ bool Module::remove_attribute(const utility::Uuid &attribute_uuid) { } else { throw std::runtime_error( fmt::format( - "{}: No attribute with id {}", - __PRETTY_FUNCTION__, - to_string(attribute_uuid)).c_str() - ); + "{}: No attribute with id {}", __PRETTY_FUNCTION__, to_string(attribute_uuid)) + .c_str()); } return true; - } utility::JsonStore Module::serialise() const { @@ -636,17 +631,14 @@ caf::message_handler Module::message_handler() { } }, - [=](remove_attribute_atom, - const utility::Uuid & uuid) -> result { - - try { - remove_attribute(uuid); - } catch (std::exception &e) { - return caf::make_error(xstudio_error::error, e.what()); - } - return true; - - }, + [=](remove_attribute_atom, const utility::Uuid &uuid) -> result { + try { + remove_attribute(uuid); + } catch (std::exception &e) { + return caf::make_error(xstudio_error::error, e.what()); + } + return true; + }, [=](attribute_uuids_atom) -> std::vector { @@ -693,12 +685,10 @@ caf::message_handler Module::message_handler() { link_to_module(linkwith, all_attrs, both_ways, intial_push_sync); }, - [=](link_module_atom, - caf::actor linkwith, - bool unlink) { - if (unlink) { - unlink_module(linkwith); - } + [=](link_module_atom, caf::actor linkwith, bool unlink) { + if (unlink) { + unlink_module(linkwith); + } }, [=](connect_to_ui_atom) { connect_to_ui(); }, @@ -922,30 +912,24 @@ void Module::notify_change( } if (role == Attribute::PreferencePath) { - - // looks like the preference path is being set on the attribute. Note + + // looks like the preference path is being set on the attribute. Note // we might get here before ser_parent_actor_addr' has been called so // we don't have 'self()' which is why I use the ActorSystemSingleton // to get to the caf system to get a GlobalStoreHelper auto prefs = global_store::GlobalStoreHelper( - xstudio::utility::ActorSystemSingleton::actor_system_ref() - ); + xstudio::utility::ActorSystemSingleton::actor_system_ref()); std::string pref_path; try { - pref_path = attr->get_role_data(Attribute::PreferencePath); + pref_path = attr->get_role_data(Attribute::PreferencePath); attr->set_role_data( Attribute::Value, prefs.get_existing_or_create_new_preference( - pref_path, - attr->role_data_as_json(Attribute::Value), - true, - false - ) - ); - - } catch (std::exception & e) { + pref_path, attr->role_data_as_json(Attribute::Value), true, false)); + + } catch (std::exception &e) { spdlog::warn("{} : {} {}", name(), __PRETTY_FUNCTION__, e.what()); } diff --git a/src/playhead/src/playhead.cpp b/src/playhead/src/playhead.cpp index ed133a652..d34a722c2 100644 --- a/src/playhead/src/playhead.cpp +++ b/src/playhead/src/playhead.cpp @@ -160,7 +160,6 @@ void PlayheadBase::add_attributes() { add_integer_attribute("Audio Delay Millisecs", "Audio Delay Millisecs", 0, -1000, 1000); audio_delay_millisecs_->set_role_data( module::Attribute::PreferencePath, "/core/audio/audio_latency_millisecs"); - } diff --git a/src/playhead/src/playhead_actor.cpp b/src/playhead/src/playhead_actor.cpp index 4b7e24ee5..e37fccbd4 100644 --- a/src/playhead/src/playhead_actor.cpp +++ b/src/playhead/src/playhead_actor.cpp @@ -1350,7 +1350,7 @@ void PlayheadActor::switch_key_playhead(int idx) { // pass the uuid of the new key playhead to the broadcast group const Uuid uuid = request_receive(*sys, key_playhead_, uuid_atom_v); key_playhead_uuid_ = uuid; - + // if 'switch_key_playhead' is called rapidly, the broadcast made below // can reach the receiver out of order, so we need to give it a timestamp // so they can know if they have got an out-of-order notification and ignore it diff --git a/src/playhead/src/playhead_global_events_actor.cpp b/src/playhead/src/playhead_global_events_actor.cpp index 80e05347f..955cbf4b2 100644 --- a/src/playhead/src/playhead_global_events_actor.cpp +++ b/src/playhead/src/playhead_global_events_actor.cpp @@ -84,19 +84,25 @@ void PlayheadGlobalEventsActor::init() { playhead); on_screen_playhead_ = playhead; if (playhead) { - // force an event broadcast for the on-screen media and + // force an event broadcast for the on-screen media and // media source (useful for plugins or anything else who // has joined our event group) - request(playhead, infinite, playhead::media_atom_v).then( - [=](caf::actor media) { - request(playhead, infinite, playhead::media_source_atom_v).then( - [=](caf::actor media_source) { - send(event_group_, utility::event_atom_v, show_atom_v, media, media_source); - }, - [=](caf::error &) {}); - - }, - [=](caf::error &) {}); + request(playhead, infinite, playhead::media_atom_v) + .then( + [=](caf::actor media) { + request(playhead, infinite, playhead::media_source_atom_v) + .then( + [=](caf::actor media_source) { + send( + event_group_, + utility::event_atom_v, + show_atom_v, + media, + media_source); + }, + [=](caf::error &) {}); + }, + [=](caf::error &) {}); } monitor(playhead); } diff --git a/src/playhead/src/sub_playhead.cpp b/src/playhead/src/sub_playhead.cpp index 5e4404548..73d7d7f38 100644 --- a/src/playhead/src/sub_playhead.cpp +++ b/src/playhead/src/sub_playhead.cpp @@ -421,24 +421,23 @@ void SubPlayhead::init() { }, [=](media_source_atom) -> result { - // MediaSourceActor at current playhead position auto rp = make_response_promise(); // we have to have run the 'source_atom' handler first (to have // built full_timeline_frames_) before we can fetch the media on // the current frame - request(caf::actor_cast(this), infinite, source_atom_v).then( - [=](caf::actor) mutable { - - auto frame = full_timeline_frames_.lower_bound(position_flicks_); - caf::actor result; - if (frame != full_timeline_frames_.end() && frame->second) { - result = caf::actor_cast(frame->second->actor_addr_); - } - rp.deliver(result); - }, - [=](const error &err) mutable { rp.deliver(err); }); + request(caf::actor_cast(this), infinite, source_atom_v) + .then( + [=](caf::actor) mutable { + auto frame = full_timeline_frames_.lower_bound(position_flicks_); + caf::actor result; + if (frame != full_timeline_frames_.end() && frame->second) { + result = caf::actor_cast(frame->second->actor_addr_); + } + rp.deliver(result); + }, + [=](const error &err) mutable { rp.deliver(err); }); return rp; }, @@ -479,23 +478,24 @@ void SubPlayhead::init() { }, [=](media_atom) -> result { - // MediaActor at current playhead position auto rp = make_response_promise(); - request(caf::actor_cast(this), infinite, media_source_atom_v).then( - [=](caf::actor media_source) mutable { - if (!media_source) - rp.deliver(caf::actor()); - else { - request(media_source, infinite, utility::parent_atom_v) - .then( - [=](caf::actor media_actor) mutable { rp.deliver(media_actor); }, - [=](const error &err) mutable { rp.deliver(err); }); - } - - }, - [=](const error &err) mutable { rp.deliver(err); }); + request(caf::actor_cast(this), infinite, media_source_atom_v) + .then( + [=](caf::actor media_source) mutable { + if (!media_source) + rp.deliver(caf::actor()); + else { + request(media_source, infinite, utility::parent_atom_v) + .then( + [=](caf::actor media_actor) mutable { + rp.deliver(media_actor); + }, + [=](const error &err) mutable { rp.deliver(err); }); + } + }, + [=](const error &err) mutable { rp.deliver(err); }); return rp; }, diff --git a/src/playlist/src/playlist_actor.cpp b/src/playlist/src/playlist_actor.cpp index dce679634..6e5634b40 100644 --- a/src/playlist/src/playlist_actor.cpp +++ b/src/playlist/src/playlist_actor.cpp @@ -368,7 +368,7 @@ void PlaylistActor::init() { std::string ext = ltrim_char(to_upper_path(fs::path(uri_to_posix_path(uri)).extension()), '.'); #else - std::string ext = + std::string ext = ltrim_char(to_upper(fs::path(uri_to_posix_path(uri)).extension()), '.'); #endif const auto source_uuid = Uuid::generate(); @@ -431,7 +431,7 @@ void PlaylistActor::init() { std::string ext = ltrim_char(to_upper_path(fs::path(uri_to_posix_path(uri)).extension()), '.'); #else - std::string ext = + std::string ext = ltrim_char(to_upper(fs::path(uri_to_posix_path(uri)).extension()), '.'); #endif const auto source_uuid = Uuid::generate(); @@ -623,9 +623,9 @@ void PlaylistActor::init() { // duration and frame rate must be known up-front std::vector media_actors = ma; - auto source_count = std::make_shared(); - (*source_count) = media_actors.size(); - auto rp = make_response_promise(); + auto source_count = std::make_shared(); + (*source_count) = media_actors.size(); + auto rp = make_response_promise(); // add to lis first, then lazy update.. @@ -1938,7 +1938,8 @@ void PlaylistActor::add_media( open_media_reader(ua.actor()); }, [=](error &err) mutable { - spdlog::warn("{} {} {}", __PRETTY_FUNCTION__, to_string(err), to_string(ua.actor())); + spdlog::warn( + "{} {} {}", __PRETTY_FUNCTION__, to_string(err), to_string(ua.actor())); send_content_changed_event(); base_.send_changed(event_group_, this); rp.deliver(ua); diff --git a/src/plugin/colour_op/grading/src/grading_colour_op.cpp b/src/plugin/colour_op/grading/src/grading_colour_op.cpp index 6224a59f6..cb45e9bdf 100644 --- a/src/plugin/colour_op/grading/src/grading_colour_op.cpp +++ b/src/plugin/colour_op/grading/src/grading_colour_op.cpp @@ -471,8 +471,8 @@ GradingColourOperator::setup_ocio_textures(OCIO::ConstGpuShaderDescRcPtr &shader : LUTDescriptor::NEAREST; auto xs_lut = std::make_shared( height > 1 - ? LUTDescriptor::Create2DLUT(width, height, xs_dtype, xs_channels, xs_interp) - : LUTDescriptor::Create1DLUT(width, xs_dtype, xs_channels, xs_interp), + ? LUTDescriptor::Create2DLUT(width, height, xs_dtype, xs_channels, xs_interp) + : LUTDescriptor::Create1DLUT(width, xs_dtype, xs_channels, xs_interp), samplerName); const int channels = channel == OCIO::GpuShaderCreator::TEXTURE_RED_CHANNEL ? 1 : 3; diff --git a/src/plugin/colour_pipeline/ocio/src/ocio.cpp b/src/plugin/colour_pipeline/ocio/src/ocio.cpp index e65c62b3c..b3507f586 100644 --- a/src/plugin/colour_pipeline/ocio/src/ocio.cpp +++ b/src/plugin/colour_pipeline/ocio/src/ocio.cpp @@ -521,23 +521,23 @@ std::string OCIOColourPipeline::input_space_for_view( std::string new_colourspace; - auto colourspace_or = [media_param](const std::string &cs, const std::string &fallback){ + auto colourspace_or = [media_param](const std::string &cs, const std::string &fallback) { const bool has_cs = bool(media_param.ocio_config->getColorSpace(cs.c_str())); return has_cs ? cs : fallback; }; if (media_param.metadata.contains("input_category")) { const auto is_untonemapped = view == "Un-tone-mapped"; - const auto category = media_param.metadata["input_category"]; + const auto category = media_param.metadata["input_category"]; if (category == "internal_movie") { - new_colourspace = is_untonemapped ? - "disp_Rec709-G24" : colourspace_or("DNEG_Rec709", "Film_Rec709"); + new_colourspace = is_untonemapped ? "disp_Rec709-G24" + : colourspace_or("DNEG_Rec709", "Film_Rec709"); } else if (category == "edit_ref" or category == "movie_media") { - new_colourspace = is_untonemapped ? - "disp_Rec709-G24" : colourspace_or("Client_Rec709", "Film_Rec709"); + new_colourspace = is_untonemapped ? "disp_Rec709-G24" + : colourspace_or("Client_Rec709", "Film_Rec709"); } else if (category == "still_media") { - new_colourspace = is_untonemapped ? - "disp_sRGB" : colourspace_or("DNEG_sRGB", "Film_sRGB"); + new_colourspace = + is_untonemapped ? "disp_sRGB" : colourspace_or("DNEG_sRGB", "Film_sRGB"); } // Double check the new colourspace actually exists @@ -1041,8 +1041,8 @@ void OCIOColourPipeline::setup_textures( : LUTDescriptor::NEAREST; auto xs_lut = std::make_shared( height > 1 - ? LUTDescriptor::Create2DLUT(width, height, xs_dtype, xs_channels, xs_interp) - : LUTDescriptor::Create1DLUT(width, xs_dtype, xs_channels, xs_interp), + ? LUTDescriptor::Create2DLUT(width, height, xs_dtype, xs_channels, xs_interp) + : LUTDescriptor::Create1DLUT(width, xs_dtype, xs_channels, xs_interp), samplerName); const int channels = channel == OCIO::GpuShaderCreator::TEXTURE_RED_CHANNEL ? 1 : 3; diff --git a/src/plugin/colour_pipeline/ocio/src/ocio_ui.cpp b/src/plugin/colour_pipeline/ocio/src/ocio_ui.cpp index 6acef9957..220c7107e 100644 --- a/src/plugin/colour_pipeline/ocio/src/ocio_ui.cpp +++ b/src/plugin/colour_pipeline/ocio/src/ocio_ui.cpp @@ -411,7 +411,8 @@ void OCIOColourPipeline::setup_ui() { // Source colour space mode - adjust_source_ = add_boolean_attribute(ui_text_.SOURCE_CS_MODE, ui_text_.SOURCE_CS_MODE_SHORT, true); + adjust_source_ = + add_boolean_attribute(ui_text_.SOURCE_CS_MODE, ui_text_.SOURCE_CS_MODE_SHORT, true); adjust_source_->set_redraw_viewport_on_change(true); adjust_source_->set_role_data( @@ -607,12 +608,13 @@ OCIOColourPipeline::parse_all_colourspaces(OCIO::ConstConfigRcPtr ocio_config) c return colourspaces; } -void OCIOColourPipeline::update_cs_from_view(const MediaParams &media_param, const std::string &view) { +void OCIOColourPipeline::update_cs_from_view( + const MediaParams &media_param, const std::string &view) { const auto new_cs = input_space_for_view(media_param, view_->value()); if (!new_cs.empty() && new_cs != source_colour_space_->value()) { - MediaParams update_media_param = media_param; + MediaParams update_media_param = media_param; update_media_param.user_input_cs = new_cs; set_media_params(update_media_param); diff --git a/src/plugin/data_source/dneg/shotgun/src/data_source_shotgun_worker.cpp b/src/plugin/data_source/dneg/shotgun/src/data_source_shotgun_worker.cpp index c354ccc20..4a8dd4bc6 100644 --- a/src/plugin/data_source/dneg/shotgun/src/data_source_shotgun_worker.cpp +++ b/src/plugin/data_source/dneg/shotgun/src/data_source_shotgun_worker.cpp @@ -83,7 +83,6 @@ void ShotgunMediaWorker::add_media_step_3( request(media, infinite, media::add_media_source_atom_v, srcs) .then( [=](const bool) mutable { - rp.deliver(true); // push metadata to media actor. anon_send( diff --git a/src/plugin/media_hook/dneg/dnhook/src/dneg.cpp b/src/plugin/media_hook/dneg/dnhook/src/dneg.cpp index ffa96d09f..167ce6d33 100644 --- a/src/plugin/media_hook/dneg/dnhook/src/dneg.cpp +++ b/src/plugin/media_hook/dneg/dnhook/src/dneg.cpp @@ -333,8 +333,8 @@ class DNegMediaHook : public MediaHook { r["active_views"] = active_views; } const auto views = utility::split(active_views, ':'); - const bool has_untonemapped_view = std::find( - views.begin(), views.end(), "Un-tone-mapped") != views.end(); + const bool has_untonemapped_view = + std::find(views.begin(), views.end(), "Un-tone-mapped") != views.end(); // Input media category detection @@ -474,7 +474,7 @@ class DNegMediaHook : public MediaHook { r["viewing_rules"] = true; } else { - r["ocio_config"] = "__raw__"; + r["ocio_config"] = "__raw__"; r["working_space"] = "raw"; } diff --git a/src/plugin/media_metadata/ffprobe/src/ffprobe_lib.cpp b/src/plugin/media_metadata/ffprobe/src/ffprobe_lib.cpp index e87730c2e..b420339d9 100644 --- a/src/plugin/media_metadata/ffprobe/src/ffprobe_lib.cpp +++ b/src/plugin/media_metadata/ffprobe/src/ffprobe_lib.cpp @@ -25,7 +25,9 @@ using namespace xstudio::ffprobe; namespace { -const auto av_time_base_q = av_get_time_base_q(); // READ https://libav-devel.libav.narkive.com/ZQCWfTun/patch-0-2-fix-avutil-h-usage-from-c +const auto av_time_base_q = + av_get_time_base_q(); // READ + // https://libav-devel.libav.narkive.com/ZQCWfTun/patch-0-2-fix-avutil-h-usage-from-c int check_stream_specifier(AVFormatContext *avfs, AVStream *avs, const char *spec) { auto result = avformat_match_stream_specifier(avfs, avs, spec); diff --git a/src/plugin/media_reader/ffmpeg/src/ffmpeg.cpp b/src/plugin/media_reader/ffmpeg/src/ffmpeg.cpp index 7b3db4077..313c75f5e 100644 --- a/src/plugin/media_reader/ffmpeg/src/ffmpeg.cpp +++ b/src/plugin/media_reader/ffmpeg/src/ffmpeg.cpp @@ -266,12 +266,13 @@ void FFMpegMediaReader::update_preferences(const utility::JsonStore &prefs) { try { readers_per_source_ = preference_value(prefs, "/plugin/media_reader/FFMPEG/readers_per_source"); -#ifdef __linux__ +#ifdef __linux__ soundcard_sample_rate_ = preference_value(prefs, "/core/audio/pulse_audio_prefs/sample_rate"); #endif #ifdef _WIN32 - soundcard_sample_rate_ = preference_value(prefs, "/core/audio/windows_audio_prefs/sample_rate"); + soundcard_sample_rate_ = + preference_value(prefs, "/core/audio/windows_audio_prefs/sample_rate"); #endif } catch (const std::exception &e) { diff --git a/src/plugin/media_reader/ffmpeg/src/ffmpeg_stream.cpp b/src/plugin/media_reader/ffmpeg/src/ffmpeg_stream.cpp index c9473e837..f8ee75459 100644 --- a/src/plugin/media_reader/ffmpeg/src/ffmpeg_stream.cpp +++ b/src/plugin/media_reader/ffmpeg/src/ffmpeg_stream.cpp @@ -544,10 +544,10 @@ AudioBufPtr FFMpegStream::get_ffmpeg_frame_as_xstudio_audio(const int soundcard_ double(frame->pts) * double(avc_stream_->time_base.num) / double(avc_stream_->time_base.den)); - //spdlog::info( - // "Calculated display timestamp: {} seconds.", - // double(frame->pts) * double(avc_stream_->time_base.num) / - // double(avc_stream_->time_base.den)); + // spdlog::info( + // "Calculated display timestamp: {} seconds.", + // double(frame->pts) * double(avc_stream_->time_base.num) / + // double(avc_stream_->time_base.den)); resample_audio(frame, audio_buffer, -1); diff --git a/src/plugin/utility/dneg/dnrun/src/dnrun.cpp b/src/plugin/utility/dneg/dnrun/src/dnrun.cpp index 0aed07b56..c4012baea 100644 --- a/src/plugin/utility/dneg/dnrun/src/dnrun.cpp +++ b/src/plugin/utility/dneg/dnrun/src/dnrun.cpp @@ -402,7 +402,7 @@ template class DNRunPluginActor : public caf::event_based_actor { quickview = jsn.at("args").at("quickview") == "true"; } } - + bool ab_compare = jsn.at("args").contains("compare") && jsn.at("args").at("compare") == "ab"; diff --git a/src/plugin_manager/src/plugin_manager.cpp b/src/plugin_manager/src/plugin_manager.cpp index b6a97f6b6..c2d5c28e3 100644 --- a/src/plugin_manager/src/plugin_manager.cpp +++ b/src/plugin_manager/src/plugin_manager.cpp @@ -54,7 +54,8 @@ size_t PluginManager::load_plugins() { // read dir content.. for (const auto &entry : fs::directory_iterator(path)) { if (not fs::is_regular_file(entry.status()) or - not(entry.path().extension() == ".so" || entry.path().extension() == ".dll")) + not(entry.path().extension() == ".so" || + entry.path().extension() == ".dll")) continue; #ifdef __linux__ diff --git a/src/plugin_manager/src/plugin_manager_actor.cpp b/src/plugin_manager/src/plugin_manager_actor.cpp index ae8ceab7f..863112288 100644 --- a/src/plugin_manager/src/plugin_manager_actor.cpp +++ b/src/plugin_manager/src/plugin_manager_actor.cpp @@ -27,7 +27,7 @@ PluginManagerActor::PluginManagerActor(caf::actor_config &cfg) : caf::event_base // use env var 'XSTUDIO_PLUGIN_PATH' to extend the folders searched for // xstudio plugins - char * plugin_path = std::getenv("XSTUDIO_PLUGIN_PATH"); + char *plugin_path = std::getenv("XSTUDIO_PLUGIN_PATH"); if (plugin_path) { for (const auto &p : xstudio::utility::split(plugin_path, ':')) { manager_.emplace_front_path(p); diff --git a/src/scanner/src/scanner_actor.cpp b/src/scanner/src/scanner_actor.cpp index ccb4b7368..e27b864f4 100644 --- a/src/scanner/src/scanner_actor.cpp +++ b/src/scanner/src/scanner_actor.cpp @@ -175,7 +175,7 @@ ScanHelperActor::ScanHelperActor(caf::actor_config &cfg) : caf::event_based_acto for (const auto &entry : fs::recursive_directory_iterator(path)) { try { if (fs::is_regular_file(entry.status())) { - // check we've not alredy got it in cache.. + // check we've not alredy got it in cache.. #ifdef _WIN32 const auto puri = posix_path_to_uri(entry.path().string()); #else @@ -198,7 +198,7 @@ ScanHelperActor::ScanHelperActor(caf::actor_config &cfg) : caf::event_based_acto #else auto checksum = get_checksum(entry.path()); #endif - cache_[puri] = std::make_pair(checksum, size); + cache_[puri] = std::make_pair(checksum, size); if (checksum == pin.first) return puri; } diff --git a/src/session/src/session_actor.cpp b/src/session/src/session_actor.cpp index 7f5b944c6..fc27d7101 100644 --- a/src/session/src/session_actor.cpp +++ b/src/session/src/session_actor.cpp @@ -335,7 +335,8 @@ bool LoadUrisActor::load_uris(const bool single_playlist) { fs::path p(uri_to_posix_path(i)); if (fs::is_directory(p)) { #ifdef _WIN32 - request(session_, infinite, add_playlist_atom_v, std::string(p.filename().string())) + request( + session_, infinite, add_playlist_atom_v, std::string(p.filename().string())) #else request(session_, infinite, add_playlist_atom_v, std::string(p.filename())) #endif diff --git a/src/shotgun_client/src/shotgun_client_actor.cpp b/src/shotgun_client/src/shotgun_client_actor.cpp index 63a63c5fb..aaaa65eac 100644 --- a/src/shotgun_client/src/shotgun_client_actor.cpp +++ b/src/shotgun_client/src/shotgun_client_actor.cpp @@ -1578,7 +1578,7 @@ void ShotgunClientActor::init() { return rp; } - + //, // TODO: Ahead Fix // [=](shotgun_image_atom, @@ -1603,7 +1603,8 @@ void ShotgunClientActor::init() { // if (thumbgen) { // std::vector bytedata(data.size()); // std::memcpy(bytedata.data(), data.data(), data.size()); - // //rp.delegate(thumbgen, media_reader::get_thumbnail_atom_v, bytedata); + // //rp.delegate(thumbgen, media_reader::get_thumbnail_atom_v, + // bytedata); // } else { // rp.deliver(make_error( // sce::response_error, "Thumbnail manager not available")); @@ -1613,7 +1614,7 @@ void ShotgunClientActor::init() { // return rp; // } - ); + ); } void ShotgunClientActor::acquire_token( diff --git a/src/thumbnail/src/thumbnail_manager_actor.cpp b/src/thumbnail/src/thumbnail_manager_actor.cpp index 9118a760b..c849af536 100644 --- a/src/thumbnail/src/thumbnail_manager_actor.cpp +++ b/src/thumbnail/src/thumbnail_manager_actor.cpp @@ -254,7 +254,7 @@ ThumbnailManagerActor::ThumbnailManagerActor(caf::actor_config &cfg) auto new_string = preference_value(js, "/core/thumbnail/disk_cache/path"); new_string = expand_envvars(new_string); - + if (cache_path != new_string) { cache_path = new_string; anon_send( diff --git a/src/timeline/src/item.cpp b/src/timeline/src/item.cpp index 3b8d98747..1f9888971 100644 --- a/src/timeline/src/item.cpp +++ b/src/timeline/src/item.cpp @@ -743,8 +743,8 @@ bool Item::process_event(const utility::JsonStore &event) { case IT_ACTIVE: set_active_range_direct(event.at("value")); has_active_range_ = event.at("value2"); - break; - case IT_AVAIL: + break; + case IT_AVAIL: set_available_range_direct(event.at("value")); has_available_range_ = event.at("value2"); break; @@ -791,29 +791,29 @@ bool Item::process_event(const utility::JsonStore &event) { } } break; - case IT_ADDR: + case IT_ADDR: if (event.at("value").is_null()) - set_actor_addr_direct(caf::actor_addr()); - else + set_actor_addr_direct(caf::actor_addr()); + else set_actor_addr_direct(string_to_actor_addr(event.at("value"))); - break; - case IA_NONE: - default: - break; - } - if (item_event_callback_) - item_event_callback_(event, *this); - } else { + break; + case IA_NONE: + default: + break; + } + if (item_event_callback_) + item_event_callback_(event, *this); + } else { // child ? for (auto &i : *this) { if (i.process_event(event)) return true; - } - - return false; } - return true; + + return false; } + return true; +} void Item::bind_item_event_func(ItemEventFunc fn, const bool recursive) { recursive_bind_ = recursive; diff --git a/src/timeline/src/timeline_actor.cpp b/src/timeline/src/timeline_actor.cpp index c4b29ba22..84f9a6b4f 100644 --- a/src/timeline/src/timeline_actor.cpp +++ b/src/timeline/src/timeline_actor.cpp @@ -647,11 +647,14 @@ void TimelineActor::init() { if (not jsn.is_null()) { send(event_group_, event_atom_v, item_atom_v, jsn, false); #ifdef _MSC_VER - auto tp = sysclock::now(); - auto micros = std::chrono::duration_cast(tp.time_since_epoch()).count(); - //using nano_sys = std::chrono::time_point; - anon_send(history_, history::log_atom_v, micros, jsn); -#else + auto tp = sysclock::now(); + auto micros = + std::chrono::duration_cast(tp.time_since_epoch()) + .count(); + // using nano_sys = std::chrono::time_point; + anon_send(history_, history::log_atom_v, micros, jsn); +#else anon_send(history_, history::log_atom_v, sysclock::now(), jsn); #endif } @@ -678,12 +681,14 @@ void TimelineActor::init() { send(event_group_, event_atom_v, item_atom_v, jsn, false); #ifdef _MSC_VER - auto tp = sysclock::now(); - auto micros = std::chrono::duration_cast(tp.time_since_epoch()).count(); - anon_send(history_, history::log_atom_v, micros, jsn); + auto tp = sysclock::now(); + auto micros = + std::chrono::duration_cast(tp.time_since_epoch()) + .count(); + anon_send(history_, history::log_atom_v, micros, jsn); #else anon_send(history_, history::log_atom_v, sysclock::now(), jsn); -#endif +#endif } return jsn; }, @@ -705,14 +710,16 @@ void TimelineActor::init() { if (not jsn.is_null()) { send(event_group_, event_atom_v, item_atom_v, jsn, false); #ifdef _MSC_VER - auto tp = sysclock::now(); - auto micros = std::chrono::duration_cast(tp.time_since_epoch()).count(); - using nano_sys = std::chrono::time_point; - anon_send(history_, history::log_atom_v, micros, jsn); + auto tp = sysclock::now(); + auto micros = + std::chrono::duration_cast(tp.time_since_epoch()) + .count(); + using nano_sys = std::chrono:: + time_point; + anon_send(history_, history::log_atom_v, micros, jsn); #else anon_send(history_, history::log_atom_v, sysclock::now(), jsn); -#endif - +#endif } return jsn; }, @@ -1609,9 +1616,11 @@ void TimelineActor::init() { // #ifdef _MSC_VER // auto tp = sysclock::now(); - // auto micros = std::chrono::duration_cast(tp.time_since_epoch()).count(); - // //using nano_sys = std::chrono::time_point; - // anon_send(actor,playhead::playhead_rate_atom_v, caf::make_timestamp(), base_.rate()); + // auto micros = + // std::chrono::duration_cast(tp.time_since_epoch()).count(); + // //using nano_sys = std::chrono::time_point; anon_send(actor,playhead::playhead_rate_atom_v, + // caf::make_timestamp(), base_.rate()); // #else // anon_send(actor, playhead::playhead_rate_atom_v, base_.rate()); // #endif @@ -2013,10 +2022,17 @@ void TimelineActor::init() { [=](playhead::get_selection_atom, caf::actor requester) { #ifdef _WIN32 auto tp = sysclock::now(); - auto micros = std::chrono::duration_cast(tp.time_since_epoch()).count(); - anon_send(requester,playhead::selection_changed_atom_v, micros, UuidList{base_.uuid()}); + auto micros = + std::chrono::duration_cast(tp.time_since_epoch()) + .count(); + anon_send( + requester, playhead::selection_changed_atom_v, micros, UuidList{base_.uuid()}); #else - anon_send(requester, utility::event_atom_v, playhead::selection_changed_atom_v, UuidList{base_.uuid()}); + anon_send( + requester, + utility::event_atom_v, + playhead::selection_changed_atom_v, + UuidList{base_.uuid()}); #endif }, @@ -2040,7 +2056,7 @@ void TimelineActor::init() { [=](session::import_atom, const std::string &data) -> result { auto rp = make_response_promise(); - // purge timeline.. ? + // purge timeline.. ? #ifdef BUILD_OTIO spawn( diff --git a/src/ui/model_data/src/model_data_actor.cpp b/src/ui/model_data/src/model_data_actor.cpp index bb644e2fe..f92f20960 100644 --- a/src/ui/model_data/src/model_data_actor.cpp +++ b/src/ui/model_data/src/model_data_actor.cpp @@ -214,9 +214,8 @@ GlobalUIModelData::GlobalUIModelData(caf::actor_config &cfg) : caf::event_based_ [=](remove_rows_atom, const std::string &model_name, - const utility::Uuid &attribute_uuid) - { - remove_attribute_from_model(model_name, attribute_uuid); + const utility::Uuid &attribute_uuid) { + remove_attribute_from_model(model_name, attribute_uuid); }, [=](remove_rows_atom, @@ -351,7 +350,7 @@ void GlobalUIModelData::set_data( broadcast_whole_model_data(model_name); } - } catch ([[maybe_unused]]std::exception &e) { + } catch ([[maybe_unused]] std::exception &e) { // spdlog::warn("{} {} {}", __PRETTY_FUNCTION__, e.what()); } } @@ -445,7 +444,7 @@ void GlobalUIModelData::insert_attribute_data_into_model( caf::actor client) { const utility::JsonStore attribute_data = attr_data; - auto p = models_.find(model_name); + auto p = models_.find(model_name); if (p != models_.end()) { // model with this name already exists. Simply add client and send the @@ -693,8 +692,8 @@ void GlobalUIModelData::remove_rows( } } -void GlobalUIModelData::remove_attribute_from_model(const std::string &model_name, const utility::Uuid &attr_uuid) -{ +void GlobalUIModelData::remove_attribute_from_model( + const std::string &model_name, const utility::Uuid &attr_uuid) { try { check_model_is_registered(model_name); @@ -707,7 +706,6 @@ void GlobalUIModelData::remove_attribute_from_model(const std::string &model_nam } catch (std::exception &e) { spdlog::warn("{} {}", __PRETTY_FUNCTION__, e.what()); } - } void GlobalUIModelData::push_to_prefs(const std::string &model_name, const bool actually_push) { diff --git a/src/ui/opengl/src/opengl_viewport_renderer.cpp b/src/ui/opengl/src/opengl_viewport_renderer.cpp index d2df464f5..26d8f072a 100644 --- a/src/ui/opengl/src/opengl_viewport_renderer.cpp +++ b/src/ui/opengl/src/opengl_viewport_renderer.cpp @@ -335,7 +335,7 @@ void OpenGLViewportRenderer::render( } // coordinate system set-up - utility::JsonStore shader_params = shader_uniforms_; + utility::JsonStore shader_params = shader_uniforms_; shader_params["to_coord_system"] = transform_viewport_to_image_space; shader_params["to_canvas"] = to_scene_matrix; shader_params["use_bilinear_filtering"] = use_bilinear_filtering; diff --git a/src/ui/opengl/src/texture.cpp b/src/ui/opengl/src/texture.cpp index c1dec8933..1ffb77ffd 100644 --- a/src/ui/opengl/src/texture.cpp +++ b/src/ui/opengl/src/texture.cpp @@ -31,9 +31,9 @@ class DebugTimer { } // namespace void GLBlindTex::release() { - //if linux - //mutex_.unlock(); - //endif + // if linux + // mutex_.unlock(); + // endif when_last_used_ = utility::clock::now(); } @@ -138,8 +138,8 @@ void GLDoubleBufferedTexture::upload_next( void GLDoubleBufferedTexture::release() { current_->release(); } GLBlindRGBA8bitTex::~GLBlindRGBA8bitTex() { - //if linux? TODO: Merged this in but might be problematic for Windows, do check. - // ensure no copying is in flight + // if linux? TODO: Merged this in but might be problematic for Windows, do check. + // ensure no copying is in flight if (upload_thread_.joinable()) upload_thread_.join(); @@ -223,23 +223,23 @@ void GLBlindRGBA8bitTex::resize(const size_t required_size_bytes) { void GLBlindRGBA8bitTex::start_pixel_upload() { - //if (new_source_frame_) { - //if (upload_thread_.joinable()) - // upload_thread_.join(); - //std::unique_lock lck(mutex_); - //mutex_.lock(); - //upload_thread_ = std::thread(&GLBlindRGBA8bitTex::pixel_upload, this); + // if (new_source_frame_) { + // if (upload_thread_.joinable()) + // upload_thread_.join(); + // std::unique_lock lck(mutex_); + // mutex_.lock(); + // upload_thread_ = std::thread(&GLBlindRGBA8bitTex::pixel_upload, this); GLBlindRGBA8bitTex::pixel_upload(); //} } void GLBlindRGBA8bitTex::pixel_upload() { - //std::unique_lock lck(mutex_); + // std::unique_lock lck(mutex_); if (!new_source_frame_->size()) { - //if linux - //mutex_.unlock(); - //endif + // if linux + // mutex_.unlock(); + // endif return; } @@ -264,7 +264,7 @@ void GLBlindRGBA8bitTex::pixel_upload() { t.join(); } - //cv.notify_one(); // notify the waiting thread + // cv.notify_one(); // notify the waiting thread } @@ -273,8 +273,8 @@ void GLBlindRGBA8bitTex::map_buffer_for_upload(media_reader::ImageBufPtr &frame) if (!frame) return; // acquire a write lock, - //mutex_.lock(); - //std::lock_guard lock(mutex_); + // mutex_.lock(); + // std::lock_guard lock(mutex_); new_source_frame_ = frame; media_key_ = frame->media_key(); @@ -294,17 +294,16 @@ void GLBlindRGBA8bitTex::map_buffer_for_upload(media_reader::ImageBufPtr &frame) } // The mutex will be automatically unlocked here when lock goes out of scope. // No need to manually call mutex_.unlock(). - //mutex_.unlock(); + // mutex_.unlock(); // N.B. threads are probably still running here! - } void GLBlindRGBA8bitTex::bind(int tex_index, Imath::V2i &dims) { - + // mutex_.lock(); - //std::unique_lock lck(mutex_); + // std::unique_lock lck(mutex_); dims.x = tex_width_; dims.y = tex_height_; @@ -312,9 +311,9 @@ void GLBlindRGBA8bitTex::bind(int tex_index, Imath::V2i &dims) { if (new_source_frame_) { if (new_source_frame_->size()) { - //if (upload_thread_.joinable()) { - // upload_thread_.join(); - //} + // if (upload_thread_.joinable()) { + // upload_thread_.join(); + // } // now the texture data is transferred (on the GPU). // Assumption is that this is fast. diff --git a/src/ui/qml/bookmark/src/bookmark_model_ui.cpp b/src/ui/qml/bookmark/src/bookmark_model_ui.cpp index d6dbe9ce4..ff3d3367b 100644 --- a/src/ui/qml/bookmark/src/bookmark_model_ui.cpp +++ b/src/ui/qml/bookmark/src/bookmark_model_ui.cpp @@ -204,11 +204,7 @@ BookmarkModel::getJSONFuture(const QModelIndex &index, const QString &path) cons scoped_actor sys{system()}; auto addr = UuidFromQUuid(index.data(uuidRole).toUuid()); auto result = request_receive( - *sys, - bookmark_actor_, - json_store::get_json_atom_v, - addr, - path_string); + *sys, bookmark_actor_, json_store::get_json_atom_v, addr, path_string); return QStringFromStd(result.dump()); diff --git a/src/ui/qml/global_store/src/global_store_model_ui.cpp b/src/ui/qml/global_store/src/global_store_model_ui.cpp index eaa16d8bf..a92d186eb 100644 --- a/src/ui/qml/global_store/src/global_store_model_ui.cpp +++ b/src/ui/qml/global_store/src/global_store_model_ui.cpp @@ -201,7 +201,7 @@ bool GlobalStoreModel::updateProperty( // convert to internal representation. nlohmann::json GlobalStoreModel::storeToTree(const nlohmann::json &src) { - + auto result = R"([])"_json; for (const auto &[k, v] : src.items()) { if (v.count("datatype")) { diff --git a/src/ui/qml/helper/src/model_data_ui.cpp b/src/ui/qml/helper/src/model_data_ui.cpp index 602ff5f23..0f024fe36 100644 --- a/src/ui/qml/helper/src/model_data_ui.cpp +++ b/src/ui/qml/helper/src/model_data_ui.cpp @@ -124,7 +124,8 @@ void UIModelData::init(caf::actor_system &system) { emit dataChanged( idx, idx, - QVector({static_cast(Roles::LASTROLE + static_cast(i))})); + QVector({static_cast( + Roles::LASTROLE + static_cast(i))})); break; } @@ -185,7 +186,7 @@ bool UIModelData::setData(const QModelIndex &index, const QVariant &value, int r .constData()); } else if (std::string(value.typeName()) == "QString") { std::string value_string = StdFromQString(value.toString()); - j = nlohmann::json::parse(value_string); + j = nlohmann::json::parse(value_string); } else { j = nlohmann::json::parse(QJsonDocument::fromVariant(value) .toJson(QJsonDocument::Compact) @@ -656,8 +657,8 @@ void MenuModelItem::insertIntoMenuModel() { global_ui_model_data_registry); utility::JsonStore menu_item_data; - std::string name_string = StdFromQString(text_); - menu_item_data["name"] = name_string; + std::string name_string = StdFromQString(text_); + menu_item_data["name"] = name_string; if (!hotkey_.isEmpty()) { std::string hotkey_string = StdFromQString(hotkey_); menu_item_data["hotkey"] = hotkey_string; diff --git a/src/ui/qml/playhead/src/playhead_ui.cpp b/src/ui/qml/playhead/src/playhead_ui.cpp index d66097ad7..6b3233f15 100644 --- a/src/ui/qml/playhead/src/playhead_ui.cpp +++ b/src/ui/qml/playhead/src/playhead_ui.cpp @@ -97,7 +97,7 @@ void PlayheadUI::set_backend(caf::actor backend) { loop_start_ = request_receive(*sys, backend_, playhead::simple_loop_start_atom_v); loop_end_ = request_receive(*sys, backend_, playhead::simple_loop_end_atom_v); - frames_ = request_receive(*sys, backend_, playhead::duration_frames_atom_v); + frames_ = request_receive(*sys, backend_, playhead::duration_frames_atom_v); use_loop_range_ = request_receive(*sys, backend_, playhead::use_loop_range_atom_v); key_playhead_index_ = diff --git a/src/ui/qml/session/src/session_model_methods_ui.cpp b/src/ui/qml/session/src/session_model_methods_ui.cpp index 24c40f590..aeba9ff2e 100644 --- a/src/ui/qml/session/src/session_model_methods_ui.cpp +++ b/src/ui/qml/session/src/session_model_methods_ui.cpp @@ -713,7 +713,7 @@ QFuture> SessionModel::handleUriListDropFuture( if (target) { for (const auto &path : jdrop.at("text/uri-list")) { auto path_string = path.get(); - auto uri = caf::make_uri(url_clean(path_string)); + auto uri = caf::make_uri(url_clean(path_string)); if (uri) { // uri maybe timeline... // hacky... @@ -1132,11 +1132,7 @@ QFuture SessionModel::getJSONFuture(const QModelIndex &index, const QSt std::string path_string = StdFromQString(path); if (type == "Media") { auto jsn = request_receive( - *sys, - actor, - json_store::get_json_atom_v, - Uuid(), - path_string); + *sys, actor, json_store::get_json_atom_v, Uuid(), path_string); result = QStringFromStd(jsn.dump()); } else { diff --git a/src/ui/qml/studio/src/studio_ui.cpp b/src/ui/qml/studio/src/studio_ui.cpp index d1bab527e..dded1291f 100644 --- a/src/ui/qml/studio/src/studio_ui.cpp +++ b/src/ui/qml/studio/src/studio_ui.cpp @@ -121,7 +121,6 @@ void StudioUI::init(actor_system &system_) { // create a new offscreen viewport and return the actor handle offscreen_viewports_.push_back(new xstudio::ui::qt::OffscreenViewport(name)); return offscreen_viewports_.back()->as_actor(); - }, [=](ui::offscreen_viewport_atom, const std::string name, caf::actor requester) { @@ -134,15 +133,12 @@ void StudioUI::init(actor_system &system_) { requester, ui::offscreen_viewport_atom_v, offscreen_viewports_.back()->as_actor()); - }, - [=](std::string) { - - loadVideoOutputPlugins(); - + [=](std::string) { + loadVideoOutputPlugins(); } - - }; + + }; }); // here we tell the studio that we're up and running so it can send us @@ -155,15 +151,13 @@ void StudioUI::init(actor_system &system_) { // create the offscreen viewport used for rendering snapshots snapshot_offscreen_viewport_ = new xstudio::ui::qt::OffscreenViewport("snapshot_viewport"); system().registry().template put( - offscreen_viewport_registry, - snapshot_offscreen_viewport_->as_actor() - ); + offscreen_viewport_registry, snapshot_offscreen_viewport_->as_actor()); // we need to delay loading video output plugins by a couple of seconds // to make sure the UI is up and running before we create offscreen viewports // etc. that the video output plugin probably wants - delayed_anon_send(as_actor(), std::chrono::seconds(5), std::string("load video output plugins")); - + delayed_anon_send( + as_actor(), std::chrono::seconds(5), std::string("load video output plugins")); } void StudioUI::setSessionActorAddr(const QString &addr) { @@ -361,7 +355,7 @@ void StudioUI::loadVideoOutputPlugins() { for (const auto &i : details) { try { - + auto video_output_plugin = request_receive( *sys, pm, plugin_manager::spawn_plugin_atom_v, i.uuid_); video_output_plugins_.push_back(video_output_plugin); diff --git a/src/ui/qml/viewport/src/qml_viewport_renderer.cpp b/src/ui/qml/viewport/src/qml_viewport_renderer.cpp index 0519df3e7..745697707 100644 --- a/src/ui/qml/viewport/src/qml_viewport_renderer.cpp +++ b/src/ui/qml/viewport/src/qml_viewport_renderer.cpp @@ -74,8 +74,8 @@ void QMLViewportRenderer::paint() { } } -void QMLViewportRenderer::frameSwapped() { - viewport_renderer_->framebuffer_swapped(utility::clock::now()); +void QMLViewportRenderer::frameSwapped() { + viewport_renderer_->framebuffer_swapped(utility::clock::now()); } void QMLViewportRenderer::setWindow(QQuickWindow *window) { m_window = window; } @@ -396,10 +396,7 @@ void QMLViewportRenderer::renderImageToFile( std::cerr << "A\n"; utility::request_receive( - *sys, - offscreen_viewport, - viewport::viewport_playhead_atom_v, - playhead); + *sys, offscreen_viewport, viewport::viewport_playhead_atom_v, playhead); std::cerr << "B\n"; utility::request_receive( @@ -414,7 +411,7 @@ void QMLViewportRenderer::renderImageToFile( } else { emit snapshotRequestResult(QString("Offscreen viewport renderer was not found.")); } - } catch (std::exception & e) { + } catch (std::exception &e) { emit snapshotRequestResult(QString(e.what())); } } diff --git a/src/ui/qt/viewport_widget/src/offscreen_viewport.cpp b/src/ui/qt/viewport_widget/src/offscreen_viewport.cpp index c3c1f940a..db93fdb21 100644 --- a/src/ui/qt/viewport_widget/src/offscreen_viewport.cpp +++ b/src/ui/qt/viewport_widget/src/offscreen_viewport.cpp @@ -30,55 +30,51 @@ using namespace xstudio::ui::viewport; namespace fs = std::filesystem; namespace { - static void threaded_memcpy(void * _dst, void * _src, size_t n, int n_threads) { +static void threaded_memcpy(void *_dst, void *_src, size_t n, int n_threads) { - std::vector memcpy_threads; - size_t step = ((n / n_threads) / 4096) * 4096; + std::vector memcpy_threads; + size_t step = ((n / n_threads) / 4096) * 4096; - uint8_t *dst = (uint8_t *)_dst; - uint8_t *src = (uint8_t *)_src; - - for (int i = 0; i < n_threads; ++i) { - memcpy_threads.emplace_back(memcpy, dst, src, std::min(n, step)); - dst += step; - src += step; - n -= step; - } - - // ensure any threads still running to copy data to this texture are done - for (auto &t : memcpy_threads) { - if (t.joinable()) - t.join(); - } + uint8_t *dst = (uint8_t *)_dst; + uint8_t *src = (uint8_t *)_src; + for (int i = 0; i < n_threads; ++i) { + memcpy_threads.emplace_back(memcpy, dst, src, std::min(n, step)); + dst += step; + src += step; + n -= step; } - static std::map format_to_gl_tex_format = { - {viewport::ImageFormat::RGBA_8, GL_RGBA8}, - {viewport::ImageFormat::RGBA_10_10_10_2, GL_RGBA8}, - {viewport::ImageFormat::RGBA_16, GL_RGBA16}, - {viewport::ImageFormat::RGBA_16F, GL_RGBA16F}, - {viewport::ImageFormat::RGBA_32F, GL_RGBA32F} - }; - - static std::map format_to_gl_pixe_type = { - {viewport::ImageFormat::RGBA_8, GL_UNSIGNED_BYTE}, - {viewport::ImageFormat::RGBA_10_10_10_2, GL_UNSIGNED_BYTE}, - {viewport::ImageFormat::RGBA_16, GL_UNSIGNED_SHORT}, - {viewport::ImageFormat::RGBA_16F, GL_HALF_FLOAT}, - {viewport::ImageFormat::RGBA_32F, GL_FLOAT} - }; - - static std::map format_to_bytes_per_pixel = { - {viewport::ImageFormat::RGBA_8, 4}, - {viewport::ImageFormat::RGBA_10_10_10_2, 4}, - {viewport::ImageFormat::RGBA_16, 8}, - {viewport::ImageFormat::RGBA_16F, 8}, - {viewport::ImageFormat::RGBA_32F, 16} - }; - + // ensure any threads still running to copy data to this texture are done + for (auto &t : memcpy_threads) { + if (t.joinable()) + t.join(); + } } +static std::map format_to_gl_tex_format = { + {viewport::ImageFormat::RGBA_8, GL_RGBA8}, + {viewport::ImageFormat::RGBA_10_10_10_2, GL_RGBA8}, + {viewport::ImageFormat::RGBA_16, GL_RGBA16}, + {viewport::ImageFormat::RGBA_16F, GL_RGBA16F}, + {viewport::ImageFormat::RGBA_32F, GL_RGBA32F}}; + +static std::map format_to_gl_pixe_type = { + {viewport::ImageFormat::RGBA_8, GL_UNSIGNED_BYTE}, + {viewport::ImageFormat::RGBA_10_10_10_2, GL_UNSIGNED_BYTE}, + {viewport::ImageFormat::RGBA_16, GL_UNSIGNED_SHORT}, + {viewport::ImageFormat::RGBA_16F, GL_HALF_FLOAT}, + {viewport::ImageFormat::RGBA_32F, GL_FLOAT}}; + +static std::map format_to_bytes_per_pixel = { + {viewport::ImageFormat::RGBA_8, 4}, + {viewport::ImageFormat::RGBA_10_10_10_2, 4}, + {viewport::ImageFormat::RGBA_16, 8}, + {viewport::ImageFormat::RGBA_16F, 8}, + {viewport::ImageFormat::RGBA_32F, 16}}; + +} // namespace + OffscreenViewport::OffscreenViewport(const std::string name) : super() { // This class is a QObject with a caf::actor 'companion' that allows it @@ -108,7 +104,7 @@ OffscreenViewport::OffscreenViewport(const std::string name) : super() { auto callback = [this](auto &&PH1) { receive_change_notification(std::forward(PH1)); }; - //viewport_renderer_->set_change_callback(callback); + // viewport_renderer_->set_change_callback(callback); self()->set_down_handler([=](down_msg &msg) { if (msg.source == video_output_actor_) { @@ -173,35 +169,31 @@ OffscreenViewport::OffscreenViewport(const std::string name) : super() { } return r; }, - + [=](video_output_actor_atom, caf::actor video_output_actor, int outputWidth, int outputHeight, viewport::ImageFormat format) { - video_output_actor_ = video_output_actor; - vid_out_width_ = outputWidth; - vid_out_height_ = outputHeight; - vid_out_format_ = format; - + vid_out_width_ = outputWidth; + vid_out_height_ = outputHeight; + vid_out_format_ = format; }, - [=](video_output_actor_atom, - caf::actor video_output_actor) { + [=](video_output_actor_atom, caf::actor video_output_actor) { video_output_actor_ = video_output_actor; }, - [=](render_viewport_to_image_atom) { + [=](render_viewport_to_image_atom) { // force a redraw receive_change_notification(Viewport::ChangeCallbackId::Redraw); } - - }); + + }); }); initGL(); - } OffscreenViewport::~OffscreenViewport() { @@ -216,15 +208,10 @@ OffscreenViewport::~OffscreenViewport() { delete surface_; video_output_actor_ = caf::actor(); - } -void OffscreenViewport::autoDelete() { - - delete this; - -} +void OffscreenViewport::autoDelete() { delete this; } void OffscreenViewport::initGL() { @@ -266,8 +253,8 @@ void OffscreenViewport::initGL() { moveToThread(thread_); thread_->start(); - // Note - the only way I seem to be able to 'cleanly' exit is - // delete ourselves when the thread quits. Not 100% sure if this + // Note - the only way I seem to be able to 'cleanly' exit is + // delete ourselves when the thread quits. Not 100% sure if this // is correct approach. I'm still cratching my head as to how // to destroy thread_ ... calling deleteLater() directly or // using finished signal has no effect. @@ -408,9 +395,10 @@ void OffscreenViewport::exportToCompressedFormat( } } -void OffscreenViewport::setupTextureAndFrameBuffer(const int width, const int height, const viewport::ImageFormat format) { +void OffscreenViewport::setupTextureAndFrameBuffer( + const int width, const int height, const viewport::ImageFormat format) { - if (tex_width_ == width && tex_height_ == height && format == vid_out_format_ ) { + if (tex_width_ == width && tex_height_ == height && format == vid_out_format_) { // bind framebuffer glBindFramebuffer(GL_FRAMEBUFFER, fboId_); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texId_, 0); @@ -425,8 +413,8 @@ void OffscreenViewport::setupTextureAndFrameBuffer(const int width, const int he glDeleteTextures(1, &depth_texId_); } - tex_width_ = width; - tex_height_ = height; + tex_width_ = width; + tex_height_ = height; vid_out_format_ = format; utility::JsonStore j; @@ -448,9 +436,11 @@ void OffscreenViewport::setupTextureAndFrameBuffer(const int width, const int he nullptr); GLint iTexFormat; - glGetTexLevelParameteriv ( GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &iTexFormat); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &iTexFormat); if (iTexFormat != format_to_gl_tex_format[vid_out_format_]) { - spdlog::warn("{} offscreen viewport texture internal format is {:#x}, which does not match desired format {:#x}", + spdlog::warn( + "{} offscreen viewport texture internal format is {:#x}, which does not match " + "desired format {:#x}", __PRETTY_FUNCTION__, iTexFormat, format_to_gl_tex_format[vid_out_format_]); @@ -500,8 +490,10 @@ void OffscreenViewport::setupTextureAndFrameBuffer(const int width, const int he } void OffscreenViewport::renderToImageBuffer( - const int w, const int h, media_reader::ImageBufPtr &image, const viewport::ImageFormat format) -{ + const int w, + const int h, + media_reader::ImageBufPtr &image, + const viewport::ImageFormat format) { auto t0 = utility::clock::now(); // ensure our GLContext is current @@ -519,8 +511,8 @@ void OffscreenViewport::renderToImageBuffer( auto t1 = utility::clock::now(); // Clearup before render, probably useless for a new buffer - //glClearColor(0.0, 1.0, 0.0, 0.0); - //glClear(GL_COLOR_BUFFER_BIT); + // glClearColor(0.0, 1.0, 0.0, 0.0); + // glClear(GL_COLOR_BUFFER_BIT); glViewport(0, 0, w, h); @@ -537,21 +529,21 @@ void OffscreenViewport::renderToImageBuffer( viewport_renderer_->render(); // Not sure if this is necessary - //glFinish(); + // glFinish(); auto t2 = utility::clock::now(); // unbind glBindFramebuffer(GL_FRAMEBUFFER, 0); - size_t pix_buf_size = w*h*format_to_bytes_per_pixel[vid_out_format_]; + size_t pix_buf_size = w * h * format_to_bytes_per_pixel[vid_out_format_]; // init RGBA float array image->allocate(pix_buf_size); image->set_image_dimensions(Imath::V2i(w, h)); - image.when_to_display_ = utility::clock::now(); + image.when_to_display_ = utility::clock::now(); image->params()["pixel_format"] = (int)format; - + if (!pixel_buffer_object_) { glGenBuffers(1, &pixel_buffer_object_); } @@ -571,47 +563,36 @@ void OffscreenViewport::renderToImageBuffer( glPixelStorei(GL_PACK_ALIGNMENT, 1); auto t3 = utility::clock::now(); - + glBindFramebuffer(GL_FRAMEBUFFER, 0); - glGetTexImage(GL_TEXTURE_2D, - 0, - GL_RGBA, - format_to_gl_pixe_type[vid_out_format_], - nullptr); - + glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, format_to_gl_pixe_type[vid_out_format_], nullptr); + glBindBuffer(GL_PIXEL_PACK_BUFFER, pixel_buffer_object_); - void* mappedBuffer = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); + void *mappedBuffer = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); auto t4 = utility::clock::now(); - - threaded_memcpy( - image->buffer(), - mappedBuffer, - pix_buf_size, - 8 - ); + + threaded_memcpy(image->buffer(), mappedBuffer, pix_buf_size, 8); - //now mapped buffer contains the pixel data + // now mapped buffer contains the pixel data glUnmapBuffer(GL_PIXEL_PACK_BUFFER); auto t5 = utility::clock::now(); auto tt = utility::clock::now(); - /*std::cerr << "glBindBuffer " - << std::chrono::duration_cast(t1-t0).count() << " " - << std::chrono::duration_cast(t2-t1).count() << " " + /*std::cerr << "glBindBuffer " + << std::chrono::duration_cast(t1-t0).count() << " " + << std::chrono::duration_cast(t2-t1).count() << " " << std::chrono::duration_cast(t3-t2).count() << " " << std::chrono::duration_cast(t4-t3).count() << " " << std::chrono::duration_cast(t5-t4).count() << " : " << std::chrono::duration_cast(t5-t0).count() << "\n";*/ - } -void OffscreenViewport::receive_change_notification( - Viewport::ChangeCallbackId id) { +void OffscreenViewport::receive_change_notification(Viewport::ChangeCallbackId id) { if (id == Viewport::ChangeCallbackId::Redraw) { diff --git a/src/ui/viewport/src/viewport.cpp b/src/ui/viewport/src/viewport.cpp index 68151da6c..6e9cf8a18 100644 --- a/src/ui/viewport/src/viewport.cpp +++ b/src/ui/viewport/src/viewport.cpp @@ -109,8 +109,10 @@ Viewport::Viewport( ViewportRendererPtr the_renderer, const std::string &_name) : Module( - _name.empty() ? (viewport_index >= 0 ? fmt::format("viewport{0}", viewport_index) - : fmt::format("offscreen_viewport{0}", abs(viewport_index))) : _name), + _name.empty() ? (viewport_index >= 0 + ? fmt::format("viewport{0}", viewport_index) + : fmt::format("offscreen_viewport{0}", abs(viewport_index))) + : _name), parent_actor_(std::move(parent_actor)), viewport_index_(viewport_index), the_renderer_(std::move(the_renderer)) { @@ -168,8 +170,12 @@ Viewport::Viewport( const Imath::V4f delta_trans = interact_start_state_.pointer_position_ - normalised_pointer_position() * interact_start_projection_matrix_; - state_.translate_.x = (state_.mirror_mode_ & MirrorMode::Flip ? -delta_trans.x : delta_trans.x) + interact_start_state_.translate_.x; - state_.translate_.y = (state_.mirror_mode_ & MirrorMode::Flop ? -delta_trans.y : delta_trans.y) + interact_start_state_.translate_.y; + state_.translate_.x = + (state_.mirror_mode_ & MirrorMode::Flip ? -delta_trans.x : delta_trans.x) + + interact_start_state_.translate_.x; + state_.translate_.y = + (state_.mirror_mode_ & MirrorMode::Flop ? -delta_trans.y : delta_trans.y) + + interact_start_state_.translate_.y; update_matrix(); return true; }; @@ -181,8 +187,8 @@ Viewport::Viewport( normalised_pointer_position() * interact_start_projection_matrix_; const float scale_factor = powf( 2.0, - (state_.mirror_mode_ & MirrorMode::Flip ? delta_trans.x : -delta_trans.x) * state_.size_.x * - settings_["pointer_zoom_senistivity"].get() * + (state_.mirror_mode_ & MirrorMode::Flip ? delta_trans.x : -delta_trans.x) * + state_.size_.x * settings_["pointer_zoom_senistivity"].get() * interact_start_state_.scale_ / 1000.0f); state_.scale_ = interact_start_state_.scale_ * scale_factor; const Imath::V4f anchor_before = @@ -558,12 +564,8 @@ bool Viewport::process_pointer_event(PointerEvent &pointer_event) { if (pointer_event_handlers_[pointer_event.signature()](pointer_event)) { // Send message to other_viewport_ and pass zoom/pan - for (auto &o: other_viewports_) { - anon_send( - o, - viewport_pan_atom_v, - state_.translate_.x, - state_.translate_.y); + for (auto &o : other_viewports_) { + anon_send(o, viewport_pan_atom_v, state_.translate_.x, state_.translate_.y); anon_send(o, viewport_scale_atom_v, state_.scale_); } @@ -575,7 +577,7 @@ bool Viewport::process_pointer_event(PointerEvent &pointer_event) { previous_fit_zoom_state_.scale_ = old_scale; state_.fit_mode_ = Free; fit_mode_->set_value("Off"); - for (auto &o: other_viewports_) { + for (auto &o : other_viewports_) { anon_send(o, fit_mode_atom_v, Free); } } @@ -620,7 +622,10 @@ bool Viewport::set_scene_coordinates( if (vp2c != viewport_to_canvas_ || (bottomright - bottomleft).length() != state_.size_.x || (bottomleft - topleft).length() != state_.size_.y) { viewport_to_canvas_ = vp2c; - set_size((bottomright - bottomleft).length(), (bottomleft - topleft).length(), devicePixelRatio); + set_size( + (bottomright - bottomleft).length(), + (bottomleft - topleft).length(), + devicePixelRatio); return true; } return false; @@ -670,10 +675,10 @@ void Viewport::update_fit_mode_matrix( } else if (fit_mode() == One2One && state_.image_size_.x) { - // for 1:1 to work when we have high DPI display scaling (e.g. with QT_SCALE_FACTOR!=1.0) - // we need to account for the pixel ratio - int screen_pix_size_x = (int)round(float(size().x)*devicePixelRatio_); - int screen_pix_size_y = (int)round(float(size().y)*devicePixelRatio_); + // for 1:1 to work when we have high DPI display scaling (e.g. with + // QT_SCALE_FACTOR!=1.0) we need to account for the pixel ratio + int screen_pix_size_x = (int)round(float(size().x) * devicePixelRatio_); + int screen_pix_size_y = (int)round(float(size().y) * devicePixelRatio_); state_.fit_mode_zoom_ = float(state_.image_size_.x) / screen_pix_size_x; @@ -706,7 +711,7 @@ void Viewport::set_scale(const float scale) { } void Viewport::set_size(const float w, const float h, const float devicePixelRatio) { - state_.size_ = Imath::V2f(w, h); + state_.size_ = Imath::V2f(w, h); devicePixelRatio_ = devicePixelRatio; update_matrix(); } @@ -815,7 +820,7 @@ void Viewport::revert_fit_zoom_to_previous(const bool synced) { event_callback_(Redraw); if (state_.fit_mode_ == FitMode::Free && !synced) { - for (auto &o: other_viewports_) { + for (auto &o : other_viewports_) { anon_send(o, fit_mode_atom_v, "revert"); } } @@ -864,8 +869,7 @@ void Viewport::update_matrix() { inv_projection_matrix_.makeIdentity(); inv_projection_matrix_.scale(Imath::V3f(1.0f, -1.0f, 1.0f)); - inv_projection_matrix_.scale( - Imath::V3f(1.0, state_.size_.x / state_.size_.y, 1.0f)); + inv_projection_matrix_.scale(Imath::V3f(1.0, state_.size_.x / state_.size_.y, 1.0f)); inv_projection_matrix_.scale(Imath::V3f(state_.scale_, state_.scale_, state_.scale_)); inv_projection_matrix_.translate( Imath::V3f(-state_.translate_.x, -state_.translate_.y, 0.0f)); @@ -876,8 +880,7 @@ void Viewport::update_matrix() { projection_matrix_.translate(Imath::V3f(state_.translate_.x, state_.translate_.y, 0.0f)); projection_matrix_.scale( Imath::V3f(1.0f / state_.scale_, 1.0f / state_.scale_, 1.0f / state_.scale_)); - projection_matrix_.scale( - Imath::V3f(1.0, state_.size_.y / state_.size_.x, 1.0f)); + projection_matrix_.scale(Imath::V3f(1.0, state_.size_.y / state_.size_.x, 1.0f)); projection_matrix_.scale(Imath::V3f(1.0f, -1.0f, 1.0f)); update_fit_mode_matrix(); @@ -941,7 +944,12 @@ caf::message_handler Viewport::message_handler() { const float devicePixelRatio) { float zoom = pixel_zoom(); if (set_scene_coordinates( - topleft, topright, bottomright, bottomleft, scene_size, devicePixelRatio)) { + topleft, + topright, + bottomright, + bottomleft, + scene_size, + devicePixelRatio)) { if (zoom != pixel_zoom()) { event_callback_(ZoomChanged); } @@ -960,9 +968,7 @@ caf::message_handler Viewport::message_handler() { } }, - [=](other_viewport_atom, - caf::actor other_view, - bool link) { + [=](other_viewport_atom, caf::actor other_view, bool link) { if (link) { auto p = other_viewports_.begin(); @@ -970,7 +976,7 @@ caf::message_handler Viewport::message_handler() { if (*p == other_view) { return; } - p++; + p++; } other_viewports_.push_back(other_view); @@ -987,16 +993,14 @@ caf::message_handler Viewport::message_handler() { } unlink_module(other_view); } - }, [=](other_viewport_atom, caf::actor other_view, caf::actor other_colour_pipeline) { - other_viewports_.push_back(other_view); link_to_module(other_view, true, true, true); - + if (other_colour_pipeline) { // here we link up the colour pipelines of the two viewports anon_send( @@ -1005,8 +1009,9 @@ caf::message_handler Viewport::message_handler() { other_colour_pipeline, false, // link all attrs true, // two way link (change in one is synced to other, both ways) - viewport_index_ == 0 // push sync (if we are main viewport, sync the - // attrs on the other colour pipelin to ourselves) + viewport_index_ == + 0 // push sync (if we are main viewport, sync the + // attrs on the other colour pipelin to ourselves) ); } }, @@ -1087,14 +1092,11 @@ caf::message_handler Viewport::message_handler() { std::string compare_mode) { quickview_media(media_items, compare_mode); }, [=](ui::fps_monitor::framebuffer_swapped_atom, - const utility::time_point swap_time) { - framebuffer_swapped(swap_time); - }, + const utility::time_point swap_time) { framebuffer_swapped(swap_time); }, [=](aux_shader_uniforms_atom, const utility::JsonStore &shader_extras, - const bool overwrite_and_clear) - { + const bool overwrite_and_clear) { set_aux_shader_uniforms(shader_extras, overwrite_and_clear); }, @@ -1387,8 +1389,8 @@ void Viewport::framebuffer_swapped(const utility::time_point swap_time) { screen_refresh_period_, viewport_index_); - static auto tp = utility::clock::now(); - auto t0 = utility::clock::now(); + static auto tp = utility::clock::now(); + auto t0 = utility::clock::now(); if (about_to_go_on_screen_frame_buffer_ != on_screen_frame_buffer_) { @@ -1408,7 +1410,7 @@ void Viewport::framebuffer_swapped(const utility::time_point swap_time) { std::chrono::duration_cast(t0-tp).count() << "\n"; } - + ff[viewport_index_] = f;*/ anon_send( @@ -1421,11 +1423,9 @@ void Viewport::framebuffer_swapped(const utility::time_point swap_time) { /*std::cerr << name() << " frame repeated " << std::chrono::duration_cast(t0-tp).count() << "\n";*/ - } - - tp = t0; + tp = t0; } media_reader::ImageBufPtr Viewport::get_onscreen_image() { @@ -1470,7 +1470,6 @@ void Viewport::get_frames_for_display(std::vector &ne std::chrono::milliseconds(1000), colour_pipeline::colour_operation_uniforms_atom_v, image); - } if (next_images.size()) { @@ -1821,9 +1820,7 @@ void Viewport::auto_connect_to_playhead(bool auto_connect) { } void Viewport::set_aux_shader_uniforms( - const utility::JsonStore & j, - const bool clear_and_overwrite) -{ + const utility::JsonStore &j, const bool clear_and_overwrite) { if (clear_and_overwrite) { aux_shader_uniforms_ = j; } else if (j.is_object()) { @@ -1832,11 +1829,11 @@ void Viewport::set_aux_shader_uniforms( } } else { spdlog::warn( - "{} Invalid shader uniforms data:\n\"{}\".\n\nIt must be a dictionary of key/value pairs.", + "{} Invalid shader uniforms data:\n\"{}\".\n\nIt must be a dictionary of key/value " + "pairs.", __PRETTY_FUNCTION__, j.dump(2)); } the_renderer_->set_aux_shader_uniforms(aux_shader_uniforms_); - } diff --git a/src/ui/viewport/src/viewport_frame_queue_actor.cpp b/src/ui/viewport/src/viewport_frame_queue_actor.cpp index 9fab647d3..17dbe83dd 100644 --- a/src/ui/viewport/src/viewport_frame_queue_actor.cpp +++ b/src/ui/viewport/src/viewport_frame_queue_actor.cpp @@ -458,7 +458,7 @@ timebase::flicks ViewportFrameQueueActor::predicted_playhead_position_at_next_vi if (!playhead_) return timebase::flicks(0); - const timebase::flicks video_refresh_period = compute_video_refresh(); + const timebase::flicks video_refresh_period = compute_video_refresh(); const utility::time_point next_video_refresh_tp = next_video_refresh(video_refresh_period); @@ -502,7 +502,7 @@ timebase::flicks ViewportFrameQueueActor::predicted_playhead_position_at_next_vi timebase::to_seconds(video_refresh_period); if (phase < 0.1 || phase > 0.9) { - + playhead_vid_sync_phase_adjust_ = timebase::flicks( video_refresh_period.count() / 2 - estimate_playhead_position_at_next_redraw.count() + @@ -524,7 +524,6 @@ timebase::flicks ViewportFrameQueueActor::predicted_playhead_position_at_next_vi const double phase = timebase::to_seconds(phase_adjusted_tp - rounded_phase_adjusted_tp) / timebase::to_seconds(video_refresh_period); - } } return rounded_phase_adjusted_tp; @@ -551,9 +550,9 @@ xstudio::utility::time_point ViewportFrameQueueActor::next_video_refresh( } else if (video_refresh_data_.refresh_history_.size() > 64) { - // refresh_history_ is a list of recent timepoints (system steady clock) when we were - // told (utlimately by Qt or graphics driver) that the video frame buffer was swapped. - // We're using this data to predict when the video buffer will be swapped to the + // refresh_history_ is a list of recent timepoints (system steady clock) when we were + // told (utlimately by Qt or graphics driver) that the video frame buffer was swapped. + // We're using this data to predict when the video buffer will be swapped to the // screen NEXT time and therefore pick the correct frame to go up on the screen. // // We might know the video refresh exactly, or we might have been lied to, but either @@ -566,15 +565,15 @@ xstudio::utility::time_point ViewportFrameQueueActor::next_video_refresh( // average cadence of video refresh... const double expected_video_refresh_period = average_video_refresh_period(); - // Here we are essentially fitting a straight line to the video refresh event + // Here we are essentially fitting a straight line to the video refresh event // timepoints - we use the line to predict when the next video refresh is // going to happen. - auto now = utility::clock::now(); - double next_refresh = 0.0; + auto now = utility::clock::now(); + double next_refresh = 0.0; double refresh_event_index = 1.0; - double estimate_count = 0.0; - auto p = video_refresh_data_.refresh_history_.rbegin(); - auto p2 = p; + double estimate_count = 0.0; + auto p = video_refresh_data_.refresh_history_.rbegin(); + auto p2 = p; p2++; while (p2 != video_refresh_data_.refresh_history_.rend()) { @@ -585,9 +584,12 @@ xstudio::utility::time_point ViewportFrameQueueActor::next_video_refresh( // a redraw doesn't happen within the video refresh period. We need to take // account of that when using the timepoints of video refreshes to predict // the next refresh - double n_refreshes_between_events = round(timebase::to_seconds(delta)/expected_video_refresh_period); + double n_refreshes_between_events = + round(timebase::to_seconds(delta) / expected_video_refresh_period); - auto estimate_refresh = timebase::to_seconds(std::chrono::duration_cast(*p-now)) + refresh_event_index*expected_video_refresh_period; + auto estimate_refresh = + timebase::to_seconds(std::chrono::duration_cast(*p - now)) + + refresh_event_index * expected_video_refresh_period; next_refresh += estimate_refresh; estimate_count++; p++; @@ -595,8 +597,9 @@ xstudio::utility::time_point ViewportFrameQueueActor::next_video_refresh( refresh_event_index += n_refreshes_between_events; } - next_refresh *= 1.0/estimate_count; - auto offset = std::chrono::duration_cast(timebase::to_flicks(next_refresh)); + next_refresh *= 1.0 / estimate_count; + auto offset = std::chrono::duration_cast( + timebase::to_flicks(next_refresh)); auto result = now + offset; return result; @@ -633,7 +636,8 @@ timebase::flicks ViewportFrameQueueActor::compute_video_refresh() const { // Here we try to match out measurement with commong video refresh rates: // Assume 24fps is the minimum refresh we'll ever encounter - const int hertz_refresh = std::max(24, int(round(1.0/average_video_refresh_period()))); + const int hertz_refresh = + std::max(24, int(round(1.0 / average_video_refresh_period()))); static const std::vector common_refresh_rates( {24, 25, 30, 48, 60, 75, 90, 120, 144, 240, 360}); @@ -671,6 +675,5 @@ double ViewportFrameQueueActor::average_video_refresh_period() const { t += *(r++); } - return timebase::to_seconds(t)/(double(deltas.size() - 16)); - + return timebase::to_seconds(t) / (double(deltas.size() - 16)); } diff --git a/src/utility/src/chrono.cpp b/src/utility/src/chrono.cpp index 26431e435..2250180c9 100644 --- a/src/utility/src/chrono.cpp +++ b/src/utility/src/chrono.cpp @@ -6,7 +6,7 @@ xstudio::utility::to_sys_time_point(const std::string &datetime) { std::istringstream in{datetime}; sys_time_point tp; #ifdef _WIN32 -//TODO: Ahead to fix +// TODO: Ahead to fix #else in >> date::parse("%Y-%m-%dT%TZ", tp); #endif diff --git a/src/utility/src/frame_list.cpp b/src/utility/src/frame_list.cpp index cb9643027..c9dcee03c 100644 --- a/src/utility/src/frame_list.cpp +++ b/src/utility/src/frame_list.cpp @@ -276,7 +276,7 @@ xstudio::utility::frame_groups_from_sequence_spec(const caf::uri &from_path) { #ifdef _WIN32 auto entryPath = entry.path().string(); // Convert to std::string #else - auto entryPath = entry.path().c_str(); + auto entryPath = entry.path().c_str(); #endif if (std::regex_match(entryPath, m, path_re)) { int frame = std::atoi(m[1].str().c_str()); diff --git a/src/utility/src/helpers.cpp b/src/utility/src/helpers.cpp index c28466394..471d6e333 100644 --- a/src/utility/src/helpers.cpp +++ b/src/utility/src/helpers.cpp @@ -16,8 +16,8 @@ #include -//#include -//#include +// #include +// #include #include "xstudio/utility/frame_list.hpp" #include "xstudio/utility/sequence.hpp" @@ -458,7 +458,7 @@ caf::uri xstudio::utility::posix_path_to_uri(const std::string &path, const bool #ifdef _WIN32 p = (fs::path(*pwd) / path).lexically_normal().string(); else - p = (std::filesystem::current_path() / path).lexically_normal().string(); + p = (std::filesystem::current_path() / path).lexically_normal().string(); #else p = fs::path(fs::path(*pwd) / path).lexically_normal(); else diff --git a/src/utility/src/json_store.cpp b/src/utility/src/json_store.cpp index 9b57fdd7d..8ebe62527 100644 --- a/src/utility/src/json_store.cpp +++ b/src/utility/src/json_store.cpp @@ -11,9 +11,7 @@ JsonStore::JsonStore(nlohmann::json json) : nlohmann::json(std::move(json)) {} // JsonStore::JsonStore(const JsonStore &other) : json_(other) {} -nlohmann::json JsonStore::get(const std::string &path) const { - return at(json_pointer(path)); -} +nlohmann::json JsonStore::get(const std::string &path) const { return at(json_pointer(path)); } void JsonStore::set(const nlohmann::json &json, const std::string &path) { (*this)[json_pointer(path)] = json; diff --git a/src/utility/src/logging.cpp b/src/utility/src/logging.cpp index 9f2a9e6a0..4e8772bb5 100644 --- a/src/utility/src/logging.cpp +++ b/src/utility/src/logging.cpp @@ -27,7 +27,7 @@ void xstudio::utility::start_logger( // sinks.end(), spdlog::thread_pool(), spdlog::async_overflow_policy::block); auto logger = std::make_shared("xstudio", sinks.begin(), sinks.end()); spdlog::set_default_logger(logger); - //spdlog::set_level(spdlog::level::debug); + // spdlog::set_level(spdlog::level::debug); // spdlog::set_error_handler([](const std::string &msg){ // spdlog::warn("{}", msg); diff --git a/src/utility/src/remote_session_file.cpp b/src/utility/src/remote_session_file.cpp index 94758b5bb..20ab3d800 100644 --- a/src/utility/src/remote_session_file.cpp +++ b/src/utility/src/remote_session_file.cpp @@ -111,13 +111,13 @@ fs::path RemoteSessionFile::filepath() const { return p; } -pid_t RemoteSessionFile::get_pid() const { - +pid_t RemoteSessionFile::get_pid() const { + #ifdef _WIN32 - return _getpid(); + return _getpid(); #else - return getpid(); -#endif + return getpid(); +#endif } diff --git a/src/utility/src/sequence.cpp b/src/utility/src/sequence.cpp index 1f36ac08c..53a1f1d75 100644 --- a/src/utility/src/sequence.cpp +++ b/src/utility/src/sequence.cpp @@ -110,7 +110,8 @@ Sequence::Sequence(const Entry &entry) ctim_(entry.stat_.st_ctim.tv_sec), #endif name_(entry.name_), - frames_() {} + frames_() { +} Sequence::Sequence(const std::string name) : name_(std::move(name)), frames_() {} std::string make_frame_sequence(