1
0
Fork 0

Merge branches 'bugfixes', 'workarounds', 'fixes', 'gui', 'xa2-ds', 'avisynth', 'vapoursynth' and 'video_panning_option' into feature

This commit is contained in:
arch1t3cht 2023-01-26 23:12:07 +01:00
24 changed files with 587 additions and 179 deletions

View File

@ -65,11 +65,11 @@ jobs:
}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: '3.x'
@ -85,7 +85,7 @@ jobs:
- name: Install dependencies (Windows)
if: matrix.config.os == 'windows-latest'
run: |
choco install ninja innosetup yasm
choco install ninja innosetup
$url = "https://github.com/leafo/moonscript/releases/download/win32-v0.5.0/moonscript-187bac54ee5a7450013e9c38e005a0e671b76f45.zip"
mkdir moonscript
Invoke-WebRequest -Uri $url -OutFile ".\moonscript\moonscript.zip"
@ -121,21 +121,24 @@ jobs:
# Windows artifacts
- name: Generate Windows installer
if: matrix.config.os == 'windows-latest'
run: meson compile win-installer -C build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run:
meson compile win-installer -C build
- name: Generate Windows portable installer
if: matrix.config.os == 'windows-latest'
run: cd build && ninja win-portable
- name: Upload artifacts - win_installer
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: matrix.config.os == 'windows-latest'
with:
name: ${{ matrix.config.name }} - installer
path: build/Aegisub-*.exe
- name: Upload artifacts - portable.zip
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: matrix.config.os == 'windows-latest'
with:
name: ${{ matrix.config.name }} - portable
@ -149,7 +152,7 @@ jobs:
meson compile osx-build-dmg -C build
- name: Upload artifacts - macOS dmg
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: matrix.config.os == 'macos-latest'
with:
name: ${{ matrix.config.name }} - installer

View File

@ -38,7 +38,7 @@ class HDAudioProvider final : public AudioProviderWrapper {
void FillBuffer(void *buf, int64_t start, int64_t count) const override {
auto missing = std::min(count, start + count - decoded_samples);
if (missing > 0) {
memset(static_cast<int16_t*>(buf) + count - missing, 0, missing * bytes_per_sample);
memset(static_cast<int16_t*>(buf) + count - missing, 0, missing * bytes_per_sample * channels);
count -= missing;
}
@ -69,7 +69,7 @@ public:
for (int64_t i = 0; i < num_samples; i += block) {
if (cancelled) break;
block = std::min(block, num_samples - i);
source->GetAudio(file.write(i * bytes_per_sample, block * bytes_per_sample), i, block);
source->GetAudio(file.write(i * bytes_per_sample * channels, block * bytes_per_sample * channels), i, block);
decoded_samples += block;
}
});

View File

@ -52,6 +52,10 @@ if get_option('debug') and host_machine.system() != 'windows'
add_project_arguments('-D_DEBUG', language: 'cpp')
endif
if get_option('buildtype') == 'release'
add_project_arguments('-DNDEBUG', language: 'cpp')
endif
conf = configuration_data()
conf.set_quoted('P_DATA', dataroot)
conf.set_quoted('P_LOCALE', localedir)

View File

@ -322,7 +322,8 @@ namespace Automation4 {
std::vector<std::future<std::unique_ptr<Script>>> script_futures;
for (auto tok : agi::Split(path, '|')) {
auto path_it = agi::Split(path, '|');
for (auto tok : std::set<agi::StringRange>(begin(path_it), end(path_it))) {
auto dirname = config::path->Decode(agi::str(tok));
if (!agi::fs::DirectoryExists(dirname)) continue;

View File

@ -121,7 +121,7 @@ namespace {
int get_translation(lua_State *L)
{
wxString str(check_wxstring(L, 1));
push_value(L, _(str).utf8_str());
push_value(L, std::string(_(str).utf8_str()));
return 1;
}

View File

@ -187,16 +187,16 @@ namespace Automation4 {
set_field(L, "start_time", dia->Start);
set_field(L, "end_time", dia->End);
set_field(L, "style", dia->Style);
set_field(L, "actor", dia->Actor);
set_field(L, "effect", dia->Effect);
set_field(L, "style", std::string(dia->Style));
set_field(L, "actor", std::string(dia->Actor));
set_field(L, "effect", std::string(dia->Effect));
set_field(L, "margin_l", dia->Margin[0]);
set_field(L, "margin_r", dia->Margin[1]);
set_field(L, "margin_t", dia->Margin[2]);
set_field(L, "margin_b", dia->Margin[2]);
set_field(L, "text", dia->Text);
set_field(L, "text", std::string(dia->Text));
// preserve the folds
*static_cast<FoldInfo*>(lua_newuserdata(L, sizeof(FoldInfo))) = dia->Fold;

View File

@ -67,7 +67,7 @@ const AVS_Linkage *AVS_linkage = nullptr;
typedef IScriptEnvironment* __stdcall FUNC(int);
AviSynthWrapper::AviSynthWrapper() {
if (!avs_refcount++) {
if (!avs_refcount){
#ifdef _WIN32
#define CONCATENATE(x, y) x ## y
#define _Lstr(x) CONCATENATE(L, x)
@ -94,6 +94,8 @@ AviSynthWrapper::AviSynthWrapper() {
if (!env)
throw AvisynthError("Failed to create a new avisynth script environment. Avisynth is too old?");
avs_refcount++;
AVS_linkage = env->GetAVSLinkage();
// Set memory limit

View File

@ -191,6 +191,9 @@ void BaseGrid::UpdateStyle() {
row_colors.FoldClosed.SetColour(to_wx(OPT_GET("Colour/Subtitle Grid/Background/Closed Fold")->GetColor()));
row_colors.LeftCol.SetColour(to_wx(OPT_GET("Colour/Subtitle Grid/Left Column")->GetColor()));
if (width_helper)
width_helper->ClearCache();
SetColumnWidths();
AdjustScrollbar();

View File

@ -507,7 +507,7 @@ static void save_snapshot(agi::Context *c, bool raw, bool subsonly = false) {
// If where ever that is isn't defined, we can't save there
if ((basepath == "\\") || (basepath == "/")) {
// So save to the current user's home dir instead
basepath = wxGetHomeDir().c_str();
basepath = std::string(wxGetHomeDir());
}
}
// Actual fixed (possibly relative) path, decode it

View File

@ -161,7 +161,7 @@ void DialogAttachments::OnExtract(wxCommandEvent &) {
// Multiple or single?
if (listView->GetNextSelected(i) != -1)
path = wxDirSelector(_("Select the path to save the files to:"), to_wx(OPT_GET("Path/Fonts Collector Destination")->GetString())).c_str();
path = std::string(wxDirSelector(_("Select the path to save the files to:"), to_wx(OPT_GET("Path/Fonts Collector Destination")->GetString())));
else {
path = SaveFileSelector(
_("Select the path to save the file to:"),

View File

@ -42,6 +42,7 @@ class WidthHelper {
public:
void SetDC(wxDC *dc) { this->dc = dc; }
void Age();
void ClearCache() { widths.clear(); };
int operator()(boost::flyweight<std::string> const& str);
int operator()(std::string const& str);

View File

@ -646,7 +646,6 @@
"Show Keyframes" : true
},
"Subtitle Sync" : true,
"Video Pan": false,
"Default to Video Zoom": false
}
}

View File

@ -2,10 +2,20 @@ fs = import('fs')
respack = find_program(meson.project_source_root() / 'tools/respack.py')
bitmap_manifest = '../bitmaps/manifest.respack'
bitmap_files = []
foreach bfile : fs.read(bitmap_manifest).strip().split('\n')
bfile_s = bfile.strip()
if bfile_s != ''
bitmap_files += files('../bitmaps' / bfile_s)
endif
endforeach
resrc = [
custom_target('bitmap.{cpp,h}',
command: [respack, '@INPUT@', '@OUTPUT@'],
input: files('../bitmaps/manifest.respack'),
input: files(bitmap_manifest),
depend_files: bitmap_files,
output: ['bitmap.cpp', 'bitmap.h'])
]

View File

@ -646,7 +646,6 @@
"Show Keyframes" : true
},
"Subtitle Sync" : true,
"Video Pan": false,
"Default to Video Zoom": false
}
}

View File

@ -173,7 +173,8 @@ void Video(wxTreebook *book, Preferences *parent) {
p->OptionAdd(general, _("Seek video to line start on selection change"), "Video/Subtitle Sync");
p->CellSkip(general);
p->OptionAdd(general, _("Automatically open audio when opening video"), "Video/Open Audio");
p->CellSkip(general);
p->OptionAdd(general, _("Default to Video Zoom"), "Video/Default to Video Zoom")
->SetToolTip("Reverses the behavior of Ctrl while scrolling the video display. If not set, scrolling will default to UI zoom and Ctrl+scrolling will zoom the video. If set, this will be reversed.");
p->OptionAdd(general, _("Disable zooming with scroll bar"), "Video/Disable Scroll Zoom")
->SetToolTip("Makes the scroll bar not zoom the video. Useful when using a track pad that often scrolls accidentally.");
p->OptionAdd(general, _("Reverse zoom direction"), "Video/Reverse Zoom");
@ -459,10 +460,6 @@ void Advanced_Video(wxTreebook *book, Preferences *parent) {
wxArrayString sp_choice = to_wx(SubtitlesProviderFactory::GetClasses());
p->OptionChoice(expert, _("Subtitles provider"), sp_choice, "Subtitle/Provider");
p->OptionAdd(expert, _("Video Panning"), "Video/Video Pan");
p->OptionAdd(expert, _("Default to Video Zoom"), "Video/Default to Video Zoom")
->SetToolTip("Reverses the behavior of Ctrl while scrolling the video display. If not set, scrolling will default to UI zoom and Ctrl+scrolling will zoom the video. If set, this will be reversed.");
#ifdef WITH_AVISYNTH
auto avisynth = p->PageSizer("Avisynth");
@ -547,8 +544,11 @@ public:
}
bool SetValue(wxVariant const& var) override {
value << var;
return true;
if (var.GetType() == "wxDataViewIconText") {
value << var;
return true;
}
return false;
}
bool Render(wxRect rect, wxDC *dc, int state) override {

View File

@ -56,7 +56,6 @@ typedef VSSCRIPTAPI* VS_CC FUNC(int);
VapourSynthWrapper::VapourSynthWrapper() {
// VSScript assumes it's only loaded once, so unlike AVS we can't unload it when the refcount reaches zero
if (!vs_loaded) {
vs_loaded = true;
#ifdef _WIN32
#define CONCATENATE(x, y) x ## y
#define _Lstr(x) CONCATENATE(L, x)
@ -92,6 +91,8 @@ VapourSynthWrapper::VapourSynthWrapper() {
if (!api)
throw VapoursynthError("Failed to get Vapoursynth API");
vs_loaded = true;
}
}

View File

@ -376,27 +376,17 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
last_mouse_pos = mouse_pos = event.GetPosition();
///if video pan
bool videoPan = OPT_GET("Video/Video Pan")->GetBool();
if (videoPan){
if (event.GetButton() == wxMOUSE_BTN_MIDDLE) {
if ((panning = event.ButtonDown()))
pan_last_pos = event.GetPosition();
}
if (panning && event.Dragging()) {
pan_x += event.GetX() - pan_last_pos.X();
pan_y += event.GetY() - pan_last_pos.Y();
if (event.GetButton() == wxMOUSE_BTN_MIDDLE) {
if ((panning = event.ButtonDown()))
pan_last_pos = event.GetPosition();
}
if (panning && event.Dragging()) {
pan_x += event.GetX() - pan_last_pos.X();
pan_y += event.GetY() - pan_last_pos.Y();
pan_last_pos = event.GetPosition();
PositionVideo();
}
}
else if ((pan_x != 0 || pan_y != 0) && !videoPan)
{
pan_x = pan_y = 0;
PositionVideo();
}
PositionVideo();
}
///
@ -411,13 +401,12 @@ void VideoDisplay::OnMouseLeave(wxMouseEvent& event) {
}
void VideoDisplay::OnMouseWheel(wxMouseEvent& event) {
bool videoPan = OPT_GET("Video/Video Pan")->GetBool();
if (int wheel = event.GetWheelRotation()) {
if (ForwardMouseWheelEvent(this, event) && !OPT_GET("Video/Disable Scroll Zoom")->GetBool()) {
if (OPT_GET("Video/Reverse Zoom")->GetBool()) {
wheel = -wheel;
}
if (!videoPan || (event.ControlDown() == OPT_GET("Video/Default to Video Zoom")->GetBool())) {
if (event.ControlDown() == OPT_GET("Video/Default to Video Zoom")->GetBool()) {
SetWindowZoom(windowZoomValue + .125 * (wheel / event.GetWheelDelta()));
} else {
SetVideoZoom(wheel / event.GetWheelDelta());
@ -475,7 +464,7 @@ void VideoDisplay::SetVideoZoom(int step) {
}
// Mouse coordinates, relative to the video, at the current zoom level
Vector2D mp = GetMousePosition() * videoZoomValue * windowZoomValue;
Vector2D mp = last_mouse_pos - Vector2D(viewport_left, viewport_top) / scale_factor;
// The video size will change by this many pixels
int pixelChangeW = std::lround(videoSize.GetWidth() * (newVideoZoom / videoZoomValue - 1.0));

View File

@ -101,6 +101,9 @@ void VapoursynthVideoProvider::SetResizeArg(VSMap *args, const VSMap *props, con
int result = vs.GetAPI()->mapGetInt(props, prop_name, 0, &err);
if (err != 0 || result == unspecified) {
result = deflt;
if (!strcmp(arg_name, "range_in")) {
result = result == VSC_RANGE_FULL ? 1 : 0;
}
vs.GetAPI()->mapSetInt(args, arg_name, result, maAppend);
}
}

View File

@ -1,7 +1,7 @@
[wrap-git]
directory = ffmpeg
url = https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git
revision = meson-4.4
revision = c7a42b33c46c7b52f5e5c908e78bc411555aac1f
patch_directory = ffmpeg
[provide]

View File

@ -1,7 +1,7 @@
[wrap-git]
directory = harfbuzz
url = https://github.com/harfbuzz/harfbuzz
revision = main
revision = c158b626c3033036321180d4ac90c129206b0ad2
[provide]
harfbuzz = libharfbuzz_dep

View File

@ -1,31 +0,0 @@
libavutil_x86_sources = files(
'cpu.c',
'fixed_dsp_init.c',
'float_dsp_init.c',
'imgutils_init.c',
'lls_init.c',
)
libavutil_x86_optional_sources = {
'pixelutils' : files('pixelutils_init.c'),
}
libavutil_x86_x86asm_sources = files(
'cpuid.asm',
'emms.asm',
'fixed_dsp.asm',
'float_dsp.asm',
'imgutils.asm',
'lls.asm',
)
libavutil_x86_x86asm_optional_sources = {
'pixelutils' : files('pixelutils.asm'),
}
libavutil_x86_mmx_optional_sources = {
}
libavutil_x86_optional_tests = {
}

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ using namespace util;
TEST(lagi_vfr, constructors_good) {
EXPECT_NO_THROW(Framerate(1.));
EXPECT_NO_THROW(Framerate(Framerate(1.)));
EXPECT_NO_THROW(Framerate({ 0, 10 }));
EXPECT_NO_THROW(Framerate(std::initializer_list<int>({ 0, 10 })));
EXPECT_NO_THROW(Framerate("data/vfr/in/v1_start_equals_end.txt"));
EXPECT_NO_THROW(Framerate("data/vfr/in/v1_whitespace.txt"));
@ -49,9 +49,9 @@ TEST(lagi_vfr, constructors_bad_cfr) {
TEST(lagi_vfr, constructors_bad_timecodes) {
EXPECT_THROW(Framerate(std::initializer_list<int>{}), InvalidFramerate);
EXPECT_THROW(Framerate({0}), InvalidFramerate);
EXPECT_THROW(Framerate({10, 0}), InvalidFramerate);
EXPECT_THROW(Framerate({0, 0}), InvalidFramerate);
EXPECT_THROW(Framerate(std::initializer_list<int>({0})), InvalidFramerate);
EXPECT_THROW(Framerate(std::initializer_list<int>({10, 0})), InvalidFramerate);
EXPECT_THROW(Framerate(std::initializer_list<int>({0, 0})), InvalidFramerate);
}
TEST(lagi_vfr, constructors_bad_v1) {
@ -245,7 +245,7 @@ TEST(lagi_vfr, vfr_time_at_frame_end) {
TEST(lagi_vfr, vfr_time_at_frame_outside_range) {
Framerate fps;
ASSERT_NO_THROW(fps = Framerate({ 0, 100, 200 }));
ASSERT_NO_THROW(fps = Framerate(std::initializer_list<int>({ 0, 100, 200 })));
EXPECT_GT(0, fps.TimeAtFrame(-1));
EXPECT_EQ(0, fps.TimeAtFrame(0));
EXPECT_EQ(100, fps.TimeAtFrame(1));
@ -334,7 +334,7 @@ TEST(lagi_vfr, validate_save) {
TEST(lagi_vfr, save_vfr_nolen) {
Framerate fps;
ASSERT_NO_THROW(fps = Framerate({ 0, 100, 200 }));
ASSERT_NO_THROW(fps = Framerate(std::initializer_list<int>({ 0, 100, 200 })));
ASSERT_NO_THROW(fps.Save("data/vfr/out/v2_nolen.txt"));
EXPECT_TRUE(validate_save("data/vfr/in/v2_nolen.txt", "data/vfr/out/v2_nolen.txt"));
@ -342,7 +342,7 @@ TEST(lagi_vfr, save_vfr_nolen) {
TEST(lagi_vfr, save_vfr_len) {
Framerate fps;
ASSERT_NO_THROW(fps = Framerate({ 0, 100, 200 }));
ASSERT_NO_THROW(fps = Framerate(std::initializer_list<int>({ 0, 100, 200 })));
ASSERT_NO_THROW(fps.Save("data/vfr/out/v2_len_3_10.txt", 10));
EXPECT_TRUE(validate_save("data/vfr/in/v2_len_3_10.txt", "data/vfr/out/v2_len_3_10.txt", 3));

View File

@ -18,6 +18,11 @@ $Env:SOURCE_ROOT = $SourceRoot
Set-Location $DepsDir
$GitHeaders = @{}
if (Test-Path 'Env:GITHUB_TOKEN') {
$GitHeaders = @{ 'Authorization' = 'Bearer ' + $Env:GITHUB_TOKEN }
}
# DepCtrl
if (!(Test-Path DependencyControl)) {
git clone https://github.com/TypesettingTools/DependencyControl.git
@ -28,7 +33,7 @@ if (!(Test-Path DependencyControl)) {
# YUtils
if (!(Test-Path YUtils)) {
git clone https://github.com/TypesettingTools/YUtils.git
git clone https://github.com/arch1t3cht/YUtils.git
}
# luajson
@ -38,7 +43,7 @@ if (!(Test-Path luajson)) {
# Avisynth
if (!(Test-Path AviSynthPlus64)) {
$avsReleases = Invoke-WebRequest "https://api.github.com/repos/AviSynth/AviSynthPlus/releases/latest" -UseBasicParsing | ConvertFrom-Json
$avsReleases = Invoke-WebRequest "https://api.github.com/repos/AviSynth/AviSynthPlus/releases/latest" -Headers $GitHeaders -UseBasicParsing | ConvertFrom-Json
$avsUrl = $avsReleases.assets[0].browser_download_url
Invoke-WebRequest $avsUrl -OutFile AviSynthPlus.7z -UseBasicParsing
7z x AviSynthPlus.7z
@ -50,7 +55,7 @@ if (!(Test-Path AviSynthPlus64)) {
if (!(Test-Path VSFilter)) {
$vsFilterDir = New-Item -ItemType Directory VSFilter
Set-Location $vsFilterDir
$vsFilterReleases = Invoke-WebRequest "https://api.github.com/repos/pinterf/xy-VSFilter/releases/latest" -UseBasicParsing | ConvertFrom-Json
$vsFilterReleases = Invoke-WebRequest "https://api.github.com/repos/pinterf/xy-VSFilter/releases/latest" -Headers $GitHeaders -UseBasicParsing | ConvertFrom-Json
$vsFilterUrl = $vsFilterReleases.assets[0].browser_download_url
Invoke-WebRequest $vsFilterUrl -OutFile VSFilter.7z -UseBasicParsing
7z x VSFilter.7z
@ -61,7 +66,7 @@ if (!(Test-Path VSFilter)) {
# ffi-experiments
if (!(Test-Path ffi-experiments)) {
Get-Command "moonc" # check to ensure Moonscript is present
git clone https://github.com/TypesettingTools/ffi-experiments.git
git clone https://github.com/arch1t3cht/ffi-experiments.git
Set-Location ffi-experiments
meson build -Ddefault_library=static
meson compile -C build