Add commands to reload audio or video

This is mostly useful for reloading Avisyth or VapourSynth scripts.
This commit is contained in:
arch1t3cht 2022-08-23 19:53:40 +02:00
parent c8d4df1355
commit c7c874acc4
3 changed files with 26 additions and 2 deletions

View file

@ -128,6 +128,17 @@ struct audio_open_video final : public Command {
}
};
struct audio_reload final : public Command {
CMD_NAME("audio/reload")
STR_MENU("Reload Audio")
STR_DISP("Reload Audio")
STR_HELP("Reload the current audio file")
void operator()(agi::Context *c) override {
c->project->ReloadAudio();
}
};
struct audio_view_spectrum final : public Command {
CMD_NAME("audio/view/spectrum")
STR_MENU("&Spectrum Display")
@ -549,6 +560,7 @@ namespace cmd {
reg(agi::make_unique<audio_open_blank>());
reg(agi::make_unique<audio_open_noise>());
reg(agi::make_unique<audio_open_video>());
reg(agi::make_unique<audio_reload>());
reg(agi::make_unique<audio_play_after>());
reg(agi::make_unique<audio_play_before>());
reg(agi::make_unique<audio_play_begin>());

View file

@ -612,6 +612,17 @@ struct video_open_dummy final : public Command {
}
};
struct video_reload final : public Command {
CMD_NAME("video/reload")
STR_MENU("Reload Video")
STR_DISP("Reload Video")
STR_HELP("Reload the current video file")
void operator()(agi::Context *c) override {
c->project->ReloadVideo();
}
};
struct video_opt_autoscroll final : public Command {
CMD_NAME("video/opt/autoscroll")
CMD_ICON(toggle_video_autoscroll)
@ -794,6 +805,7 @@ namespace cmd {
reg(agi::make_unique<video_jump_start>());
reg(agi::make_unique<video_open>());
reg(agi::make_unique<video_open_dummy>());
reg(agi::make_unique<video_reload>());
reg(agi::make_unique<video_opt_autoscroll>());
reg(agi::make_unique<video_play>());
reg(agi::make_unique<video_play_line>());

View file

@ -60,8 +60,6 @@ class Project {
void LoadUnloadFiles(ProjectProperties properties);
void UpdateRelativePaths();
void ReloadAudio();
void ReloadVideo();
void SetPath(agi::fs::path& var, const char *token, const char *mru, agi::fs::path const& value);
@ -74,11 +72,13 @@ public:
bool CanLoadSubtitlesFromVideo() const { return video_has_subtitles; }
void LoadAudio(agi::fs::path path);
void ReloadAudio();
void CloseAudio();
agi::AudioProvider *AudioProvider() const { return audio_provider.get(); }
agi::fs::path const& AudioName() const { return audio_file; }
void LoadVideo(agi::fs::path path);
void ReloadVideo();
void CloseVideo();
AsyncVideoProvider *VideoProvider() const { return video_provider.get(); }
agi::fs::path const& VideoName() const { return video_file; }