Skip to content

Commit

Permalink
CI-Build 2022-07-30
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1t3cht committed Jul 30, 2022
2 parents 58d6fa4 + 4b9c50a commit d0c8ffd
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 29 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Go [here](#branchfeature-list) for the new features.

### Don't we have enough Aegisub forks already??
We absolutely do, and I'm aware that adding another one doesn't sound like a good idea on paper. However,
We absolutely do, and I'm aware that adding another one [doesn't sound like a good idea on paper](https://xkcd.com/927/). However,

- None of the existing forks are completely satisfying at the moment:
- [wangqr's fork](https://github.com/wangqr/Aegisub) is actively maintained, but focussing more on stability. It's missing most of the modern features.
Expand All @@ -24,6 +24,7 @@ The `cibuilds` branch makes some CI builds of snapshots of `feature` at relevant
- [`color_picker_fix2`](https://github.com/arch1t3cht/Aegisub/tree/color_picker_fix2): Add an option (under "Interface") to restrict the color picker to the window, which fixes the color picker on Linux in a lot of cases.
- [`avisynth`](https://github.com/arch1t3cht/Aegisub/tree/avisynth): Reenable Avisynth support on Windows (Still occasionally crashes)
- [`bugfixes`](https://github.com/arch1t3cht/Aegisub/tree/bugfixes): Various fixes, mostly relevant for compilation
- [`misc_dc`](https://github.com/arch1t3cht/Aegisub/tree/misc_dc): Miscellaneous changes taken from AegisubDC
- [`video_panning_feature`](https://github.com/arch1t3cht/Aegisub/tree/video_panning_feature): Merge [moex3's video zoom and panning](https://github.com/TypesettingTools/Aegisub/pull/150), with an OSX fix and an option to toggle the behavior of Ctrl+Zoom
- [`spectrum-frequency-mapping`](https://github.com/arch1t3cht/Aegisub/tree/spectrum-frequency-mapping): Merge EleonoreMizo's [spectrum display improvements](https://github.com/TypesettingTools/Aegisub/pull/94), and also make Shift+Scroll vertically zoom the audio display

Expand All @@ -39,6 +40,9 @@ The exact way of switching depends on your Linux distribution, but essentially y
#### I get errors like "Option not found" after merging one of these branches
The changes to `default_config.json` or similar files weren't detected by meson due to missing regen dependencies. You can either merge the `bugfixes` branch or rebuild from scratch.

#### The video is desynced / Frames don't appear at the right time
This is probably due to the ffms2 seeking bug ([#394](https://github.com/FFMS/ffms2/issues/394)). On Windows, this shouldn't happen anymore. On Linux, you need to install the latest git version of ffms2 - for example the [`ffms2-git`](https://aur.archlinux.org/packages/ffms2-git) AUR package on Arch linux, or just compile it yourself.


# Aegisub

Expand Down
25 changes: 14 additions & 11 deletions src/audio_provider_ffmpegsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,20 @@ void FFmpegSourceAudioProvider::LoadAudio(agi::fs::path const& filename) {
throw agi::AudioProviderError("unknown or unsupported sample format");
}

if (channels > 1 || bytes_per_sample != 2) {
std::unique_ptr<FFMS_ResampleOptions, decltype(&FFMS_DestroyResampleOptions)>
opt(FFMS_CreateResampleOptions(AudioSource), FFMS_DestroyResampleOptions);
opt->ChannelLayout = FFMS_CH_FRONT_CENTER;
opt->SampleFormat = FFMS_FMT_S16;

// Might fail if FFMS2 wasn't built with libavresample
if (!FFMS_SetOutputFormatA(AudioSource, opt.get(), nullptr)) {
channels = 1;
bytes_per_sample = 2;
float_samples = false;
if (OPT_GET("Provider/Audio/FFmpegSource/Downmix")->GetBool()) {
if (channels > 2 || bytes_per_sample != 2 || float_samples) {
std::unique_ptr<FFMS_ResampleOptions, decltype(&FFMS_DestroyResampleOptions)>
opt(FFMS_CreateResampleOptions(AudioSource), FFMS_DestroyResampleOptions);
if (channels > 2)
opt->ChannelLayout = FFMS_CH_FRONT_LEFT | FFMS_CH_FRONT_RIGHT;
opt->SampleFormat = FFMS_FMT_S16;

// Might fail if FFMS2 wasn't built with libavresample
if (!FFMS_SetOutputFormatA(AudioSource, opt.get(), nullptr)) {
channels = channels > 2 ? 2 : channels;
bytes_per_sample = 2;
float_samples = false;
}
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions src/command/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,23 @@ struct video_cycle_subtitles_provider final : public cmd::Command {
}
};

struct video_reload_subtitles_provider final : public cmd::Command {
CMD_NAME("video/subtitles_provider/reload")
STR_MENU("Reload active subtitles provider")
STR_DISP("Reload active subtitles provider")
STR_HELP("Reloads the current subtitles provider")

void operator()(agi::Context* c) override {
auto providers = SubtitlesProviderFactory::GetClasses();
if (providers.empty()) return;

auto it = find(begin(providers), end(providers), OPT_GET("Subtitle/Provider")->GetString());

OPT_SET("Subtitle/Provider")->SetString(*it);
c->frame->StatusTimeout(fmt_tl("Subtitles provider set to %s", *it), 5000);
}
};

struct video_detach final : public validator_video_loaded {
CMD_NAME("video/detach")
CMD_ICON(detach_video_menu)
Expand Down Expand Up @@ -757,6 +774,7 @@ namespace cmd {
reg(agi::make_unique<video_close>());
reg(agi::make_unique<video_copy_coordinates>());
reg(agi::make_unique<video_cycle_subtitles_provider>());
reg(agi::make_unique<video_reload_subtitles_provider>());
reg(agi::make_unique<video_detach>());
reg(agi::make_unique<video_details>());
reg(agi::make_unique<video_focus_seek>());
Expand Down
3 changes: 2 additions & 1 deletion src/libresrc/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@
"Sample Rate" : 0
},
"FFmpegSource" : {
"Decode Error Handling" : "ignore"
"Decode Error Handling" : "ignore",
"Downmix" : false
}
},
"Avisynth" : {
Expand Down
2 changes: 2 additions & 0 deletions src/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ void Advanced_Audio(wxTreebook *book, Preferences *parent) {
p->OptionChoice(ffms, _("Audio indexing error handling mode"), error_modes_choice, "Provider/Audio/FFmpegSource/Decode Error Handling");

p->OptionAdd(ffms, _("Always index all audio tracks"), "Provider/FFmpegSource/Index All Tracks");
wxControl* stereo = p->OptionAdd(ffms, _("Downmix to stereo"), "Provider/Audio/FFmpegSource/Downmix");
stereo->SetToolTip("Reduces memory usage on surround audio, but may cause audio tracks to sound blank in specific circumstances. This will not affect audio with two channels or less.");
#endif

#ifdef WITH_PORTAUDIO
Expand Down
1 change: 1 addition & 0 deletions src/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Project::Project(agi::Context *c) : context(c) {
OPT_SUB("Audio/Cache/Type", &Project::ReloadAudio, this);
OPT_SUB("Audio/Provider", &Project::ReloadAudio, this);
OPT_SUB("Provider/Audio/FFmpegSource/Decode Error Handling", &Project::ReloadAudio, this);
OPT_SUB("Provider/Audio/FFmpegSource/Downmix", &Project::ReloadAudio, this);
OPT_SUB("Provider/Avisynth/Memory Max", &Project::ReloadVideo, this);
OPT_SUB("Provider/Video/FFmpegSource/Decoding Threads", &Project::ReloadVideo, this);
OPT_SUB("Provider/Video/FFmpegSource/Unsafe Seeking", &Project::ReloadVideo, this);
Expand Down
10 changes: 5 additions & 5 deletions src/spline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,25 @@ std::string Spline::EncodeToAss() const {
result += "m ";
last = 'm';
}
result += ToScript(pt.p1).DStr(' ');
result += ToScript(pt.p1).Str(' ');
break;

case SplineCurve::LINE:
if (last != 'l') {
result += "l ";
last = 'l';
}
result += ToScript(pt.p2).DStr(' ');
result += ToScript(pt.p2).Str(' ');
break;

case SplineCurve::BICUBIC:
if (last != 'b') {
result += "b ";
last = 'b';
}
result += ToScript(pt.p2).DStr(' ') + " ";
result += ToScript(pt.p3).DStr(' ') + " ";
result += ToScript(pt.p4).DStr(' ');
result += ToScript(pt.p2).Str(' ') + " ";
result += ToScript(pt.p3).Str(' ') + " ";
result += ToScript(pt.p4).Str(' ');
break;

default: break;
Expand Down
2 changes: 1 addition & 1 deletion src/subs_edit_ctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void SubsTextEditCtrl::SetStyles() {

void SubsTextEditCtrl::UpdateStyle() {
AssDialogue *diag = context ? context->selectionController->GetActiveLine() : nullptr;
bool template_line = diag && diag->Comment && boost::istarts_with(diag->Effect.get(), "template");
bool template_line = diag && diag->Comment && (boost::istarts_with(diag->Effect.get(), "template") || boost::istarts_with(diag->Effect.get(), "mixin"));

tokenized_line = agi::ass::TokenizeDialogueBody(line_text, template_line);
agi::ass::SplitWords(line_text, tokenized_line);
Expand Down
5 changes: 3 additions & 2 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ wxString PrettySize(int bytes) {
return agi::wxformat(fmt, size) + " " + suffix[i];
}

std::string float_to_string(double val) {
std::string s = agi::format("%.3f", val);
std::string float_to_string(double val, int precision) {
std::string fmt = "%." + std::to_string(precision) + "f";
std::string s = agi::format(fmt, val);
size_t pos = s.find_last_not_of("0");
if (pos != s.find(".")) ++pos;
s.erase(begin(s) + pos, end(s));
Expand Down
2 changes: 1 addition & 1 deletion src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class wxWindow;

wxString PrettySize(int bytes);

std::string float_to_string(double val);
std::string float_to_string(double val, int precision = 3);

/// @brief Get the smallest power of two that is greater or equal to x
///
Expand Down
2 changes: 1 addition & 1 deletion src/vector2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ std::string Vector2D::DStr(char sep) const {
}

std::string Vector2D::Str(char sep) const {
return float_to_string(x) + sep + float_to_string(y);
return float_to_string(x,2) + sep + float_to_string(y,2);
}
10 changes: 5 additions & 5 deletions src/visual_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,11 @@ std::string VisualToolBase::GetLineVectorClip(AssDialogue *diag, int &scale, boo
tag = find_tag(blocks, "\\clip");

if (tag && tag->size() == 4) {
return agi::format("m %d %d l %d %d %d %d %d %d"
, (*tag)[0].Get<int>(), (*tag)[1].Get<int>()
, (*tag)[2].Get<int>(), (*tag)[1].Get<int>()
, (*tag)[2].Get<int>(), (*tag)[3].Get<int>()
, (*tag)[0].Get<int>(), (*tag)[3].Get<int>());
return agi::format("m %.2f %.2f l %.2f %.2f %.2f %.2f %.2f %.2f"
, (*tag)[0].Get<double>(), (*tag)[1].Get<double>()
, (*tag)[2].Get<double>(), (*tag)[1].Get<double>()
, (*tag)[2].Get<double>(), (*tag)[3].Get<double>()
, (*tag)[0].Get<double>(), (*tag)[3].Get<double>());
}
if (tag) {
scale = std::max((*tag)[0].Get(scale), 1);
Expand Down
2 changes: 1 addition & 1 deletion src/visual_tool_vector_clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void VisualToolVectorClip::SetToolbar(wxToolBar *toolBar) {
toolBar->Realize();
toolBar->Show(true);
toolBar->Bind(wxEVT_TOOL, [=](wxCommandEvent& e) { SetMode((VisualToolVectorClipMode) (e.GetId() - BUTTON_ID_BASE)); });
SetMode(VCLIP_DRAG);
SetMode(VCLIP_LINE);
#undef ICON
}

Expand Down

0 comments on commit d0c8ffd

Please sign in to comment.