Skip to content

Commit

Permalink
Sync to DNEG internal repo
Browse files Browse the repository at this point in the history
  • Loading branch information
tedwaine committed Jan 13, 2025
1 parent 0407e17 commit 4ddc9df
Show file tree
Hide file tree
Showing 362 changed files with 10,504 additions and 6,247 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ if(INSTALL_XSTUDIO)
add_subdirectory(share/fonts)

if(BUILD_DOCS)
add_subdirectory(docs)
#add_subdirectory(docs)
else()
install(DIRECTORY share/docs/ DESTINATION share/xstudio/docs)
endif ()
Expand Down
1 change: 1 addition & 0 deletions cmake/macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ macro(default_compile_options name)
PRIVATE $<$<PLATFORM_ID:Linux>:-Wfatal-errors> # Stop after first error
PRIVATE $<$<AND:$<CONFIG:Debug>,$<PLATFORM_ID:Linux>>:-Wpedantic>
PRIVATE $<$<AND:$<CONFIG:Debug>,$<PLATFORM_ID:Windows>>:/wd4100>
PRIVATE $<$<PLATFORM_ID:Windows>:/bigobj>
# PRIVATE $<$<CONFIG:Debug>:-Wall>
# PRIVATE $<$<CONFIG:Debug>:-Werror>
# PRIVATE $<$<CONFIG:Debug>:-Wextra>
Expand Down
34 changes: 22 additions & 12 deletions include/xstudio/atoms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ namespace media {
class MediaKey;
class AVFrameID;
class StreamDetail;
typedef std::shared_ptr<const std::map<timebase::flicks, std::shared_ptr<const AVFrameID>>> FrameTimeMapPtr;
typedef std::shared_ptr<const std::map<timebase::flicks, std::shared_ptr<const AVFrameID>>>
FrameTimeMapPtr;
typedef std::vector<std::pair<utility::time_point, std::shared_ptr<const AVFrameID>>>
AVFrameIDsAndTimePoints;
typedef std::vector<std::shared_ptr<const AVFrameID>> AVFrameIDs;
Expand All @@ -113,7 +114,7 @@ namespace media_reader {
class ImageBufDisplaySet;
class ImageSetLayoutData;
typedef std::shared_ptr<const ImageBufDisplaySet> ImageBufDisplaySetPtr;
typedef std::shared_ptr<const ImageSetLayoutData> ImageSetLayoutDataPtr;
typedef std::shared_ptr<const ImageSetLayoutData> ImageSetLayoutDataPtr;
class MediaReaderManager;
class PixelInfo;
} // namespace media_reader
Expand Down Expand Up @@ -218,7 +219,7 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_simple_types, FIRST_CUSTOM_ID)
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media::AVFrameID))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media::AVFrameIDs))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media::AVFrameIDsAndTimePoints))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media::FrameTimeMapPtr))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media::FrameTimeMapPtr))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media::media_error))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media::MediaDetail))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media::MediaKey))
Expand All @@ -228,12 +229,12 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_simple_types, FIRST_CUSTOM_ID)
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media_metadata::MMCertainty))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media_reader::AudioBufPtr))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media_reader::ImageBufPtr))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media_reader::ImageBufDisplaySetPtr))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media_reader::ImageSetLayoutDataPtr))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media_reader::ImageBufDisplaySetPtr))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media_reader::ImageSetLayoutDataPtr))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media_reader::MRCertainty))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::media_reader::PixelInfo))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::playhead::AssemblyMode))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::playhead::AutoAlignMode))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::playhead::AutoAlignMode))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::playhead::LoopMode))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::playhead::OverflowMode))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::plugin_manager::PluginDetail))
Expand All @@ -253,8 +254,8 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_simple_types, FIRST_CUSTOM_ID)
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::ui::viewport::FitMode))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::ui::viewport::MirrorMode))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::ui::viewport::GPUShaderPtr))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::ui::viewport::GraphicsAPI))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::ui::viewport::ViewportRendererPtr))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::ui::viewport::GraphicsAPI))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::ui::viewport::ViewportRendererPtr))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::utility::absolute_receive_timeout))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::utility::ContainerDetail))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::utility::CopyResult))
Expand All @@ -276,6 +277,8 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_simple_types, FIRST_CUSTOM_ID)
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::utility::NotificationType))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::utility::Notification))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::playhead::SelectionMode))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::timeline::ItemType))
CAF_ADD_TYPE_ID(xstudio_simple_types, (xstudio::utility::ColourTriplet))

CAF_END_TYPE_ID_BLOCK(xstudio_simple_types)

Expand Down Expand Up @@ -377,6 +380,11 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_complex_types, FIRST_CUSTOM_ID + 200)
CAF_ADD_TYPE_ID(xstudio_complex_types, (std::pair<xstudio::playhead::AutoAlignMode, xstudio::playhead::AssemblyMode>))
CAF_ADD_TYPE_ID(xstudio_complex_types, (std::pair<float, std::vector<Imath::M44f>>))

CAF_ADD_TYPE_ID(xstudio_complex_types, (std::vector<std::optional<std::pair<xstudio::timeline::Item, xstudio::utility::FrameRate>>>))

CAF_ADD_TYPE_ID(xstudio_complex_types, (std::vector<xstudio::utility::Notification>))


CAF_END_TYPE_ID_BLOCK(xstudio_complex_types)

CAF_BEGIN_TYPE_ID_BLOCK(xstudio_framework_atoms, FIRST_CUSTOM_ID + (200 * 2))
Expand All @@ -389,7 +397,6 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_framework_atoms, FIRST_CUSTOM_ID + (200 * 2))
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::global, create_studio_atom)
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::global, exit_atom)
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::global, get_actor_from_registry_atom)
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::global, get_api_mode_atom)
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::global, get_application_mode_atom)
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::global, get_global_audio_cache_atom)
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::global, get_global_image_cache_atom)
Expand Down Expand Up @@ -442,9 +449,6 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_framework_atoms, FIRST_CUSTOM_ID + (200 * 2))
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::module, release_ui_focus_atom)
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::module, update_attribute_in_preferences_atom)

CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::sync, authorise_connection_atom)
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::sync, get_sync_atom)
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::sync, request_connection_atom)
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::thumbnail, cache_path_atom)
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::thumbnail, cache_stats_atom)
CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::utility, change_atom)
Expand Down Expand Up @@ -473,6 +477,8 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_framework_atoms, FIRST_CUSTOM_ID + (200 * 2))

CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::utility, notification_atom)

CAF_ADD_ATOM(xstudio_framework_atoms, xstudio::global, authenticate_atom)

CAF_END_TYPE_ID_BLOCK(xstudio_framework_atoms)


Expand Down Expand Up @@ -666,6 +672,8 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_session_atoms, FIRST_CUSTOM_ID + (200 * 4))
CAF_ADD_ATOM(xstudio_session_atoms, xstudio::playlist, expanded_atom)

CAF_ADD_ATOM(xstudio_session_atoms, xstudio::media, current_media_atom)
CAF_ADD_ATOM(xstudio_session_atoms, xstudio::timeline, item_selection_atom)
CAF_ADD_ATOM(xstudio_session_atoms, xstudio::timeline, item_type_atom)

CAF_END_TYPE_ID_BLOCK(xstudio_session_atoms)

Expand All @@ -675,6 +683,7 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_playback_atoms, FIRST_CUSTOM_ID + (200 * 5))
CAF_ADD_ATOM(xstudio_playback_atoms, xstudio::audio, get_samples_for_soundcard_atom)
CAF_ADD_ATOM(xstudio_playback_atoms, xstudio::audio, push_samples_atom)
CAF_ADD_ATOM(xstudio_playback_atoms, xstudio::audio, set_override_volume_atom)
CAF_ADD_ATOM(xstudio_playback_atoms, xstudio::audio, audio_samples_atom)
CAF_ADD_ATOM(xstudio_playback_atoms, xstudio::colour_pipeline, colour_operation_uniforms_atom)
CAF_ADD_ATOM(xstudio_playback_atoms, xstudio::colour_pipeline, colour_pipeline_atom)
CAF_ADD_ATOM(xstudio_playback_atoms, xstudio::colour_pipeline, connect_to_viewport_atom)
Expand Down Expand Up @@ -792,6 +801,7 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_ui_atoms, FIRST_CUSTOM_ID + (200 * 6))
CAF_ADD_ATOM(xstudio_ui_atoms, xstudio::ui::keypress_monitor, register_hotkey_atom)
CAF_ADD_ATOM(xstudio_ui_atoms, xstudio::ui::keypress_monitor, skipped_mouse_event_atom)
CAF_ADD_ATOM(xstudio_ui_atoms, xstudio::ui::keypress_monitor, text_entry_atom)
CAF_ADD_ATOM(xstudio_ui_atoms, xstudio::ui::keypress_monitor, watch_hotkey_atom)
CAF_ADD_ATOM(xstudio_ui_atoms, xstudio::ui::model_data, insert_or_update_menu_node_atom)
CAF_ADD_ATOM(xstudio_ui_atoms, xstudio::ui::model_data, insert_rows_atom)
CAF_ADD_ATOM(xstudio_ui_atoms, xstudio::ui::model_data, menu_node_activated_atom)
Expand Down
26 changes: 20 additions & 6 deletions include/xstudio/audio/audio_output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,19 @@ class AudioOutputControl {
* audio frames.
*
*/
void prepare_samples_for_soundcard(
void prepare_samples_for_soundcard_playback(
std::vector<int16_t> &samples,
const long num_samps_to_push,
const long microseconds_delay,
const int num_channels,
const int sample_rate);

/**
* @brief Pick audio samples based on the current playhead position to sound
* audio during timeline scrubbing.
*
*/
void prepare_samples_for_soundcard_scrubbing(
std::vector<int16_t> &samples,
const long num_samps_to_push,
const long microseconds_delay,
Expand All @@ -54,13 +66,13 @@ class AudioOutputControl {
/**
* @brief Queue audio buffer for streaming to the soundcard
*/
void queue_samples_for_playing(
const std::vector<media_reader::AudioBufPtr> &audio_buffers);
void queue_samples_for_playing(const std::vector<media_reader::AudioBufPtr> &audio_buffers);

/**
* @brief Fine grained update of playhead position
*/
void playhead_position_changed(const timebase::flicks playhead_position,
void playhead_position_changed(
const timebase::flicks playhead_position,
const bool forward,
const float velocity,
const bool playing,
Expand Down Expand Up @@ -92,7 +104,7 @@ class AudioOutputControl {
override_volume_ = override_volume;
}

private:
protected:
media_reader::AudioBufPtr
pick_audio_buffer(const utility::clock::time_point &tp, const bool drop_old_buffers);

Expand All @@ -104,14 +116,16 @@ class AudioOutputControl {
std::map<timebase::flicks, media_reader::AudioBufPtr> sample_data_;
media_reader::AudioBufPtr current_buf_;
media_reader::AudioBufPtr previous_buf_;
media_reader::AudioBufPtr next_buf_;
long current_buf_pos_;
float playback_velocity_ = {1.0f};

int fade_in_out_ = {NoFade};

timebase::flicks playhead_position_;
bool playing_forward_ = {true};
bool playing_forward_ = {true};
utility::time_point playhead_position_update_tp_;
timebase::flicks last_buffer_pts_;

bool audio_repitch_ = {false};
bool audio_scrubbing_ = {false};
Expand Down
32 changes: 24 additions & 8 deletions include/xstudio/audio/audio_output_actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,17 @@ class AudioOutputDeviceActor : public caf::event_based_actor {
// we get this message every time the AudioOutputActor has
// received samples to play.
// connect to the sound output device if necessary
if (output_device_)
output_device_->connect_to_soundcard();
if (output_device_) {
try {
output_device_->connect_to_soundcard();
} catch (std::exception &err) {
spdlog::critical("Failed to connect to audio device: {}", err.what());
output_device_.reset();
return;
}
} else {
return;
}

if (!waiting_for_samples_) {
// start playback loop
Expand All @@ -77,7 +86,6 @@ class AudioOutputDeviceActor : public caf::event_based_actor {
}
},
[=](push_samples_atom) {

if (!output_device_)
return;

Expand All @@ -100,10 +108,10 @@ class AudioOutputDeviceActor : public caf::event_based_actor {
// essentially we have two loops running within the single actor.
if (waiting_for_samples_)
return;
waiting_for_samples_ = true;
waiting_for_samples_ = true;
const long num_samps_soundcard_wants = (long)output_device_->desired_samples();

auto tt = utility::clock::now();
auto tt = utility::clock::now();
request(
audio_samples_actor_,
infinite,
Expand Down Expand Up @@ -152,8 +160,13 @@ class AudioOutputDeviceActor : public caf::event_based_actor {
class AudioOutputActor : public caf::event_based_actor, AudioOutputControl {

public:
AudioOutputActor(caf::actor_config &cfg, std::shared_ptr<AudioOutputDevice> output_device)
: caf::event_based_actor(cfg), output_device_(output_device) {
AudioOutputActor(
caf::actor_config &cfg,
std::shared_ptr<AudioOutputDevice> output_device,
bool subscribe_to_global_audio_stream = true)
: caf::event_based_actor(cfg),
output_device_(output_device),
is_global_(subscribe_to_global_audio_stream) {
init();
}

Expand All @@ -170,13 +183,13 @@ class AudioOutputActor : public caf::event_based_actor, AudioOutputControl {

caf::behavior behavior_;
const utility::JsonStore params_;
bool playing_ = {false};
int video_frame_ = {0};
int retry_on_error_ = {0};
utility::Uuid uuid_ = {utility::Uuid::generate()};
utility::Uuid sub_playhead_uuid_;
std::shared_ptr<AudioOutputDevice> output_device_;
caf::actor playhead_;
bool is_global_;
};

/* Singleton class that receives audio sample buffers from the current
Expand All @@ -203,13 +216,16 @@ class GlobalAudioOutputActor : public caf::event_based_actor, module::Module {


private:
caf::actor independent_output(const utility::Uuid &playhead_uuid);

caf::actor event_group_;
caf::message_handler behavior_;
module::BooleanAttribute *audio_repitch_;
module::BooleanAttribute *audio_scrubbing_;
module::FloatAttribute *volume_;
module::BooleanAttribute *muted_;
utility::Uuid mute_hotkey_;
std::map<utility::Uuid, caf::actor> independent_outputs_;
};

} // namespace xstudio::audio
5 changes: 5 additions & 0 deletions include/xstudio/bookmark/bookmark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ namespace bookmark {
}
utility::Uuid bookmark_uuid_;

virtual size_t hash() const { return 0; }

private:
utility::JsonStore store_;
};
Expand Down Expand Up @@ -104,6 +106,7 @@ namespace bookmark {

std::optional<bool> has_note_;
std::optional<bool> has_annotation_;
std::optional<size_t> annotation_hash_;

std::optional<utility::MediaReference> media_reference_;
std::optional<std::string> media_flag_;
Expand All @@ -124,6 +127,7 @@ namespace bookmark {
f.field("utp", x.user_type_),
f.field("udt", x.user_data_),
f.field("hasa", x.has_annotation_),
f.field("anh", x.annotation_hash_),
f.field("hasn", x.has_note_),
f.field("aut", x.author_),
f.field("cat", x.category_),
Expand Down Expand Up @@ -288,6 +292,7 @@ namespace bookmark {

auto has_note() const { return static_cast<bool>(note_); }
auto has_annotation() const { return static_cast<bool>(annotation_); }
size_t annotation_hash() const { return annotation_ ? annotation_->hash() : 0; }

void create_note();
void create_annotation();
Expand Down
16 changes: 9 additions & 7 deletions include/xstudio/colour_pipeline/colour_pipeline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ namespace colour_pipeline {
std::any user_data_;

void set_cache_id(const std::string &id) { cache_id_ = id; }
[[nodiscard]] const std::string & cache_id() const { return cache_id_; }
[[nodiscard]] const std::string &cache_id() const { return cache_id_; }

private:
private:
std::string cache_id_;

};

typedef std::shared_ptr<ColourOperationData> ColourOperationDataPtr;
Expand Down Expand Up @@ -92,10 +91,9 @@ namespace colour_pipeline {
}

void set_cache_id(const std::string &id) { cache_id_ = id; }
[[nodiscard]] const std::string & cache_id() const { return cache_id_; }
[[nodiscard]] const std::string &cache_id() const { return cache_id_; }

private:

std::string cache_id_;

/*Apply grades and other colour manipulations after stage_zero_operation_*/
Expand Down Expand Up @@ -217,7 +215,9 @@ namespace colour_pipeline {
virtual size_t fast_display_transform_hash(const media::AVFrameID &media_ptr) = 0;

protected:
void make_pre_draw_gpu_hook(caf::typed_response_promise<plugin::GPUPreDrawHookPtr> rp);
void make_pre_draw_gpu_hook(
const std::string &viewport_name,
caf::typed_response_promise<plugin::GPUPreDrawHookPtr> rp);

void attribute_changed(const utility::Uuid &attr_uuid, const int role) override;

Expand Down Expand Up @@ -268,7 +268,9 @@ namespace colour_pipeline {
bool colour_ops_loaded_ = false;

std::vector<caf::actor> colour_op_plugins_;
std::vector<caf::typed_response_promise<plugin::GPUPreDrawHookPtr>> hook_requests_;
std::vector<
std::pair<std::string, caf::typed_response_promise<plugin::GPUPreDrawHookPtr>>>
hook_requests_;
};

} // namespace colour_pipeline
Expand Down
1 change: 1 addition & 0 deletions include/xstudio/conform/conform_manager_actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class ConformWorkerActor : public caf::event_based_actor {
inline static const std::string NAME = "ConformWorkerActor";
caf::behavior behavior_;
std::vector<caf::actor> conformers_;
bool initialised_{false};
};

class ConformManagerActor : public caf::event_based_actor, public module::Module {
Expand Down
Loading

0 comments on commit 4ddc9df

Please sign in to comment.