Skip to content

Commit

Permalink
CI-Build 2022-11-02
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1t3cht committed Nov 2, 2022
2 parents 2317062 + 9d4a67b commit 277d1e1
Show file tree
Hide file tree
Showing 17 changed files with 259 additions and 46 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ We absolutely do, and I'm aware that adding another one [doesn't sound like](htt
- [AegisubDC](https://github.com/Ristellise/AegisubDC) has the most modern features (in particular video-panning), but is Windows-only and not actively maintained anymore.
- [The TypesettingTools fork](https://github.com/TypesettingTools/Aegisub) is the one that will one day become the upstream version and builds relatively effortlessly on all operating systems, but at the moment it's not moving much. It's the base for this fork, and I hope to one day merge most of these additions into it.
- Only PR'ing the changes in here to various forks would cause even more chaos
- I try to convince myself that this isn't really a "fork" in the traditional sense - one which aims to provide extended support and stability fixes. It's a collection of new feature additions which I built myself, together with some of the most important new features floating around other forks.
- ~~I try to convince myself that this isn't really a "fork" in the traditional sense - one which aims to provide extended support and stability fixes. It's a collection of new feature additions which I built myself, together with some of the most important new features floating around other forks.~~ At this point it's probably too late to still be saying this. Still, the general mission hasn't changed. This fork collects new features and critical bugfixes, but won't be putting extra time into maintenance aspects like cleanup and refactors. Partly, this is also because any big refactors would make it harder to pull these changes into upstream repositories or future forks.

While this is usually also the version of Aegisub I'm currently using, I make absolutely no promises on stability. **Don't** use this version if you're just looking for any version of Aegisub - this is mostly intended for typesetting and other advanced usage.
While this is usually also the version of Aegisub I'm currently using, I make no promises on stability. **Don't** use this version if you're just looking for any version of Aegisub - this is mostly intended for typesetting and other advanced usage.

### Organization
Being a collection of different feature additions, this repository consists of a set of branches for different features, so that they can easily be merged into other repositories. The [`feature`](https://github.com/arch1t3cht/Aegisub/tree/feature) branch merges together all the features I deem as currently usable. Due to the structure of the repository, I will be force-pushing to this branch and some of the individual branches very frequently, so they're not ideal for basing further branches on.
Expand All @@ -31,10 +31,11 @@ This list is for navigating the repository. Go to the [release page](https://git
- [`workarounds`](https://github.com/arch1t3cht/Aegisub/tree/workarounds): Same as `bugfixes`, but these are hacky fixes that probably shouldn't be pulled without more work.
- [`fixes`](https://github.com/arch1t3cht/Aegisub/tree/fixes): Miscellaneous bugfixes
- [`misc`](https://github.com/arch1t3cht/Aegisub/tree/misc): Other miscellaneous additions
- [`wangqr_gui`](https://github.com/arch1t3cht/Aegisub/tree/wangqr_gui): Merge wangqr's changes regarding the GUI. In particular, add high-DPI compatibility.
- [`misc_dc`](https://github.com/arch1t3cht/Aegisub/tree/misc_dc): Miscellaneous changes taken from AegisubDC
- [`xa2-ds`](https://github.com/arch1t3cht/Aegisub/tree/xa2-ds): Add XAudio2 backend and allow stereo playback for some other backends, by wangqr and Shinon.
- [`stereo`](https://github.com/arch1t3cht/Aegisub/tree/stereo): Add multi-channel support for the other audio backends where possible.
- [`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 more options to control zoom behavior
- [`video_panning_option`](https://github.com/arch1t3cht/Aegisub/tree/video_panning_option): Merge [moex3's video zoom and panning](https://github.com/TypesettingTools/Aegisub/pull/150), with several bugfixes and more options to control zoom behavior
- [`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
- [`wangqr_time_video`](https://github.com/arch1t3cht/Aegisub/tree/wangqr_time_video): Merge wangqr's feature adding a tool for timing subtitles to changes in the video

Expand Down Expand Up @@ -64,11 +65,13 @@ If you're compiling yourself, try adding `--force-fallback-for=zlib` to the meso
### Compilation
For compilation on Windows, see the TSTools documentation below. Also check the [GitHub workflow](https://github.com/arch1t3cht/Aegisub/blob/cibuilds/.github/workflows/ci.yml) for the project arguments.

On Linux, you can use the [TSTools PKGBUILD](https://aur.archlinux.org/packages/aegisub-ttools-meson-git) as a base, in particular for installing the necessary dependencies if you don't want to compile them yourself.
To compile manually,
- Install Meson (at the moment, you'll need to downgrade Meson below 0.63.0: `pip install meson==0.62.2`)
On Arch Linux, there is an AUR package called [aegisub-arch1t3cht-git](https://aur.archlinux.org/packages/aegisub-arch1t3cht-git). It's not maintained by me but seems to work.

On other distributions or for manual compilation you can use this package or the [TSTools PKGBUILD](https://aur.archlinux.org/packages/aegisub-ttools-meson-git) as a reference, in particular for installing the necessary dependencies if you don't want to compile them yourself.
If all dependencies are installed:
- Install Meson
- Clone the repository
- In the repository, run `meson setup build` for the default configuration. See below for further options.
- In the repository, run `meson setup build --buildtype=release` for the default configuration. See below for further options.
- `cd` to the `build` directory and run `ninja`
- You'll get an `aegisub` binary in the `build` folder. To install it to a system-wide location, run `ninja install`. To install to `/usr` instead of `/usr/local`, pass `--prefix=/usr` when configuring or reconfiguring meson.
- When recompiling after pulling new commits, skip the `meson setup` setup and just immediately run `ninja` from the build directory - even when the build configuration changed.
Expand Down
115 changes: 112 additions & 3 deletions libaegisub/ass/dialogue_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ class SyntaxHighlighter {
case dt::ERROR: SetStyling(tok.length, ss::ERROR); break;
case dt::ARG: SetStyling(tok.length, ss::PARAMETER); break;
case dt::COMMENT: SetStyling(tok.length, ss::COMMENT); break;
case dt::DRAWING: SetStyling(tok.length, ss::DRAWING); break;
case dt::DRAWING_CMD:SetStyling(tok.length, ss::DRAWING_CMD);break;
case dt::DRAWING_X: SetStyling(tok.length, ss::DRAWING_X); break;
case dt::DRAWING_Y: SetStyling(tok.length, ss::DRAWING_Y); break;
case dt::DRAWING_ENDPOINT_X: SetStyling(tok.length, ss::DRAWING_ENDPOINT_X); break;
case dt::DRAWING_ENDPOINT_Y: SetStyling(tok.length, ss::DRAWING_ENDPOINT_Y); break;
case dt::TEXT: SetStyling(tok.length, ss::NORMAL); break;
case dt::TAG_NAME: SetStyling(tok.length, ss::TAG); break;
case dt::OPEN_PAREN: case dt::CLOSE_PAREN: case dt::ARG_SEP: case dt::TAG_START:
Expand All @@ -72,6 +76,8 @@ class SyntaxHighlighter {
case dt::WHITESPACE:
if (ranges.size() && ranges.back().type == ss::PARAMETER)
SetStyling(tok.length, ss::PARAMETER);
else if (ranges.size() && ranges.back().type == ss::DRAWING_ENDPOINT_X)
SetStyling(tok.length, ss::DRAWING_ENDPOINT_X); // connect the underline between x and y of endpoints
else
SetStyling(tok.length, ss::NORMAL);
break;
Expand Down Expand Up @@ -118,6 +124,64 @@ class WordSplitter {
}
}

void SplitDrawing(size_t &i) {
size_t starti = i;

// First, split into words
size_t dpos = pos;
size_t tlen = 0;
bool tokentype = text[pos] == ' ' || text[pos] == '\t';
while (tlen < tokens[i].length) {
bool newtype = text[dpos] == ' ' || text[dpos] == '\t';
if (newtype != tokentype) {
tokentype = newtype;
SwitchTo(i, tokentype ? dt::DRAWING_FULL : dt::WHITESPACE, tlen);
tokens[i].type = tokentype ? dt::WHITESPACE : dt::DRAWING_FULL;
tlen = 0;
}
++tlen;
++dpos;
}

// Then, label all the tokens
dpos = pos;
int num_coord = 0;
char lastcmd = ' ';

for (size_t j = starti; j <= i; j++) {
char c = text[dpos];
if (tokens[j].type == dt::WHITESPACE) {
} else if (c == 'm' || c == 'n' || c == 'l' || c == 's' || c == 'b' || c == 'p' || c == 'c') {
tokens[j].type = dt::DRAWING_CMD;

if (tokens[j].length != 1)
tokens[j].type = dt::ERROR;
if (num_coord % 2 != 0)
tokens[j].type = dt::ERROR;

lastcmd = c;
num_coord = 0;
} else {
bool valid = true;
for (size_t k = 0; k < tokens[j].length; k++) {
char c = text[dpos + k];
if (!((c >= '0' && c <= '9') || c == '.' || c == '-' || c == 'e')) {
valid = false;
}
}
if (!valid)
tokens[j].type = dt::ERROR;
else if (lastcmd == 'b' && num_coord % 6 >= 4)
tokens[j].type = num_coord % 2 == 0 ? dt::DRAWING_ENDPOINT_X : dt::DRAWING_ENDPOINT_Y;
else
tokens[j].type = num_coord % 2 == 0 ? dt::DRAWING_X : dt::DRAWING_Y;
++num_coord;
}

dpos += tokens[j].length;
}
}

public:
WordSplitter(std::string const& text, std::vector<DialogueToken> &tokens)
: text(text)
Expand All @@ -131,6 +195,9 @@ class WordSplitter {
size_t len = tokens[i].length;
if (tokens[i].type == dt::TEXT)
SplitText(i);
else if (tokens[i].type == dt::DRAWING_FULL) {
SplitDrawing(i);
}
pos += len;
}
}
Expand Down Expand Up @@ -163,9 +230,51 @@ void MarkDrawings(std::string const& str, std::vector<DialogueToken> &tokens) {
switch (tokens[i].type) {
case dt::TEXT:
if (in_drawing)
tokens[i].type = dt::DRAWING;
tokens[i].type = dt::DRAWING_FULL;
break;
case dt::TAG_NAME:
if (i + 3 < tokens.size() && (len == 4 || len == 5) && !strncmp(str.c_str() + pos + len - 4, "clip", 4)) {
if (tokens[i + 1].type != dt::OPEN_PAREN)
goto tag_p;

size_t drawing_start = 0;
size_t drawing_end = 0;

// Try to find a vector clip
for (size_t j = i + 2; j < tokens.size(); j++) {
if (tokens[j].type == dt::ARG_SEP) {
if (drawing_start) {
break; // More than two arguents - this is a rectangular clip
}
drawing_start = j + 1;
} else if (tokens[j].type == dt::CLOSE_PAREN) {
drawing_end = j;
break;
} else if (tokens[j].type != dt::WHITESPACE && tokens[j].type != dt::ARG) {
break;
}
}

if (!drawing_end)
goto tag_p;
if (!drawing_start)
drawing_start = i + 2;
if (drawing_end == drawing_start + 1)
goto tag_p;

// We found a clip between drawing_start and drawing_end. Now, join
// all the tokens into one and label it as a drawing.
size_t tokenlen = 0;
for (size_t j = drawing_start; j < drawing_end; j++) {
tokenlen += tokens[j].length;
}

tokens[drawing_start].length = tokenlen;
tokens[drawing_start].type = dt::DRAWING_FULL;
tokens.erase(tokens.begin() + drawing_start + 1, tokens.begin() + drawing_end);
last_ovr_end -= drawing_end - drawing_start - 1;
}
tag_p:
if (len != 1 || i + 1 >= tokens.size() || str[pos] != 'p')
break;

Expand Down Expand Up @@ -199,7 +308,7 @@ void MarkDrawings(std::string const& str, std::vector<DialogueToken> &tokens) {
case dt::KARAOKE_VARIABLE: break;
case dt::LINE_BREAK: break;
default:
tokens[i].type = in_drawing ? dt::DRAWING : dt::TEXT;
tokens[i].type = in_drawing ? dt::DRAWING_FULL : dt::TEXT;
if (i > 0 && tokens[i - 1].type == tokens[i].type) {
tokens[i - 1].length += tokens[i].length;
tokens.erase(tokens.begin() + i);
Expand Down
2 changes: 1 addition & 1 deletion libaegisub/common/vfr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ int Framerate::FrameAtTime(int ms, Time type) const {
return int((ms * numerator / denominator - 999) / 1000);

if (ms > timecodes.back())
return int((ms * numerator - last + denominator - 1) / denominator / 1000) + (int)timecodes.size() - 1;
return int((ms * numerator - numerator / 2 - last + numerator - 1) / denominator / 1000) + (int)timecodes.size() - 1;

return (int)distance(lower_bound(timecodes.rbegin(), timecodes.rend(), ms, std::greater<int>()), timecodes.rend()) - 1;
}
Expand Down
13 changes: 11 additions & 2 deletions libaegisub/include/libaegisub/ass/dialogue_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ namespace agi {
ERROR,
COMMENT,
WHITESPACE,
DRAWING,
DRAWING_FULL,
DRAWING_CMD,
DRAWING_X,
DRAWING_Y,
DRAWING_ENDPOINT_X,
DRAWING_ENDPOINT_Y,
KARAOKE_TEMPLATE,
KARAOKE_VARIABLE
};
Expand All @@ -49,7 +54,11 @@ namespace agi {
enum {
NORMAL = 0,
COMMENT,
DRAWING,
DRAWING_CMD,
DRAWING_X,
DRAWING_Y,
DRAWING_ENDPOINT_X,
DRAWING_ENDPOINT_Y,
OVERRIDE,
PUNCTUATION,
TAG,
Expand Down
6 changes: 4 additions & 2 deletions src/audio_provider_vs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ VapoursynthAudioProvider::VapoursynthAudioProvider(agi::fs::path const& filename
num_samples = vi->numSamples;
}
catch (VapoursynthError const& err) {
throw agi::AudioProviderError(agi::format("Vapoursynth error: %s", err.GetMessage()));
// Unlike the video provider manager, the audio provider factory catches AudioProviderErrors and picks whichever source doesn't throw one.
// So just rethrow the Error here with an extra label so the user will see the error message and know the audio wasn't loaded with VS
throw VapoursynthError(agi::format("Vapoursynth error: %s", err.GetMessage()));
}

template<typename T>
Expand Down Expand Up @@ -115,7 +117,7 @@ void VapoursynthAudioProvider::FillBufferWithFrame(void *buf, int n, int64_t sta

std::vector<const uint8_t *> planes(channels);
for (int c = 0; c < channels; c++) {
planes[c] = vs.GetAPI()->getReadPtr(frame, c);
planes[c] = vs.GetAPI()->getReadPtr(frame, c) + bytes_per_sample * start;
if (planes[c] == nullptr) {
vs.GetAPI()->freeFrame(frame);
throw VapoursynthError("Failed to read audio channel");
Expand Down
15 changes: 12 additions & 3 deletions src/libresrc/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@
"Background" : {
"Brackets" : "",
"Comment" : "",
"Drawing" : "",
"Drawing Command" : "",
"Drawing X" : "",
"Drawing Y" : "",
"Error" : "rgb(255, 200, 200)",
"Karaoke Template" : "",
"Karaoke Variable" : "",
Expand All @@ -244,7 +246,9 @@
"Bold" : {
"Brackets" : false,
"Comment" : true,
"Drawing" : true,
"Drawing Command" : true,
"Drawing X" : false,
"Drawing Y" : false,
"Error" : false,
"Karaoke Template" : true,
"Karaoke Variable" : true,
Expand All @@ -254,9 +258,14 @@
"Slashes" : false,
"Tags" : true
},
"Underline": {
"Drawing Endpoint": true
},
"Brackets" : "rgb(20, 50, 255)",
"Comment" : "rgb(0,0,0)",
"Drawing" : "rgb(0,0,0)",
"Drawing Command" : "rgb(0,0,0)",
"Drawing X" : "rgb(90,40,40)",
"Drawing Y" : "rgb(40,90,40)",
"Error" : "rgb(200, 0, 0)",
"Karaoke Template" : "rgb(128, 0, 192)",
"Karaoke Variable" : "rgb(128, 0, 192)",
Expand Down
15 changes: 12 additions & 3 deletions src/libresrc/osx/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@
"Background" : {
"Brackets" : "",
"Comment" : "",
"Drawing" : "",
"Drawing Command" : "",
"Drawing X" : "",
"Drawing Y" : "",
"Error" : "rgb(255, 200, 200)",
"Karaoke Template" : "",
"Karaoke Variable" : "",
Expand All @@ -244,7 +246,9 @@
"Bold" : {
"Brackets" : false,
"Comment" : true,
"Drawing" : true,
"Drawing Command" : true,
"Drawing X" : false,
"Drawing Y" : false,
"Error" : false,
"Karaoke Template" : true,
"Karaoke Variable" : true,
Expand All @@ -254,9 +258,14 @@
"Slashes" : false,
"Tags" : true
},
"Underline": {
"Drawing Endpoint": true
},
"Brackets" : "rgb(20, 50, 255)",
"Comment" : "rgb(0,0,0)",
"Drawing" : "rgb(0,0,0)",
"Drawing Command" : "rgb(0,0,0)",
"Drawing X" : "rgb(90,40,40)",
"Drawing Y" : "rgb(40,90,40)",
"Error" : "rgb(200, 0, 0)",
"Karaoke Template" : "rgb(128, 0, 192)",
"Karaoke Variable" : "rgb(128, 0, 192)",
Expand Down
6 changes: 5 additions & 1 deletion src/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,11 @@ void Interface_Colours(wxTreebook *book, Preferences *parent) {
p->OptionAdd(syntax, _("Background"), "Colour/Subtitle/Background");
p->OptionAdd(syntax, _("Normal"), "Colour/Subtitle/Syntax/Normal");
p->OptionAdd(syntax, _("Comments"), "Colour/Subtitle/Syntax/Comment");
p->OptionAdd(syntax, _("Drawings"), "Colour/Subtitle/Syntax/Drawing");
p->OptionAdd(syntax, _("Drawing Commands"), "Colour/Subtitle/Syntax/Drawing Command");
p->OptionAdd(syntax, _("Drawing X Coords"), "Colour/Subtitle/Syntax/Drawing X");
p->OptionAdd(syntax, _("Drawing Y Coords"), "Colour/Subtitle/Syntax/Drawing Y");
p->OptionAdd(syntax, _("Underline Spline Endpoints"), "Colour/Subtitle/Syntax/Underline/Drawing Endpoint");
p->CellSkip(syntax);
p->OptionAdd(syntax, _("Brackets"), "Colour/Subtitle/Syntax/Brackets");
p->OptionAdd(syntax, _("Slashes and Parentheses"), "Colour/Subtitle/Syntax/Slashes");
p->OptionAdd(syntax, _("Tags"), "Colour/Subtitle/Syntax/Tags");
Expand Down
2 changes: 1 addition & 1 deletion src/res/aegisub.exe.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<description>Aegisub subtitle editor</description>
<description>Aegisub Subtitle Editor</description>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 and Windows 11 -->
Expand Down
13 changes: 11 additions & 2 deletions src/subs_edit_ctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxSize wsize, long style, a
OPT_SUB("Subtitle/Edit Box/Font Size", &SubsTextEditCtrl::SetStyles, this);
Subscribe("Normal");
Subscribe("Comment");
Subscribe("Drawing");
Subscribe("Drawing Command");
Subscribe("Drawing X");
Subscribe("Drawing Y");
OPT_SUB("Colour/Subtitle/Syntax/Underline/Drawing Endpoint", &SubsTextEditCtrl::SetStyles, this);
Subscribe("Brackets");
Subscribe("Slashes");
Subscribe("Tags");
Expand Down Expand Up @@ -230,7 +233,13 @@ void SubsTextEditCtrl::SetStyles() {
namespace ss = agi::ass::SyntaxStyle;
SetSyntaxStyle(ss::NORMAL, font, "Normal", default_background);
SetSyntaxStyle(ss::COMMENT, font, "Comment", default_background);
SetSyntaxStyle(ss::DRAWING, font, "Drawing", default_background);
SetSyntaxStyle(ss::DRAWING_CMD, font, "Drawing Command", default_background);
SetSyntaxStyle(ss::DRAWING_X, font, "Drawing X", default_background);
SetSyntaxStyle(ss::DRAWING_Y, font, "Drawing Y", default_background);
SetSyntaxStyle(ss::DRAWING_ENDPOINT_X, font, "Drawing X", default_background);
SetSyntaxStyle(ss::DRAWING_ENDPOINT_Y, font, "Drawing Y", default_background);
StyleSetUnderline(ss::DRAWING_ENDPOINT_X, OPT_GET("Colour/Subtitle/Syntax/Underline/Drawing Endpoint")->GetBool());
StyleSetUnderline(ss::DRAWING_ENDPOINT_Y, OPT_GET("Colour/Subtitle/Syntax/Underline/Drawing Endpoint")->GetBool());
SetSyntaxStyle(ss::OVERRIDE, font, "Brackets", default_background);
SetSyntaxStyle(ss::PUNCTUATION, font, "Slashes", default_background);
SetSyntaxStyle(ss::TAG, font, "Tags", default_background);
Expand Down
Loading

0 comments on commit 277d1e1

Please sign in to comment.