From 2821db09af4b7ef9befbd95d0b1586deafaf2916 Mon Sep 17 00:00:00 2001 From: Masaiki Date: Fri, 10 Sep 2021 12:32:19 +0800 Subject: [PATCH 1/4] fix for compile --- src/text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text.c b/src/text.c index 58dc2c2..a5c45b3 100644 --- a/src/text.c +++ b/src/text.c @@ -486,7 +486,7 @@ static void VS_CC assRenderCreate(const VSMap *in, VSMap *out, void *userData, vsapi->mapConsumeFrame(vsapi->getFramePropertiesRW(frame), "_Alpha", alpha, maAppend); - d->lastframe = frame; + d.lastframe = frame; data = malloc(sizeof(d)); *data = d; From a6bb34bfe29dc21e6bd80c94f2766da12d2c6c1a Mon Sep 17 00:00:00 2001 From: Masaiki Date: Fri, 10 Sep 2021 12:32:50 +0800 Subject: [PATCH 2/4] add cmake build system --- .gitignore | 2 ++ CMakeLists.txt | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index 259148f..8487ac3 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,5 @@ *.exe *.out *.app + +/build \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6fc0ba7 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.12) +project(subtext) + +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_C_VISIBILITY_PRESET hidden) + +include(FetchContent) +FetchContent_Declare(VapourSynth + URL https://github.com/vapoursynth/vapoursynth/archive/refs/tags/R55-API4-RC3.zip + URL_HASH MD5=2352CD4FD2DEEA88A9495279820AC2A0) +FetchContent_MakeAvailable(VapourSynth) + +find_package(Iconv REQUIRED) +find_package(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL REQUIRED) +find_package(PkgConfig REQUIRED) +PKG_CHECK_MODULES(LIBASS REQUIRED libass>=0.12.0) + +add_library(subtext SHARED + "src/common.c" + "src/image.cpp" + "src/text.c" + "src/toass.cpp" + "src/toutf8.c" +) +target_include_directories(subtext PRIVATE "${vapoursynth_SOURCE_DIR}/include" ${FFMPEG_INCLUDE_DIRS} ${LIBASS_INCLUDE_DIRS}) +target_link_libraries(subtext PRIVATE Iconv::Iconv ${FFMPEG_LIBRARIES} ${LIBASS_LINK_LIBRARIES}) \ No newline at end of file From e6db8b10ef4059f4d177ffd034d754a1c31703b8 Mon Sep 17 00:00:00 2001 From: Masaiki Date: Fri, 10 Sep 2021 17:16:52 +0800 Subject: [PATCH 3/4] use pkg-config instead of find_package --- CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fc0ba7..3814f96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,9 +12,13 @@ FetchContent_Declare(VapourSynth FetchContent_MakeAvailable(VapourSynth) find_package(Iconv REQUIRED) -find_package(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL REQUIRED) find_package(PkgConfig REQUIRED) -PKG_CHECK_MODULES(LIBASS REQUIRED libass>=0.12.0) +pkg_check_modules(LIBAV REQUIRED + libavcodec + libavformat + libavutil +) +pkg_check_modules(LIBASS REQUIRED libass>=0.12.0) add_library(subtext SHARED "src/common.c" @@ -23,5 +27,5 @@ add_library(subtext SHARED "src/toass.cpp" "src/toutf8.c" ) -target_include_directories(subtext PRIVATE "${vapoursynth_SOURCE_DIR}/include" ${FFMPEG_INCLUDE_DIRS} ${LIBASS_INCLUDE_DIRS}) -target_link_libraries(subtext PRIVATE Iconv::Iconv ${FFMPEG_LIBRARIES} ${LIBASS_LINK_LIBRARIES}) \ No newline at end of file +target_include_directories(subtext PRIVATE "${vapoursynth_SOURCE_DIR}/include" ${LIBAV_INCLUDE_DIRS} ${LIBASS_INCLUDE_DIRS}) +target_link_libraries(subtext PRIVATE Iconv::Iconv ${LIBAV_LINK_LIBRARIES} ${LIBASS_LINK_LIBRARIES}) \ No newline at end of file From 8d1f4c9b65b931343c71fbf153a2d6add968d76f Mon Sep 17 00:00:00 2001 From: Masaiki Date: Sat, 11 Sep 2021 11:11:38 +0800 Subject: [PATCH 4/4] update cmake minimum version for cmake policy CMP0091 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3814f96..1c6d9e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.15) # for cmake policy CMP0091 https://cmake.org/cmake/help/latest/policy/CMP0091.html#policy:CMP0091 project(subtext) set(CMAKE_C_STANDARD 11)