Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WebVTT-in-video-stream support #196

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/build-project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ jobs:
restore-keys: |
${{ runner.os }}-ccache-${{ matrix.architecture }}-

- uses: actions-rust-lang/setup-rust-toolchain@v1
if: matrix.architecture == 'arm64'
with:
target: aarch64-apple-darwin

- uses: actions-rust-lang/setup-rust-toolchain@v1
if: matrix.architecture == 'x86_64'
with:
target: x86_64-apple-darwin

- name: Set Up Codesigning 🔑
uses: ./.github/actions/setup-macos-codesigning
if: fromJSON(needs.check-event.outputs.codesign)
Expand Down Expand Up @@ -197,6 +207,8 @@ jobs:
echo "pluginName=${product_name}" >> $GITHUB_OUTPUT
echo "pluginVersion=${product_version}" >> $GITHUB_OUTPUT

- uses: actions-rust-lang/setup-rust-toolchain@v1

- uses: actions/cache@v4
id: ccache-cache
with:
Expand Down Expand Up @@ -271,6 +283,8 @@ jobs:
"pluginName=${ProductName}" >> $env:GITHUB_OUTPUT
"pluginVersion=${ProductVersion}" >> $env:GITHUB_OUTPUT

- uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Build Plugin 🧱
uses: ./.github/actions/build-plugin
with:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/check-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,17 @@ jobs:
uses: ./.github/actions/run-cmake-format
with:
failCondition: error

cargo-fmt:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: rustfmt
uses: actions-rust-lang/rustfmt@v1
with:
manifest-path: deps/c-webvtt-in-video-stream/Cargo.toml
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ if(DEFINED ENV{LOCALVOCAL_EXTRA_VERBOSE})
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE LOCALVOCAL_EXTRA_VERBOSE)
endif()

option(ENABLE_WEBVTT "Enable WebVTT embedding" ON)

if(ENABLE_WEBVTT)
include(cmake/BuildWebVTT.cmake)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE c_webvtt_in_video_stream)
target_compile_definitions(c_webvtt_in_video_stream INTERFACE ENABLE_WEBVTT)
endif()

target_sources(
${CMAKE_PROJECT_NAME}
PRIVATE src/plugin-main.c
Expand Down
23 changes: 23 additions & 0 deletions cmake/BuildWebVTT.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
include(FetchContent)

set(Rust_RUSTUP_INSTALL_MISSING_TARGET true)

if(OS_MACOS)
if("$ENV{MACOS_ARCH}" STREQUAL "x86_64")
set(Rust_CARGO_TARGET "x86_64-apple-darwin")
endif()
endif()

FetchContent_Declare(
Corrosion
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
GIT_TAG v0.5 # Optionally specify a commit hash, version tag or branch here
)
FetchContent_MakeAvailable(Corrosion)

# Import targets defined in a package or workspace manifest `Cargo.toml` file
corrosion_import_crate(MANIFEST_PATH "${CMAKE_SOURCE_DIR}/deps/c-webvtt-in-video-stream/Cargo.toml" CRATE_TYPES
"staticlib" PROFILE release)

set_target_properties(c_webvtt_in_video_stream PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${CMAKE_SOURCE_DIR}/deps/c-webvtt-in-video-stream/target/")
6 changes: 6 additions & 0 deletions data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ vad_threshold="VAD Threshold"
log_level="Internal Log Level"
log_words="Log Output to Console"
caption_to_stream="Stream Captions"
webvtt_group="WebVTT"
webvtt_caption_to_stream="Add WebVTT captions to stream"
webvtt_caption_to_recording="Add WebVTT captions to recording"
webvtt_latency_to_video_in_msecs="Latency to video (milliseconds)"
webvtt_send_frequency_hz="Send frequency (Hz)"
webvtt_language_description="Language $1"
subtitle_sources="Output Destination"
none_no_output="None / No output"
file_output_enable="Save to File"
Expand Down
1 change: 1 addition & 0 deletions deps/c-webvtt-in-video-stream/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
7 changes: 7 additions & 0 deletions deps/c-webvtt-in-video-stream/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"editor.formatOnSave": true,
"evenBetterToml.formatter.reorderKeys": true,
"evenBetterToml.formatter.reorderArrays": true,
"evenBetterToml.formatter.trailingNewline": true,
"rust-analyzer.check.command": "clippy"
}
Loading
Loading