diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 00000000..3cd91bae
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,91 @@
+name: Build VSFilter
+
+on:
+ push:
+ branches: [ci, xy_sub_filter_rc*, vsfilter_rc*, master]
+
+jobs:
+ build:
+ runs-on: windows-2019
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - msarch: x64
+ vsfplat: x64
+ namesuf: x86-64
+ - arch: x86
+ vsfplat: Win32
+ namesuf: x86-32
+ defaults:
+ run:
+ shell: 'bash'
+
+ steps:
+ - name: Determine configuration
+ id: config
+ run: |
+ # base name of GHA artifact
+ name="VSFilter+SubFilter"
+ # space delimited list of filename stems to delete from artifact
+ delete=""
+
+ # If it runs for one of the main XySubFilter or xy-VSFilter dev branches,
+ # only publish compatible binaries. If it's some other branch, it's probably
+ # a transient testing build, so keep everything.
+ # ref.: https://github.com/Cyberbeing/xy-VSFilter/pull/18#issuecomment-1302638201
+ REF="${{ github.ref }}"
+ REF="${REF#refs/heads/}"
+ if [ "$REF" = "master" ] || [ "$REF" = "vsfilter_rc" ] ; then
+ name="VSFilter"
+ delete="XySubFilter"
+ # xy-VSFilter specific changes weren't merged back into the
+ # XySubFilter branch, so it normally shouldn't be used to build
+ # xy-VSFilter. But in pinterf/xy-VSFilter there’s only one branch.
+ #elif echo "$REF" | grep -qE '^xy_sub_filter_rc' ; then
+ # name="SubFilter"
+ # delete="VSFilter"
+ fi
+
+ echo "name=$name" >> $GITHUB_OUTPUT
+ echo "delete=$delete" >> $GITHUB_OUTPUT
+
+ - name: checkout code
+ uses: actions/checkout@v3
+ with:
+ # We need full history to allow finding the tag in build prep
+ fetch-depth: 0
+
+ - name: install yasm
+ shell: cmd
+ run: |
+ git clone --depth=1 https://github.com/ShiftMediaProject/VSYASM.git
+ .\VSYASM\install_script.bat
+
+ # VS2019 is 16.x; VS2022 17.x
+ - name: Setup VS2019
+ uses: microsoft/setup-msbuild@v1.1
+ with:
+ msbuild-architecture: matrix.msarch
+ # vs-version: '[16.01,16.11]'
+
+ - name: Build xy-VSFilter and/or XySubFilter
+ run: |
+ export VS160COMNTOOLS="C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/"
+ bash ./build_vsfilter.sh -platform "${{ matrix.vsfplat }}" -compiler VS2019
+
+ - name: Prune incompatible files
+ if: steps.config.outputs.delete != ''
+ run: |
+ for dir in bin/lib*/*/Release ; do
+ for bn in ${{ steps.config.outputs.delete }} ; do
+ rm -f "$dir"/"$bn".*
+ done
+ done
+
+ - name: Publish output
+ uses: actions/upload-artifact@v3
+ with:
+ name: xy-${{ steps.config.outputs.name }}_nightly_${{ matrix.namesuf }}
+ path: |
+ bin/lib*/*/Release
diff --git a/src/subtitles/RTS.cpp b/src/subtitles/RTS.cpp
index c2e73902..9fae771f 100644
--- a/src/subtitles/RTS.cpp
+++ b/src/subtitles/RTS.cpp
@@ -1854,22 +1854,23 @@ void CRenderedTextSubtitle::OnChanged()
bool CRenderedTextSubtitle::Init( const CRectCoor2& video_rect, const CRectCoor2& subtitle_target_rect,
- const SIZE& original_video_size )
+ const SIZE& layout_size )
{
XY_LOG_INFO(_T(""));
Deinit();
+
m_video_rect = CRect(video_rect.left*MAX_SUB_PIXEL,
video_rect.top*MAX_SUB_PIXEL,
video_rect.right*MAX_SUB_PIXEL,
video_rect.bottom*MAX_SUB_PIXEL);
m_subtitle_target_rect = CRect(subtitle_target_rect.left*MAX_SUB_PIXEL, subtitle_target_rect.top*MAX_SUB_PIXEL,
subtitle_target_rect.right*MAX_SUB_PIXEL, subtitle_target_rect.bottom*MAX_SUB_PIXEL);
- m_size = CSize(original_video_size.cx*MAX_SUB_PIXEL, original_video_size.cy*MAX_SUB_PIXEL);
+ m_size = CSize(layout_size.cx*MAX_SUB_PIXEL, layout_size.cy*MAX_SUB_PIXEL);
- ASSERT(original_video_size.cx!=0 && original_video_size.cy!=0);
+ ASSERT(layout_size.cx!=0 && layout_size.cy!=0);
- m_target_scale_x = video_rect.Width() * 1.0 / original_video_size.cx;
- m_target_scale_y = video_rect.Height() * 1.0 / original_video_size.cy;
+ m_target_scale_x = video_rect.Width() * 1.0 / layout_size.cx;
+ m_target_scale_y = video_rect.Height() * 1.0 / layout_size.cy;
return(true);
}
@@ -3360,6 +3361,12 @@ STDMETHODIMP CRenderedTextSubtitle::RenderEx( IXySubRenderFrame**subRenderFrame,
cvideo_rect.MoveToXY(0,0);
}
+ SIZE layout_size = original_video_size;
+ if (m_layout_size.cx > 0 && m_layout_size.cy > 0) {
+ layout_size.cx = m_layout_size.cx;
+ layout_size.cy = m_layout_size.cy;
+ }
+
XyColorSpace color_space = XY_CS_ARGB;
switch(spd_type)
{
@@ -3391,9 +3398,9 @@ STDMETHODIMP CRenderedTextSubtitle::RenderEx( IXySubRenderFrame**subRenderFrame,
subtitle_target_rect.top*MAX_SUB_PIXEL,
subtitle_target_rect.right*MAX_SUB_PIXEL,
subtitle_target_rect.bottom*MAX_SUB_PIXEL)
- || m_size != CSize(original_video_size.cx*MAX_SUB_PIXEL, original_video_size.cy*MAX_SUB_PIXEL) )
+ || m_size != CSize(layout_size.cx*MAX_SUB_PIXEL, layout_size.cy*MAX_SUB_PIXEL) )
{
- if (!Init(cvideo_rect, subtitle_target_rect, original_video_size))
+ if (!Init(cvideo_rect, subtitle_target_rect, layout_size))
{
XY_LOG_FATAL("Failed to Init.");
return E_FAIL;
diff --git a/src/subtitles/RTS.h b/src/subtitles/RTS.h
index 0beaf741..eaa55fd5 100644
--- a/src/subtitles/RTS.h
+++ b/src/subtitles/RTS.h
@@ -457,9 +457,16 @@ class CRenderedTextSubtitle : public CSubPicProviderImpl, public ISubStream, pub
virtual void Copy(CSimpleTextSubtitle& sts);
virtual void Empty();
-public:
+private:
+ /*
+ * The layout_size parameter is either derived from
+ * valid LayoutRes{X,Y} script headers (both must be valid!)
+ * or if those do not exist, equal to the video's storage resolution.
+ * Will call Deinit()
+ */
bool Init(const CRectCoor2& video_rect, const CRectCoor2& subtitle_target_rect,
- const SIZE& original_video_size); // will call Deinit()
+ const SIZE& layout_size);
+public:
void Deinit();
DECLARE_IUNKNOWN
diff --git a/src/subtitles/STS.cpp b/src/subtitles/STS.cpp
index 7b1c61b9..a1a4c9cb 100644
--- a/src/subtitles/STS.cpp
+++ b/src/subtitles/STS.cpp
@@ -2060,6 +2060,16 @@ if(sver <= 4) style->scrAlignment = (style->scrAlignment&4) ? ((style->scrAlig
: ret.m_dstScreenSize.cy * 4 / 3;
}
}
+ else if(entry == L"layoutresx")
+ {
+ try {ret.m_layout_size.cx = GetInt(buff);}
+ catch(...) {ret.m_layout_size = CSize(0, 0); return(false);}
+ }
+ else if(entry == L"layoutresy")
+ {
+ try {ret.m_layout_size.cy = GetInt(buff);}
+ catch(...) {ret.m_layout_size = CSize(0, 0); return(false);}
+ }
else if(entry == L"wrapstyle")
{
try {ret.m_defaultWrapStyle = GetInt(buff);}
diff --git a/src/subtitles/STS.h b/src/subtitles/STS.h
index b191b24c..eef103b2 100644
--- a/src/subtitles/STS.h
+++ b/src/subtitles/STS.h
@@ -180,6 +180,7 @@ class CSimpleTextSubtitle
int m_defaultWrapStyle;
int m_collisions;
bool m_fScaledBAS;
+ CSize m_layout_size;
CSTSStyleMap m_styles;
diff --git a/src/thirdparty/VirtualDub/Kasumi/Kasumi.vcxproj b/src/thirdparty/VirtualDub/Kasumi/Kasumi.vcxproj
index d667a791..1d85de5b 100644
--- a/src/thirdparty/VirtualDub/Kasumi/Kasumi.vcxproj
+++ b/src/thirdparty/VirtualDub/Kasumi/Kasumi.vcxproj
@@ -39,6 +39,18 @@
+
+ $(VCInstallDir);$(VC_ExecutablePath_x86);$(CommonExecutablePath)
+
+
+ $(VCInstallDir);$(VC_ExecutablePath_x86);$(CommonExecutablePath)
+
+
+ $(VCInstallDir);$(VC_ExecutablePath_x64);$(CommonExecutablePath)
+
+
+ $(VCInstallDir);$(VC_ExecutablePath_x64);$(CommonExecutablePath)
+
h;..\h;%(AdditionalIncludeDirectories)
@@ -200,4 +212,4 @@
-
\ No newline at end of file
+
diff --git a/src/thirdparty/VirtualDub/system/system.vcxproj b/src/thirdparty/VirtualDub/system/system.vcxproj
index 3482ea17..e44acf16 100644
--- a/src/thirdparty/VirtualDub/system/system.vcxproj
+++ b/src/thirdparty/VirtualDub/system/system.vcxproj
@@ -39,6 +39,18 @@
+
+ $(VCInstallDir);$(VC_ExecutablePath_x86);$(CommonExecutablePath)
+
+
+ $(VCInstallDir);$(VC_ExecutablePath_x86);$(CommonExecutablePath)
+
+
+ $(VCInstallDir);$(VC_ExecutablePath_x64);$(CommonExecutablePath)
+
+
+ $(VCInstallDir);$(VC_ExecutablePath_x64);$(CommonExecutablePath)
+
..\h;h;%(AdditionalIncludeDirectories)
@@ -192,4 +204,4 @@
-
\ No newline at end of file
+