Skip to content

Commit

Permalink
Merge branch 'master' into rusty-ccextractor
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekmedia authored Apr 14, 2024
2 parents 5a43799 + 3f50441 commit fe093c0
Show file tree
Hide file tree
Showing 19 changed files with 494 additions and 135 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
run: sudo apt update && sudo apt-get install libgpac-dev
- uses: actions/checkout@v4
- name: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
src/rust/.cargo/registry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
src/rust/.cargo/registry
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
with:
msbuild-architecture: x64
uses: microsoft/[email protected]
- name: Install llvm and clang
run: choco install llvm gpac
- name: Setup vcpkg
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
src/rust/.cargo/registry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
shell: bash
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.3.1
uses: microsoft/setup-msbuild@v2.0.0
- name: Install llvm and clang
uses: egor-tensin/setup-clang@v1
with:
Expand Down
2 changes: 2 additions & 0 deletions docs/CHANGES.TXT
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
0.95 (to be released)
-----------------
- Update: Bump rsmpeg to latest version for ffmpeg bindings (#1600)
- New: Add SCC support for CEA-708 decoder (#1595)
- Fix: respect `-stdout` even if multiple CC tracks are present in a Matroska input file (#1453)
- Fix: crash in Rust decoder on ATSC1.0 TS Files (#1407)
- Removed the --with-gui flag for linux/configure and mac/configure (use the Flutter GUI instead)
Expand Down
8 changes: 4 additions & 4 deletions docs/COMPILATION.MD
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ Debian:
sudo apt-get install -y libgpac-dev libglew-dev libglfw3-dev cmake gcc libcurl4-gnutls-dev tesseract-ocr libtesseract-dev libleptonica-dev clang libclang-dev
```

RHEL:
RHEL/Fedora:

```bash
yum install -y glew-devel glfw-devel cmake gcc libcurl-devel tesseract-devel leptonica-devel clang
yum install -y glew-devel glfw-devel cmake gcc libcurl-devel tesseract-devel leptonica-devel clang gpac-devel
```

Arch:
```bash
sudo paru -S glew glfw curl tesseract leptonica cmake gcc clang
sudo paru -S glew glfw curl tesseract leptonica cmake gcc clang gpac
```

Rust 1.54 or above is also required. [Install Rust](https://www.rust-lang.org/tools/install). Check specific compilation methods below, on how to compile without rust.
Expand Down Expand Up @@ -57,7 +57,7 @@ cd ccextractor/linux
./build -without-rust

# compile with debug info
./build -debug # same as ./build_debug
./build -debug # same as ./builddebug

# compile with hardsubx
[Optional] You need to set these environment variables correctly according to your machine,
Expand Down
2 changes: 1 addition & 1 deletion linux/build
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ SRC_FREETYPE="../src/thirdparty/freetype/autofit/autofit.c
../src/thirdparty/freetype/type42/type42.c
../src/thirdparty/freetype/winfonts/winfnt.c"
BLD_SOURCES="../src/ccextractor.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC $SRC_FREETYPE"
BLD_LINKER="$BLD_LINKER -lm -zmuldefs -l tesseract -l lept -lpthread -ldl -lgpac"
BLD_LINKER="$BLD_LINKER -lm -zmuldefs -l tesseract -l leptonica -lpthread -ldl -lgpac"

echo "Running pre-build script..."
./pre-build.sh
Expand Down
107 changes: 0 additions & 107 deletions linux/build-static.sh

This file was deleted.

63 changes: 63 additions & 0 deletions linux/build_appimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

set -x
set -e

# store the path of where the script is
OLD_CWD=$(readlink -f .)

# store repo root as variable
REPO_ROOT=$(dirname $OLD_CWD)

# Make a temp directory for building stuff which will be cleaned automatically
BUILD_DIR="$OLD_CWD/temp"

# Check if temp directory exist, and if so then remove contents from it
# if not then create temp directory
if [ -d "$BUILD_DIR" ]; then
rm -r "$BUILD_DIR/*" | true
else
mkdir -p "$BUILD_DIR"
fi

# make sure to clean up build dir, even if errors occur
cleanup() {
if [ -d "$BUILD_DIR" ]; then
rm -rf "$BUILD_DIR"
fi
}

# Automatically trigger Cleanup function
trap cleanup EXIT

# switch to build dir
pushd "$BUILD_DIR"

# configure build files with CMake
# we need to explicitly set the install prefix, as CMake's default is /usr/local for some reason...
cmake "$REPO_ROOT/src"

# build project and install files into AppDir
make -j$(nproc) ENABLE_OCR=yes

# download linuxdeploy tool
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage

# make them executable
chmod +x linuxdeploy*.AppImage

# Create AppDir
mkdir -p "$BUILD_DIR/AppDir"

# Link of CCExtractor image of any of these resolution(8x8, 16x16, 20x20, 22x22, 24x24, 28x28, 32x32, 36x36, 42x42,
# 48x48, 64x64, 72x72, 96x96, 128x128, 160x160, 192x192, 256x256, 384x384, 480x480, 512x512) in png extension
PNG_LINK="https://ccextractor.org/images/ccextractor.png"

# Download the image and put it in AppDir
wget "$PNG_LINK" -P AppDir

# now, build AppImage using linuxdeploy
./linuxdeploy-x86_64.AppImage --appdir=AppDir -e ccextractor --create-desktop-file --output appimage -i AppDir/ccextractor.png

# Move resulted AppImage binary to base directory
mv ccextractor*.AppImage "$OLD_CWD"
28 changes: 28 additions & 0 deletions src/lib_ccx/ccx_common_timing.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,34 @@ LLONG get_fts_max(struct ccx_common_timing_ctx *ctx)
return ctx->fts_max + ctx->fts_global;
}

/**
* SCC Time formatting
*/
size_t print_scc_time(struct ccx_boundary_time time, char *buf)
{
char *fmt = "%02u:%02u:%02u;%02u";
double frame;

frame = ((double)(time.time_in_ms - 1000 * (time.ss + 60 * (time.mm + 60 * time.hh))) * 29.97 / 1000);

return (size_t)sprintf(buf + time.set, fmt, time.hh, time.mm, time.ss, (unsigned)frame);
}

struct ccx_boundary_time get_time(LLONG time)
{
if (time < 0) // Avoid loss of data warning with abs()
time = -time;

struct ccx_boundary_time result;
result.hh = (unsigned)(time / 1000 / 60 / 60);
result.mm = (unsigned)(time / 1000 / 60 - 60 * result.hh);
result.ss = (unsigned)(time / 1000 - 60 * (result.mm + 60 * result.hh));
result.time_in_ms = time;
result.set = (time < 0 ? 1 : 0);

return result;
}

/**
* Fill buffer with a time string using specified format
* @param fmt has to contain 4 format specifiers for h, m, s and ms respectively
Expand Down
2 changes: 2 additions & 0 deletions src/lib_ccx/ccx_common_timing.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ struct ccx_common_timing_ctx *init_timing_ctx(struct ccx_common_timing_settings_

void set_current_pts(struct ccx_common_timing_ctx *ctx, LLONG pts);
void add_current_pts(struct ccx_common_timing_ctx *ctx, LLONG pts);
struct ccx_boundary_time get_time(LLONG mstime);
size_t print_scc_time(struct ccx_boundary_time time, char *buf);
int set_fts(struct ccx_common_timing_ctx *ctx);
LLONG get_fts(struct ccx_common_timing_ctx *ctx, int current_field);
LLONG get_fts_max(struct ccx_common_timing_ctx *ctx);
Expand Down
1 change: 1 addition & 0 deletions src/lib_ccx/ccx_decoders_708.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ typedef struct dtvcc_tv_screen
LLONG time_ms_hide;
unsigned int cc_count;
int service_number;
int old_cc_time_end;
} dtvcc_tv_screen;

/**
Expand Down
Loading

0 comments on commit fe093c0

Please sign in to comment.