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

[rust] add parser #1619

Merged
merged 190 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
190 commits
Select commit Hold shift + click to select a range
71c83b6
feat: unpack gpac
prateekmedia May 6, 2023
b8b5994
fix: linux ci
prateekmedia May 6, 2023
1c9d7b5
fix: mac build
prateekmedia May 6, 2023
e3fecf9
fix: remove unused [no ci]
prateekmedia May 6, 2023
3b1e5d0
fix: ignore config.h [no ci]
prateekmedia May 6, 2023
9ed4fe0
temp commit, will drop this soon
prateekmedia May 13, 2023
82c30ce
fix: install gpac
prateekmedia May 13, 2023
c99950a
fix: gpac
prateekmedia May 13, 2023
0794d92
fix: formatting
prateekmedia May 13, 2023
4d18e2e
fix: preproccessor directive
prateekmedia May 13, 2023
fe112e6
fix: comment display version for now
prateekmedia May 13, 2023
4086914
fix: display dlls code
prateekmedia May 14, 2023
6e0bcbf
fix: bundle vcruntime in hardsubx windows
prateekmedia May 14, 2023
cadc476
fix: again
prateekmedia May 14, 2023
b69733f
fix: erros in ci
prateekmedia May 14, 2023
fcf225f
fix: ci
prateekmedia May 14, 2023
93bbe3d
fix: add vcruntime in additional dependencies
prateekmedia May 14, 2023
fa4af06
fix: try to copy vcruntime after build
prateekmedia May 14, 2023
0ca6373
fix: space in runtime library
prateekmedia May 14, 2023
a937be2
fix: remove for now [no ci]
prateekmedia May 14, 2023
4853b29
fix: things in vcxproj
prateekmedia May 20, 2023
104fd2f
fix: ci for leptonica sys
prateekmedia May 20, 2023
62ef593
fix: docs
prateekmedia May 21, 2023
01a6a82
fix: copy dlls on post build event
prateekmedia May 24, 2023
46a13a4
fix: copy vcruntime after build
prateekmedia May 30, 2023
78cefa2
Merge branch 'CCExtractor:master' into master
prateekmedia Aug 18, 2023
c16ab8d
feat: add arguments through clap
prateekmedia Jul 28, 2023
afa0fff
fix: type of some arguments
prateekmedia Jul 28, 2023
6429154
fix: "-" and "--" in comments
prateekmedia Jul 28, 2023
658d531
fix: format files
prateekmedia Jul 28, 2023
1028785
fix: add argument parsing till mkvlang
prateekmedia Aug 2, 2023
1d1fe4c
fix: one todo item
prateekmedia Aug 2, 2023
497b8d7
chore: lint fixes
prateekmedia Aug 2, 2023
1c64346
fix: nocodec value
prateekmedia Aug 3, 2023
27b4b01
fix: for nocodec
prateekmedia Aug 3, 2023
e4f443c
fix: add cfg feature for hardsubx
prateekmedia Aug 3, 2023
81c652c
feat: complete till startcreditstext
prateekmedia Aug 3, 2023
9259702
fix: add more notes, args: option affect processed
prateekmedia Aug 4, 2023
b5d710c
feat: port all till network stuff
prateekmedia Aug 8, 2023
6d4796f
fix: complete almost all argument parsing
prateekmedia Aug 8, 2023
12d1495
fix: error free code
prateekmedia Aug 9, 2023
8f21456
fix: complete params port
prateekmedia Aug 9, 2023
7c685d1
fix: hardsubx erros
prateekmedia Aug 9, 2023
a8ba5a2
feat: clean up main function
prateekmedia Aug 10, 2023
ffd2943
fix: pr reviews
prateekmedia Aug 11, 2023
2e85bb8
fix: make input,output function better
prateekmedia Aug 11, 2023
fe2ce06
fix: variant not used warning
prateekmedia Aug 19, 2023
2191e44
fix: warnings
prateekmedia Aug 19, 2023
7142885
fix: all clippy warnings
prateekmedia Aug 19, 2023
8f8c161
feat: add tests
prateekmedia Aug 19, 2023
4ecd8de
feat: add tests
prateekmedia Aug 20, 2023
9e16276
chore: lint fixes
prateekmedia Aug 20, 2023
1a36bc7
fix: move unit tests to correct folder
prateekmedia Aug 21, 2023
9e12d45
fix: remove unncessary files
prateekmedia Aug 21, 2023
c3f113b
fix: make function for parse_args
prateekmedia Aug 21, 2023
060cddf
fix: review changes
prateekmedia Aug 21, 2023
375432b
fix: Impl CcxOptions whenever I could
prateekmedia Aug 21, 2023
24220b4
fix: try to convert rust to c
prateekmedia Aug 21, 2023
8fe4afe
chore: push c code
prateekmedia Aug 21, 2023
aa8a173
fix: add more rust to c conversions
prateekmedia Aug 22, 2023
e292ccb
fix: use set methods for bitfield
prateekmedia Aug 23, 2023
41d99cd
fix: errors
prateekmedia Aug 23, 2023
0ce5e04
fix: arguments parsing
prateekmedia Aug 23, 2023
b9eb4fc
fix: all issues
prateekmedia Aug 23, 2023
06970a1
fix: many errors
prateekmedia Aug 23, 2023
4fcde9d
chore: lint fix
prateekmedia Aug 23, 2023
b0dabce
fix: err
prateekmedia Aug 23, 2023
2dc0d23
fix: unsafe function error
prateekmedia Aug 24, 2023
0b53387
fix: unsafe warning
prateekmedia Aug 25, 2023
800d879
fix: safety lint
prateekmedia Aug 25, 2023
3a553aa
chore: add docs
prateekmedia Aug 25, 2023
62c36f6
fix: windows build
prateekmedia Aug 25, 2023
2de905d
fix: function
prateekmedia Aug 25, 2023
f5fdc0e
fix: dependencies
prateekmedia Aug 25, 2023
5c8609b
fix: set_binary_mode
prateekmedia Aug 26, 2023
8fda4bd
chore: lint fix
prateekmedia Aug 26, 2023
da7e726
fix: set_binary_mode for windows
prateekmedia Aug 27, 2023
54e7a7b
fix: error
prateekmedia Aug 29, 2023
4468f2a
fix: undefined reference error
prateekmedia Aug 29, 2023
9e5319b
chore: remove comment
prateekmedia Aug 29, 2023
3555064
Merge branch 'CCExtractor:master' into rusty-ccextractor
prateekmedia Sep 1, 2023
73de871
fix: output field
prateekmedia Sep 10, 2023
dfc64e2
chore: fix lint
prateekmedia Sep 10, 2023
094671e
fix: ru1, ru2, ru3
prateekmedia Sep 10, 2023
9db014f
fix: undef before
prateekmedia Sep 11, 2023
13fd4f2
fix: parameter and update deps
prateekmedia Sep 11, 2023
4edf72f
chore: update vcpkg
prateekmedia Sep 11, 2023
823f1b3
feat: add release-with-debug profile
prateekmedia Sep 24, 2023
617267c
fix; uncomment code
prateekmedia Sep 24, 2023
76ed1bf
Merge branch 'master' into rusty-ccextractor
prateekmedia Sep 24, 2023
83ec282
fix: update visual studio to 2022
prateekmedia Sep 24, 2023
63b3b37
chore: update docs
prateekmedia Sep 24, 2023
b1f9e55
fix: use default vcpkg
prateekmedia Sep 24, 2023
b56d44e
fix: caching logic on release ci
prateekmedia Sep 24, 2023
822edc1
fix: vcpkg caching
prateekmedia Sep 24, 2023
4f3be46
fix: add setup vcpkg
prateekmedia Sep 24, 2023
7a16ba8
chore: remove unneccesary formatting
prateekmedia Sep 26, 2023
0a2ed69
fix: Always write 2 bytes for UTF-16BE
prateekmedia Sep 26, 2023
62d1e8d
Merge branch 'CCExtractor:master' into master
prateekmedia Sep 26, 2023
36bee73
fix: formatting
prateekmedia Sep 26, 2023
2c5a894
Merge branch 'CCExtractor:master' into master
prateekmedia Dec 7, 2023
39b4f5d
Merge branch 'CCExtractor:master' into master
prateekmedia Jan 10, 2024
b65f340
feat: add rest of the notes to bring continuity
prateekmedia Jan 14, 2024
0e0edc6
fix: remove extra line
prateekmedia Jan 14, 2024
cdb65f9
fix: add hardsubx note
prateekmedia Jan 14, 2024
e5c6e2d
Merge branch 'CCExtractor:master' into rusty-ccextractor
prateekmedia Jan 14, 2024
4db3260
Merge branch 'CCExtractor:master' into master
prateekmedia Jan 14, 2024
8a95f7c
fix: source code format error
prateekmedia Jan 15, 2024
bd68411
chore: lint fixes acc to rustfmt
prateekmedia Jan 15, 2024
dee7d41
feat: add unit test ci
prateekmedia Jan 15, 2024
132de1a
fix: conversion of strings, add file queue handling
prateekmedia Apr 14, 2024
5a43799
fix: decoder cfg
prateekmedia Apr 14, 2024
fe093c0
Merge branch 'master' into rusty-ccextractor
prateekmedia Apr 14, 2024
9c5eb06
fix: update dependencies
prateekmedia Apr 14, 2024
021fa39
chore: lint fix
prateekmedia Apr 14, 2024
a0cef4b
chore: add safety doc
prateekmedia Apr 14, 2024
36aa62a
fix: default value for CcxOptions
prateekmedia May 11, 2024
a4aa3c6
fix(rust): default value for teletext
prateekmedia May 11, 2024
461ef55
fix: leptonica version for windows
prateekmedia May 11, 2024
11b3315
fix: format errors
prateekmedia May 12, 2024
e7da98c
fix: workflow
prateekmedia May 19, 2024
7db22c8
Revert "fix: leptonica version for windows"
prateekmedia May 19, 2024
2f83b38
fix: pin ffmpeg to 6 for mac
prateekmedia May 19, 2024
210d94d
fix(parser): default values and unwrap's
prateekmedia May 23, 2024
a75b3e5
fix(parser): hardsubx fixes
prateekmedia May 23, 2024
a391534
chore(parse): lint fixes
prateekmedia May 23, 2024
0ad0116
fix(windows): switch back to sdk 2019
prateekmedia May 23, 2024
71ab3e9
fix(workflow): windows workflow revert
prateekmedia May 23, 2024
5a9d13b
fix(windows): revert to old files which were working before
prateekmedia May 24, 2024
10cba7a
fix(workflow): pin vcpkg packages
prateekmedia May 24, 2024
6c93f2d
chore(rust): downgrade leptonica
prateekmedia May 24, 2024
13e45f0
fix(windows): move vcpkg.json to correct place
prateekmedia May 24, 2024
3b683b0
fix(windows): improve vcxproj
prateekmedia May 24, 2024
39f1455
fix(windows): workflow
prateekmedia May 24, 2024
30f7343
fix(windows): workflow
prateekmedia May 24, 2024
0fa3b9d
fix(windows): workflow clone from vcpkg everytime
prateekmedia May 24, 2024
c3f6619
fix(workflow): error
prateekmedia May 24, 2024
d8392c8
fix(workflow): don't skip building vcpkg
prateekmedia May 24, 2024
44eea4e
fix: remove depth from vcpkg
prateekmedia May 24, 2024
d775242
temporary commit
prateekmedia May 24, 2024
c083596
fix(windows): pin gpac and use local vcpkg manifest properly
prateekmedia May 25, 2024
fe0c993
fix(windows): install vcpkg dependencies manually
prateekmedia May 25, 2024
3bf6e51
fix(windows): update dll names
prateekmedia May 25, 2024
f452b3f
fix(windows); dependencies copy
prateekmedia May 25, 2024
4046ca5
fix(windows): don't continue on error for release
prateekmedia May 25, 2024
a9ae858
fix(macos): build ffmpeg for mac workflow
prateekmedia May 27, 2024
4a47f53
fix: move ffmpeg to current workspace
prateekmedia May 27, 2024
5fef868
Merge remote-tracking branch 'origin' into rusty-ccextractor
prateekmedia Jun 9, 2024
e38f250
Merge branch 'master' into rusty-ccextractor
prateekmedia Jun 9, 2024
d14c88f
fix: re-add profile for windows
prateekmedia Jun 9, 2024
c5ea8fa
fix: pkg config for mac
prateekmedia Jun 9, 2024
65ecb67
fix(mac): use ffmpeg@6 from brew
prateekmedia Jun 9, 2024
a140094
fix(macos): there is no ffmpeg_prebuilt
prateekmedia Jun 9, 2024
5e71d20
fix(macos): specify ffmpeg pkg config
prateekmedia Jun 9, 2024
ab21af8
fix(macos): globally define pkg config
prateekmedia Jun 9, 2024
409c1b0
fix(macos): add ffmpeg include and libs dir
prateekmedia Jun 9, 2024
71f28cf
fix(macos): include ffmpeg headers in makefile
prateekmedia Jun 9, 2024
ba628b9
fix: include ffmpeg libraries and include directories
prateekmedia Jun 9, 2024
02445c8
fix: try to manually specify ffmpeg header in rust
prateekmedia Jun 14, 2024
f6b62ce
fix: also include leptonica headres
prateekmedia Jun 14, 2024
c618f1c
fix: leptonica name
prateekmedia Jun 14, 2024
fafb4bc
fix: test
prateekmedia Jun 14, 2024
7dcda15
fix: string null when output_filename is empty
prateekmedia Jun 20, 2024
d46d885
fix: error
prateekmedia Jun 20, 2024
9efb629
fix: remove cflgas
prateekmedia Jun 20, 2024
3a4f7d2
fix(mac): disable cmake ocr hardsubx
prateekmedia Jun 20, 2024
cf4fc75
chore: update gitignore
prateekmedia Jun 20, 2024
3ff533b
fix: null if string is empty
prateekmedia Jun 20, 2024
5e81583
fix: allow --in
prateekmedia Jun 20, 2024
c0d63b6
chore: bump version to 1.0 in rust
prateekmedia Jun 23, 2024
11bf64a
chore: add space to trigger sp
prateekmedia Jun 25, 2024
bdd2d18
fix: don't panic with rust
prateekmedia Jul 2, 2024
d2dcf3b
fix: add double dashes to indicate parameters
prateekmedia Jul 2, 2024
e26df57
chore: update CHANGES.txt
prateekmedia Jul 2, 2024
7514df3
fix: test
prateekmedia Jul 2, 2024
0f0e3cf
fix(workflow): update workflow name
prateekmedia Jul 2, 2024
ae396b5
fix(rust): linux output_filename in sampleplatform
prateekmedia Jul 2, 2024
ca440e0
fix(rust): parser default values
prateekmedia Jul 3, 2024
efa12dc
fix(rust): exit with MalformedParameter instead of panic
prateekmedia Jul 6, 2024
f0055a9
fix(decoder): revert always write 2 bytes
prateekmedia Jul 6, 2024
50cb4e8
Merge branch 'master' into rusty-ccextractor
prateekmedia Jul 6, 2024
463113f
chore(rust): format
prateekmedia Jul 6, 2024
068b9ca
Merge remote-tracking branch 'upstream/master' into rusty-ccextractor
prateekmedia Aug 5, 2024
71eee02
chore: update lock file
prateekmedia Aug 5, 2024
9b2becf
fix(test): test lib_ccxr and rename to test
prateekmedia Aug 5, 2024
8d87a18
fix(mac): remove failing cmake_ocr test
prateekmedia Aug 5, 2024
7d66a5a
fix: ci errors
prateekmedia Aug 9, 2024
75ae7dd
fix: feature related changes
prateekmedia Aug 9, 2024
9f55324
fix: trim down default features
prateekmedia Aug 9, 2024
a98e308
fix: don't check clippy for all features
prateekmedia Aug 9, 2024
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
16 changes: 0 additions & 16 deletions .github/workflows/build_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,6 @@ jobs:
working-directory: build
- name: Display version information
run: ./build/ccextractor --version
cmake_ocr_hardsubx:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: brew install pkg-config autoconf automake libtool tesseract leptonica gpac ffmpeg
- name: cmake
run: |
mkdir build && cd build
cmake -DWITH_OCR=ON -DWITH_HARDSUBX=ON ../src
- name: build
run: |
make -j$(nproc)
working-directory: build
- name: Display version information
run: ./build/ccextractor --version
build_rust:
runs-on: macos-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
run: cargo fmt --all -- --check
- name: clippy
run: |
cargo clippy --all-features -- -D warnings
cargo clippy -- -D warnings
37 changes: 37 additions & 0 deletions .github/workflows/test_rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Unit Test Rust
on:
push:
paths:
- ".github/workflows/test.yml"
- "src/rust/**"
tags-ignore:
- "*.*"
pull_request:
types: [opened, synchronize, reopened]
paths:
- ".github/workflows/test.yml"
- "src/rust/**"
jobs:
test_rust:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src/rust
steps:
- uses: actions/checkout@v4
- name: cache
uses: actions/cache@v3
with:
path: |
src/rust/.cargo/registry
src/rust/.cargo/git
src/rust/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Test main module
run: cargo test
working-directory: ./src/rust
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ CVS
mac/ccextractor
linux/ccextractor
linux/depend
windows/x86_64-pc-windows-msvc/**
windows/Debug/**
windows/Debug-OCR/**
windows/release-with-debug/**
windows/Release/**
windows/Release-Full/**
windows/Release-OCR/**
Expand Down Expand Up @@ -154,3 +156,4 @@ windows/ccx_rust.lib
windows/*/debug/*
windows/*/CACHEDIR.TAG
windows/.rustc_info.json
linux/configure~
3 changes: 2 additions & 1 deletion docs/CHANGES.TXT
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.95 (to be released)
1.0 (to be released)
-----------------
- Breaking: Major argument flags revamp for CCExtractor (#1564 & #1619)
- New: Create a Docker image to simplify the CCExtractor usage without any environmental hustle (#1611)
- New: Add time units module in lib_ccxr (#1623)
- New: Add bits and levenshtein module in lib_ccxr (#1627)
Expand Down
2 changes: 1 addition & 1 deletion docs/FFMPEG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Note:If you installed ffmpeg on non-standard location, please change/update your

### On Windows:
#### Set preprocessor flag `ENABLE_FFMPEG=1`
1. In visual studio 2013 right click <Project> and select property.
1. In visual studio 2022 right click <Project> and select property.
2. In the left panel, select Configuration Properties, C/C++, Preprocessor.
3. In the right panel, in the right-hand column of the Preprocessor Definitions property, open the drop-down menu and choose Edit.
4. In the Preprocessor Definitions dialog box, add `ENABLE_FFMPEG=1`. Choose OK to save your changes.
4 changes: 2 additions & 2 deletions docs/OCR.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ Download prebuild library of leptonica and tesseract from following link
https://drive.google.com/file/d/0B2ou7ZfB-2nZOTRtc3hJMHBtUFk/view?usp=sharing

put the path of libs/include of leptonica and tesseract in library paths.
1. In visual studio 2013 right click <Project> and select property.
1. In visual studio 2022 right click <Project> and select property.
2. Select Configuration properties in left panel(column) of property.
3. Select VC++ Directory.
4. In the right pane, in the right-hand column of the VC++ Directory property, open the drop-down menu and choose Edit.
5. Add path of Directory where you have kept uncompressed library of leptonica and tesseract.


Set preprocessor flag ENABLE_OCR=1
1. In visual studio 2013 right click <Project> and select property.
1. In visual studio 2022 right click <Project> and select property.
2. In the left panel, select Configuration Properties, C/C++, Preprocessor.
3. In the right panel, in the right-hand column of the Preprocessor Definitions property, open the drop-down menu and choose Edit.
4. In the Preprocessor Definitions dialog box, add ENABLE_OCR=1. Choose OK to save your changes.
Expand Down
3 changes: 2 additions & 1 deletion mac/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ GPAC_CPPFLAGS = $(shell pkg-config --cflags gpac)

ccextractor_CPPFLAGS =-I../src/lib_ccx/ -I../src/thirdparty/libpng/ -I../src/thirdparty/zlib/ -I../src/lib_ccx/zvbi/ -I../src/thirdparty/lib_hash/ -I../src/thirdparty/protobuf-c/ -I../src/thirdparty -I../src/ -I../src/thirdparty/freetype/include/
ccextractor_CPPFLAGS += $(GPAC_CPPFLAGS)
ccextractor_CPPFLAGS += $(FFMPEG_CPPFLAGS)

ccextractor_LDADD=-lm -lpthread -ldl

Expand All @@ -271,7 +272,7 @@ if HARDSUBX_IS_ENABLED
ccextractor_CFLAGS += -DENABLE_HARDSUBX
ccextractor_CPPFLAGS+= ${libavcodec_CFLAGS}
ccextractor_CPPFLAGS+= ${libavformat_CFLAGS}
ccextractor_CPPFLAGS+= ${libavutil_CFALGS}
ccextractor_CPPFLAGS+= ${libavutil_CFLAGS}
ccextractor_CPPFLAGS+= ${libswscale_CFLAGS}
AV_LIB = ${libavcodec_LIBS}
AV_LIB += ${libavformat_LIBS}
Expand Down
4 changes: 4 additions & 0 deletions src/ccextractor.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,11 @@ int main(int argc, char *argv[])
// If "ccextractor.cnf" is present, takes options from it.
// See docs/ccextractor.cnf.sample for more info.

#ifndef DISABLE_RUST
int compile_ret = ccxr_parse_parameters(api_options, argc, argv);
#else
int compile_ret = parse_parameters(api_options, argc, argv);
#endif

if (compile_ret == EXIT_NO_INPUT_FILES)
{
Expand Down
3 changes: 3 additions & 0 deletions src/lib_ccx/lib_ccx.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ extern void ccxr_init_basic_logger(struct ccx_s_options *opts);
void print_end_msg(void);

//params.c
#ifndef DISABLE_RUST
extern int ccxr_parse_parameters(struct ccx_s_options *opt, int argc, char *argv[]);
#endif
int parse_parameters (struct ccx_s_options *opt, int argc, char *argv[]);
void print_usage (void);
int atoi_hex (char *s);
Expand Down
4 changes: 2 additions & 2 deletions src/lib_ccx/matroska.c
Original file line number Diff line number Diff line change
Expand Up @@ -1362,8 +1362,8 @@ int matroska_loop(struct lib_ccx_ctx *ctx)
{
if (ccx_options.write_format_rewritten)
{
mprint(MATROSKA_WARNING "You are using -out=<format>, but Matroska parser extract subtitles in a recorded format\n");
mprint("-out=<format> will be ignored\n");
mprint(MATROSKA_WARNING "You are using --out=<format>, but Matroska parser extract subtitles in a recorded format\n");
mprint("--out=<format> will be ignored\n");
}

// Don't need generated input file
Expand Down
18 changes: 12 additions & 6 deletions src/lib_ccx/params.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ int parsedelay(struct ccx_s_options *opt, char *par)
return 0;
}

void set_binary_mode()
{
#ifdef WIN32
setmode(fileno(stdin), O_BINARY);
#endif
}

int append_file_to_queue(struct ccx_s_options *opt, char *filename)
{
if (filename[0] == '\0') // skip files with empty file name (ex : ./ccextractor "")
Expand Down Expand Up @@ -978,14 +985,14 @@ void print_usage(void)
mprint(" a .d extension. Each .png file will contain an image representing one caption\n");
mprint(" and named subNNNN.png, starting with sub0000.png.\n");
mprint(" For example, the command:\n");
mprint(" ccextractor -out=spupng input.mpg\n");
mprint(" ccextractor --out=spupng input.mpg\n");
mprint(" will create the files:\n");
mprint(" input.xml\n");
mprint(" input.d/sub0000.png\n");
mprint(" input.d/sub0001.png\n");
mprint(" ...\n");
mprint(" The command:\n");
mprint(" ccextractor -out=spupng -o /tmp/output --12 input.mpg\n");
mprint(" ccextractor --out=spupng -o /tmp/output --12 input.mpg\n");
mprint(" will create the files:\n");
mprint(" /tmp/output_1.xml\n");
mprint(" /tmp/output_1.d/sub0000.png\n");
Expand Down Expand Up @@ -1245,9 +1252,8 @@ int parse_parameters(struct ccx_s_options *opt, int argc, char *argv[])
}
if (strcmp(argv[i], "-") == 0 || strcmp(argv[i], "--stdin") == 0)
{
#ifdef WIN32
setmode(fileno(stdin), O_BINARY);
#endif
set_binary_mode();

opt->input_source = CCX_DS_STDIN;
if (!opt->live_stream)
opt->live_stream = -1;
Expand Down Expand Up @@ -2934,7 +2940,7 @@ int parse_parameters(struct ccx_s_options *opt, int argc, char *argv[])
}
if (opt->write_format == CCX_OF_SPUPNG && opt->cc_to_stdout)
{
print_error(opt->gui_mode_reports, "You cannot use -out=spupng with -stdout.\n");
print_error(opt->gui_mode_reports, "You cannot use --out=spupng with -stdout.\n");
return EXIT_INCOMPATIBLE_PARAMETERS;
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib_ccx/ts_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ int parse_PMT(struct ccx_demuxer *ctx, unsigned char *buf, int len, struct progr
#ifndef ENABLE_OCR
if (ccx_options.write_format != CCX_OF_SPUPNG)
{
mprint("DVB subtitles detected, OCR subsystem not present. Use -out=spupng for graphic output\n");
mprint("DVB subtitles detected, OCR subsystem not present. Use --out=spupng for graphic output\n");
continue;
}
#endif
Expand Down
Loading
Loading