mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-08 13:34:59 +00:00
Compare commits
201 Commits
v0.88
...
compatibil
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fdf31238a | ||
|
|
1d7589e653 | ||
|
|
e09abe7a83 | ||
|
|
e86e8692a8 | ||
|
|
961bfda727 | ||
|
|
8218d5ff73 | ||
|
|
5850ef073d | ||
|
|
7347440277 | ||
|
|
4007198342 | ||
|
|
c09524d043 | ||
|
|
d81c692bbb | ||
|
|
6d366bfdc6 | ||
|
|
ceb0110378 | ||
|
|
f06436c1fe | ||
|
|
67e15aaf80 | ||
|
|
5b29ef281a | ||
|
|
24b90970c7 | ||
|
|
84e6891922 | ||
|
|
0dcdf72042 | ||
|
|
e3b939baad | ||
|
|
0e5910ebee | ||
|
|
8a81a57a24 | ||
|
|
02d84d27d0 | ||
|
|
a2af0d7044 | ||
|
|
4f5bd7bf37 | ||
|
|
91ef488dff | ||
|
|
1af107aef8 | ||
|
|
9a60796674 | ||
|
|
7f4acae74b | ||
|
|
fa8b0a3023 | ||
|
|
acb55470f6 | ||
|
|
97da554da6 | ||
|
|
a121823adc | ||
|
|
cb85740690 | ||
|
|
e91a13bb60 | ||
|
|
a063be996b | ||
|
|
19da837232 | ||
|
|
22a494d834 | ||
|
|
2e68e9f600 | ||
|
|
b1c22e5034 | ||
|
|
e3c54327e8 | ||
|
|
9e62f8c557 | ||
|
|
6216247ecb | ||
|
|
082100a0d4 | ||
|
|
cf828471d6 | ||
|
|
cf84757e02 | ||
|
|
f486efbb57 | ||
|
|
0db5b0c838 | ||
|
|
e411a75dcd | ||
|
|
33ecccedce | ||
|
|
28dd35b040 | ||
|
|
e82a492c94 | ||
|
|
4509b9daf5 | ||
|
|
d330b78f37 | ||
|
|
ab89f88aea | ||
|
|
0227c2787a | ||
|
|
84dec36845 | ||
|
|
b4f692807a | ||
|
|
1f5ec6cd8d | ||
|
|
6f375cd9b3 | ||
|
|
e959654c6f | ||
|
|
18484d555f | ||
|
|
1534d81ae7 | ||
|
|
84b5df2713 | ||
|
|
8e729cc62c | ||
|
|
0f1f4d889f | ||
|
|
487b521c9b | ||
|
|
1aed90e42c | ||
|
|
e2d387bfa9 | ||
|
|
b974a7ed81 | ||
|
|
522ebae65e | ||
|
|
1b17a04b25 | ||
|
|
588c4a8187 | ||
|
|
88830e6c58 | ||
|
|
db646f50ac | ||
|
|
b1c9540085 | ||
|
|
e98137e059 | ||
|
|
3c37d49764 | ||
|
|
a8d6b81baf | ||
|
|
b8321cac0f | ||
|
|
6697ed3496 | ||
|
|
722d52420c | ||
|
|
af6d8282cb | ||
|
|
732b20aefa | ||
|
|
54318d0402 | ||
|
|
5f61fae0c7 | ||
|
|
0afba56a26 | ||
|
|
0873953d9f | ||
|
|
75af5f2e8c | ||
|
|
8d8dc9ccc2 | ||
|
|
e37a21aace | ||
|
|
40a603d366 | ||
|
|
c5bed1e3b2 | ||
|
|
8db3398eb7 | ||
|
|
7b038ab649 | ||
|
|
7d0c2ede26 | ||
|
|
60773bb859 | ||
|
|
a919ef4410 | ||
|
|
424e67f5f4 | ||
|
|
4097831b9b | ||
|
|
1764aa1f92 | ||
|
|
19de49763a | ||
|
|
a0b4e389f9 | ||
|
|
2281051d3d | ||
|
|
fc21280857 | ||
|
|
746806dcef | ||
|
|
812734fd2a | ||
|
|
66d59e498b | ||
|
|
5599ce9eaf | ||
|
|
2e2075ca52 | ||
|
|
c69d2db52b | ||
|
|
54ecce8b86 | ||
|
|
82b60988bb | ||
|
|
ab1af7c678 | ||
|
|
84ba7c5238 | ||
|
|
676be1f193 | ||
|
|
e8cb55e739 | ||
|
|
30613b224a | ||
|
|
19241744d7 | ||
|
|
27288ccf89 | ||
|
|
34282c17b8 | ||
|
|
227f149670 | ||
|
|
27477e9f7c | ||
|
|
b3018e083e | ||
|
|
96de55429d | ||
|
|
863eacc440 | ||
|
|
78249045f8 | ||
|
|
dad108b7e1 | ||
|
|
79f18b996b | ||
|
|
987c5cd301 | ||
|
|
34d0df1d96 | ||
|
|
1db731a7a8 | ||
|
|
af67596e66 | ||
|
|
86f98ddf5f | ||
|
|
bba6c4fcfd | ||
|
|
af64fa8a3d | ||
|
|
e1d3060232 | ||
|
|
3a1815163f | ||
|
|
0954b47a24 | ||
|
|
594a83cc4e | ||
|
|
ecec3ea22b | ||
|
|
f9cfc7219d | ||
|
|
c854d25963 | ||
|
|
4fe32b1482 | ||
|
|
5fcb31d279 | ||
|
|
b2d3a2fefc | ||
|
|
70ac7f9a40 | ||
|
|
f739d54cbc | ||
|
|
fc78fc3192 | ||
|
|
b0e5eb03e1 | ||
|
|
84cff4d6d8 | ||
|
|
e5575a0f50 | ||
|
|
f4961a0bd8 | ||
|
|
e3e810f34e | ||
|
|
57eb1795aa | ||
|
|
37e4d4163f | ||
|
|
59a8c7a049 | ||
|
|
8ef89f6bf1 | ||
|
|
2739602575 | ||
|
|
a7d2264cc1 | ||
|
|
7d8499a7fb | ||
|
|
99a12b8737 | ||
|
|
5b29db341f | ||
|
|
777ce98aa5 | ||
|
|
fe9c94d50c | ||
|
|
6d074928b6 | ||
|
|
1e32bee8e5 | ||
|
|
6281e128aa | ||
|
|
c1c0627dab | ||
|
|
9cfc345041 | ||
|
|
f3a72bff3d | ||
|
|
e906585287 | ||
|
|
b27c6fe415 | ||
|
|
5e888ee895 | ||
|
|
c9f55f5a39 | ||
|
|
1e9939bc8a | ||
|
|
df66746e89 | ||
|
|
5dac23f156 | ||
|
|
a3148f07ac | ||
|
|
75e21feee3 | ||
|
|
334a87aed1 | ||
|
|
ee3418cd60 | ||
|
|
b9ca8a1291 | ||
|
|
280b4308f7 | ||
|
|
45eec1c919 | ||
|
|
7ad5859629 | ||
|
|
bdfe4ca25b | ||
|
|
3020fd24e7 | ||
|
|
0f2a5b3b96 | ||
|
|
8fec59e753 | ||
|
|
7598225ee1 | ||
|
|
8a9d924fc1 | ||
|
|
2bcd993c0f | ||
|
|
e461c14b48 | ||
|
|
c9a6707fdc | ||
|
|
6cb70be4a4 | ||
|
|
403581462e | ||
|
|
9e212fa104 | ||
|
|
b6978f2fd8 | ||
|
|
513372978c | ||
|
|
de9b198496 |
7
.clang-format
Normal file
7
.clang-format
Normal file
@@ -0,0 +1,7 @@
|
||||
BreakBeforeBraces: Allman
|
||||
ColumnLimit: 0
|
||||
IndentCaseLabels: true
|
||||
IndentWidth: 8
|
||||
TabWidth: 8
|
||||
UseTab: Always
|
||||
SortIncludes: false
|
||||
47
.github/ISSUE_TEMPLATE.md
vendored
47
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,8 +1,26 @@
|
||||
Please prefix your issue with one of the following: [BUG], [PROPOSAL], [QUESTION].
|
||||
|
||||
CCExtractor version (using the --version parameter preferably) : **X.X**
|
||||
To get the version of CCExtractor, you can use `--version`.
|
||||
|
||||
**In raising this issue, I confirm the following (please check boxes, eg [X] - and delete unchecked ones):**
|
||||
Please check all that apply and **remove the ones that do not**.
|
||||
|
||||
In the necessary information section, if this is a regression (something that used to work does not work anymore), make sure to specify the last known working version.
|
||||
|
||||
Only specify the minimum number of arguments needed to reproduce the issue.
|
||||
|
||||
In the additional information section, describe your problem.
|
||||
|
||||
Please make the affected input file available for us (no screenshots, those don't help!). Public links to Dropbox, Google Drive, etc, are all fine. If it is not possible to make it available publicly, send us a private invitation (both Dropbox and Google Drive allow that). In this case we will download the file and upload it to the private developer repository. Methods to send the private invitation to us can be found [here](https://ccextractor.org/public:general:support#email).
|
||||
|
||||
Do **not** upload your file to any location that will require us to sign up or endure a wait list, slow downloads, etc. If your upload expires make sure you keep it active somehow (replace links if needed). Keep in mind that while we go over all tickets some may take a few days, and it's important we have the file available when we actually need it.
|
||||
|
||||
Make sure to enable notifications in GitHub so you get notifications about your ticket. We may need to ask questions and we do everything inside GitHub's system.
|
||||
|
||||
Once you have read all of the instructions **delete all the text from here to the top**.
|
||||
|
||||
CCExtractor version: {replace with the version}
|
||||
|
||||
# In raising this issue, I confirm the following:
|
||||
|
||||
- [ ] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md).
|
||||
- [ ] I have checked that the bug-fix I am reporting can be replicated, or that the feature I am suggesting isn't already present.
|
||||
@@ -10,27 +28,18 @@ CCExtractor version (using the --version parameter preferably) : **X.X**
|
||||
- [ ] I have checked that the issue I'm porting isn't already solved and no duplicates exist in [closed issues](https://github.com/CCExtractor/ccextractor/issues?q=is%3Aissue+is%3Aclosed) and in [opened issues](https://github.com/CCExtractor/ccextractor/issues)
|
||||
- [ ] I have checked the pull requests tab for existing solutions/implementations to my issue/suggestion.
|
||||
- [ ] I have used the latest available version of CCExtractor to verify this issue exists.
|
||||
- [ ] I have ticked all the boxes in this section and to prove it I'm deleting the section completely to remove boilerplate text.
|
||||
|
||||
**My familiarity with the project is as follows (check one, eg [X] - and delete unchecked ones):**
|
||||
# Necessary information
|
||||
|
||||
- [ ] I have never used CCExtractor.
|
||||
- [ ] I have used CCExtractor just a couple of times.
|
||||
- [ ] I absolutely love CCExtractor, but have not contributed previously.
|
||||
- [ ] I am an active contributor to CCExtractor.
|
||||
- Is this a regression (i.e. did it work before)? {YES/NO}
|
||||
- What platform did you use? {Window/Linux/Mac}
|
||||
- What were the used arguments? `{replace with the arguments}`
|
||||
|
||||
**Necessary information**
|
||||
- Is this a regression (did it work before)? [ ] NO | [ ] YES - *please specify the last known working version*
|
||||
- What platform did you use? [ ] Windows - [ ] Linux - [ ] Mac
|
||||
- What were the used arguments? `-autoprogram`
|
||||
# Video links
|
||||
|
||||
**Video links (replace text below with your links) **
|
||||
* {Replace with a link to a video file}
|
||||
|
||||
Please make the affected input file available for us (no screenshots, those don't help!). Public links to Dropbox, Google Drive, etc, are all fine. If it is not possible to make it available publicly, send us a private invitation (both Dropbox and Google Drive allow that). In this case we will download the file and upload it to the private developer repository.
|
||||
|
||||
Do *not* upload your file to any location that will require us to sign up or endure a wait list, slow downloads, etc. If your upload expires make sure you keep it active somehow (replace links if needed). Keep in mind that while we go over all tickets some may take a few days, and it's important we have the file available when we actually need it.
|
||||
|
||||
**Additional information**
|
||||
# Additional information
|
||||
|
||||
{issue content here, replace this line with your issue content}
|
||||
|
||||
PS: Make sure you set an alert in GitHub so you get notifications about your ticket. We may need to ask questions and we do everything inside GitHub's system.
|
||||
|
||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,4 +1,4 @@
|
||||
Please prefix your pull request with one of the following: **[FEATURE]** **[FIX]** **[IMPROVEMENT]**.
|
||||
<!-- Please prefix your pull request with one of the following: **[FEATURE]** **[FIX]** **[IMPROVEMENT]**. -->
|
||||
|
||||
**In raising this pull request, I confirm the following (please check boxes):**
|
||||
|
||||
|
||||
9
.github/dependabot.yml
vendored
Normal file
9
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "10:00"
|
||||
timezone: America/Los_Angeles
|
||||
open-pull-requests-limit: 10
|
||||
89
.github/workflows/build_linux.yml
vendored
Normal file
89
.github/workflows/build_linux.yml
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
name: Build CCExtractor on Linux
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '.github/workflows/build_linux.yml'
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- '**Makefile**'
|
||||
- 'linux/**'
|
||||
- 'package_creators/**'
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
paths:
|
||||
- '.github/workflows/build_linux.yml'
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- '**Makefile**'
|
||||
- 'linux/**'
|
||||
- 'package_creators/**'
|
||||
jobs:
|
||||
build_shell:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install tesseract
|
||||
run: sudo apt-get install libtesseract-dev
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- name: build
|
||||
run: ./build
|
||||
working-directory: ./linux
|
||||
- name: Display version information
|
||||
run: ./linux/ccextractor --version
|
||||
- name: Prepare artifacts
|
||||
run: mkdir ./linux/artifacts
|
||||
- name: Copy release artifact
|
||||
run: cp ./linux/ccextractor ./linux/artifacts/
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: CCExtractor Linux build
|
||||
path: ./linux/artifacts
|
||||
build_autoconf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- name: run autogen
|
||||
run: ./autogen.sh
|
||||
working-directory: ./linux
|
||||
- name: configure
|
||||
run: ./configure
|
||||
working-directory: ./linux
|
||||
- name: make
|
||||
run: make
|
||||
working-directory: ./linux
|
||||
- name: Display version information
|
||||
run: ./linux/ccextractor --version
|
||||
cmake:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- name: cmake
|
||||
run: mkdir build && cd build && cmake ../src
|
||||
- name: build
|
||||
run: make -j$(nproc)
|
||||
working-directory: build
|
||||
- name: Display version information
|
||||
run: ./build/ccextractor --version
|
||||
cmake_ocr_hardsubx:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- name: dependencies
|
||||
run: sudo apt update && sudo apt install libtesseract-dev libavformat-dev libswscale-dev
|
||||
- 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
|
||||
bazel:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- name: bazel build
|
||||
working-directory: ./
|
||||
run: bazel build //src:ccextractor --verbose_failures
|
||||
- name: Display version information
|
||||
working-directory: ./bazel-bin
|
||||
run: ./src/ccextractor --version
|
||||
111
.github/workflows/build_windows.yml
vendored
Normal file
111
.github/workflows/build_windows.yml
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
name: Build CCExtractor on Windows
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '.github/workflows/build_windows.yml'
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'windows/**'
|
||||
tags-ignore:
|
||||
- '*.*'
|
||||
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
paths:
|
||||
- '.github/workflows/build_windows.yml'
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'windows/**'
|
||||
|
||||
jobs:
|
||||
build_non_ocr_release:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2.3.4
|
||||
- name: Setup MSBuild.exe
|
||||
uses: microsoft/setup-msbuild@v1.0.2
|
||||
- name: build Release
|
||||
run: msbuild ccextractor.sln /p:Configuration=Release
|
||||
working-directory: ./windows
|
||||
- name: Display version information
|
||||
run: ./ccextractorwin.exe --version
|
||||
working-directory: ./windows/Release
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: CCExtractor Windows Non-OCR Release build
|
||||
path: |
|
||||
./windows/Release/ccextractorwin.exe
|
||||
./windows/Release/ccextractorgui.exe
|
||||
./windows/Release/*.dll
|
||||
build_non_ocr_debug:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2.3.4
|
||||
- name: Setup MSBuild.exe
|
||||
uses: microsoft/setup-msbuild@v1.0.2
|
||||
- name: build Debug
|
||||
run: msbuild ccextractor.sln /p:Configuration=Debug
|
||||
working-directory: ./windows
|
||||
- name: Display version information
|
||||
run: ./ccextractorwin.exe --version
|
||||
working-directory: ./windows/Debug
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: CCExtractor Windows Non-OCR Debug build
|
||||
path: |
|
||||
./windows/Debug/ccextractorwin.exe
|
||||
./windows/Debug/ccextractorwin.pdb
|
||||
./windows/Debug/ccextractorgui.exe
|
||||
./windows/Debug/*.dll
|
||||
build_ocr_hardsubx_release:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2.3.4
|
||||
- name: Setup MSBuild.exe
|
||||
uses: microsoft/setup-msbuild@v1.0.2
|
||||
- name: build Release
|
||||
run: msbuild ccextractor.sln /p:Configuration=Release-Full
|
||||
working-directory: ./windows
|
||||
- name: Display version information
|
||||
run: ./ccextractorwinfull.exe --version
|
||||
working-directory: ./windows/Release-Full
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: CCExtractor Windows OCR and HardSubX Release build
|
||||
path: |
|
||||
./windows/Release-Full/ccextractorwinfull.exe
|
||||
./windows/Release-Full/*.dll
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: CCExtractor Windows OCR and HardSubX Release build
|
||||
path: |
|
||||
./windows/Release/ccextractorgui.exe
|
||||
build_ocr_hardsubx_debug:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2.3.4
|
||||
- name: Setup MSBuild.exe
|
||||
uses: microsoft/setup-msbuild@v1.0.2
|
||||
- name: build Debug
|
||||
run: msbuild ccextractor.sln /p:Configuration=Debug-Full
|
||||
working-directory: ./windows
|
||||
- name: Display version information
|
||||
run: ./ccextractorwinfull.exe --version
|
||||
working-directory: ./windows/Debug-Full
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: CCExtractor Windows OCR and HardSubX Debug build
|
||||
path: |
|
||||
./windows/Debug-Full/ccextractorwinfull.exe
|
||||
./windows/Debug-Full/ccextractorwinfull.pdb
|
||||
./windows/Debug-Full/*.dll
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: CCExtractor Windows OCR and HardSubX Debug build
|
||||
path: |
|
||||
./windows/Debug/ccextractorgui.exe
|
||||
22
.github/workflows/format.yml
vendored
Normal file
22
.github/workflows/format.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
name: Format sourcecode
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '.github/workflows/format.yml'
|
||||
- 'src/**.c'
|
||||
- 'src/**.h'
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
paths:
|
||||
- '.github/workflows/format.yml'
|
||||
- 'src/**.c'
|
||||
- 'src/**.h'
|
||||
jobs:
|
||||
format:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- name: Format code
|
||||
run: |
|
||||
find src/ -type f -not -path "src/thirdparty/*" -not -path "src/lib_ccx/zvbi/*" -name '*.c' -not -path "src/GUI/icon_data.c" | xargs clang-format -i
|
||||
git diff-index --quiet HEAD -- || (git diff && exit 1)
|
||||
38
.github/workflows/release.yml
vendored
Normal file
38
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Upload releases
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- created
|
||||
|
||||
jobs:
|
||||
build_windows:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2.4.0
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
|
||||
shell: bash
|
||||
- name: Setup MSBuild.exe
|
||||
uses: microsoft/setup-msbuild@v1.0.2
|
||||
- name: Install Win 10 SDK
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: build Release-Full
|
||||
run: msbuild ccextractor.sln /p:Configuration=Release-Full /p:Platform=Win32
|
||||
working-directory: ./windows
|
||||
- name: Copy files to directory for installer
|
||||
run: mkdir installer; cp ./Release/ccextractorgui.exe ./installer; cp ./Release-Full/ccextractorwinfull.exe ./installer; cp ./Release-Full/*.dll ./installer
|
||||
working-directory: ./windows
|
||||
- name: Display installer folder contents
|
||||
run: Get-ChildItem -Recurse ./installer
|
||||
working-directory: ./windows
|
||||
- name: Create portable zip
|
||||
run: Compress-Archive -Path ./installer/* -DestinationPath ./CCExtractor_win_portable.zip
|
||||
working-directory: ./windows
|
||||
- name: Upload as asset
|
||||
uses: AButler/upload-release-assets@v2.0
|
||||
with:
|
||||
files: './windows/CCExtractor_win_portable.zip'
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -137,3 +137,6 @@ mac/cmake_install.cmake
|
||||
mac/CMakeFiles/
|
||||
mac/CMakeCache.txt
|
||||
*.py.bak
|
||||
|
||||
# Bazel
|
||||
bazel*
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
MAINTAINER = Marc Espie <espie@openbsd.org>
|
||||
CATEGORIES = multimedia
|
||||
COMMENT = closed caption subtitles extractor
|
||||
HOMEPAGE = http://ccextractor.sourceforge.net/
|
||||
V = 0.88
|
||||
HOMEPAGE = https://ccextractor.org
|
||||
V = 0.89
|
||||
DISTFILES = ccextractor.${V:S/.//}-src.zip
|
||||
MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=ccextractor/}
|
||||
DISTNAME = ccextractor-$V
|
||||
|
||||
14
README.md
14
README.md
@@ -6,7 +6,7 @@
|
||||
[](https://sampleplatform.ccextractor.org/test/master/windows)
|
||||
[](https://sampleplatform.ccextractor.org/test/master/linux)
|
||||
[](https://sourceforge.net/projects/ccextractor/)
|
||||

|
||||
[](https://github.com/CCExtractor/ccextractor/releases/latest)
|
||||
|
||||
CCExtractor is a tool used to produce subtitles for TV recordings from almost anywhere in the world. We intend to keep up with all sources and formats.
|
||||
|
||||
@@ -27,7 +27,7 @@ The core functionality is written in C. Other languages used include C++ and Pyt
|
||||
|
||||
## Installation and Usage
|
||||
|
||||
Downloads for precompiled binaries and source code can be found [on our website](https://www.ccextractor.org?id=public:general:downloads).
|
||||
Downloads for precompiled binaries and source code can be found [on our website](https://ccextractor.org/public/general/downloads/).
|
||||
|
||||
Extracting subtitles is relatively simple. Just run the following command:
|
||||
|
||||
@@ -37,11 +37,13 @@ This will extract the subtitles.
|
||||
|
||||
More usage information can be found on our website:
|
||||
|
||||
- [Using the command line tool](https://www.ccextractor.org/doku.php?id=public:general:command_line_usage)
|
||||
- [Using the Windows GUI](https://www.ccextractor.org/doku.php?id=public:general:win_gui_usage)
|
||||
- [Using the command line tool](https://ccextractor.org/public/general/command_line_usage/)
|
||||
- [Using the Windows GUI](https://ccextractor.org/public/general/win_gui_usage/)
|
||||
|
||||
You can also find the list of parameters and their brief description by running `ccextractor` without any arguments.
|
||||
|
||||
You can find sample files on [our website](https://ccextractor.org/public/general/tvsamples/) to test the software.
|
||||
|
||||
## Compiling CCExtractor
|
||||
|
||||
To learn more about how to compile and build CCExtractor for your platform check the [compilation guide](https://github.com/CCExtractor/ccextractor/blob/master/docs/COMPILATION.MD).
|
||||
@@ -52,9 +54,9 @@ By far the best way to get support is by opening an issue at our [issue tracker]
|
||||
|
||||
When you create a new issue, please fill in the needed details in the provided template. That makes it easier for us to help you more efficiently.
|
||||
|
||||
If you have a question or a problem you can also [contact us by email or chat with the team in Slack](https://www.ccextractor.org/doku.php?id=public:general:support).
|
||||
If you have a question or a problem you can also [contact us by email or chat with the team in Slack](https://ccextractor.org/public/general/support/).
|
||||
|
||||
If you want to contribute to CCExtractor but can't submit some code patches or issues or video samples, you can also [donate to us](https://www.ccextractor.org/public:general:http:sourceforge.net_donate_index.php?group_id=190832)
|
||||
If you want to contribute to CCExtractor but can't submit some code patches or issues or video samples, you can also [donate to us](https://sourceforge.net/donate/index.php?group_id=190832)
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
from builtins import str
|
||||
import ccextractor as cc
|
||||
import ccx_to_python_g608 as g608
|
||||
import python_srt_generator as srt_generator
|
||||
text,font,color = [],[],[]
|
||||
filename = " "
|
||||
srt_counter = " "
|
||||
def generate_output_srt(line, encoding):
|
||||
global text,font,color
|
||||
global filename, srt_counter
|
||||
if "filename:" in line:
|
||||
filename = str(str(line.split(":")[1]).split("\n")[0])
|
||||
with open(filename, 'w+') as fh:
|
||||
pass
|
||||
elif "srt_counter-" in line:
|
||||
srt_counter = str(line.split("-")[1])
|
||||
with open(filename, 'a+') as fh:
|
||||
fh.write(srt_counter)
|
||||
elif "start_time" in line:
|
||||
with open(filename, 'a+') as fh:
|
||||
data = line.split("-")
|
||||
end_time = str(data[-1].split("\n")[0])
|
||||
start_time = str(data[1].split("\t")[0])
|
||||
fh.write(start_time)
|
||||
fh.write(" --> ")
|
||||
fh.write(end_time)
|
||||
fh.write("\n")
|
||||
fh.flush()
|
||||
elif "***END OF FRAME***" in line:
|
||||
d={}
|
||||
d['text']=text
|
||||
d['color']=color
|
||||
d['font']=font
|
||||
srt_generator.generate_output_srt(filename,d, encoding)
|
||||
text,font,color = [],[],[]
|
||||
else:
|
||||
g608.g608_grid_former(line,text,color,font)
|
||||
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
from __future__ import print_function
|
||||
###
|
||||
#MANDATORY UPDATES IN EVERY PYTHON SCRIPT
|
||||
###
|
||||
import sys
|
||||
|
||||
import ccextractor as cc
|
||||
|
||||
|
||||
def callback(line, encoding):
|
||||
print(line)
|
||||
|
||||
|
||||
def init_ccextractor(callback):
|
||||
"""
|
||||
:param callback: The callback which we use to handle
|
||||
the extracted subtitle info
|
||||
:return return the initialized options
|
||||
"""
|
||||
optionos = cc.api_init_options()
|
||||
cc.check_configuration_file(optionos)
|
||||
for arg in sys.argv[1:]:
|
||||
cc.api_add_param(optionos, arg)
|
||||
compile_ret = cc.compile_params(optionos, len(sys.argv[1:]))
|
||||
|
||||
# use my_pythonapi to add callback in C source code
|
||||
cc.my_pythonapi(optionos, callback)
|
||||
|
||||
return optionos
|
||||
|
||||
|
||||
def main():
|
||||
options = init_ccextractor(callback)
|
||||
cc.api_start(options)
|
||||
|
||||
|
||||
if __name__=="__main__":
|
||||
main()
|
||||
@@ -1,97 +0,0 @@
|
||||
#!/bin/bash
|
||||
BLD_FLAGS="-std=gnu99 -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DENABLE_OCR -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP -DPYTHON_API"
|
||||
BLD_INCLUDE="-I/usr/include/python2.7/ -I../src -I /usr/include/leptonica/ -I /usr/include/tesseract/ -I../src/lib_ccx/ -I../src/gpacmp4/ -I../src/libpng/ -I../src/zlib/ -I../src/zvbi -I../src/lib_hash -I../src/protobuf-c -I../src/utf8proc -I../src/freetype/include"
|
||||
SRC_LIBPNG="$(find ../src/libpng/ -name '*.c')"
|
||||
SRC_ZLIB="$(find ../src/zlib/ -name '*.c')"
|
||||
SRC_ZVBI="$(find ../src/zvbi/ -name '*.c')"
|
||||
SRC_CCX="$(find ../src/lib_ccx/ -name '*.c')"
|
||||
SRC_GPAC="$(find ../src/gpacmp4/ -name '*.c')"
|
||||
SRC_HASH="$(find ../src/lib_hash/ -name '*.c')"
|
||||
SRC_PROTOBUF="$(find ../src/protobuf-c/ -name '*.c')"
|
||||
SRC_UTF8PROC="../src/utf8proc/utf8proc.c"
|
||||
SRC_FREETYPE="../src/freetype/autofit/autofit.c
|
||||
../src/freetype/base/ftbase.c
|
||||
../src/freetype/base/ftbbox.c
|
||||
../src/freetype/base/ftbdf.c
|
||||
../src/freetype/base/ftbitmap.c
|
||||
../src/freetype/base/ftcid.c
|
||||
../src/freetype/base/ftfntfmt.c
|
||||
../src/freetype/base/ftfstype.c
|
||||
../src/freetype/base/ftgasp.c
|
||||
../src/freetype/base/ftglyph.c
|
||||
../src/freetype/base/ftgxval.c
|
||||
../src/freetype/base/ftinit.c
|
||||
../src/freetype/base/ftlcdfil.c
|
||||
../src/freetype/base/ftmm.c
|
||||
../src/freetype/base/ftotval.c
|
||||
../src/freetype/base/ftpatent.c
|
||||
../src/freetype/base/ftpfr.c
|
||||
../src/freetype/base/ftstroke.c
|
||||
../src/freetype/base/ftsynth.c
|
||||
../src/freetype/base/ftsystem.c
|
||||
../src/freetype/base/fttype1.c
|
||||
../src/freetype/base/ftwinfnt.c
|
||||
../src/freetype/bdf/bdf.c
|
||||
../src/freetype/bzip2/ftbzip2.c
|
||||
../src/freetype/cache/ftcache.c
|
||||
../src/freetype/cff/cff.c
|
||||
../src/freetype/cid/type1cid.c
|
||||
../src/freetype/gzip/ftgzip.c
|
||||
../src/freetype/lzw/ftlzw.c
|
||||
../src/freetype/pcf/pcf.c
|
||||
../src/freetype/pfr/pfr.c
|
||||
../src/freetype/psaux/psaux.c
|
||||
../src/freetype/pshinter/pshinter.c
|
||||
../src/freetype/psnames/psnames.c
|
||||
../src/freetype/raster/raster.c
|
||||
../src/freetype/sfnt/sfnt.c
|
||||
../src/freetype/smooth/smooth.c
|
||||
../src/freetype/truetype/truetype.c
|
||||
../src/freetype/type1/type1.c
|
||||
../src/freetype/type42/type42.c
|
||||
../src/freetype/winfonts/winfnt.c"
|
||||
API_WRAPPERS="$(find ../src/wrappers/ -name '*.c')"
|
||||
# the `swig -python ccextractor.i` will generate ccextractor_wrap.c
|
||||
BLD_SOURCES="../src/ccextractor.c ccextractor_wrap.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC $API_WRAPPERS $SRC_FREETYPE"
|
||||
|
||||
BLD_LINKER="-lm -zmuldefs -l tesseract -l lept -l python3.6m"
|
||||
|
||||
echo "Running pre-build script..."
|
||||
../linux/pre-build.sh
|
||||
echo "Trying to compile..."
|
||||
|
||||
|
||||
out=$((swig -python ccextractor.i && LC_ALL=C gcc -fPIC -c $BLD_FLAGS $BLD_INCLUDE $BLD_SOURCES $BLD_LINKER)2>&1)
|
||||
res=$?
|
||||
if [[ $out == *"gcc: command not found"* ]]
|
||||
then
|
||||
echo "Error: please install gcc";
|
||||
exit 1
|
||||
fi
|
||||
if [[ $out == *"curl.h: No such file or directory"* ]]
|
||||
then
|
||||
echo "Error: please install curl development library (libcurl4-gnutls-dev for Debian/Ubuntu)";
|
||||
exit 2
|
||||
fi
|
||||
if [[ $out == *"capi.h: No such file or directory"* ]]
|
||||
then
|
||||
echo "Error: please install tesseract development library (tesseract-ocr-dev for Debian/Ubuntu)";
|
||||
exit 3
|
||||
fi
|
||||
if [[ $out == *"allheaders.h: No such file or directory"* ]]
|
||||
then
|
||||
echo "Error: please install leptonica development library (libleptonica-dev for Debian/Ubuntu)";
|
||||
exit 4
|
||||
fi
|
||||
if [[ $res -ne 0 ]] # Unknown error
|
||||
then
|
||||
echo "Compiled with errors"
|
||||
>&2 echo "$out"
|
||||
exit 5
|
||||
fi
|
||||
if [[ "$out" != "" ]] ; then
|
||||
echo "$out"
|
||||
echo "Compilation successful, compiler message shown in previous lines"
|
||||
else
|
||||
echo "Compilation successful, no compiler messages."
|
||||
fi
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
BLD_LINKER="-lm -zmuldefs -l tesseract -l lept -l python2.7"
|
||||
WRAPPER_FLAGS="-Wl,-wrap,write"
|
||||
|
||||
out=$((./build_api && gcc -shared $(find -name '*.o') -o _ccextractor.so $BLD_LINKER)2>&1)
|
||||
res=$?
|
||||
if [[ $out == *"gcc: command not found"* ]]
|
||||
then
|
||||
echo "Error: please install gcc";
|
||||
exit 1
|
||||
fi
|
||||
if [[ $out == *"curl.h: No such file or directory"* ]]
|
||||
then
|
||||
echo "Error: please install curl development library (libcurl4-gnutls-dev for Debian/Ubuntu)";
|
||||
exit 2
|
||||
fi
|
||||
if [[ $out == *"capi.h: No such file or directory"* ]]
|
||||
then
|
||||
echo "Error: please install tesseract development library (tesseract-ocr-dev for Debian/Ubuntu)";
|
||||
exit 3
|
||||
fi
|
||||
if [[ $out == *"allheaders.h: No such file or directory"* ]]
|
||||
then
|
||||
echo "Error: please install leptonica development library (libleptonica-dev for Debian/Ubuntu)";
|
||||
exit 4
|
||||
fi
|
||||
if [[ $res -ne 0 ]] # Unknown error
|
||||
then
|
||||
echo "Compiled with errors"
|
||||
>&2 echo "$out"
|
||||
exit 5
|
||||
fi
|
||||
rm *.o
|
||||
echo "Compilation successful";
|
||||
@@ -1,18 +0,0 @@
|
||||
%module ccextractor
|
||||
%{
|
||||
#define SWIG_FILE_WITH_INIT
|
||||
#include "../src/lib_ccx/lib_ccx.h"
|
||||
#include "../src/lib_ccx/configuration.h"
|
||||
#include "../src/lib_ccx/ccx_common_option.h"
|
||||
#include "../src/lib_ccx/ccx_mp4.h"
|
||||
#include "../src/lib_ccx/hardsubx.h"
|
||||
#include "../src/lib_ccx/ccx_share.h"
|
||||
#include "../src/ccextractor.h"
|
||||
#include "../src/wrappers/wrapper.h"
|
||||
%}
|
||||
struct ccx_s_options* api_init_options();
|
||||
void check_configuration_file(struct ccx_s_options api_options);
|
||||
int compile_params(struct ccx_s_options *api_options,int argc);
|
||||
void api_add_param(struct ccx_s_options* api_options,char* arg);
|
||||
int api_start(struct ccx_s_options api_options);
|
||||
void my_pythonapi(struct ccx_s_options *api_options, PyObject *func);
|
||||
@@ -1,63 +0,0 @@
|
||||
from __future__ import print_function
|
||||
from builtins import str
|
||||
def g608_grid_former(line,text,color,font):
|
||||
if "text[" in line:
|
||||
line = str(line.split(":", 1)[1])
|
||||
line = str(line.split("\n")[0])
|
||||
text.append(line)
|
||||
if "color[" in line:
|
||||
line = str(line.split(":", 1)[1])
|
||||
line = str(line.split("\n")[0])
|
||||
color.append(line)
|
||||
if "font[" in line:
|
||||
line = str(line.split(":", 1)[1])
|
||||
line = str(line.split("\n")[0])
|
||||
font.append(line)
|
||||
|
||||
def return_g608_grid(case,text,color,font):
|
||||
ret_val = {'text':" ",'color':" ",'font':" "}
|
||||
help_string = """
|
||||
Case is the value that would give the desired output.
|
||||
case = 0 --> print start_time,end_time,text,color,font
|
||||
case = 1 --> print start_time,end_time,text
|
||||
case = 2 --> print start_time,end_time,color
|
||||
case = 3 --> print start_time,end_time,font
|
||||
case = 4 --> print start_time,end_time,text,color
|
||||
case = 5 --> print start_time,end_time,text,font
|
||||
case = 6 --> print start_time,end_time,color,font
|
||||
"""
|
||||
if case==0:
|
||||
if text:
|
||||
ret_val['text']=text
|
||||
if color:
|
||||
ret_val['color']=color
|
||||
if font:
|
||||
ret_val['font']=font
|
||||
|
||||
elif case==1:
|
||||
if text:
|
||||
ret_val['text']=text
|
||||
elif case==2:
|
||||
if color:
|
||||
ret_val['color']=color
|
||||
elif case==3:
|
||||
if font:
|
||||
ret_val['font']=font
|
||||
elif case==4:
|
||||
if text:
|
||||
ret_val['text']=text
|
||||
if color:
|
||||
ret_val['color']=color
|
||||
elif case==5:
|
||||
if text:
|
||||
ret_val['text']=text
|
||||
if font:
|
||||
ret_val['font']=font
|
||||
elif case==6:
|
||||
if color:
|
||||
ret_val['color']=color
|
||||
if font:
|
||||
ret_val['font']=font
|
||||
else:
|
||||
print(help_string)
|
||||
return ret_val
|
||||
@@ -1,155 +0,0 @@
|
||||
from __future__ import print_function
|
||||
from builtins import zip
|
||||
from builtins import str
|
||||
import ccextractor as cc
|
||||
import re
|
||||
"""
|
||||
#Handling underline
|
||||
buff = ""
|
||||
underline_flag = 0
|
||||
for i,font_type in enumerate(font_line):
|
||||
if font_type == 'U' and not underline_flag:
|
||||
buff = buff + '<u> '
|
||||
underline_flag = 1
|
||||
underline=1
|
||||
elif font_type =="R" and underline_flag:
|
||||
buff = buff + '</u>'
|
||||
underline_flag = 0
|
||||
continue;
|
||||
buff += letter[i]
|
||||
#adding a new line after buff has seen underline
|
||||
#need to cross check with CCExtractor output as to how they are doing
|
||||
if underline:
|
||||
buff+= "\n"
|
||||
else:
|
||||
buff=""
|
||||
"""
|
||||
encodings_map = {
|
||||
'0':'unicode',
|
||||
'1':'latin1',
|
||||
'2':'utf-8',
|
||||
'3':'ascii',
|
||||
}
|
||||
|
||||
color_text_start={
|
||||
"0":"",
|
||||
"1":"<font color=\"#00ff00\">",
|
||||
"2":"<font color=\"#0000ff\">",
|
||||
"3":"<font color=\"#00ffff\">",
|
||||
"4":"<font color=\"#ff0000\">",
|
||||
"5":"<font color=\"#ffff00\">",
|
||||
"6":"<font color=\"#ff00ff\">",
|
||||
"7":"<font color=\"",
|
||||
"8":"",
|
||||
"9":""
|
||||
};
|
||||
color_text_end={
|
||||
"0":"",
|
||||
"1":"</font",
|
||||
"2":"</font>",
|
||||
"3":"</font>",
|
||||
"4":"</font>",
|
||||
"5":"</font>",
|
||||
"6":"</font>",
|
||||
"7":"</font>",
|
||||
"8":"",
|
||||
"9":""
|
||||
};
|
||||
no_color_tag = ['0','8','9']
|
||||
def comparing_text_font_grids(text, font, color):
|
||||
original_text = text
|
||||
original_color = color
|
||||
temp_color = []
|
||||
for letter,color_line in zip(original_text,color):
|
||||
color = 0
|
||||
prev = color_line[0]
|
||||
buff = color_text_start[str(prev)]
|
||||
if prev not in no_color_tag:
|
||||
color_flag = 1
|
||||
else:
|
||||
color_flag = 0
|
||||
if letter.count(" ")<32:
|
||||
for i,color_type in enumerate(color_line):
|
||||
if color_type not in no_color_tag and prev!=color_type and not color_flag:
|
||||
color = 1
|
||||
buff = buff + color_text_start[str(color_type)]
|
||||
color_flag = 1
|
||||
elif prev!=color_type and color_flag:
|
||||
color = 1
|
||||
buff = buff + color_text_end[str(prev)]
|
||||
color_flag = 0
|
||||
buff += letter[i]
|
||||
prev=color_type
|
||||
if color_flag:
|
||||
color_flag=0
|
||||
buff+=color_text_end[str(prev)]
|
||||
if color:
|
||||
temp_color.append((buff,1))
|
||||
else:
|
||||
temp_color.append((letter,0))
|
||||
temp_font_italics=[]
|
||||
for letter,font_line in zip(original_text,font):
|
||||
if letter.count(" ")<32:
|
||||
buff=""
|
||||
underline,italics = 0,0
|
||||
#Handling italics
|
||||
italics_flag = 0
|
||||
for i,font_type in enumerate(font_line):
|
||||
if font_type == 'I' and not italics_flag:
|
||||
italics=1
|
||||
buff = buff + '<i>'
|
||||
italics_flag = 1
|
||||
elif font_type =="R" and italics_flag:
|
||||
italics=1
|
||||
buff = buff + '</i>'
|
||||
italics_flag = 0
|
||||
buff += letter[i]
|
||||
if italics_flag:
|
||||
buff+='</i>'
|
||||
if italics:
|
||||
temp_font_italics.append((buff,1))
|
||||
else:
|
||||
temp_font_italics.append((letter,0))
|
||||
else:
|
||||
temp_font_italics.append((letter,0))
|
||||
final = []
|
||||
for i,j in zip(temp_color,temp_font_italics):
|
||||
if i[1] and not j[1]:
|
||||
final.append(i[0])
|
||||
elif j[1] and not i[1]:
|
||||
final.append(j[0])
|
||||
else:
|
||||
if not i[1]:
|
||||
final.append(i[0])
|
||||
else:
|
||||
print("error")
|
||||
return (final,font,color)
|
||||
|
||||
|
||||
def generate_output_srt(filename,d, encoding):
|
||||
if encoding in list(encodings_map.keys()):
|
||||
if encoding!='0':
|
||||
encoding_format = encodings_map[encoding]
|
||||
else:
|
||||
encoding_format = ""
|
||||
else:
|
||||
print("encoding error in python")
|
||||
return
|
||||
if encoding_format:
|
||||
d['text'] = [str(item,encoding_format) for item in d['text']]
|
||||
else:
|
||||
d['text'] = [str(item) for item in d['text']]
|
||||
d['text'],d['font'],d['color']= comparing_text_font_grids(d['text'],d['font'],d['color'])
|
||||
for item in d['text']:
|
||||
if item.count(" ")<32:
|
||||
o=item
|
||||
with open(filename,'ab+') as fh:
|
||||
if encoding_format:
|
||||
fh.write(o.encode(encoding_format))
|
||||
else:
|
||||
fh.write(str(o))
|
||||
fh.write("\n")
|
||||
fh.flush()
|
||||
with open(filename,'ab+') as fh:
|
||||
fh.write("\n")
|
||||
fh.flush()
|
||||
@@ -1,26 +0,0 @@
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
output_formats = ['.srt','.ass','.ssa','.webvtt','.sami','.txt','.original','.python','.py']
|
||||
args_list = sys.argv[1:]
|
||||
args_count = len(args_list)
|
||||
if args_count>1:
|
||||
print("wrong usage")
|
||||
exit(0)
|
||||
directory = args_list[0]
|
||||
if not os.path.isdir(directory):
|
||||
print("error: path given is not a directory")
|
||||
exit(0)
|
||||
files = []
|
||||
for item in os.listdir(directory):
|
||||
ext = os.path.splitext(item)[1]
|
||||
if ext not in output_formats:
|
||||
files.append(os.path.join(directory,item))
|
||||
for sample in files:
|
||||
print("Processing file: "+sample)
|
||||
#command=['../linux/ccextractor',sample]
|
||||
command = ['python','api_testing.py',sample]
|
||||
subprocess.call(command)
|
||||
print("Finished processing file: "+sample)
|
||||
@@ -1,3 +1,42 @@
|
||||
0.89 (2021-06-13)
|
||||
-----------------
|
||||
- Fix: Fix broken links in README
|
||||
- Fix: Timing in DVB, sub duration check for timeout.
|
||||
- New: Added support for SCC and CCD encoder formats
|
||||
- New: Added support to output captions to MCC file (#733).
|
||||
- New: Add support for censoring words ("Kid Friendly") (#1139)
|
||||
- New: Extend support of capitalization for all BITMAP and 608 subtitles (#1214)
|
||||
- New: Added an option to disable timestamps for WebVTT (In response to issue #1127)
|
||||
- Fix: Change inet_ntop to inet_ntoa for Windows XP compatibility
|
||||
- Fix: Added italics, underline, and color rendering support for -out=spupng with EIA608/teletext
|
||||
- Fix: ccx_demuxer_mxf.c: Parse framerate from MXF captions to fix caption timings.
|
||||
- Fix: hardsubx_decoder.c: Fix memory leaks using Leptonica API.
|
||||
- Fix: linux/Makefile.am: added some sources to enable rpms to be created.
|
||||
- Fix: Crash when using -sc (sentence case) option (#1115)
|
||||
- Fix: Segmentation fault on VOB #1128
|
||||
- Fix: Hang while processing video #1121
|
||||
- Fix: lib_ccx.c: Initialize fatal error logging function before first usage in init_libraries
|
||||
- Fix: A few (minor) memory leaks around the code.
|
||||
- Fix: General code clean up / reformatting
|
||||
- Fix: Fix multiple definitions with new -fno-common default in GCC 10
|
||||
- Fix: Mac now builds reproducibly again without errors on the date command (#1230)
|
||||
- Fix: Allow all oem modes with tesseract v4 (#1264)
|
||||
- Doc: Updated ccextractor.cnf.sample.
|
||||
- Update: Updated LibPNG to 1.6.37
|
||||
- Remove: Python API (since no one cares about it and it's unmaintained)
|
||||
- Remove: -cf , just use FFmpeg if you want a ES from a TS or PS, CCExtractor is a bad tool
|
||||
for this.
|
||||
- Fix: Segmentation fault on Windows
|
||||
- Update: Updated libGPAC to 1.0.1
|
||||
- Fix: Segmentation fault with unsupported and multitrack file reports
|
||||
- Fix: Write subtitle header to multitrack outputs
|
||||
- Fix: Write multitrack files to the output file directory
|
||||
- Fix: Correct frame number calculation in SCC (#1340)
|
||||
- Fix: Regression on Teletext that caused dates to be wrong (RT 78 on the sample platform)
|
||||
- Fix: CEA-708: Better timing, fixes for missing subtitles
|
||||
- Fix: timing for direct rollup
|
||||
- Fix: timing for VOB files with multiple chapters
|
||||
|
||||
0.88 (2019-05-21)
|
||||
-----------------
|
||||
- New: More tapping points for debug image in ccextractor.
|
||||
@@ -1176,4 +1215,3 @@ version of CCExtractor.
|
||||
- Added video information (as extracted from sequence header).
|
||||
- Some code clean-up.
|
||||
- FF sanity check enabled by default.
|
||||
|
||||
|
||||
@@ -14,39 +14,45 @@ git clone https://github.com/CCExtractor/ccextractor.git
|
||||
|
||||
1. Make sure all the dependencies are met.
|
||||
|
||||
Debian:
|
||||
|
||||
```bash
|
||||
sudo apt-get install -y libglew-dev libglfw3-dev cmake gcc libcurl4-gnutls-dev tesseract-ocr tesseract-ocr-dev libleptonica-dev
|
||||
```
|
||||
sudo apt-get install -y libglew-dev
|
||||
sudo apt-get install -y libglfw3-dev
|
||||
sudo apt-get install -y cmake
|
||||
sudo apt-get install -y gcc
|
||||
sudo apt-get install -y libcurl4-gnutls-dev
|
||||
sudo apt-get install -y tesseract-ocr
|
||||
sudo apt-get install -y tesseract-ocr-dev
|
||||
sudo apt-get install -y libleptonica-dev
|
||||
|
||||
RHEL:
|
||||
|
||||
```bash
|
||||
yum install -y glew-devel glfw-devel cmake gcc libcurl-devel tesseract-devel leptonica-devel
|
||||
```
|
||||
|
||||
**Note:** On Ubuntu Version 18.04 (Bionic) and (probably) later, install `libtesseract-dev` rather than `tesseract-ocr-dev`, which does not exist anymore.
|
||||
|
||||
**Note:** On Ubuntu Version 14.04 (Trusty) and earlier, you should build leptonica and tesseract from source
|
||||
|
||||
2. Compiling
|
||||
|
||||
### Using the build script
|
||||
By default build script does not include debugging information hence, you cannot debug the executable produced (i.e. `./ccextractor`) on a debugger. To include debugging information, use the `builddebug` script.
|
||||
|
||||
**Using the build script**
|
||||
|
||||
|
||||
```
|
||||
```bash
|
||||
#Navigate to linux directory and call the build script
|
||||
|
||||
cd ccextractor/linux
|
||||
|
||||
# compile without debug flags
|
||||
./build
|
||||
|
||||
# compile with debug info
|
||||
./builddebug
|
||||
|
||||
# test your build
|
||||
./ccextractor
|
||||
```
|
||||
|
||||
**Standard linux compilation through Autoconf scripts**
|
||||
### Standard linux compilation through Autoconf scripts
|
||||
|
||||
```
|
||||
```bash
|
||||
sudo apt-get install autoconf #Dependency to generate configuration script
|
||||
cd ccextractor/linux
|
||||
./autogen.sh
|
||||
@@ -60,9 +66,9 @@ make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
**Using CMake**
|
||||
### Using CMake
|
||||
|
||||
```
|
||||
```bash
|
||||
#Create and navigate to directory where you want to store built files
|
||||
|
||||
cd ccextractor/
|
||||
@@ -81,14 +87,15 @@ make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
`cmake` also accepts the argument `-DWITH_OCR=ON` to enable OCR.
|
||||
|
||||
**Compiling with GUI:**
|
||||
### Compiling with GUI:
|
||||
|
||||
To build CCExtractor with a gui you will additionally need to install [GLEW](http://glew.sourceforge.net/build.html) and [GLFW](http://www.glfw.org/docs/latest/compile.html)
|
||||
|
||||
In order to compile it you'll need to configure it using autoconf by passing the `-with-gui` option.
|
||||
|
||||
```
|
||||
```bash
|
||||
./autogen.sh
|
||||
./configure --with-gui
|
||||
make
|
||||
@@ -103,25 +110,25 @@ Once set up you can run the GUI interface from the terminal `./ccextractorGUI`
|
||||
|
||||
1. Make sure all the dependencies are met. They can be installed via Homebrew as
|
||||
|
||||
```
|
||||
```bash
|
||||
brew install pkg-config
|
||||
brew install autoconf automake libtool
|
||||
brew install tesseract
|
||||
brew install leptonica
|
||||
```
|
||||
|
||||
To verify tesseract and leptonica are detected by pkg-config, e.g.
|
||||
Use pkg-config to verify tesseract and leptonica dependencies, e.g.
|
||||
|
||||
````
|
||||
```bash
|
||||
pkg-config --exists --print-errors tesseract
|
||||
pkg-config --exists --print-errors lept
|
||||
````
|
||||
|
||||
2. Compiling
|
||||
|
||||
**Using build.command script:**
|
||||
|
||||
```
|
||||
|
||||
### Compiling
|
||||
|
||||
#### Using build.command script:
|
||||
|
||||
```bash
|
||||
cd ccextractor/mac
|
||||
./build.command OCR
|
||||
|
||||
@@ -131,7 +138,7 @@ cd ccextractor/mac
|
||||
|
||||
If you don't want the OCR capabilities, then you don't need to configure the tesseract and leptonica packages, and build it with just
|
||||
|
||||
```
|
||||
```bash
|
||||
cd ccextractor/mac
|
||||
./build.command
|
||||
|
||||
@@ -139,9 +146,9 @@ cd ccextractor/mac
|
||||
./ccextractor
|
||||
```
|
||||
|
||||
**Using CMake**
|
||||
#### Using CMake
|
||||
|
||||
```
|
||||
```bash
|
||||
#Create and navigate to directory where you want to store built files
|
||||
|
||||
cd ccextractor/
|
||||
@@ -157,9 +164,9 @@ make
|
||||
./ccextractor
|
||||
```
|
||||
|
||||
**Standard compilation through Autoconf scripts :**
|
||||
#### Standard compilation through Autoconf scripts:
|
||||
|
||||
```
|
||||
```bash
|
||||
cd ccextractor/mac
|
||||
./autogen.sh
|
||||
./configure
|
||||
@@ -169,18 +176,18 @@ make
|
||||
./ccextractor
|
||||
```
|
||||
|
||||
**Compiling with GUI:**
|
||||
#### Compiling with GUI:
|
||||
|
||||
To use CCExtractor with a gui you will additionally need to install GLEW and GLFW. You can do that by installing it via homebrew using:
|
||||
|
||||
```
|
||||
```bash
|
||||
brew install glfw
|
||||
brew install glew
|
||||
```
|
||||
|
||||
In order to compile it you'll need to configure it using autoconf by passing the `-with-gui` option.
|
||||
|
||||
```
|
||||
```bash
|
||||
./autogen.sh
|
||||
./configure --with-gui
|
||||
make
|
||||
@@ -218,11 +225,11 @@ Configurations options are: `(Debug|Release)-Full`
|
||||
|
||||
Configurations options include dependent libraries which are used for OCR.
|
||||
|
||||
**Using CMake**
|
||||
### Using CMake
|
||||
|
||||
You may also generate `.sln` files for Visual Studio and build using build tools, or open `.sln` files using Visual Studio.
|
||||
|
||||
```
|
||||
```bash
|
||||
cmake ../src/ -G "Visual Studio 14 2015"
|
||||
cmake --build . --config Release --ccextractor
|
||||
```
|
||||
@@ -236,4 +243,3 @@ Go to the package_creators folder using `cd` and run the `./arch.sh`
|
||||
### Redhat Package Manager (rpm) based Linux Distributions
|
||||
|
||||
Go to the package_creators folder using `cd` and run the `./rpm.sh`
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
Overview
|
||||
========
|
||||
FFmpeg Integration was done to support multiple encapsulations.
|
||||
|
||||
Dependency
|
||||
=========
|
||||
FFmpeg library's
|
||||
|
||||
Download and Install FFmpeg on your Linux pc.
|
||||
---------------------------------------------
|
||||
|
||||
Download latest source code from following link
|
||||
https://ffmpeg.org/download.html
|
||||
|
||||
then following command to install ffmpeg
|
||||
./configure && make && make install
|
||||
|
||||
Note:If you installed ffmpeg on non-standard location, please change/update your
|
||||
environment variable $PATH and $LD_LIBRARY_PATH
|
||||
|
||||
Download and Install FFmpeg on your Windows pc.
|
||||
----------------------------------------------
|
||||
Download prebuild library from following link
|
||||
http://ffmpeg.zeranoe.com/builds/
|
||||
|
||||
You need to download Shared Versions to run the program and Dev Versions to compile.
|
||||
|
||||
How to compile ccextractor
|
||||
==========================
|
||||
|
||||
In Linux
|
||||
--------
|
||||
make ENABLE_FFMPEG=yes
|
||||
|
||||
On Windows
|
||||
----------
|
||||
put the path of libs/include of ffmpeg library in library paths.
|
||||
Step 1) In visual studio 2013 right click <Project> and select property.
|
||||
Step 2) Select Configuration properties in left panel(column) of property.
|
||||
Step 3) Select VC++ Directory.
|
||||
Step 4) In the right pane, in the right-hand column of the VC++ Directory property,
|
||||
open the drop-down menu and choose Edit.
|
||||
Step 5) Add path of Directory where you have kept uncompressed library of FFmpeg.
|
||||
|
||||
|
||||
Set preprocessor flag ENABLE_FFMPEG=1
|
||||
Step 1) In visual studio 2013 right click <Project> and select property.
|
||||
Step 2) In the left panel, select Configuration Properties, C/C++, Preprocessor.
|
||||
Step 3) In the right panel, in the right-hand column of the Preprocessor Definitions property, open the drop-down menu and choose Edit.
|
||||
Step 4) In the Preprocessor Definitions dialog box, add ENABLE_FFMPEG=1. Choose OK to save your changes.
|
||||
|
||||
Add library in linker
|
||||
Step 1) Open property of project
|
||||
Step 2) Select Configuration properties
|
||||
Step 3) Select Linker in left panel(column)
|
||||
Step 4) Select Input
|
||||
Step 5) Select Additional dependencies in right panel
|
||||
Step 6) Add all FFmpeg's lib in new line
|
||||
50
docs/FFMPEG.md
Normal file
50
docs/FFMPEG.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# Overview
|
||||
|
||||
FFmpeg Integration was done to support multiple encapsulations.
|
||||
|
||||
## Dependencies
|
||||
FFmpeg libraries
|
||||
|
||||
### Download and Install FFmpeg on your Linux pc:
|
||||
Download latest source code from following link
|
||||
https://ffmpeg.org/download.html
|
||||
|
||||
Then following command to install ffmpeg:
|
||||
`./configure && make && make install`
|
||||
|
||||
Note:If you installed ffmpeg on non-standard location, please change/update your
|
||||
environment variable `$PATH` and `$LD_LIBRARY_PATH`
|
||||
|
||||
### Download and Install FFmpeg on your Windows pc:
|
||||
Download prebuilt library from following link:
|
||||
http://ffmpeg.zeranoe.com/builds/
|
||||
|
||||
You need to download Shared Versions to run the program and Dev Versions to compile.
|
||||
|
||||
## How to compile ccextractor
|
||||
|
||||
### On Linux:
|
||||
`make ENABLE_FFMPEG=yes`
|
||||
|
||||
### On Windows:
|
||||
#### Put the path of libs/include of ffmpeg library in library paths.
|
||||
1. In visual studio 2013 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 FFmpeg.
|
||||
|
||||
|
||||
#### Set preprocessor flag `ENABLE_FFMPEG=1`
|
||||
1. In visual studio 2013 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.
|
||||
|
||||
#### Add library in linker
|
||||
1. Open property of project
|
||||
2. Select Configuration properties
|
||||
3. Select Linker in left panel(column)
|
||||
4. Select Input
|
||||
5. Select Additional dependencies in right panel
|
||||
6. Add all FFmpeg's lib in new line
|
||||
@@ -20,6 +20,10 @@ Linux
|
||||
Make sure Tesseract, Leptonica and FFMPeg are installed, and that their libraries can be found using pkg-config.
|
||||
Refer to OCR.txt for installation details.
|
||||
|
||||
FFmpeg from packages (on Debian) plus a couple of other dependencies you will need:
|
||||
sudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libxcb-shm0-dev liblzma-dev
|
||||
|
||||
FFmpeg from source:
|
||||
To install FFmpeg (libav), follow the steps at:-
|
||||
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu - For Ubuntu, Debian and Linux Mint
|
||||
https://trac.ffmpeg.org/wiki/CompilationGuide/Generic - For generic Linux compilation
|
||||
|
||||
@@ -71,7 +71,7 @@ cd ccextractor/linux
|
||||
```
|
||||
cd ccextractor/linux
|
||||
./autogen.sh
|
||||
./configure --with-gui --enable-oc
|
||||
./configure --with-gui --enable-ocr
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
@@ -1,246 +0,0 @@
|
||||
This is the main documentation of Python extension module for CCExtractor:
|
||||
|
||||
====
|
||||
CCExtractor Library
|
||||
|
||||
----
|
||||
Refactoring the codebase into a library
|
||||
Earlier version of CCExtractor was compiled as a binary and could not be used as a library. The entire codebase was executed via a single main function defined in ccextractor.c and this architecture was not suitable for extending ccextractor source code to a library. Hence, many modifications were made to ccextractor.c so that conversion to a library could be done. Major modifications were:
|
||||
Segmenting the larger functions into smaller functions so that they could be called from one main function. Earlier the entire processing was carried out from one main function itself. This was not a good idea considering the possibility for library. This would allow the user to set the parameters to be passed to CCExtractor from Python with one parameter at a time and not the entire list of all parameters together.
|
||||
The refactoring of the code base and architectural judgements as to how the code should be segmented so that the entire working remains the same and also the library structure could be established.
|
||||
Apart from these changes, the header file ccextractor.h was also included into the codebase to define many global variables as well as the function declarations of definitions made in ccextractor.c. The major changes could be seen at this PR (merged). However, following the next stages of development after the changes made in the above mentioned PR, the final structure could be found at ccextractor.c and ccextractor.h.
|
||||
|
||||
----
|
||||
Definitions made in ccextractor.h
|
||||
In ccextractor.h, the major changes included declaring global variables which would be accessible throughout the codebase for calling the respective callbacks (discussed later in the documentation) from C to Python for processing the caption frames in Python as they are extracted in CCExtractor. So we need a global variable to store the py callback function for the future using which type is PyObject*.
|
||||
The major point to note is that the compilation of Python extension module includes setting a macro PYTHON_API which acts as an indication that the compilation is made for Python extension module and this helps in declaring as well as defining the functions which are only needed for Python extension module. As defined here, the PYTHON_API macro is used to define the functions/variables which are needed only by the extension module.
|
||||
Another major advantage of defining the macro PYTHON_API is that the definitions made for Python extension module only need python-dev package as a prerequisite for compilation. However, if the user wants to compile only CCExtractor and not the Python extension module, then the code should not have python-dev package as a dependency. This has been attained by using macro PYTHON_API and C pre-processors.
|
||||
|
||||
====
|
||||
CCExtractor Python Extension Module
|
||||
|
||||
----
|
||||
Extension module dependencies
|
||||
|
||||
1. SWIG
|
||||
For generation of the wrappers of the C code base, which would then be used to compile the extension module, I have used SWIG (swig-3.0.12). The entire compilation has been included in a build script (discussed later) and the user need not have prior knowledge of SWIG to get started.
|
||||
For compiling the Python extension module, the second dependency in addition to the dependencies of CCExtractor is SWIG. The user can follow these installation steps for getting SWIG installed.
|
||||
For generating the wrappers of the C/C++ code in a user required language, the user needs to have a basic understanding of the interface file which is used by SWIG. However, in case of generating the extension module for CCExtractor, the interface file has been written and is available here. SWIG uses this interface file to generate the wrappers for CCExtractor which are then compiled to form the extension module.
|
||||
2. Python-dev package
|
||||
|
||||
----
|
||||
Overall architecture
|
||||
|
||||
The entire Python Extension module related work is done in the api/ directory with modifications to the CCExtractor codebase to integrate the divergent path, CCExtractor would take if the processing is done via Python module.
|
||||
|
||||
----
|
||||
Generating the Python extension module:
|
||||
|
||||
For this project, I have mainly used two build scripts, viz., build_api and build_library which are both present in the api/ directory. For generating the Python bindings, user need to just run the build_library script as ./build_library. This would internally generate the SWIG wrappers from the SWIG interface file (ccextractor.i) present in the same directory. The user should note that if the user has not installed SWIG, the the compilation would stop at this step itself. Once the wrappers are generated, then the build_library script would execute the build_api script which would compile the entire code base of CCExtractor along with the wrappers generated by SWIG. In addition to this, build_api would also compile the wrappers defined in the wrappers/ directories. Once the compilation is successful, then build_library would generate a shared library called _ccextractor.so from the entire code which would be shared object for the module.
|
||||
In addition to generating the wrapper codes generated by SWIG, it also outputs the ccextractor.py which would be later used as Python extension module for accessing CCExtractor functionality via Python.
|
||||
As mentioned in earlier section, the build_api compiles the entire code base with an option -DPYTHON_API which is used by GCC to define a macro PYTHON_API. This macro then acts as a signal telling that the extension module is being generated and the bindings dependency need a check as well as the bindings dependent functions need to be defined.
|
||||
|
||||
----
|
||||
Workflow of Python extension module
|
||||
|
||||
The following section encompasses on the detailed description of the entire workflow of Python extension modules and the importance of each function in the codeflow. An example usage has been done in api_testing.py.
|
||||
|
||||
****
|
||||
api_init_options
|
||||
Function declaration- struct ccx_s_options* api_init_options()
|
||||
This function returns an initialized instance of struct ccx_s_options which is modified in CCExtractor according to the values of the parameters provided by the user while executing CCExtractor.
|
||||
****
|
||||
check_configuration_file
|
||||
Function declaration- void check_configuration_file(struct ccx_s_options api_options)
|
||||
This function is used to check the configuration file and it takes the struct ccx_s_options instance as returned by api_init_options().
|
||||
****
|
||||
api_add_param
|
||||
Function declaration- void api_add_param(struct ccx_s_options* api_options,char* arg)
|
||||
The api_add_param function is used to add user passed parameters to the struct ccx_s_options instance which would be used to compile the parameters and make the necessary modifications in the working of CCExtractor.
|
||||
This function takes the instance of struct ccx_s_options passed to check_configuration_file function and also, the string denoting the parameter passed by the user.
|
||||
The parameters are added to the python_params element of struct ccx_s_options and the count of the parameters is kept in python_param_count.
|
||||
****
|
||||
my_pythonapi
|
||||
Function declaration- void my_pythonapi(struct ccx_s_options *api_options, PyObject *callback_func)
|
||||
The my_pythonapi is aimed to provide a Python api to add the callback function when the subtitle extractor had done everyline
|
||||
Thus, it can been observed that my_pythonapi takes two arguments when the compilation is done as extension module. In both the case, the first argument is struct ccx_s_options instance as used by api_add_param. But in case of compiling the extension module, the my_pythonapi function takes a second parameter which is the python callback function that CCExtractor would call when passing values from C to Python (a detailed discussion about this has been done later).
|
||||
This function is not a mandatory function to call when using the CCExtractor binary.
|
||||
****
|
||||
compile_params
|
||||
Function declaration- int compile_params(struct ccx_s_options *api_options,int argc)
|
||||
The compile_params function mainly compiles all the parameters supplied by the user and modifies the elements of the api_options on the basis of the parameters supplied by the user.
|
||||
In this function, we add a dummy parameter ./ccextractor so that the parse_params function which is called from compile_params function properly compiles all the parameter except the first parameter as done in here.
|
||||
This function then returns the return value as obtained by the parse_params function.
|
||||
****
|
||||
api_start
|
||||
Function declaration- int api_start(struct ccx_s_options api_options)
|
||||
This is the most important function of entire processing done by CCExtractor. After the entire compiling of parameters have been completed, then comes the stage when the actual processing is done.
|
||||
The api_start is the function which is majorly responsible for extracting the caption frames and passing them back to Python for processing.
|
||||
|
||||
The user should note that the codeflow discussed above till this point is generic to both CCExtractor binary as well as CCExtractor’s Python extension module. From this point onwards, the codeflow that has been described is mainly how the Python extension module accepts the caption frames via callback function and then processings done on the caption frames to generate the output subtitle file (.srt) via Python.
|
||||
|
||||
The api_start function in case of CE-608 captions calls a function general_loop for processing of the sample(video) that needs to be processed which in turn makes a call to encode_sub which encodes the subtitle buffer obtained from the sample.
|
||||
In encode_sub function, the sub_type is checked to be CE-608. If the sub_type is 608, then a call to pass_cc_buffer_to_python is made. Otherwise, the processing continues as if the call for processing was made from CCExtractor binary.
|
||||
From the pass_cc_buffer_to_python function, the call is made to the extractor function, then the extractor function in turns calls the callback function provided earlier via my_pythonapi function. The arguments given to the callback function are the ones corresponding to the information content of the caption frame which has been processed by CCExtractor. This information is accessed via the Python SRT generator scripts which would process the caption frames and write the processed information in the output subtitle files.
|
||||
The following sections would be sequential in-detail descriptions about how each process functions:
|
||||
|
||||
----
|
||||
Python Encoder for CCExtractor
|
||||
|
||||
Following the architecture of CCExtractor’s codebase, a new file named ccx_encoders_python.c was added. The main reason of adding this file was to define the functions which would be called when the extraction process or CCExtractor extraction functionality is being performed via Python extension module. At this moment, since the extension module extends support only for CE-608 samples, only pass_cc_buffer_to_python function has been defined. Later on, when the binding’s support is extended to support other formats then in that case other functions like pass_cc_bitmap_to_python and others would be included in this file following the architecture of other encoders.
|
||||
****
|
||||
pass_cc_buffer_to_python
|
||||
Function declaration- int pass_cc_buffer_to_python(struct eia608_screen *data, struct encoder_ctx *context)
|
||||
This is the function where the actual work of passing the extracted caption buffer to Python extension modules for processing the caption frames is done.
|
||||
The pass_cc_buffer_to_python function is called when the sample from which the caption frames are to be extracted is a CE-608 sample and the call for extraction is made from Python extension module.
|
||||
In this function, whenever a caption frame element is extracted, be it the srt_counter, caption timing information or any information related to the text, font or color grid of the CE-608 captions, then that information is passed to extractor function defined in extractors/ directory. A detailed description about how exactly the extractors function would be included in the next section.
|
||||
|
||||
----
|
||||
Extractors for bindings
|
||||
|
||||
As documented in the previous section, when the extraction of CE-608 caption frames in done via Python, then the call is made to pass_cc_buffer_to_python function defined in ccx_encoders_python.c. In this function, after extracting lines in a caption frame (lines may belong to any of the text, font or color grid for CE-608), those lines are passed to python_extract_g608_grid function defined also in ccx_encoders_python.c.
|
||||
****
|
||||
python_extract_g608_grid
|
||||
Function declaration- void python_extract_g608_grid(unsigned h1, unsigned m1, unsigned s1, unsigned ms1, unsigned h2, unsigned m2, unsigned s2, unsigned ms2, char* buffer, int identifier, int srt_counter, int encoding)
|
||||
The main aim of using python_extract_g608_grid function is to able to identify the lines belonging to a particular frame and then passing these lines to the Python callback function with added identifiers for identification as to which CE-608 grid those lines belong to in a particular caption frame. More documentation about the identifiers and the nomenclature used for the bindings has been documented in the ‘Support for only CE-608 captions’ section and the user is advised to read that section to get a better understanding of the nomenclature.
|
||||
The arguments passed to python_extract_g608_grid include encoding which is the encoding that CCExtractor would have used to write the output subtitle file. Thus, the encoding is passed from CCExtractor to Python via the callback function so that the output subtitle file generated by Python would have the same encoding as the output generated by CCExtractor would have had.
|
||||
Out of all the arguments that are passed to the python_extract_g608_grid function, the one interesting argument is the identifier argument which has different values depending on the type of caption frame line it is called with. For example, if the line passed to python_extract_g608_grid function is a line belonging to its color grid, then the value of the identifier would be 2. Similarly, we have:
|
||||
identifier = 0 -> adding start and end time
|
||||
identifier = 1 -> subtitle
|
||||
identifier = 2 -> color
|
||||
identifier = 3 -> font
|
||||
identifier = 4 ---> end of frame
|
||||
This is how the python_extract_g608_grid function is able to generate the entire caption frame for a CE-608 sample along with timings.
|
||||
|
||||
----
|
||||
Callback Function architecture
|
||||
|
||||
When using the extension module, when a particular C function is called from Python, the control is transferred to C and returned to Python only after the execution of the function. However, according to the adopted architecture, a single function would process the entire sample and extract all the caption frames until the control is passed back to Python for processing the captions in Python. Thereupon, for further processing in Python the user would have had to wait until the end of the extraction of all the caption frames from the sample. This would violate the basic ideology that the module should be able to process the caption frames in Python as they are extracted in CCExtractor rather than waiting till the end of extraction from the entire sample.
|
||||
As a result of this, the callback function architecture was adopted. The main advantage of this architecture is that the moment a line from the caption frame is extracted the line is passed via a callback function to Python and the processing of the extracted line could be done in Python.
|
||||
In the present architecture, the user has a flexibility to tell CCExtractor which Python function would act as a callback function and a mechanism has been designed to convey this function to CCExtractor. This has been done with the use of my_pythonapi function as discussed in the previous sections.
|
||||
NOTE: In the api_testing.py, I have defined the callback function to be named callback. However, the user has complete freedom to define any name for the callback function. The user needs to note that the callback function would be getting nothing but a line from the caption frame that is extracted by CCExtractor. Further processing of the extracted line is the responsibility of the user.
|
||||
After defining the callback function, the user needs to make sure that this function is passed via Python to CCExtractor so that it can be used for callback. For doing so, the user needs to set the second argument of the function my_pythonapi as the callback function. This has been done in the api_testing.py script and the user can refer to it for example.
|
||||
A detailed description about why a single line of the caption frame is passed via the callback function and not the entire frame is described in detail in later sections.
|
||||
Also, when the user passes the callback function via Python to CCExtractor so the my_pythonapi function saves a pointer to this function as an element to a global structure, array, defined and declared in ccextractor.h. The element reporter holds the callback function passed by user via Python.
|
||||
Whenever the user wants to pass a line to the callback function then the user needs to call the function py_callback which has been defined in ccextractor.c.
|
||||
****
|
||||
py_callback
|
||||
Function declaration- void py_callback(char *line, int encoding);
|
||||
The py_callback function takes two arguments and their description is as follows:
|
||||
The first argument is the line which needs to be passed to Python.
|
||||
The second is the line's encoding.
|
||||
This is how the callback mechanism works for passing the lines from C to Python in real time.
|
||||
|
||||
----
|
||||
Processing output in Python
|
||||
|
||||
As described in the previous sections, the extension modules just return a single line from the caption frames. The processing of the caption frames to generate the output subtitle file is done in Python.
|
||||
A script to generate an output subtitle file from the extracted captions frames in Python has been written. The api_testing.py has a function named callback which acts as a callback function returning the extracted caption lines in Python. These lines then are passed to generated_output_srt in api_support.py described in the api/ directory. Thereupon, the function searches if the line has specific identifier which are used to decide how the output would be generated. A detailed section has been included in this documentation regarding the nomenclature used for processing different lines in CE-608 format caption fields (Support for only CE-608 captions section). The main reason for doing so is to avoid any buffering in C to hold the caption lines until the entire caption frames are extracted. This facilitates real time processing of the extracted caption frames.
|
||||
For getting the output filename from CCExtractor which would then be used to write the output srt file from Python, whenever the code is run from the extension module the first line that is passed via the callback function is the output filename generated by CCExtractor. This is incorporated by calling the callback function from init_write function defined in the src/lib_ccx/output.c file. The line passed to the callback function is of the format filename-<name of the output file to be generated> and this is then used to generate the output file. This line is then captured in the generate_output_srt function defined in the api_support.py.
|
||||
However, if the user wants the flexibility of defining the filename in a different manner, then for such outputs, the user must make changes in the generate_output_srt function to set the filename and ignoring the first line that appears in Python via the callback function.
|
||||
|
||||
----
|
||||
Support for only CE-608 captions:
|
||||
|
||||
For understanding the CE-608 caption format, the user is advised to refer to this documentation on CE-608.
|
||||
|
||||
The Python extension module is so far able to extract the captions frames from CE-608 samples. In samples with CE-608, the caption frames that are extracted by CCExtractor are in the form a 15x32 grid which depicts the screen. Thus, the information regarding the font of the captions, the colour they would be having on the screen as well as their alignment on the screen is captured in font,color and text grids respectively.
|
||||
Using Python modules each of such grids can be accessed in Python. However, as described in the previous section the callback function gets a single line and not the entire grid from CCExtractor, some processing needs to be done in Python for getting the user required grids per caption frames.
|
||||
The functions which would be acting as the processing and buffering functions for grid generations are present in the ccx_to_python_g608.py. The two major functions are return_g608_grid and g608_grid_former. The g608_grid_former is mainly used to form the grid from lines obtained at the callback function.
|
||||
The main advantage of the return_g608_grid function is that the user can generate whatever pattern the user desires to process in Python. For accessing various different combinations of the font, color and text grids in CE-608, a help_string has been defined in the return_g608_grid function in the ccx_to_python_g608.py file which describes on the value of mode to be passed to this function to get proper combination of the grids.
|
||||
In the earlier sections it has been stated that the callback function in Python is not passed with the entire caption frame but just one single line from the frame, a particular nomenclature has been devised to make sure that the lines belonging to the same caption frames are identified in the Python interface. The nomenclature is as follows:
|
||||
For every frame, the first line that is passed to the callback function is the srt_counter which indicates the identifier value of the caption frame that would be extracted next.
|
||||
Following the srt_counter, the next line would contain a conjunction of the start time and end time of the caption frame with respect to the timings when the captions would be visible on the screen. The start_time and end_time would be conjuncted as start_time-<start time>\t end_time-<end time>\n and the user needs to process this line to get the timings. This processing in case of getting a srt file as an output has been done in the generate_output_srt function.
|
||||
After the timings have been sent via the callback function, until the next srt_counter is extracted, the lines containing information about the color, font or text grids of CE-608 samples are passed via the callback function to Python.
|
||||
For processing the grids separately, the color grid could be identified by identifying the presence of color[<srt_counter value>]:<color grid line> in the line obtained from the callback function. Similarly, for the font and text grids, the nomenclatures are font[<srt_counter value>]:<font grid line> and text[<srt_counter value>]:<text grid line> respectively. Processing a grid on the basis of such a nomenclature has been done in the g608_grid_former in the ccx_to_python_g608.py file.
|
||||
After the entire caption frame has been sent via the callback function to Python for further processing, when the extraction of present caption frames finishes and CCExtractor shifts to a new frame, then a line containing ***END OF FRAME*** is passed via the callback function from C to Python. The user needs to catch this line in order to get the signal that from the next line onwards a new caption frame would begin. Similar approach has been implemented in the function generate_output_srt in the api_support.py file.
|
||||
This is how the entire CE-608 is transmitted to Python and the user needs to follow the nomenclature in order to get the caption frames in Python.
|
||||
However, if the user thinks to modify the nomenclature in accordance with some other nomenclature that suits their use case, then the user can do so by editing the python_extract_g608_grid function in the ccx_encoders_python.c file. In this file, the user needs to find the lines where the function py_callback is called with its parameter which are subtitle line and encoding.
|
||||
|
||||
----
|
||||
Wrappers for the extension module
|
||||
|
||||
In case of using an API, it is highly desired to set the parameters desired by the user not via command line but as call to built-in functions. This gave rise to the necessity of wrapper functions which can be called to set certain parameters for directing the functioning of the bindings.
|
||||
The wrappers have been defined in the wrapper.c file in api/wrappers/ directory. The user can use just call the wrappers to set some parameters. More wrappers can be defined according to the architecture followed in wrapper.c.
|
||||
The user needs to note that the wrappers can be called anytime in between adding parameters to CCExtractor instance (as done in api_testing.py) and before calling the compile_params function from the CCExtractor module.
|
||||
Another thing to note about the wrapper is that, the my_pythonapi wrapper function is a very important wrapper function. It tells CCExtractor that the call has been made using the Python module and thus the functioning of CCExtractor is altered. Hence, if the user intends to use the Python module the user is always advised to call this wrapper function with its first argument to be the object returned by api_init function from CCExtractor module and second argument being the callback function which would be called by the CCExtractor to pass the extracted caption lines back to Python.
|
||||
|
||||
----
|
||||
Test Script
|
||||
|
||||
Once the Python module are generated then the user can use them by importing ccextractor module in Python.
|
||||
For testing the output of the bindings a test script, api_testing.py. But to mention, the module at this stage only supports generating a subtitle file from the CE-608 standard samples only.
|
||||
Another testing feature, that has been added is that the user can use recursive_tester.py to generate the subtitle files for all the samples from a directory. The only parameter needed to run this script is the location of all the samples.
|
||||
|
||||
----
|
||||
Silent API
|
||||
|
||||
The Python bindings have been designed in such a way that the API is silent in itself as well as in the form of output generation. Silent in itself means that the API doesn’t write out any output to the STDOUT and the entire output of CCExtractor is silenced when the module is used for extraction of caption frames. This feature has been made possible by passing a parameter -pythonapi internally in api_testing.py using the function my_pythonapi() from the ccextractor module. The -pythonapi internally makes CCExtractor to silence all the outputs that could have been generated otherwise.
|
||||
If the user wants to add some print functionality from the CCExtractor, then may be defining the prints using printf C function could be an option. Note that the user cannot use the mprint function to get prints from the extension module from inside the CCExtractor C code part as used in CCExtractor to get the desired STDOUT prints as these are silenced via -pythonapi.
|
||||
|
||||
====
|
||||
Work status
|
||||
The proposal made by me for this project had a major component of multi-threading to let CCExtractor’s Python bindings run the CCExtractor’s extraction process in multi-threads.
|
||||
However, the end goal was modified while the GSOC 2017 coding period and after Second Phase Evaluation, the main aim was to create a Python extension module for CCExtractor which could process CE-608 video samples, extract the caption information present in them and pass this information to Python for further processing. The module was expected to be silent and the output generation from the caption information present in the video sample has to be done via Python.
|
||||
The present status of the extension module is that the module can extract caption information from CE-608 standard video samples and pass the caption information to Python. Further work has also been done to process this caption information to generate an output subtitle(srt) file (the user is advised to check completion of comparing_text_font_grids function sub-section under the future work section).
|
||||
|
||||
====
|
||||
Future Work
|
||||
|
||||
----
|
||||
Identifying the input format and raising errors if unsupported
|
||||
|
||||
CCExtractor does not process any non-video files. Similarly, the processing of non-video files is not supported by extension module. However, since the API has been designed to be silent, the module doesn’t output any error log stating that the input file is a non-video file and it cannot be processed.
|
||||
This is a much desired feature and the present version of CCExtractor extension module lacks this feature. I would be working on this feature post GSOC 2017 but if any user finds that this feature has not been added until they start contribution to CCExtractor’s extension module, then their work on this feature would be highly appreciated.
|
||||
For adding this feature to extension module, the extension module must be extended to process the return value from CCExtractor as done in the api_start function. When the sample (non-video) is processed via CCExtractor’s binary, then the processing is stopped by raising an ‘Invalid option to CCExtractor Library’ error. However, since the extension module has been designed to be silent, this error message is suppressed. Hence, the user should extend the test scripts to process the return value of api_start function in python extension module according to the constants defined in ccx_common_common.h
|
||||
|
||||
----
|
||||
Callback class mechanism
|
||||
|
||||
The present architecture uses a callback mechanism to pass the extracted caption lines from the caption frames of CE-608 captions to Python for further processing. In the callback mechanism, a callback function is supplied to CCExtractor in C via the my_pythonapi function which stores the callback function as a PyObject* in the global variable array. However, according to Python documentation on C-API, everything in Python is a PyObject; be it a function, a tuple or a class.
|
||||
So, the ideology is to replace the present callback function by a class which can have many methods that the user can use for different use cases.
|
||||
An example of such an implementation has been done here. The user needs to note that for accessing the Python class in C, some modifications need to be done to the py_callback function defined in ccextractor.c and a sample example for calling a class method named ‘callback’ could be found here.
|
||||
Also, an important point to be noted in this case is that the user needs to pass the callback function’s name to run function in C so that the corresponding callback method of the class passed via my_pythonapi could be called via C. As an example, the callback method’s name has been provided here.
|
||||
For understanding the exact implementation of this approach, I would recommend the user to understand C-API for Python as the documentation is quite extensive to every use case.
|
||||
|
||||
----
|
||||
Completion of comparing_text_font_grids function
|
||||
|
||||
The Python extension module for CCExtractor is able to pass lines of the caption frames for different grids of CE-608 captions. However, for generating the subtitle file from the caption grids, the text grid needs to be modified according to the color grid as well as font grid. In CCExtractor, this job is done at the function, get_decoder_line_encoded.
|
||||
For generation of subtitle files (.srt files) from Python, an equivalent version of get_decoder_line_encoded has been implemented in Python and has been defined as comparing_text_font_grids in python_srt_generator.py
|
||||
However, as the user can note that this function is not a complete implementation of get_decoder_line_encoded function, completion of this function’s definition is a matter of future work.
|
||||
|
||||
----
|
||||
Adding more wrapper functions
|
||||
|
||||
As described in the ‘Wrappers for the extension module’ section, more wrapper functions are needed to be declared in the wrapper.c file. For example, few wrappers have been defined. More wrapper functions can be defined in a similar manner.
|
||||
Extending the module to support other caption formats
|
||||
In this version, CCExtractor’s extension module supports processing of video samples having CE-608 standard captions in them and writing these captions to output subtitle (.srt) files.
|
||||
However, CCExtractor in itself has support for other caption standards like DVB, 708 etc. So, extension of module to extract of caption information from samples containing the caption information in these formats is a future task.
|
||||
The user should note that the information passed from CE-608 to Python is in raw form as lines which are then used to form the 608 grids. Similarly, the extension to other formats must consider passing the raw information of caption in respective format and then processing the information extracted by CCExtractor in Python.
|
||||
While extending, the architecture to be followed for ccx_encoders_python should be consistent to other encoders in the codebase to maintain uniformity. Thus for DVB samples, a function name pass_cc_bitmap_to_python and for 708 samples pass_cc_subtitle_to_python need to be declared in ccx_encoders_python.c.
|
||||
|
||||
====
|
||||
PyPI module
|
||||
(This section is for contributors who want to upload the package to PyPI)
|
||||
The PyPI module that has been uploaded has many things added to the CCExtractor code tree and all of this can be found here (branch - manifest_file).
|
||||
The contributor is advised to use the documentation at ‘An Introduction to Distutils’ and its subsequent parts to understand this section.
|
||||
The overall strategy or steps that have been followed to generate the distribution for being uploaded to PyPI is as follows:
|
||||
|
||||
----
|
||||
Adding files to distribution and generating the distribution
|
||||
|
||||
All the files that are needed to be included in the package distribution are to be added the MANIFEST file as done here. For understanding the syntax used in MANIFEST file the user can check this documentation.
|
||||
After the MANIFEST file has been written properly, the user can generate the distribution package by the command
|
||||
python setup.py sdist
|
||||
This command would generate the distribution on the basis of MANIFEST file and place in the dist/ directory as a .tar.gz file until specified otherwise by the user.
|
||||
One thing to mention about the MANIFEST file is that it can only include files/folders from the folder it is defined within. It cannot include directories/files from parent directory or any other child directory. However, in the MANIFEST file I used, I have added the symlink to src main src directory so that the source code can be added to the package distribution via the MANIFEST file.
|
||||
|
||||
----
|
||||
An analysis of the setup.py file used
|
||||
|
||||
The setup.py has been used to install the Python module on the user system. To understand what all the parameters mean in setup the user must refer to this documentation.
|
||||
The cmdclass defined at line is a very important part of the script as it internally makes call to the scripts included in package_build_scripts. A point to note is that this directory is used to include the scripts into the package distribution via the MANIFEST file.
|
||||
The scripts in package_build_scripts are the scripts which do the actual compilation of the source code to required python module and shared object. The user is advised to refer to build_library_package and build_api_package to understand how to compilation process takes place. The user may also refer to this documentation for understanding how the build scripts work.
|
||||
For any modifications made to the build scripts, viz, build_library and build_api corresponding modifications are to be made to the scripts included in package_build_scripts so that the compilation does not fail while installing the Python extension module.
|
||||
The ccextractor.i used in the package_build_scripts is an interface file used by SWIG to generate the wrapper codes. This is an essential part and should always be present with the distribution.
|
||||
@@ -1,20 +1,16 @@
|
||||
CCExtractor
|
||||
(check AUTHORS.TXT for history and developers)
|
||||
----------------------------------------------
|
||||
## CCExtractor
|
||||
check AUTHORS.TXT for history and developers
|
||||
|
||||
License
|
||||
-------
|
||||
## License
|
||||
GPL 2.0.
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
## Description
|
||||
Since the original port, the whole code has been rewritten (more than once,
|
||||
one might add) and support for most subtitle formats around the world has
|
||||
been added (teletext, DVB, CEA-708, ISDB...)
|
||||
|
||||
Basic Usage
|
||||
-----------
|
||||
## Basic Usage
|
||||
(please run ccextractor with no parameters for the complete manual -
|
||||
this is for your convenience, really).
|
||||
|
||||
@@ -31,8 +27,7 @@ trivial - you just need to pass the input file and (optionally) some
|
||||
details about the input and output files.
|
||||
|
||||
|
||||
Languages
|
||||
---------
|
||||
## Languages
|
||||
Usually English captions are transmitted in line 21 field 1 data,
|
||||
using channel 1, so the default values are correct so you don't
|
||||
need to do anything and you don't need to understand what it all
|
||||
@@ -50,20 +45,17 @@ So try adding these parameter combinations to your other parameters.
|
||||
|
||||
If there are Spanish subtitles, one of them should work.
|
||||
|
||||
McPoodle's page
|
||||
---------------
|
||||
## McPoodle's page
|
||||
http://www.theneitherworld.com/mcpoodle/SCC_TOOLS/DOCS/SCC_TOOLS.HTML
|
||||
|
||||
Essential CC related information and free (with source) tools.
|
||||
|
||||
Encoding
|
||||
--------
|
||||
## Encoding
|
||||
This version, in both its Linux and Windows builds generates by
|
||||
default Unicode files. You can use -latin1 and -utf8 if you prefer
|
||||
these encodings (usually it just depends on what your specific
|
||||
player likes).
|
||||
|
||||
Future work
|
||||
-----------
|
||||
## Future work
|
||||
- Please check www.ccextractor.org for news and future work.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#######################################################
|
||||
# Version 0.01
|
||||
# Version 0.02
|
||||
#
|
||||
# To enable required option please uncomment option
|
||||
#
|
||||
@@ -12,12 +12,15 @@
|
||||
# 0 = file
|
||||
# 1 = stdin
|
||||
# 2 = network
|
||||
# 3 = tcp
|
||||
|
||||
INPUT_SOURCE=0
|
||||
|
||||
# The Buffer Input tag
|
||||
# This tag takes number in its input.
|
||||
|
||||
# Is it ccx_bufferdata_type ?
|
||||
|
||||
#BUFFER_INPUT=0
|
||||
|
||||
# The Direct Rollup tag
|
||||
@@ -45,22 +48,28 @@ INPUT_SOURCE=0
|
||||
#NOTYPE_SETTING=
|
||||
|
||||
# The Codec Tag takes the preference of codec
|
||||
# tag CCX_CODEC_ANY is by default
|
||||
# tag CCX_CODEC_ANY by default
|
||||
# This tag takes number in its input and their meanings
|
||||
# are following
|
||||
# 0 = CCX_CODEC_ANY (default)
|
||||
# 1 = CCX_CODEC_TELETEXT
|
||||
# 2 = CCX_CODEC_DVB
|
||||
# 3 = CCX_CODEC_ISDB_CC
|
||||
# 4 = CCX_CODEC_ATSC_CC
|
||||
# 5 = CCX_CODEC_NONE
|
||||
|
||||
#CODEC=
|
||||
|
||||
# The NO Codec Tag uses codec specified
|
||||
# tag CCX_CODEC_NONE by default
|
||||
# This tag takes number in its input and their meanings
|
||||
# are following
|
||||
# 0 = CCX_CODEC_ANY
|
||||
# 1 = CCX_CODEC_TELETEXT
|
||||
# 2 = CCX_CODEC_DVB
|
||||
|
||||
#CODEC=
|
||||
|
||||
# The NO Codec Tag do not use codec specified
|
||||
# tag CCX_CODEC_NONE is by default
|
||||
# This tag takes number in its input and their meanings
|
||||
# are following
|
||||
# 1 = CCX_CODEC_TELETEXT
|
||||
# 2 = CCX_CODEC_DVB
|
||||
# 3 = CCX_CODEC_NONE
|
||||
# 3 = CCX_CODEC_ISDB_CC
|
||||
# 4 = CCX_CODEC_ATSC_CC
|
||||
# 5 = CCX_CODEC_NONE (default)
|
||||
|
||||
#NOCODEC=
|
||||
|
||||
@@ -68,15 +77,21 @@ INPUT_SOURCE=0
|
||||
# by default output format is srt
|
||||
# This tag takes number in its input and their meanings
|
||||
# are following
|
||||
# 0 = CCX_OF_RAW
|
||||
# 1 = CCX_OF_SRT (default)
|
||||
# 2 = CCX_OF_SAMI
|
||||
# 3 = CCX_OF_TRANSCRIPT
|
||||
# 4 = CCX_OF_RCWT
|
||||
# 5 = CCX_OF_NULL
|
||||
# 6 = CCX_OF_SMPTETT
|
||||
# 7 = CCX_OF_SPUPNG
|
||||
# 8 = CCX_OF_DVDRAW
|
||||
# 0 = CCX_OF_RAW
|
||||
# 1 = CCX_OF_SRT (default)
|
||||
# 2 = CCX_OF_SAMI
|
||||
# 3 = CCX_OF_TRANSCRIPT
|
||||
# 4 = CCX_OF_RCWT
|
||||
# 5 = CCX_OF_NULL
|
||||
# 6 = CCX_OF_SMPTETT
|
||||
# 7 = CCX_OF_SPUPNG
|
||||
# 8 = CCX_OF_DVDRAW
|
||||
# 9 = CCX_OF_WEBVTT
|
||||
# 10 = CCX_OF_SIMPLE_XML
|
||||
# 11 = CCX_OF_G608
|
||||
# 12 = CCX_OF_CURL
|
||||
# 13 = CCX_OF_SSA
|
||||
# 14 = CCX_OF_MCC
|
||||
|
||||
#OUTPUT_FORMAT=
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
find /vagrant/Second\ phase\ evaluation/ -name '*.ts' -exec sh -c '
|
||||
for file do
|
||||
python ../../api/api_testing.py $file -quiet
|
||||
done
|
||||
' sh {} +
|
||||
@@ -5,105 +5,110 @@ bin_PROGRAMS = ccextractor
|
||||
ccextractor_SOURCES = \
|
||||
../src/ccextractor.c \
|
||||
../src/ccextractor.h \
|
||||
../src/gpacmp4/avc_ext.c \
|
||||
../src/gpacmp4/avilib.c \
|
||||
../src/gpacmp4/av_parsers.c \
|
||||
../src/gpacmp4/base_encoding.c \
|
||||
../src/gpacmp4/bitstream.c \
|
||||
../src/gpacmp4/box_code_3gpp.c \
|
||||
../src/gpacmp4/box_code_adobe.c \
|
||||
../src/gpacmp4/box_code_apple.c \
|
||||
../src/gpacmp4/box_code_base.c \
|
||||
../src/gpacmp4/box_code_drm.c \
|
||||
../src/gpacmp4/box_dump.c \
|
||||
../src/gpacmp4/box_code_meta.c \
|
||||
../src/gpacmp4/box_funcs.c \
|
||||
../src/gpacmp4/color.c \
|
||||
../src/gpacmp4/configfile.c \
|
||||
../src/gpacmp4/data_map.c \
|
||||
../src/gpacmp4/desc_private.c \
|
||||
../src/gpacmp4/descriptors.c \
|
||||
../src/gpacmp4/drm_sample.c \
|
||||
../src/gpacmp4/error.c \
|
||||
../src/gpacmp4/gpac_ogg.c \
|
||||
../src/gpacmp4/hint_track.c \
|
||||
../src/gpacmp4/hinting.c \
|
||||
../src/gpacmp4/ipmpx_code.c \
|
||||
../src/gpacmp4/ipmpx_parse.c \
|
||||
../src/gpacmp4/isom_intern.c \
|
||||
../src/gpacmp4/isom_read.c \
|
||||
../src/gpacmp4/isom_store.c \
|
||||
../src/gpacmp4/isom_write.c \
|
||||
../src/gpacmp4/list.c \
|
||||
../src/gpacmp4/math.c \
|
||||
../src/gpacmp4/media.c \
|
||||
../src/gpacmp4/media_odf.c \
|
||||
../src/gpacmp4/meta.c \
|
||||
../src/gpacmp4/movie_fragments.c \
|
||||
../src/gpacmp4/mp4.c \
|
||||
../src/gpacmp4/odf_code.c \
|
||||
../src/gpacmp4/odf_codec.c \
|
||||
../src/gpacmp4/odf_command.c \
|
||||
../src/gpacmp4/os_config_init.c \
|
||||
../src/gpacmp4/os_divers.c \
|
||||
../src/gpacmp4/os_file.c \
|
||||
../src/gpacmp4/qos.c \
|
||||
../src/gpacmp4/sample_descs.c \
|
||||
../src/gpacmp4/slc.c \
|
||||
../src/gpacmp4/stbl_read.c \
|
||||
../src/gpacmp4/stbl_write.c \
|
||||
../src/gpacmp4/track.c \
|
||||
../src/gpacmp4/tx3g.c \
|
||||
../src/gpacmp4/url.c \
|
||||
../src/gpacmp4/utf.c \
|
||||
../src/gpacmp4/gpac/avparse.h \
|
||||
../src/gpacmp4/gpac/base_coding.h \
|
||||
../src/gpacmp4/gpac/bitstream.h \
|
||||
../src/gpacmp4/gpac/color.h \
|
||||
../src/gpacmp4/gpac/config_file.h \
|
||||
../src/gpacmp4/gpac/configuration.h \
|
||||
../src/gpacmp4/gpac/constants.h \
|
||||
../src/gpacmp4/gpac/events_constants.h \
|
||||
../src/gpacmp4/gpac/ietf.h \
|
||||
../src/gpacmp4/gpac/isomedia.h \
|
||||
../src/gpacmp4/gpac/list.h \
|
||||
../src/gpacmp4/gpac/maths.h \
|
||||
../src/gpacmp4/gpac/media_tools.h \
|
||||
../src/gpacmp4/gpac/mpeg4_odf.h \
|
||||
../src/gpacmp4/gpac/network.h \
|
||||
../src/gpacmp4/gpac/revision.h \
|
||||
../src/gpacmp4/gpac/setup.h \
|
||||
../src/gpacmp4/gpac/tools.h \
|
||||
../src/gpacmp4/gpac/utf.h \
|
||||
../src/gpacmp4/gpac/version.h \
|
||||
../src/gpacmp4/gpac/internal/avilib.h \
|
||||
../src/gpacmp4/gpac/internal/isomedia_dev.h \
|
||||
../src/gpacmp4/gpac/internal/media_dev.h \
|
||||
../src/gpacmp4/gpac/internal/odf_dev.h \
|
||||
../src/gpacmp4/gpac/internal/odf_parse_common.h \
|
||||
../src/gpacmp4/gpac/internal/ogg.h \
|
||||
../src/libpng/pngstruct.h \
|
||||
../src/libpng/pngpriv.h \
|
||||
../src/libpng/pnginfo.h \
|
||||
../src/libpng/pnglibconf.h \
|
||||
../src/libpng/pngconf.h \
|
||||
../src/libpng/pngdebug.h \
|
||||
../src/libpng/png.h \
|
||||
../src/libpng/png.c \
|
||||
../src/libpng/pngerror.c \
|
||||
../src/libpng/pngget.c \
|
||||
../src/libpng/pngmem.c \
|
||||
../src/libpng/pngpread.c \
|
||||
../src/libpng/pngread.c \
|
||||
../src/libpng/pngrio.c \
|
||||
../src/libpng/pngrtran.c \
|
||||
../src/libpng/pngrutil.c \
|
||||
../src/libpng/pngset.c \
|
||||
../src/libpng/pngtrans.c \
|
||||
../src/libpng/pngwio.c \
|
||||
../src/libpng/pngwrite.c \
|
||||
../src/libpng/pngwtran.c \
|
||||
../src/libpng/pngwutil.c \
|
||||
../src/thirdparty/gpacmp4/avc_ext.c \
|
||||
../src/thirdparty/gpacmp4/avilib.c \
|
||||
../src/thirdparty/gpacmp4/av_parsers.c \
|
||||
../src/thirdparty/gpacmp4/base_encoding.c \
|
||||
../src/thirdparty/gpacmp4/bitstream.c \
|
||||
../src/thirdparty/gpacmp4/box_code_3gpp.c \
|
||||
../src/thirdparty/gpacmp4/box_code_adobe.c \
|
||||
../src/thirdparty/gpacmp4/box_code_apple.c \
|
||||
../src/thirdparty/gpacmp4/box_code_base.c \
|
||||
../src/thirdparty/gpacmp4/box_code_drm.c \
|
||||
../src/thirdparty/gpacmp4/box_dump.c \
|
||||
../src/thirdparty/gpacmp4/box_code_meta.c \
|
||||
../src/thirdparty/gpacmp4/box_funcs.c \
|
||||
../src/thirdparty/gpacmp4/color.c \
|
||||
../src/thirdparty/gpacmp4/configfile.c \
|
||||
../src/thirdparty/gpacmp4/data_map.c \
|
||||
../src/thirdparty/gpacmp4/desc_private.c \
|
||||
../src/thirdparty/gpacmp4/descriptors.c \
|
||||
../src/thirdparty/gpacmp4/drm_sample.c \
|
||||
../src/thirdparty/gpacmp4/error.c \
|
||||
../src/thirdparty/gpacmp4/gpac_ogg.c \
|
||||
../src/thirdparty/gpacmp4/hint_track.c \
|
||||
../src/thirdparty/gpacmp4/hinting.c \
|
||||
../src/thirdparty/gpacmp4/ipmpx_code.c \
|
||||
../src/thirdparty/gpacmp4/ipmpx_parse.c \
|
||||
../src/thirdparty/gpacmp4/isom_intern.c \
|
||||
../src/thirdparty/gpacmp4/isom_read.c \
|
||||
../src/thirdparty/gpacmp4/isom_store.c \
|
||||
../src/thirdparty/gpacmp4/isom_write.c \
|
||||
../src/thirdparty/gpacmp4/list.c \
|
||||
../src/thirdparty/gpacmp4/math.c \
|
||||
../src/thirdparty/gpacmp4/media.c \
|
||||
../src/thirdparty/gpacmp4/media_odf.c \
|
||||
../src/thirdparty/gpacmp4/meta.c \
|
||||
../src/thirdparty/gpacmp4/movie_fragments.c \
|
||||
../src/thirdparty/gpacmp4/odf_code.c \
|
||||
../src/thirdparty/gpacmp4/odf_codec.c \
|
||||
../src/thirdparty/gpacmp4/odf_command.c \
|
||||
../src/thirdparty/gpacmp4/os_config_init.c \
|
||||
../src/thirdparty/gpacmp4/os_divers.c \
|
||||
../src/thirdparty/gpacmp4/os_file.c \
|
||||
../src/thirdparty/gpacmp4/qos.c \
|
||||
../src/thirdparty/gpacmp4/sample_descs.c \
|
||||
../src/thirdparty/gpacmp4/slc.c \
|
||||
../src/thirdparty/gpacmp4/stbl_read.c \
|
||||
../src/thirdparty/gpacmp4/stbl_write.c \
|
||||
../src/thirdparty/gpacmp4/track.c \
|
||||
../src/thirdparty/gpacmp4/tx3g.c \
|
||||
../src/thirdparty/gpacmp4/url.c \
|
||||
../src/thirdparty/gpacmp4/utf.c \
|
||||
../src/thirdparty/gpacmp4/os_thread.c \
|
||||
../src/thirdparty/gpacmp4/module.c \
|
||||
../src/thirdparty/gpacmp4/os_module.c \
|
||||
../src/thirdparty/gpacmp4/xml_parser.c \
|
||||
../src/thirdparty/gpacmp4/constants.c \
|
||||
../src/thirdparty/gpacmp4/gpac/avparse.h \
|
||||
../src/thirdparty/gpacmp4/gpac/base_coding.h \
|
||||
../src/thirdparty/gpacmp4/gpac/bitstream.h \
|
||||
../src/thirdparty/gpacmp4/gpac/color.h \
|
||||
../src/thirdparty/gpacmp4/gpac/config_file.h \
|
||||
../src/thirdparty/gpacmp4/gpac/configuration.h \
|
||||
../src/thirdparty/gpacmp4/gpac/constants.h \
|
||||
../src/thirdparty/gpacmp4/gpac/events_constants.h \
|
||||
../src/thirdparty/gpacmp4/gpac/ietf.h \
|
||||
../src/thirdparty/gpacmp4/gpac/isomedia.h \
|
||||
../src/thirdparty/gpacmp4/gpac/list.h \
|
||||
../src/thirdparty/gpacmp4/gpac/maths.h \
|
||||
../src/thirdparty/gpacmp4/gpac/media_tools.h \
|
||||
../src/thirdparty/gpacmp4/gpac/mpeg4_odf.h \
|
||||
../src/thirdparty/gpacmp4/gpac/network.h \
|
||||
../src/thirdparty/gpacmp4/gpac/revision.h \
|
||||
../src/thirdparty/gpacmp4/gpac/setup.h \
|
||||
../src/thirdparty/gpacmp4/gpac/tools.h \
|
||||
../src/thirdparty/gpacmp4/gpac/utf.h \
|
||||
../src/thirdparty/gpacmp4/gpac/version.h \
|
||||
../src/thirdparty/gpacmp4/gpac/iso639.h \
|
||||
../src/thirdparty/gpacmp4/gpac/internal/avilib.h \
|
||||
../src/thirdparty/gpacmp4/gpac/internal/isomedia_dev.h \
|
||||
../src/thirdparty/gpacmp4/gpac/internal/media_dev.h \
|
||||
../src/thirdparty/gpacmp4/gpac/internal/odf_dev.h \
|
||||
../src/thirdparty/gpacmp4/gpac/internal/odf_parse_common.h \
|
||||
../src/thirdparty/gpacmp4/gpac/internal/ogg.h \
|
||||
../src/thirdparty/libpng/pngstruct.h \
|
||||
../src/thirdparty/libpng/pngpriv.h \
|
||||
../src/thirdparty/libpng/pnginfo.h \
|
||||
../src/thirdparty/libpng/pnglibconf.h \
|
||||
../src/thirdparty/libpng/pngconf.h \
|
||||
../src/thirdparty/libpng/pngdebug.h \
|
||||
../src/thirdparty/libpng/png.h \
|
||||
../src/thirdparty/libpng/png.c \
|
||||
../src/thirdparty/libpng/pngerror.c \
|
||||
../src/thirdparty/libpng/pngget.c \
|
||||
../src/thirdparty/libpng/pngmem.c \
|
||||
../src/thirdparty/libpng/pngpread.c \
|
||||
../src/thirdparty/libpng/pngread.c \
|
||||
../src/thirdparty/libpng/pngrio.c \
|
||||
../src/thirdparty/libpng/pngrtran.c \
|
||||
../src/thirdparty/libpng/pngrutil.c \
|
||||
../src/thirdparty/libpng/pngset.c \
|
||||
../src/thirdparty/libpng/pngtrans.c \
|
||||
../src/thirdparty/libpng/pngwio.c \
|
||||
../src/thirdparty/libpng/pngwrite.c \
|
||||
../src/thirdparty/libpng/pngwtran.c \
|
||||
../src/thirdparty/libpng/pngwutil.c \
|
||||
../src/lib_ccx/ccx_common_common.h \
|
||||
../src/lib_ccx/ccx_common_option.h \
|
||||
../src/lib_ccx/utility.h \
|
||||
@@ -155,8 +160,10 @@ ccextractor_SOURCES = \
|
||||
../src/lib_ccx/ccx_encoders_g608.c \
|
||||
../src/lib_ccx/ccx_encoders_helpers.c \
|
||||
../src/lib_ccx/ccx_encoders_helpers.h \
|
||||
../src/lib_ccx/ccx_encoders_python.c \
|
||||
../src/lib_ccx/ccx_encoders_mcc.c \
|
||||
../src/lib_ccx/ccx_encoders_mcc.h \
|
||||
../src/lib_ccx/ccx_encoders_sami.c \
|
||||
../src/lib_ccx/ccx_encoders_scc.c \
|
||||
../src/lib_ccx/ccx_encoders_smptett.c \
|
||||
../src/lib_ccx/ccx_encoders_splitbysentence.c \
|
||||
../src/lib_ccx/ccx_encoders_spupng.c \
|
||||
@@ -202,6 +209,7 @@ ccextractor_SOURCES = \
|
||||
../src/lib_ccx/list.h \
|
||||
../src/lib_ccx/matroska.c \
|
||||
../src/lib_ccx/matroska.h \
|
||||
../src/lib_ccx/mp4.c \
|
||||
../src/lib_ccx/myth.c \
|
||||
../src/lib_ccx/networking.c \
|
||||
../src/lib_ccx/networking.h \
|
||||
@@ -222,100 +230,100 @@ ccextractor_SOURCES = \
|
||||
../src/lib_ccx/ts_tables_epg.c \
|
||||
../src/lib_ccx/wtv_constants.h \
|
||||
../src/lib_ccx/wtv_functions.c \
|
||||
../src/zlib/adler32.c \
|
||||
../src/zlib/compress.c \
|
||||
../src/zlib/crc32.c \
|
||||
../src/zlib/crc32.h \
|
||||
../src/zlib/deflate.c \
|
||||
../src/zlib/deflate.h \
|
||||
../src/zlib/gzclose.c \
|
||||
../src/zlib/gzguts.h \
|
||||
../src/zlib/gzlib.c \
|
||||
../src/zlib/gzread.c \
|
||||
../src/zlib/gzwrite.c \
|
||||
../src/zlib/infback.c \
|
||||
../src/zlib/inffast.c \
|
||||
../src/zlib/inffast.h \
|
||||
../src/zlib/inffixed.h \
|
||||
../src/zlib/inflate.c \
|
||||
../src/zlib/inflate.h \
|
||||
../src/zlib/inftrees.c \
|
||||
../src/zlib/inftrees.h \
|
||||
../src/zlib/trees.c \
|
||||
../src/zlib/trees.h \
|
||||
../src/zlib/uncompr.c \
|
||||
../src/zlib/zconf.h \
|
||||
../src/zlib/zlib.h \
|
||||
../src/zlib/zutil.c \
|
||||
../src/zlib/zutil.h \
|
||||
../src/utf8proc/utf8proc.c \
|
||||
../src/utf8proc/utf8proc.h \
|
||||
../src/lib_hash/sha2.c \
|
||||
../src/lib_hash/sha2.h \
|
||||
../src/protobuf-c/protobuf-c.c \
|
||||
../src/protobuf-c/protobuf-c.h \
|
||||
../src/zvbi/bcd.h \
|
||||
../src/zvbi/bit_slicer.c \
|
||||
../src/zvbi/bit_slicer.h \
|
||||
../src/zvbi/decoder.c \
|
||||
../src/zvbi/macros.h \
|
||||
../src/zvbi/misc.h \
|
||||
../src/zvbi/raw_decoder.c \
|
||||
../src/zvbi/raw_decoder.h \
|
||||
../src/zvbi/sampling_par.c \
|
||||
../src/zvbi/sampling_par.h \
|
||||
../src/zvbi/sliced.h \
|
||||
../src/zvbi/zvbi_decoder.h \
|
||||
../src/wrappers/wrapper.c \
|
||||
../src/wrappers/wrapper.h \
|
||||
../src/freetype/autofit/autofit.c \
|
||||
../src/freetype/base/ftbase.c \
|
||||
../src/freetype/base/ftbbox.c \
|
||||
../src/freetype/base/ftbdf.c \
|
||||
../src/freetype/base/ftbitmap.c \
|
||||
../src/freetype/base/ftcid.c \
|
||||
../src/freetype/base/ftfntfmt.c \
|
||||
../src/freetype/base/ftfstype.c \
|
||||
../src/freetype/base/ftgasp.c \
|
||||
../src/freetype/base/ftglyph.c \
|
||||
../src/freetype/base/ftgxval.c \
|
||||
../src/freetype/base/ftinit.c \
|
||||
../src/freetype/base/ftlcdfil.c \
|
||||
../src/freetype/base/ftmm.c \
|
||||
../src/freetype/base/ftotval.c \
|
||||
../src/freetype/base/ftpatent.c \
|
||||
../src/freetype/base/ftpfr.c \
|
||||
../src/freetype/base/ftstroke.c \
|
||||
../src/freetype/base/ftsynth.c \
|
||||
../src/freetype/base/ftsystem.c \
|
||||
../src/freetype/base/fttype1.c \
|
||||
../src/freetype/base/ftwinfnt.c \
|
||||
../src/freetype/bdf/bdf.c \
|
||||
../src/freetype/bzip2/ftbzip2.c \
|
||||
../src/freetype/cache/ftcache.c \
|
||||
../src/freetype/cff/cff.c \
|
||||
../src/freetype/cid/type1cid.c \
|
||||
../src/freetype/gzip/ftgzip.c \
|
||||
../src/freetype/lzw/ftlzw.c \
|
||||
../src/freetype/pcf/pcf.c \
|
||||
../src/freetype/pfr/pfr.c \
|
||||
../src/freetype/psaux/psaux.c \
|
||||
../src/freetype/pshinter/pshinter.c \
|
||||
../src/freetype/psnames/psnames.c \
|
||||
../src/freetype/raster/raster.c \
|
||||
../src/freetype/sfnt/sfnt.c \
|
||||
../src/freetype/smooth/smooth.c \
|
||||
../src/freetype/truetype/truetype.c \
|
||||
../src/freetype/type1/type1.c \
|
||||
../src/freetype/type42/type42.c \
|
||||
../src/freetype/winfonts/winfnt.c
|
||||
../src/thirdparty/zlib/adler32.c \
|
||||
../src/thirdparty/zlib/compress.c \
|
||||
../src/thirdparty/zlib/crc32.c \
|
||||
../src/thirdparty/zlib/crc32.h \
|
||||
../src/thirdparty/zlib/deflate.c \
|
||||
../src/thirdparty/zlib/deflate.h \
|
||||
../src/thirdparty/zlib/gzclose.c \
|
||||
../src/thirdparty/zlib/gzguts.h \
|
||||
../src/thirdparty/zlib/gzlib.c \
|
||||
../src/thirdparty/zlib/gzread.c \
|
||||
../src/thirdparty/zlib/gzwrite.c \
|
||||
../src/thirdparty/zlib/infback.c \
|
||||
../src/thirdparty/zlib/inffast.c \
|
||||
../src/thirdparty/zlib/inffast.h \
|
||||
../src/thirdparty/zlib/inffixed.h \
|
||||
../src/thirdparty/zlib/inflate.c \
|
||||
../src/thirdparty/zlib/inflate.h \
|
||||
../src/thirdparty/zlib/inftrees.c \
|
||||
../src/thirdparty/zlib/inftrees.h \
|
||||
../src/thirdparty/zlib/trees.c \
|
||||
../src/thirdparty/zlib/trees.h \
|
||||
../src/thirdparty/zlib/uncompr.c \
|
||||
../src/thirdparty/zlib/zconf.h \
|
||||
../src/thirdparty/zlib/zlib.h \
|
||||
../src/thirdparty/zlib/zutil.c \
|
||||
../src/thirdparty/zlib/zutil.h \
|
||||
../src/thirdparty/utf8proc/utf8proc.c \
|
||||
../src/thirdparty/utf8proc/utf8proc.h \
|
||||
../src/thirdparty/lib_hash/sha2.c \
|
||||
../src/thirdparty/lib_hash/sha2.h \
|
||||
../src/thirdparty/protobuf-c/protobuf-c.c \
|
||||
../src/thirdparty/protobuf-c/protobuf-c.h \
|
||||
../src/thirdparty/zvbi/bcd.h \
|
||||
../src/lib_ccx/zvbi/bit_slicer.c \
|
||||
../src/lib_ccx/zvbi/bit_slicer.h \
|
||||
../src/lib_ccx/zvbi/decoder.c \
|
||||
../src/lib_ccx/zvbi/macros.h \
|
||||
../src/lib_ccx/zvbi/misc.h \
|
||||
../src/lib_ccx/zvbi/raw_decoder.c \
|
||||
../src/lib_ccx/zvbi/raw_decoder.h \
|
||||
../src/lib_ccx/zvbi/sampling_par.c \
|
||||
../src/lib_ccx/zvbi/sampling_par.h \
|
||||
../src/lib_ccx/zvbi/sliced.h \
|
||||
../src/lib_ccx/zvbi/zvbi_decoder.h \
|
||||
../src/freetype/* \
|
||||
../src/thirdparty/freetype/autofit/autofit.c \
|
||||
../src/thirdparty/freetype/base/ftbase.c \
|
||||
../src/thirdparty/freetype/base/ftbbox.c \
|
||||
../src/thirdparty/freetype/base/ftbdf.c \
|
||||
../src/thirdparty/freetype/base/ftbitmap.c \
|
||||
../src/thirdparty/freetype/base/ftcid.c \
|
||||
../src/thirdparty/freetype/base/ftfntfmt.c \
|
||||
../src/thirdparty/freetype/base/ftfstype.c \
|
||||
../src/thirdparty/freetype/base/ftgasp.c \
|
||||
../src/thirdparty/freetype/base/ftglyph.c \
|
||||
../src/thirdparty/freetype/base/ftgxval.c \
|
||||
../src/thirdparty/freetype/base/ftinit.c \
|
||||
../src/thirdparty/freetype/base/ftlcdfil.c \
|
||||
../src/thirdparty/freetype/base/ftmm.c \
|
||||
../src/thirdparty/freetype/base/ftotval.c \
|
||||
../src/thirdparty/freetype/base/ftpatent.c \
|
||||
../src/thirdparty/freetype/base/ftpfr.c \
|
||||
../src/thirdparty/freetype/base/ftstroke.c \
|
||||
../src/thirdparty/freetype/base/ftsynth.c \
|
||||
../src/thirdparty/freetype/base/ftsystem.c \
|
||||
../src/thirdparty/freetype/base/fttype1.c \
|
||||
../src/thirdparty/freetype/base/ftwinfnt.c \
|
||||
../src/thirdparty/freetype/bdf/bdf.c \
|
||||
../src/thirdparty/freetype/bzip2/ftbzip2.c \
|
||||
../src/thirdparty/freetype/cache/ftcache.c \
|
||||
../src/thirdparty/freetype/cff/cff.c \
|
||||
../src/thirdparty/freetype/cid/type1cid.c \
|
||||
../src/thirdparty/freetype/gzip/ftgzip.c \
|
||||
../src/thirdparty/freetype/include/ft2build.h \
|
||||
../src/thirdparty/freetype/lzw/ftlzw.c \
|
||||
../src/thirdparty/freetype/pcf/pcf.c \
|
||||
../src/thirdparty/freetype/pfr/pfr.c \
|
||||
../src/thirdparty/freetype/psaux/psaux.c \
|
||||
../src/thirdparty/freetype/pshinter/pshinter.c \
|
||||
../src/thirdparty/freetype/psnames/psnames.c \
|
||||
../src/thirdparty/freetype/raster/raster.c \
|
||||
../src/thirdparty/freetype/sfnt/sfnt.c \
|
||||
../src/thirdparty/freetype/smooth/smooth.c \
|
||||
../src/thirdparty/freetype/truetype/truetype.c \
|
||||
../src/thirdparty/freetype/type1/type1.c \
|
||||
../src/thirdparty/freetype/type42/type42.c \
|
||||
../src/thirdparty/freetype/winfonts/winfnt.c
|
||||
|
||||
ccextractor_CFLAGS = -std=gnu99 -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP
|
||||
ccextractor_CFLAGS = -std=gnu99 -Wno-write-strings -Wno-pointer-sign -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP -DGPAC_DISABLE_REMOTERY -DNO_GZIP -DGPAC_HAVE_CONFIG_H
|
||||
|
||||
ccextractor_CPPFLAGS =-I../src/lib_ccx/ -I../src/gpacmp4/ -I../src/libpng/ -I../src/zlib/ -I../src/zvbi/ -I../src/lib_hash/ -I../src/protobuf-c/ -I../src/utf8proc/ -I../src/ -I../src/freetype/include/
|
||||
ccextractor_CPPFLAGS =-I../src/lib_ccx/ -I../src/thirdparty/gpacmp4/ -I../src/thirdparty/libpng/ -I../src/thirdparty/zlib/ -I../src/thirdparty/zvbi/ -I../src/thirdparty/lib_hash/ -I../src/thirdparty/protobuf-c/ -I../src/thirdparty -I../src/ -I../src/thirdparty/freetype/include/
|
||||
|
||||
|
||||
ccextractor_LDADD=-lm
|
||||
ccextractor_LDADD=-lm -lpthread -ldl
|
||||
|
||||
if SYS_IS_LINUX
|
||||
ccextractor_CFLAGS += -O3 -s -DGPAC_CONFIG_LINUX
|
||||
@@ -367,7 +375,7 @@ ccextractor_LDADD += $(TESS_LIB)
|
||||
ccextractor_LDADD += $(LEPT_LIB)
|
||||
endif
|
||||
|
||||
EXTRA_DIST = ../src/gpacmp4/gpac/sync_layer.h ../src/lib_ccx/ccfont2.xbm ../src/utf8proc/utf8proc_data.c fonts/ icon/
|
||||
EXTRA_DIST = ../src/thirdparty/gpacmp4/gpac/sync_layer.h ../src/lib_ccx/ccfont2.xbm ../src/thirdparty/utf8proc/utf8proc_data.c fonts/ icon/
|
||||
|
||||
#For GUI
|
||||
if BUILD_WITH_GUI
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
./pre-build.sh
|
||||
autoreconf -i
|
||||
|
||||
106
linux/build
106
linux/build
@@ -1,63 +1,61 @@
|
||||
#!/bin/bash
|
||||
BLD_FLAGS="-std=gnu99 -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DENABLE_OCR -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP"
|
||||
#!/usr/bin/env bash
|
||||
BLD_FLAGS="$BLD_FLAGS -std=gnu99 -Wno-write-strings -Wno-pointer-sign -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DENABLE_OCR -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP -DGPAC_DISABLE_REMOTERY -DNO_GZIP -DGPAC_HAVE_CONFIG_H"
|
||||
bit_os=$(getconf LONG_BIT)
|
||||
if [ "$bit_os"=="64" ]
|
||||
then
|
||||
BLD_FLAGS="$BLD_FLAGS -DGPAC_64_BITS"
|
||||
fi
|
||||
BLD_INCLUDE="-I../src -I /usr/include/leptonica/ -I /usr/include/tesseract/ -I../src/lib_ccx/ -I../src/gpacmp4/ -I../src/libpng/ -I../src/zlib/ -I../src/zvbi -I../src/lib_hash -I../src/protobuf-c -I../src/utf8proc -I../src/freetype/include"
|
||||
SRC_LIBPNG="$(find ../src/libpng/ -name '*.c')"
|
||||
SRC_ZLIB="$(find ../src/zlib/ -name '*.c')"
|
||||
SRC_ZVBI="$(find ../src/zvbi/ -name '*.c')"
|
||||
BLD_INCLUDE="-I../src -I /usr/include/leptonica/ -I /usr/include/tesseract/ -I../src/lib_ccx/ -I../src/thirdparty/gpacmp4/ -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/thirdparty/freetype/include"
|
||||
SRC_LIBPNG="$(find ../src/thirdparty/libpng/ -name '*.c')"
|
||||
SRC_ZLIB="$(find ../src/thirdparty/zlib/ -name '*.c')"
|
||||
SRC_CCX="$(find ../src/lib_ccx/ -name '*.c')"
|
||||
SRC_GPAC="$(find ../src/gpacmp4/ -name '*.c')"
|
||||
SRC_HASH="$(find ../src/lib_hash/ -name '*.c')"
|
||||
SRC_PROTOBUF="$(find ../src/protobuf-c/ -name '*.c')"
|
||||
SRC_UTF8PROC="../src/utf8proc/utf8proc.c"
|
||||
SRC_FREETYPE="../src/freetype/autofit/autofit.c
|
||||
../src/freetype/base/ftbase.c
|
||||
../src/freetype/base/ftbbox.c
|
||||
../src/freetype/base/ftbdf.c
|
||||
../src/freetype/base/ftbitmap.c
|
||||
../src/freetype/base/ftcid.c
|
||||
../src/freetype/base/ftfntfmt.c
|
||||
../src/freetype/base/ftfstype.c
|
||||
../src/freetype/base/ftgasp.c
|
||||
../src/freetype/base/ftglyph.c
|
||||
../src/freetype/base/ftgxval.c
|
||||
../src/freetype/base/ftinit.c
|
||||
../src/freetype/base/ftlcdfil.c
|
||||
../src/freetype/base/ftmm.c
|
||||
../src/freetype/base/ftotval.c
|
||||
../src/freetype/base/ftpatent.c
|
||||
../src/freetype/base/ftpfr.c
|
||||
../src/freetype/base/ftstroke.c
|
||||
../src/freetype/base/ftsynth.c
|
||||
../src/freetype/base/ftsystem.c
|
||||
../src/freetype/base/fttype1.c
|
||||
../src/freetype/base/ftwinfnt.c
|
||||
../src/freetype/bdf/bdf.c
|
||||
../src/freetype/bzip2/ftbzip2.c
|
||||
../src/freetype/cache/ftcache.c
|
||||
../src/freetype/cff/cff.c
|
||||
../src/freetype/cid/type1cid.c
|
||||
../src/freetype/gzip/ftgzip.c
|
||||
../src/freetype/lzw/ftlzw.c
|
||||
../src/freetype/pcf/pcf.c
|
||||
../src/freetype/pfr/pfr.c
|
||||
../src/freetype/psaux/psaux.c
|
||||
../src/freetype/pshinter/pshinter.c
|
||||
../src/freetype/psnames/psnames.c
|
||||
../src/freetype/raster/raster.c
|
||||
../src/freetype/sfnt/sfnt.c
|
||||
../src/freetype/smooth/smooth.c
|
||||
../src/freetype/truetype/truetype.c
|
||||
../src/freetype/type1/type1.c
|
||||
../src/freetype/type42/type42.c
|
||||
../src/freetype/winfonts/winfnt.c"
|
||||
API_WRAPPERS="$(find ../src/wrappers/ -name '*.c')"
|
||||
BLD_SOURCES="../src/ccextractor.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC $API_WRAPPERS $SRC_FREETYPE"
|
||||
BLD_LINKER="-lm -zmuldefs -l tesseract -l lept"
|
||||
SRC_GPAC="$(find ../src/thirdparty/gpacmp4/ -name '*.c')"
|
||||
SRC_HASH="$(find ../src/thirdparty/lib_hash/ -name '*.c')"
|
||||
SRC_PROTOBUF="$(find ../src/thirdparty/protobuf-c/ -name '*.c')"
|
||||
SRC_UTF8PROC="../src/thirdparty/utf8proc/utf8proc.c"
|
||||
SRC_FREETYPE="../src/thirdparty/freetype/autofit/autofit.c
|
||||
../src/thirdparty/freetype/base/ftbase.c
|
||||
../src/thirdparty/freetype/base/ftbbox.c
|
||||
../src/thirdparty/freetype/base/ftbdf.c
|
||||
../src/thirdparty/freetype/base/ftbitmap.c
|
||||
../src/thirdparty/freetype/base/ftcid.c
|
||||
../src/thirdparty/freetype/base/ftfntfmt.c
|
||||
../src/thirdparty/freetype/base/ftfstype.c
|
||||
../src/thirdparty/freetype/base/ftgasp.c
|
||||
../src/thirdparty/freetype/base/ftglyph.c
|
||||
../src/thirdparty/freetype/base/ftgxval.c
|
||||
../src/thirdparty/freetype/base/ftinit.c
|
||||
../src/thirdparty/freetype/base/ftlcdfil.c
|
||||
../src/thirdparty/freetype/base/ftmm.c
|
||||
../src/thirdparty/freetype/base/ftotval.c
|
||||
../src/thirdparty/freetype/base/ftpatent.c
|
||||
../src/thirdparty/freetype/base/ftpfr.c
|
||||
../src/thirdparty/freetype/base/ftstroke.c
|
||||
../src/thirdparty/freetype/base/ftsynth.c
|
||||
../src/thirdparty/freetype/base/ftsystem.c
|
||||
../src/thirdparty/freetype/base/fttype1.c
|
||||
../src/thirdparty/freetype/base/ftwinfnt.c
|
||||
../src/thirdparty/freetype/bdf/bdf.c
|
||||
../src/thirdparty/freetype/bzip2/ftbzip2.c
|
||||
../src/thirdparty/freetype/cache/ftcache.c
|
||||
../src/thirdparty/freetype/cff/cff.c
|
||||
../src/thirdparty/freetype/cid/type1cid.c
|
||||
../src/thirdparty/freetype/gzip/ftgzip.c
|
||||
../src/thirdparty/freetype/lzw/ftlzw.c
|
||||
../src/thirdparty/freetype/pcf/pcf.c
|
||||
../src/thirdparty/freetype/pfr/pfr.c
|
||||
../src/thirdparty/freetype/psaux/psaux.c
|
||||
../src/thirdparty/freetype/pshinter/pshinter.c
|
||||
../src/thirdparty/freetype/psnames/psnames.c
|
||||
../src/thirdparty/freetype/raster/raster.c
|
||||
../src/thirdparty/freetype/sfnt/sfnt.c
|
||||
../src/thirdparty/freetype/smooth/smooth.c
|
||||
../src/thirdparty/freetype/truetype/truetype.c
|
||||
../src/thirdparty/freetype/type1/type1.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"
|
||||
|
||||
echo "Running pre-build script..."
|
||||
./pre-build.sh
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh -ex
|
||||
#!/usr/bin/env sh -ex
|
||||
|
||||
####################################################################
|
||||
# setup by tracey apr 2012
|
||||
@@ -88,13 +88,13 @@ cd ccextractor/linux/;
|
||||
# cd ccextractor.*/linux/;
|
||||
perl -i -pe 's/O3 /O3 -static /' Makefile;
|
||||
# quick patch:
|
||||
perl -i -pe 's/(strchr|strstr)\(/$1((char *)/' ../src/gpacmp4/url.c ../src/gpacmp4/error.c;
|
||||
perl -i -pe 's/(strchr|strstr)\(/$1((char *)/' ../src/thirdparty/gpacmp4/url.c ../src/thirdparty/gpacmp4/error.c;
|
||||
set +e; # this _will_ FAIL at the end..
|
||||
make ENABLE_OCR=yes;
|
||||
set -e;
|
||||
# I confess hand-compiling (cherrypicking which .a to use when there are 2, etc.) is fragile...
|
||||
# But it was the _only_ way I could get a fully static build after hours of thrashing...
|
||||
gcc -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -O3 -std=gnu99 -s -DGPAC_CONFIG_LINUX -DENABLE_OCR -DPNG_NO_CONFIG_H -I/usr/local/include/tesseract -I/usr/local/include/leptonica objs/*.o -o ccextractor \
|
||||
gcc -Wno-write-strings -Wno-pointer-sign -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -O3 -std=gnu99 -s -DGPAC_CONFIG_LINUX -DENABLE_OCR -DPNG_NO_CONFIG_H -I/usr/local/include/tesseract -I/usr/local/include/leptonica objs/*.o -o ccextractor \
|
||||
--static -lm \
|
||||
/usr/local/lib/libtesseract.a \
|
||||
/usr/local/lib/liblept.a \
|
||||
|
||||
@@ -1,64 +1,4 @@
|
||||
#!/bin/bash
|
||||
BLD_FLAGS="-g -std=gnu99 -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DENABLE_OCR -DENABLE_HARDSUBX -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP"
|
||||
bit_os=$(getconf LONG_BIT)
|
||||
if [ "$bit_os"=="64" ]
|
||||
then
|
||||
BLD_FLAGS="$BLD_FLAGS -DGPAC_64_BITS"
|
||||
fi
|
||||
BLD_INCLUDE="-I../src -I /usr/local/include -I /usr/include/leptonica/ -I /usr/include/tesseract/ -I../src/lib_ccx/ -I../src/gpacmp4/ -I../src/libpng/ -I../src/zlib/ -I../src/zvbi -I../src/lib_hash -I../src/protobuf-c -I../src/freetype/include"
|
||||
SRC_LIBPNG="$(find ../src/libpng/ -name '*.c')"
|
||||
SRC_ZLIB="$(find ../src/zlib/ -name '*.c')"
|
||||
SRC_ZVBI="$(find ../src/zvbi/ -name '*.c')"
|
||||
SRC_CCX="$(find ../src/lib_ccx/ -name '*.c')"
|
||||
SRC_GPAC="$(find ../src/gpacmp4/ -name '*.c')"
|
||||
SRC_HASH="$(find ../src/lib_hash/ -name '*.c')"
|
||||
SRC_UTF8="../src/utf8proc/utf8proc.c"
|
||||
SRC_FREETYPE="../src/freetype/autofit/autofit.c
|
||||
../src/freetype/base/ftbase.c
|
||||
../src/freetype/base/ftbbox.c
|
||||
../src/freetype/base/ftbdf.c
|
||||
../src/freetype/base/ftbitmap.c
|
||||
../src/freetype/base/ftcid.c
|
||||
../src/freetype/base/ftfntfmt.c
|
||||
../src/freetype/base/ftfstype.c
|
||||
../src/freetype/base/ftgasp.c
|
||||
../src/freetype/base/ftglyph.c
|
||||
../src/freetype/base/ftgxval.c
|
||||
../src/freetype/base/ftinit.c
|
||||
../src/freetype/base/ftlcdfil.c
|
||||
../src/freetype/base/ftmm.c
|
||||
../src/freetype/base/ftotval.c
|
||||
../src/freetype/base/ftpatent.c
|
||||
../src/freetype/base/ftpfr.c
|
||||
../src/freetype/base/ftstroke.c
|
||||
../src/freetype/base/ftsynth.c
|
||||
../src/freetype/base/ftsystem.c
|
||||
../src/freetype/base/fttype1.c
|
||||
../src/freetype/base/ftwinfnt.c
|
||||
../src/freetype/bdf/bdf.c
|
||||
../src/freetype/bzip2/ftbzip2.c
|
||||
../src/freetype/cache/ftcache.c
|
||||
../src/freetype/cff/cff.c
|
||||
../src/freetype/cid/type1cid.c
|
||||
../src/freetype/gzip/ftgzip.c
|
||||
../src/freetype/lzw/ftlzw.c
|
||||
../src/freetype/pcf/pcf.c
|
||||
../src/freetype/pfr/pfr.c
|
||||
../src/freetype/psaux/psaux.c
|
||||
../src/freetype/pshinter/pshinter.c
|
||||
../src/freetype/psnames/psnames.c
|
||||
../src/freetype/raster/raster.c
|
||||
../src/freetype/sfnt/sfnt.c
|
||||
../src/freetype/smooth/smooth.c
|
||||
../src/freetype/truetype/truetype.c
|
||||
../src/freetype/type1/type1.c
|
||||
../src/freetype/type42/type42.c
|
||||
../src/freetype/winfonts/winfnt.c"
|
||||
API_WRAPPERS="$(find ../src/wrappers/ -name '*.c')"
|
||||
SRC_PROTOBUF="$(find ../src/protobuf-c/ -name '*.c')"
|
||||
protobuf-c
|
||||
BLD_SOURCES="../src/ccextractor.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_UTF8 $SRC_PROTOBUF $API_WRAPPERS $SRC_FREETYPE"
|
||||
BLD_LINKER="-lm -zmuldefs -l tesseract -l lept -L/usr/local/lib -lswscale -lavutil -pthread -lavformat -lavcodec -lxcb-shm -lxcb -lX11 -llzma -lz -lswresample"
|
||||
|
||||
./pre-build.sh
|
||||
gcc $BLD_FLAGS $BLD_INCLUDE -o ccextractor $BLD_SOURCES $BLD_LINKER
|
||||
#!/usr/bin/env bash
|
||||
export BLD_FLAGS="-DENABLE_HARDSUBX"
|
||||
export BLD_LINKER="-lswscale -lavutil -pthread -lavformat -lavcodec -lxcb-shm -lxcb -lX11 -llzma -lswresample"
|
||||
./build
|
||||
|
||||
102
linux/builddebug
102
linux/builddebug
@@ -1,99 +1,3 @@
|
||||
#!/bin/bash
|
||||
BLD_FLAGS="-g -std=gnu99 -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DENABLE_OCR -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP"
|
||||
bit_os=$(getconf LONG_BIT)
|
||||
if [ "$bit_os"=="64" ]
|
||||
then
|
||||
BLD_FLAGS="$BLD_FLAGS -DGPAC_64_BITS"
|
||||
fi
|
||||
BLD_INCLUDE="-I../src -I /usr/include/leptonica/ -I /usr/include/tesseract/ -I../src/lib_ccx/ -I../src/gpacmp4/ -I../src/libpng/ -I../src/zlib/ -I../src/zvbi -I../src/lib_hash -I../src/protobuf-c -I../src/utf8proc -I../src/freetype/include"
|
||||
SRC_LIBPNG="$(find ../src/libpng/ -name '*.c')"
|
||||
SRC_ZLIB="$(find ../src/zlib/ -name '*.c')"
|
||||
SRC_ZVBI="$(find ../src/zvbi/ -name '*.c')"
|
||||
SRC_CCX="$(find ../src/lib_ccx/ -name '*.c')"
|
||||
SRC_GPAC="$(find ../src/gpacmp4/ -name '*.c')"
|
||||
SRC_HASH="$(find ../src/lib_hash/ -name '*.c')"
|
||||
SRC_PROTOBUF="$(find ../src/protobuf-c/ -name '*.c')"
|
||||
SRC_UTF8PROC="../src/utf8proc/utf8proc.c"
|
||||
SRC_FREETYPE="../src/freetype/autofit/autofit.c
|
||||
../src/freetype/base/ftbase.c
|
||||
../src/freetype/base/ftbbox.c
|
||||
../src/freetype/base/ftbdf.c
|
||||
../src/freetype/base/ftbitmap.c
|
||||
../src/freetype/base/ftcid.c
|
||||
../src/freetype/base/ftfntfmt.c
|
||||
../src/freetype/base/ftfstype.c
|
||||
../src/freetype/base/ftgasp.c
|
||||
../src/freetype/base/ftglyph.c
|
||||
../src/freetype/base/ftgxval.c
|
||||
../src/freetype/base/ftinit.c
|
||||
../src/freetype/base/ftlcdfil.c
|
||||
../src/freetype/base/ftmm.c
|
||||
../src/freetype/base/ftotval.c
|
||||
../src/freetype/base/ftpatent.c
|
||||
../src/freetype/base/ftpfr.c
|
||||
../src/freetype/base/ftstroke.c
|
||||
../src/freetype/base/ftsynth.c
|
||||
../src/freetype/base/ftsystem.c
|
||||
../src/freetype/base/fttype1.c
|
||||
../src/freetype/base/ftwinfnt.c
|
||||
../src/freetype/bdf/bdf.c
|
||||
../src/freetype/bzip2/ftbzip2.c
|
||||
../src/freetype/cache/ftcache.c
|
||||
../src/freetype/cff/cff.c
|
||||
../src/freetype/cid/type1cid.c
|
||||
../src/freetype/gzip/ftgzip.c
|
||||
../src/freetype/lzw/ftlzw.c
|
||||
../src/freetype/pcf/pcf.c
|
||||
../src/freetype/pfr/pfr.c
|
||||
../src/freetype/psaux/psaux.c
|
||||
../src/freetype/pshinter/pshinter.c
|
||||
../src/freetype/psnames/psnames.c
|
||||
../src/freetype/raster/raster.c
|
||||
../src/freetype/sfnt/sfnt.c
|
||||
../src/freetype/smooth/smooth.c
|
||||
../src/freetype/truetype/truetype.c
|
||||
../src/freetype/type1/type1.c
|
||||
../src/freetype/type42/type42.c
|
||||
../src/freetype/winfonts/winfnt.c"
|
||||
API_WRAPPERS="$(find ../src/wrappers/ -name '*.c')"
|
||||
BLD_SOURCES="../src/ccextractor.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC $API_WRAPPERS $SRC_FREETYPE"
|
||||
BLD_LINKER="-lm -zmuldefs -l tesseract -l lept"
|
||||
|
||||
echo "Running pre-build script..."
|
||||
./pre-build.sh
|
||||
echo "Trying to compile..."
|
||||
|
||||
out=$((LC_ALL=C gcc $BLD_FLAGS $BLD_INCLUDE -o ccextractor $BLD_SOURCES $BLD_LINKER)2>&1)
|
||||
res=$?
|
||||
if [[ $out == *"gcc: command not found"* ]]
|
||||
then
|
||||
echo "Error: please install gcc";
|
||||
exit 1
|
||||
fi
|
||||
if [[ $out == *"curl.h: No such file or directory"* ]]
|
||||
then
|
||||
echo "Error: please install curl development library (libcurl4-gnutls-dev for Debian/Ubuntu)";
|
||||
exit 2
|
||||
fi
|
||||
if [[ $out == *"capi.h: No such file or directory"* ]]
|
||||
then
|
||||
echo "Error: please install tesseract development library (libtesseract-dev for Debian/Ubuntu)";
|
||||
exit 3
|
||||
fi
|
||||
if [[ $out == *"allheaders.h: No such file or directory"* ]]
|
||||
then
|
||||
echo "Error: please install leptonica development library (libleptonica-dev for Debian/Ubuntu)";
|
||||
exit 4
|
||||
fi
|
||||
if [[ $res -ne 0 ]] # Unknown error
|
||||
then
|
||||
echo "Compiled with errors"
|
||||
>&2 echo "$out"
|
||||
exit 5
|
||||
fi
|
||||
if [[ "$out" != "" ]] ; then
|
||||
echo "$out"
|
||||
echo "Compilation successful, compiler message shown in previous lines"
|
||||
else
|
||||
echo "Compilation successful, no compiler messages."
|
||||
fi
|
||||
#!/usr/bin/env bash
|
||||
export BLD_FLAGS="-g"
|
||||
./build
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
make distclean > /dev/null 2>&1 || true
|
||||
rm -rf Makefile configure *.in config.status config.log aclocal.m4 build-conf autom4te.cache
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([CCExtractor], [0.88], [carlos@ccextractor.org])
|
||||
AC_INIT([CCExtractor], [0.89], [carlos@ccextractor.org])
|
||||
AC_CONFIG_AUX_DIR([build-conf])
|
||||
AC_CONFIG_SRCDIR([../src/ccextractor.c])
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#!/bin/bash
|
||||
SRC_LIBPNG="$(find ../src/libpng/ -name '*.c')"
|
||||
SRC_ZLIB="$(find ../src/zlib/ -name '*.c')"
|
||||
SRC_ZVBI="$(find ../src/zvbi/ -name '*.c')"
|
||||
#!/usr/bin/env bash
|
||||
SRC_LIBPNG="$(find ../src/thirdparty/libpng/ -name '*.c')"
|
||||
SRC_ZLIB="$(find ../sr/thirdpartyc/zlib/ -name '*.c')"
|
||||
SRC_ZVBI="$(find ../sr/thirdpartyc/zvbi/ -name '*.c')"
|
||||
SRC_CCX="$(find ../src/lib_ccx/ -name '*.c')"
|
||||
SRC_GPAC="$(find ../src/gpacmp4/ -name '*.c')"
|
||||
SRC_HASH="$(find ../src/lib_hash/ -name '*.c')"
|
||||
SRC_PROTOBUF="$(find ../src/protobuf-c/ -name '*.c')"
|
||||
SRC_GPAC="$(find ../sr/thirdpartyc/gpacmp4/ -name '*.c')"
|
||||
SRC_HASH="$(find ../sr/thirdpartyc/lib_hash/ -name '*.c')"
|
||||
SRC_PROTOBUF="$(find ../src/thirdparty/protobuf-c/ -name '*.c')"
|
||||
SRC_UTF8PROC="../src/utf8proc/utf8proc.c"
|
||||
API_WRAPPERS="$(find ../src/wrappers/ -name '*.c')"
|
||||
BLD_SOURCES="../src/ccextractor.c ../src/ccextractorapi_wrap.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC $API_WRAPPERS"
|
||||
BLD_SOURCES="../src/ccextractor.c ../src/ccextractorapi_wrap.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC"
|
||||
|
||||
python setup.py $BLD_SOURCES
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
echo "Obtaining Git commit"
|
||||
commit=(`git rev-parse HEAD 2>/dev/null`)
|
||||
if [ -z "$commit" ]; then
|
||||
|
||||
387
mac/Makefile.am
387
mac/Makefile.am
@@ -5,105 +5,109 @@ bin_PROGRAMS = ccextractor
|
||||
ccextractor_SOURCES = \
|
||||
../src/ccextractor.c \
|
||||
../src/ccextractor.h \
|
||||
../src/gpacmp4/avc_ext.c \
|
||||
../src/gpacmp4/avilib.c \
|
||||
../src/gpacmp4/av_parsers.c \
|
||||
../src/gpacmp4/base_encoding.c \
|
||||
../src/gpacmp4/bitstream.c \
|
||||
../src/gpacmp4/box_code_3gpp.c \
|
||||
../src/gpacmp4/box_code_adobe.c \
|
||||
../src/gpacmp4/box_code_apple.c \
|
||||
../src/gpacmp4/box_code_base.c \
|
||||
../src/gpacmp4/box_code_drm.c \
|
||||
../src/gpacmp4/box_dump.c \
|
||||
../src/gpacmp4/box_code_meta.c \
|
||||
../src/gpacmp4/box_funcs.c \
|
||||
../src/gpacmp4/color.c \
|
||||
../src/gpacmp4/configfile.c \
|
||||
../src/gpacmp4/data_map.c \
|
||||
../src/gpacmp4/desc_private.c \
|
||||
../src/gpacmp4/descriptors.c \
|
||||
../src/gpacmp4/drm_sample.c \
|
||||
../src/gpacmp4/error.c \
|
||||
../src/gpacmp4/gpac_ogg.c \
|
||||
../src/gpacmp4/hint_track.c \
|
||||
../src/gpacmp4/hinting.c \
|
||||
../src/gpacmp4/ipmpx_code.c \
|
||||
../src/gpacmp4/ipmpx_parse.c \
|
||||
../src/gpacmp4/isom_intern.c \
|
||||
../src/gpacmp4/isom_read.c \
|
||||
../src/gpacmp4/isom_store.c \
|
||||
../src/gpacmp4/isom_write.c \
|
||||
../src/gpacmp4/list.c \
|
||||
../src/gpacmp4/math.c \
|
||||
../src/gpacmp4/media.c \
|
||||
../src/gpacmp4/media_odf.c \
|
||||
../src/gpacmp4/meta.c \
|
||||
../src/gpacmp4/movie_fragments.c \
|
||||
../src/gpacmp4/mp4.c \
|
||||
../src/gpacmp4/odf_code.c \
|
||||
../src/gpacmp4/odf_codec.c \
|
||||
../src/gpacmp4/odf_command.c \
|
||||
../src/gpacmp4/os_config_init.c \
|
||||
../src/gpacmp4/os_divers.c \
|
||||
../src/gpacmp4/os_file.c \
|
||||
../src/gpacmp4/qos.c \
|
||||
../src/gpacmp4/sample_descs.c \
|
||||
../src/gpacmp4/slc.c \
|
||||
../src/gpacmp4/stbl_read.c \
|
||||
../src/gpacmp4/stbl_write.c \
|
||||
../src/gpacmp4/track.c \
|
||||
../src/gpacmp4/tx3g.c \
|
||||
../src/gpacmp4/url.c \
|
||||
../src/gpacmp4/utf.c \
|
||||
../src/gpacmp4/gpac/avparse.h \
|
||||
../src/gpacmp4/gpac/base_coding.h \
|
||||
../src/gpacmp4/gpac/bitstream.h \
|
||||
../src/gpacmp4/gpac/color.h \
|
||||
../src/gpacmp4/gpac/config_file.h \
|
||||
../src/gpacmp4/gpac/configuration.h \
|
||||
../src/gpacmp4/gpac/constants.h \
|
||||
../src/gpacmp4/gpac/events_constants.h \
|
||||
../src/gpacmp4/gpac/ietf.h \
|
||||
../src/gpacmp4/gpac/isomedia.h \
|
||||
../src/gpacmp4/gpac/list.h \
|
||||
../src/gpacmp4/gpac/maths.h \
|
||||
../src/gpacmp4/gpac/media_tools.h \
|
||||
../src/gpacmp4/gpac/mpeg4_odf.h \
|
||||
../src/gpacmp4/gpac/network.h \
|
||||
../src/gpacmp4/gpac/revision.h \
|
||||
../src/gpacmp4/gpac/setup.h \
|
||||
../src/gpacmp4/gpac/tools.h \
|
||||
../src/gpacmp4/gpac/utf.h \
|
||||
../src/gpacmp4/gpac/version.h \
|
||||
../src/gpacmp4/gpac/internal/avilib.h \
|
||||
../src/gpacmp4/gpac/internal/isomedia_dev.h \
|
||||
../src/gpacmp4/gpac/internal/media_dev.h \
|
||||
../src/gpacmp4/gpac/internal/odf_dev.h \
|
||||
../src/gpacmp4/gpac/internal/odf_parse_common.h \
|
||||
../src/gpacmp4/gpac/internal/ogg.h \
|
||||
../src/libpng/pngstruct.h \
|
||||
../src/libpng/pngpriv.h \
|
||||
../src/libpng/pnginfo.h \
|
||||
../src/libpng/pnglibconf.h \
|
||||
../src/libpng/pngconf.h \
|
||||
../src/libpng/pngdebug.h \
|
||||
../src/libpng/png.h \
|
||||
../src/libpng/png.c \
|
||||
../src/libpng/pngerror.c \
|
||||
../src/libpng/pngget.c \
|
||||
../src/libpng/pngmem.c \
|
||||
../src/libpng/pngpread.c \
|
||||
../src/libpng/pngread.c \
|
||||
../src/libpng/pngrio.c \
|
||||
../src/libpng/pngrtran.c \
|
||||
../src/libpng/pngrutil.c \
|
||||
../src/libpng/pngset.c \
|
||||
../src/libpng/pngtrans.c \
|
||||
../src/libpng/pngwio.c \
|
||||
../src/libpng/pngwrite.c \
|
||||
../src/libpng/pngwtran.c \
|
||||
../src/libpng/pngwutil.c \
|
||||
../src/thirdparty/gpacmp4/avc_ext.c \
|
||||
../src/thirdparty/gpacmp4/avilib.c \
|
||||
../src/thirdparty/gpacmp4/av_parsers.c \
|
||||
../src/thirdparty/gpacmp4/base_encoding.c \
|
||||
../src/thirdparty/gpacmp4/bitstream.c \
|
||||
../src/thirdparty/gpacmp4/box_code_3gpp.c \
|
||||
../src/thirdparty/gpacmp4/box_code_adobe.c \
|
||||
../src/thirdparty/gpacmp4/box_code_apple.c \
|
||||
../src/thirdparty/gpacmp4/box_code_base.c \
|
||||
../src/thirdparty/gpacmp4/box_code_drm.c \
|
||||
../src/thirdparty/gpacmp4/box_dump.c \
|
||||
../src/thirdparty/gpacmp4/box_code_meta.c \
|
||||
../src/thirdparty/gpacmp4/box_funcs.c \
|
||||
../src/thirdparty/gpacmp4/color.c \
|
||||
../src/thirdparty/gpacmp4/configfile.c \
|
||||
../src/thirdparty/gpacmp4/data_map.c \
|
||||
../src/thirdparty/gpacmp4/desc_private.c \
|
||||
../src/thirdparty/gpacmp4/descriptors.c \
|
||||
../src/thirdparty/gpacmp4/drm_sample.c \
|
||||
../src/thirdparty/gpacmp4/error.c \
|
||||
../src/thirdparty/gpacmp4/gpac_ogg.c \
|
||||
../src/thirdparty/gpacmp4/hint_track.c \
|
||||
../src/thirdparty/gpacmp4/hinting.c \
|
||||
../src/thirdparty/gpacmp4/ipmpx_code.c \
|
||||
../src/thirdparty/gpacmp4/ipmpx_parse.c \
|
||||
../src/thirdparty/gpacmp4/isom_intern.c \
|
||||
../src/thirdparty/gpacmp4/isom_read.c \
|
||||
../src/thirdparty/gpacmp4/isom_store.c \
|
||||
../src/thirdparty/gpacmp4/isom_write.c \
|
||||
../src/thirdparty/gpacmp4/list.c \
|
||||
../src/thirdparty/gpacmp4/math.c \
|
||||
../src/thirdparty/gpacmp4/media.c \
|
||||
../src/thirdparty/gpacmp4/media_odf.c \
|
||||
../src/thirdparty/gpacmp4/meta.c \
|
||||
../src/thirdparty/gpacmp4/movie_fragments.c \
|
||||
../src/thirdparty/gpacmp4/odf_code.c \
|
||||
../src/thirdparty/gpacmp4/odf_codec.c \
|
||||
../src/thirdparty/gpacmp4/odf_command.c \
|
||||
../src/thirdparty/gpacmp4/os_config_init.c \
|
||||
../src/thirdparty/gpacmp4/os_divers.c \
|
||||
../src/thirdparty/gpacmp4/os_file.c \
|
||||
../src/thirdparty/gpacmp4/qos.c \
|
||||
../src/thirdparty/gpacmp4/sample_descs.c \
|
||||
../src/thirdparty/gpacmp4/slc.c \
|
||||
../src/thirdparty/gpacmp4/stbl_read.c \
|
||||
../src/thirdparty/gpacmp4/stbl_write.c \
|
||||
../src/thirdparty/gpacmp4/track.c \
|
||||
../src/thirdparty/gpacmp4/tx3g.c \
|
||||
../src/thirdparty/gpacmp4/url.c \
|
||||
../src/thirdparty/gpacmp4/utf.c \
|
||||
../src/thirdparty/gpacmp4/os_thread.c \
|
||||
../src/thirdparty/gpacmp4/module.c \
|
||||
../src/thirdparty/gpacmp4/os_module.c \
|
||||
../src/thirdparty/gpacmp4/xml_parser.c \
|
||||
../src/thirdparty/gpacmp4/constants.c \
|
||||
../src/thirdparty/gpacmp4/gpac/avparse.h \
|
||||
../src/thirdparty/gpacmp4/gpac/base_coding.h \
|
||||
../src/thirdparty/gpacmp4/gpac/bitstream.h \
|
||||
../src/thirdparty/gpacmp4/gpac/color.h \
|
||||
../src/thirdparty/gpacmp4/gpac/config_file.h \
|
||||
../src/thirdparty/gpacmp4/gpac/configuration.h \
|
||||
../src/thirdparty/gpacmp4/gpac/constants.h \
|
||||
../src/thirdparty/gpacmp4/gpac/events_constants.h \
|
||||
../src/thirdparty/gpacmp4/gpac/ietf.h \
|
||||
../src/thirdparty/gpacmp4/gpac/isomedia.h \
|
||||
../src/thirdparty/gpacmp4/gpac/list.h \
|
||||
../src/thirdparty/gpacmp4/gpac/maths.h \
|
||||
../src/thirdparty/gpacmp4/gpac/media_tools.h \
|
||||
../src/thirdparty/gpacmp4/gpac/mpeg4_odf.h \
|
||||
../src/thirdparty/gpacmp4/gpac/network.h \
|
||||
../src/thirdparty/gpacmp4/gpac/revision.h \
|
||||
../src/thirdparty/gpacmp4/gpac/setup.h \
|
||||
../src/thirdparty/gpacmp4/gpac/tools.h \
|
||||
../src/thirdparty/gpacmp4/gpac/utf.h \
|
||||
../src/thirdparty/gpacmp4/gpac/version.h \
|
||||
../src/thirdparty/gpacmp4/gpac/internal/avilib.h \
|
||||
../src/thirdparty/gpacmp4/gpac/internal/isomedia_dev.h \
|
||||
../src/thirdparty/gpacmp4/gpac/internal/media_dev.h \
|
||||
../src/thirdparty/gpacmp4/gpac/internal/odf_dev.h \
|
||||
../src/thirdparty/gpacmp4/gpac/internal/odf_parse_common.h \
|
||||
../src/thirdparty/gpacmp4/gpac/internal/ogg.h \
|
||||
../src/thirdparty/libpng/pngstruct.h \
|
||||
../src/thirdparty/libpng/pngpriv.h \
|
||||
../src/thirdparty/libpng/pnginfo.h \
|
||||
../src/thirdparty/libpng/pnglibconf.h \
|
||||
../src/thirdparty/libpng/pngconf.h \
|
||||
../src/thirdparty/libpng/pngdebug.h \
|
||||
../src/thirdparty/libpng/png.h \
|
||||
../src/thirdparty/libpng/png.c \
|
||||
../src/thirdparty/libpng/pngerror.c \
|
||||
../src/thirdparty/libpng/pngget.c \
|
||||
../src/thirdparty/libpng/pngmem.c \
|
||||
../src/thirdparty/libpng/pngpread.c \
|
||||
../src/thirdparty/libpng/pngread.c \
|
||||
../src/thirdparty/libpng/pngrio.c \
|
||||
../src/thirdparty/libpng/pngrtran.c \
|
||||
../src/thirdparty/libpng/pngrutil.c \
|
||||
../src/thirdparty/libpng/pngset.c \
|
||||
../src/thirdparty/libpng/pngtrans.c \
|
||||
../src/thirdparty/libpng/pngwio.c \
|
||||
../src/thirdparty/libpng/pngwrite.c \
|
||||
../src/thirdparty/libpng/pngwtran.c \
|
||||
../src/thirdparty/libpng/pngwutil.c \
|
||||
../src/lib_ccx/ccx_common_common.h \
|
||||
../src/lib_ccx/ccx_common_option.h \
|
||||
../src/lib_ccx/utility.h \
|
||||
@@ -155,8 +159,10 @@ ccextractor_SOURCES = \
|
||||
../src/lib_ccx/ccx_encoders_g608.c \
|
||||
../src/lib_ccx/ccx_encoders_helpers.c \
|
||||
../src/lib_ccx/ccx_encoders_helpers.h \
|
||||
../src/lib_ccx/ccx_encoders_python.c \
|
||||
../src/lib_ccx/ccx_encoders_mcc.c \
|
||||
../src/lib_ccx/ccx_encoders_mcc.h \
|
||||
../src/lib_ccx/ccx_encoders_sami.c \
|
||||
../src/lib_ccx/ccx_encoders_scc.c \
|
||||
../src/lib_ccx/ccx_encoders_smptett.c \
|
||||
../src/lib_ccx/ccx_encoders_splitbysentence.c \
|
||||
../src/lib_ccx/ccx_encoders_spupng.c \
|
||||
@@ -202,6 +208,7 @@ ccextractor_SOURCES = \
|
||||
../src/lib_ccx/list.h \
|
||||
../src/lib_ccx/matroska.c \
|
||||
../src/lib_ccx/matroska.h \
|
||||
../src/lib_ccx/mp4.c \
|
||||
../src/lib_ccx/myth.c \
|
||||
../src/lib_ccx/networking.c \
|
||||
../src/lib_ccx/networking.h \
|
||||
@@ -222,101 +229,99 @@ ccextractor_SOURCES = \
|
||||
../src/lib_ccx/ts_tables_epg.c \
|
||||
../src/lib_ccx/wtv_constants.h \
|
||||
../src/lib_ccx/wtv_functions.c \
|
||||
../src/zlib/adler32.c \
|
||||
../src/zlib/compress.c \
|
||||
../src/zlib/crc32.c \
|
||||
../src/zlib/crc32.h \
|
||||
../src/zlib/deflate.c \
|
||||
../src/zlib/deflate.h \
|
||||
../src/zlib/gzclose.c \
|
||||
../src/zlib/gzguts.h \
|
||||
../src/zlib/gzlib.c \
|
||||
../src/zlib/gzread.c \
|
||||
../src/zlib/gzwrite.c \
|
||||
../src/zlib/infback.c \
|
||||
../src/zlib/inffast.c \
|
||||
../src/zlib/inffast.h \
|
||||
../src/zlib/inffixed.h \
|
||||
../src/zlib/inflate.c \
|
||||
../src/zlib/inflate.h \
|
||||
../src/zlib/inftrees.c \
|
||||
../src/zlib/inftrees.h \
|
||||
../src/zlib/trees.c \
|
||||
../src/zlib/trees.h \
|
||||
../src/zlib/uncompr.c \
|
||||
../src/zlib/zconf.h \
|
||||
../src/zlib/zlib.h \
|
||||
../src/zlib/zutil.c \
|
||||
../src/zlib/zutil.h \
|
||||
../src/utf8proc/utf8proc.c \
|
||||
../src/utf8proc/utf8proc.h \
|
||||
../src/lib_hash/sha2.c \
|
||||
../src/lib_hash/sha2.h \
|
||||
../src/protobuf-c/protobuf-c.c \
|
||||
../src/protobuf-c/protobuf-c.h \
|
||||
../src/zvbi/bcd.h \
|
||||
../src/zvbi/bit_slicer.c \
|
||||
../src/zvbi/bit_slicer.h \
|
||||
../src/zvbi/decoder.c \
|
||||
../src/zvbi/macros.h \
|
||||
../src/zvbi/misc.h \
|
||||
../src/zvbi/raw_decoder.c \
|
||||
../src/zvbi/raw_decoder.h \
|
||||
../src/zvbi/sampling_par.c \
|
||||
../src/zvbi/sampling_par.h \
|
||||
../src/zvbi/sliced.h \
|
||||
../src/zvbi/zvbi_decoder.h \
|
||||
../src/wrappers/wrapper.c \
|
||||
../src/wrappers/wrapper.h \
|
||||
../src/freetype/autofit/autofit.c \
|
||||
../src/freetype/base/ftbase.c \
|
||||
../src/freetype/base/ftbbox.c \
|
||||
../src/freetype/base/ftbdf.c \
|
||||
../src/freetype/base/ftbitmap.c \
|
||||
../src/freetype/base/ftcid.c \
|
||||
../src/freetype/base/ftfntfmt.c \
|
||||
../src/freetype/base/ftfstype.c \
|
||||
../src/freetype/base/ftgasp.c \
|
||||
../src/freetype/base/ftglyph.c \
|
||||
../src/freetype/base/ftgxval.c \
|
||||
../src/freetype/base/ftinit.c \
|
||||
../src/freetype/base/ftlcdfil.c \
|
||||
../src/freetype/base/ftmm.c \
|
||||
../src/freetype/base/ftotval.c \
|
||||
../src/freetype/base/ftpatent.c \
|
||||
../src/freetype/base/ftpfr.c \
|
||||
../src/freetype/base/ftstroke.c \
|
||||
../src/freetype/base/ftsynth.c \
|
||||
../src/freetype/base/ftsystem.c \
|
||||
../src/freetype/base/fttype1.c \
|
||||
../src/freetype/base/ftwinfnt.c \
|
||||
../src/freetype/bdf/bdf.c \
|
||||
../src/freetype/bzip2/ftbzip2.c \
|
||||
../src/freetype/cache/ftcache.c \
|
||||
../src/freetype/cff/cff.c \
|
||||
../src/freetype/cid/type1cid.c \
|
||||
../src/freetype/gzip/ftgzip.c \
|
||||
../src/freetype/lzw/ftlzw.c \
|
||||
../src/freetype/pcf/pcf.c \
|
||||
../src/freetype/pfr/pfr.c \
|
||||
../src/freetype/psaux/psaux.c \
|
||||
../src/freetype/pshinter/pshinter.c \
|
||||
../src/freetype/psnames/psnames.c \
|
||||
../src/freetype/raster/raster.c \
|
||||
../src/freetype/sfnt/sfnt.c \
|
||||
../src/freetype/smooth/smooth.c \
|
||||
../src/freetype/truetype/truetype.c \
|
||||
../src/freetype/type1/type1.c \
|
||||
../src/freetype/type42/type42.c \
|
||||
../src/freetype/winfonts/winfnt.c
|
||||
../src/thirdparty/zlib/adler32.c \
|
||||
../src/thirdparty/zlib/compress.c \
|
||||
../src/thirdparty/zlib/crc32.c \
|
||||
../src/thirdparty/zlib/crc32.h \
|
||||
../src/thirdparty/zlib/deflate.c \
|
||||
../src/thirdparty/zlib/deflate.h \
|
||||
../src/thirdparty/zlib/gzclose.c \
|
||||
../src/thirdparty/zlib/gzguts.h \
|
||||
../src/thirdparty/zlib/gzlib.c \
|
||||
../src/thirdparty/zlib/gzread.c \
|
||||
../src/thirdparty/zlib/gzwrite.c \
|
||||
../src/thirdparty/zlib/infback.c \
|
||||
../src/thirdparty/zlib/inffast.c \
|
||||
../src/thirdparty/zlib/inffast.h \
|
||||
../src/thirdparty/zlib/inffixed.h \
|
||||
../src/thirdparty/zlib/inflate.c \
|
||||
../src/thirdparty/zlib/inflate.h \
|
||||
../src/thirdparty/zlib/inftrees.c \
|
||||
../src/thirdparty/zlib/inftrees.h \
|
||||
../src/thirdparty/zlib/trees.c \
|
||||
../src/thirdparty/zlib/trees.h \
|
||||
../src/thirdparty/zlib/uncompr.c \
|
||||
../src/thirdparty/zlib/zconf.h \
|
||||
../src/thirdparty/zlib/zlib.h \
|
||||
../src/thirdparty/zlib/zutil.c \
|
||||
../src/thirdparty/zlib/zutil.h \
|
||||
../src/thirdparty/utf8proc/utf8proc.c \
|
||||
../src/thirdparty/utf8proc/utf8proc.h \
|
||||
../src/thirdparty/lib_hash/sha2.c \
|
||||
../src/thirdparty/lib_hash/sha2.h \
|
||||
../src/thirdparty/protobuf-c/protobuf-c.c \
|
||||
../src/thirdparty/protobuf-c/protobuf-c.h \
|
||||
../src/thirdparty/zvbi/bcd.h \
|
||||
../src/thirdparty/zvbi/bit_slicer.c \
|
||||
../src/thirdparty/zvbi/bit_slicer.h \
|
||||
../src/thirdparty/zvbi/decoder.c \
|
||||
../src/thirdparty/zvbi/macros.h \
|
||||
../src/thirdparty/zvbi/misc.h \
|
||||
../src/thirdparty/zvbi/raw_decoder.c \
|
||||
../src/thirdparty/zvbi/raw_decoder.h \
|
||||
../src/thirdparty/zvbi/sampling_par.c \
|
||||
../src/thirdparty/zvbi/sampling_par.h \
|
||||
../src/thirdparty/zvbi/sliced.h \
|
||||
../src/thirdparty/zvbi/zvbi_decoder.h \
|
||||
../src/thirdparty/freetype/autofit/autofit.c \
|
||||
../src/thirdparty/freetype/base/ftbase.c \
|
||||
../src/thirdparty/freetype/base/ftbbox.c \
|
||||
../src/thirdparty/freetype/base/ftbdf.c \
|
||||
../src/thirdparty/freetype/base/ftbitmap.c \
|
||||
../src/thirdparty/freetype/base/ftcid.c \
|
||||
../src/thirdparty/freetype/base/ftfntfmt.c \
|
||||
../src/thirdparty/freetype/base/ftfstype.c \
|
||||
../src/thirdparty/freetype/base/ftgasp.c \
|
||||
../src/thirdparty/freetype/base/ftglyph.c \
|
||||
../src/thirdparty/freetype/base/ftgxval.c \
|
||||
../src/thirdparty/freetype/base/ftinit.c \
|
||||
../src/thirdparty/freetype/base/ftlcdfil.c \
|
||||
../src/thirdparty/freetype/base/ftmm.c \
|
||||
../src/thirdparty/freetype/base/ftotval.c \
|
||||
../src/thirdparty/freetype/base/ftpatent.c \
|
||||
../src/thirdparty/freetype/base/ftpfr.c \
|
||||
../src/thirdparty/freetype/base/ftstroke.c \
|
||||
../src/thirdparty/freetype/base/ftsynth.c \
|
||||
../src/thirdparty/freetype/base/ftsystem.c \
|
||||
../src/thirdparty/freetype/base/fttype1.c \
|
||||
../src/thirdparty/freetype/base/ftwinfnt.c \
|
||||
../src/thirdparty/freetype/bdf/bdf.c \
|
||||
../src/thirdparty/freetype/bzip2/ftbzip2.c \
|
||||
../src/thirdparty/freetype/cache/ftcache.c \
|
||||
../src/thirdparty/freetype/cff/cff.c \
|
||||
../src/thirdparty/freetype/cid/type1cid.c \
|
||||
../src/thirdparty/freetype/gzip/ftgzip.c \
|
||||
../src/thirdparty/freetype/lzw/ftlzw.c \
|
||||
../src/thirdparty/freetype/pcf/pcf.c \
|
||||
../src/thirdparty/freetype/pfr/pfr.c \
|
||||
../src/thirdparty/freetype/psaux/psaux.c \
|
||||
../src/thirdparty/freetype/pshinter/pshinter.c \
|
||||
../src/thirdparty/freetype/psnames/psnames.c \
|
||||
../src/thirdparty/freetype/raster/raster.c \
|
||||
../src/thirdparty/freetype/sfnt/sfnt.c \
|
||||
../src/thirdparty/freetype/smooth/smooth.c \
|
||||
../src/thirdparty/freetype/truetype/truetype.c \
|
||||
../src/thirdparty/freetype/type1/type1.c \
|
||||
../src/thirdparty/freetype/type42/type42.c \
|
||||
../src/thirdparty/freetype/winfonts/winfnt.c
|
||||
|
||||
|
||||
ccextractor_CFLAGS = -std=gnu99 -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP
|
||||
ccextractor_CFLAGS = -std=gnu99 -Wno-write-strings -Wno-pointer-sign -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP -DGPAC_DISABLE_REMOTERY -DNO_GZIP -DGPAC_HAVE_CONFIG_H
|
||||
|
||||
ccextractor_CPPFLAGS =-I../src/lib_ccx/ -I../src/gpacmp4/ -I../src/libpng/ -I../src/zlib/ -I../src/zvbi/ -I../src/lib_hash/ -I../src/protobuf-c/ -I../src/utf8proc/ -I../src/ -I../src/freetype/include/
|
||||
ccextractor_CPPFLAGS =-I../src/lib_ccx/ -I../src/thirdparty/gpacmp4/ -I../src/thirdparty/libpng/ -I../src/thirdparty/zlib/ -I../src/thirdparty/zvbi/ -I../src/thirdparty/lib_hash/ -I../src/thirdparty/protobuf-c -I../src/thirdparty -I../src -I../src/thirdparty/freetype/include
|
||||
|
||||
|
||||
ccextractor_LDADD=-lm
|
||||
ccextractor_LDADD=-lm -lpthread -ldl
|
||||
|
||||
if SYS_IS_LINUX
|
||||
ccextractor_CFLAGS += -O3 -s -DGPAC_CONFIG_LINUX
|
||||
@@ -364,7 +369,7 @@ ccextractor_LDADD += $(TESS_LIB)
|
||||
ccextractor_LDADD += $(LEPT_LIB)
|
||||
endif
|
||||
|
||||
EXTRA_DIST = ../src/gpacmp4/gpac/sync_layer.h ../src/lib_ccx/ccfont2.xbm ../src/utf8proc/utf8proc_data.c fonts/ icon/
|
||||
EXTRA_DIST = ../src/thirdparty/gpacmp4/gpac/sync_layer.h ../src/lib_ccx/ccfont2.xbm ../src/thirdparty/utf8proc/utf8proc_data.c fonts/ icon/
|
||||
|
||||
#For GUI
|
||||
if BUILD_WITH_GUI
|
||||
|
||||
@@ -1,61 +1,60 @@
|
||||
#!/bin/bash
|
||||
cd `dirname $0`
|
||||
BLD_FLAGS="-std=gnu99 -Wno-write-strings -DGPAC_CONFIG_DARWIN -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -Dfopen64=fopen -Dopen64=open -Dlseek64=lseek -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP"
|
||||
BLD_FLAGS="-std=gnu99 -Wno-write-strings -Wno-pointer-sign -DGPAC_CONFIG_DARWIN -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -Dfopen64=fopen -Dopen64=open -Dlseek64=lseek -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP -DGPAC_DISABLE_REMOTERY -DNO_GZIP -DGPAC_HAVE_CONFIG_H"
|
||||
[[ $1 = "OCR" ]] && BLD_FLAGS="$BLD_FLAGS -DENABLE_OCR"
|
||||
BLD_INCLUDE="-I../src/ -I../src/lib_ccx -I../src/gpacmp4 -I../src/lib_hash -I../src/libpng -I../src/utf8proc -I../src/protobuf-c -I../src/zlib -I../src/zvbi -I../src/freetype/include"
|
||||
BLD_INCLUDE="-I../src/ -I../src/lib_ccx -I../src/thirdparty/gpacmp4 -I../src/lib_hash -I../src/thirdparty/libpng -I../src/thirdparty -I../src/thirdparty/protobuf-c -I../src/thirdparty/zlib -I../src/thirdparty/zvbi -I../src/thirdparty/freetype/include"
|
||||
[[ $1 = "OCR" ]] && BLD_INCLUDE="$BLD_INCLUDE `pkg-config --cflags --silence-errors tesseract`"
|
||||
SRC_CCX="$(find ../src/lib_ccx -name '*.c')"
|
||||
SRC_GPAC="$(find ../src/gpacmp4 -name '*.c')"
|
||||
SRC_LIB_HASH="$(find ../src/lib_hash -name '*.c')"
|
||||
SRC_LIBPNG="$(find ../src/libpng -name '*.c')"
|
||||
SRC_PROTOBUF="$(find ../src/protobuf-c -name '*.c')"
|
||||
SRC_UTF8="../src/utf8proc/utf8proc.c"
|
||||
SRC_ZLIB="$(find ../src/zlib -name '*.c')"
|
||||
SRC_ZVBI="$(find ../src/zvbi -name '*.c')"
|
||||
API_WRAPPERS="$(find ../src/wrappers/ -name '*.c')"
|
||||
SRC_FREETYPE="../src/freetype/autofit/autofit.c \
|
||||
../src/freetype/base/ftbase.c \
|
||||
../src/freetype/base/ftbbox.c \
|
||||
../src/freetype/base/ftbdf.c \
|
||||
../src/freetype/base/ftbitmap.c \
|
||||
../src/freetype/base/ftcid.c \
|
||||
../src/freetype/base/ftfntfmt.c \
|
||||
../src/freetype/base/ftfstype.c \
|
||||
../src/freetype/base/ftgasp.c \
|
||||
../src/freetype/base/ftglyph.c \
|
||||
../src/freetype/base/ftgxval.c \
|
||||
../src/freetype/base/ftinit.c \
|
||||
../src/freetype/base/ftlcdfil.c \
|
||||
../src/freetype/base/ftmm.c \
|
||||
../src/freetype/base/ftotval.c \
|
||||
../src/freetype/base/ftpatent.c \
|
||||
../src/freetype/base/ftpfr.c \
|
||||
../src/freetype/base/ftstroke.c \
|
||||
../src/freetype/base/ftsynth.c \
|
||||
../src/freetype/base/ftsystem.c \
|
||||
../src/freetype/base/fttype1.c \
|
||||
../src/freetype/base/ftwinfnt.c \
|
||||
../src/freetype/bdf/bdf.c \
|
||||
../src/freetype/bzip2/ftbzip2.c \
|
||||
../src/freetype/cache/ftcache.c \
|
||||
../src/freetype/cff/cff.c \
|
||||
../src/freetype/cid/type1cid.c \
|
||||
../src/freetype/gzip/ftgzip.c \
|
||||
../src/freetype/lzw/ftlzw.c \
|
||||
../src/freetype/pcf/pcf.c \
|
||||
../src/freetype/pfr/pfr.c \
|
||||
../src/freetype/psaux/psaux.c \
|
||||
../src/freetype/pshinter/pshinter.c \
|
||||
../src/freetype/psnames/psnames.c \
|
||||
../src/freetype/raster/raster.c \
|
||||
../src/freetype/sfnt/sfnt.c \
|
||||
../src/freetype/smooth/smooth.c \
|
||||
../src/freetype/truetype/truetype.c \
|
||||
../src/freetype/type1/type1.c \
|
||||
../src/freetype/type42/type42.c \
|
||||
../src/freetype/winfonts/winfnt.c"
|
||||
BLD_SOURCES="../src/ccextractor.c $SRC_API $SRC_CCX $SRC_GPAC $SRC_LIB_HASH $SRC_LIBPNG $SRC_PROTOBUF $SRC_UTF8 $SRC_ZLIB $SRC_ZVBI $SRC_FREETYPE $API_WRAPPERS"
|
||||
BLD_LINKER="-lm -liconv"
|
||||
SRC_GPAC="$(find ../src/thirdparty/gpacmp4 -name '*.c')"
|
||||
SRC_LIB_HASH="$(find ../src/thirdparty/lib_hash -name '*.c')"
|
||||
SRC_LIBPNG="$(find ../src/thirdparty/libpng -name '*.c')"
|
||||
SRC_PROTOBUF="$(find ../src/thirdparty/protobuf-c -name '*.c')"
|
||||
SRC_UTF8="../src/thirdparty/utf8proc/utf8proc.c"
|
||||
SRC_ZLIB="$(find ../src/thirdparty/zlib -name '*.c')"
|
||||
SRC_ZVBI="$(find ../src/thirdparty/zvbi -name '*.c')"
|
||||
SRC_FREETYPE="../src/thirdparty/freetype/autofit/autofit.c \
|
||||
../src/thirdparty/freetype/base/ftbase.c \
|
||||
../src/thirdparty/freetype/base/ftbbox.c \
|
||||
../src/thirdparty/freetype/base/ftbdf.c \
|
||||
../src/thirdparty/freetype/base/ftbitmap.c \
|
||||
../src/thirdparty/freetype/base/ftcid.c \
|
||||
../src/thirdparty/freetype/base/ftfntfmt.c \
|
||||
../src/thirdparty/freetype/base/ftfstype.c \
|
||||
../src/thirdparty/freetype/base/ftgasp.c \
|
||||
../src/thirdparty/freetype/base/ftglyph.c \
|
||||
../src/thirdparty/freetype/base/ftgxval.c \
|
||||
../src/thirdparty/freetype/base/ftinit.c \
|
||||
../src/thirdparty/freetype/base/ftlcdfil.c \
|
||||
../src/thirdparty/freetype/base/ftmm.c \
|
||||
../src/thirdparty/freetype/base/ftotval.c \
|
||||
../src/thirdparty/freetype/base/ftpatent.c \
|
||||
../src/thirdparty/freetype/base/ftpfr.c \
|
||||
../src/thirdparty/freetype/base/ftstroke.c \
|
||||
../src/thirdparty/freetype/base/ftsynth.c \
|
||||
../src/thirdparty/freetype/base/ftsystem.c \
|
||||
../src/thirdparty/freetype/base/fttype1.c \
|
||||
../src/thirdparty/freetype/base/ftwinfnt.c \
|
||||
../src/thirdparty/freetype/bdf/bdf.c \
|
||||
../src/thirdparty/freetype/bzip2/ftbzip2.c \
|
||||
../src/thirdparty/freetype/cache/ftcache.c \
|
||||
../src/thirdparty/freetype/cff/cff.c \
|
||||
../src/thirdparty/freetype/cid/type1cid.c \
|
||||
../src/thirdparty/freetype/gzip/ftgzip.c \
|
||||
../src/thirdparty/freetype/lzw/ftlzw.c \
|
||||
../src/thirdparty/freetype/pcf/pcf.c \
|
||||
../src/thirdparty/freetype/pfr/pfr.c \
|
||||
../src/thirdparty/freetype/psaux/psaux.c \
|
||||
../src/thirdparty/freetype/pshinter/pshinter.c \
|
||||
../src/thirdparty/freetype/psnames/psnames.c \
|
||||
../src/thirdparty/freetype/raster/raster.c \
|
||||
../src/thirdparty/freetype/sfnt/sfnt.c \
|
||||
../src/thirdparty/freetype/smooth/smooth.c \
|
||||
../src/thirdparty/freetype/truetype/truetype.c \
|
||||
../src/thirdparty/freetype/type1/type1.c \
|
||||
../src/thirdparty/freetype/type42/type42.c \
|
||||
../src/thirdparty/freetype/winfonts/winfnt.c"
|
||||
BLD_SOURCES="../src/ccextractor.c $SRC_API $SRC_CCX $SRC_GPAC $SRC_LIB_HASH $SRC_LIBPNG $SRC_PROTOBUF $SRC_UTF8 $SRC_ZLIB $SRC_ZVBI $SRC_FREETYPE"
|
||||
BLD_LINKER="-lm -liconv -lpthread -ldl"
|
||||
[[ $1 = "OCR" ]] && BLD_LINKER="$BLD_LINKER `pkg-config --libs --silence-errors tesseract` `pkg-config --libs --silence-errors lept`"
|
||||
|
||||
./pre-build.sh
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([CCExtractor], [0.88], [carlos@ccextractor.org])
|
||||
AC_INIT([CCExtractor], [0.89], [carlos@ccextractor.org])
|
||||
AC_CONFIG_AUX_DIR([build-conf])
|
||||
AC_CONFIG_SRCDIR([../src/ccextractor.c])
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||
|
||||
BIN
mac/gui/InstallCCExtractorMacGUI.app.zip
Normal file
BIN
mac/gui/InstallCCExtractorMacGUI.app.zip
Normal file
Binary file not shown.
BIN
mac/gui/InstallCCExtractorMacGUI.app/Contents/Info.plist
Normal file
BIN
mac/gui/InstallCCExtractorMacGUI.app/Contents/Info.plist
Normal file
Binary file not shown.
BIN
mac/gui/InstallCCExtractorMacGUI.app/Contents/MacOS/InstallCCExtractorMacGUI
Executable file
BIN
mac/gui/InstallCCExtractorMacGUI.app/Contents/MacOS/InstallCCExtractorMacGUI
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
mac/gui/InstallCCExtractorMacGUI.app/Contents/Resources/MainMenu.nib
generated
Normal file
BIN
mac/gui/InstallCCExtractorMacGUI.app/Contents/Resources/MainMenu.nib
generated
Normal file
Binary file not shown.
BIN
mac/gui/InstallCCExtractorMacGUI.app/Contents/Resources/script
Executable file
BIN
mac/gui/InstallCCExtractorMacGUI.app/Contents/Resources/script
Executable file
Binary file not shown.
2
mac/gui/README.md
Normal file
2
mac/gui/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
## Simple MacOS GUI for CCExtractor
|
||||
This is a simple GUI for MacOS. It was generated using the open source Platypus tool created by [Sveinbjörn Þórðarson](https://sveinbjorn.org). You can learn more about Platypus [here.](https://sveinbjorn.org/platypus) It is recommended if you need more customization please use the CLI tool as this app only has the default settings.
|
||||
BIN
mac/gui/src/CCExtractor.app/Contents/Info.plist
Normal file
BIN
mac/gui/src/CCExtractor.app/Contents/Info.plist
Normal file
Binary file not shown.
BIN
mac/gui/src/CCExtractor.app/Contents/MacOS/CCExtractor
Executable file
BIN
mac/gui/src/CCExtractor.app/Contents/MacOS/CCExtractor
Executable file
Binary file not shown.
BIN
mac/gui/src/CCExtractor.app/Contents/Resources/AppIcon.icns
Normal file
BIN
mac/gui/src/CCExtractor.app/Contents/Resources/AppIcon.icns
Normal file
Binary file not shown.
BIN
mac/gui/src/CCExtractor.app/Contents/Resources/AppSettings.plist
Normal file
BIN
mac/gui/src/CCExtractor.app/Contents/Resources/AppSettings.plist
Normal file
Binary file not shown.
BIN
mac/gui/src/CCExtractor.app/Contents/Resources/MainMenu.nib
generated
Normal file
BIN
mac/gui/src/CCExtractor.app/Contents/Resources/MainMenu.nib
generated
Normal file
Binary file not shown.
12
mac/gui/src/CCExtractor.app/Contents/Resources/script
Executable file
12
mac/gui/src/CCExtractor.app/Contents/Resources/script
Executable file
@@ -0,0 +1,12 @@
|
||||
/usr/local/bin/ccextractor $1
|
||||
|
||||
function display() {
|
||||
osascript <<EOT
|
||||
tell app "System Events"
|
||||
display dialog "$1" buttons {"OK"} default button 1 with title "CCExtractor"
|
||||
return
|
||||
end tell
|
||||
EOT
|
||||
}
|
||||
echo "Done"
|
||||
display "Process Complete. Check the source file's folder for the subtitles."
|
||||
BIN
mac/gui/src/CCExtractor.dmg
Normal file
BIN
mac/gui/src/CCExtractor.dmg
Normal file
Binary file not shown.
25
mac/gui/src/HowToGenerateApp.md
Normal file
25
mac/gui/src/HowToGenerateApp.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# HowToGenerateApp
|
||||
|
||||
## Main App
|
||||
|
||||
Script Type: Shell
|
||||
|
||||
Script Path: script.sh located in src folder
|
||||
|
||||
Interface: Droplet
|
||||
|
||||
Remain running after execution: Enabled
|
||||
|
||||
Accept Dropped Files: Enabled
|
||||
|
||||
## Install App
|
||||
|
||||
Script Type: Apple Script
|
||||
|
||||
Script Path: InstallCCExtractor.scpt located in src folder
|
||||
|
||||
Interface: Progress Bar
|
||||
|
||||
Bundled Files: CCExtractor.dmg located in src folder
|
||||
|
||||
Remain running after execution: Disabled
|
||||
BIN
mac/gui/src/InstallCCExtractor.scpt
Normal file
BIN
mac/gui/src/InstallCCExtractor.scpt
Normal file
Binary file not shown.
BIN
mac/gui/src/ccx_logo_icon.png
Normal file
BIN
mac/gui/src/ccx_logo_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
1
mac/gui/src/placeholder.md
Normal file
1
mac/gui/src/placeholder.md
Normal file
@@ -0,0 +1 @@
|
||||
place
|
||||
12
mac/gui/src/script.sh
Normal file
12
mac/gui/src/script.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
/usr/local/bin/ccextractor $1
|
||||
|
||||
function display() {
|
||||
osascript <<EOT
|
||||
tell app "System Events"
|
||||
display dialog "$1" buttons {"OK"} default button 1 with title "CCExtractor"
|
||||
return
|
||||
end tell
|
||||
EOT
|
||||
}
|
||||
echo "Done"
|
||||
display "Process Complete. Check the source file's folder for the subtitles."
|
||||
@@ -21,7 +21,7 @@ fi
|
||||
if [ -z "$commit" ]; then
|
||||
commit="Unknown"
|
||||
fi
|
||||
builddate=`date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y-%m-%d`
|
||||
builddate=`date -j -u -r "${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y-%m-%d`
|
||||
echo "Storing variables in file"
|
||||
echo "Commit: $commit"
|
||||
echo "Date: $builddate"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
pkgname=ccextractor
|
||||
pkgver=0.88
|
||||
pkgver=0.89
|
||||
pkgrel=1
|
||||
pkgdesc="A closed captions and teletext subtitles extractor for video streams."
|
||||
arch=('i686' 'x86_64')
|
||||
|
||||
16
src/BUILD
Normal file
16
src/BUILD
Normal file
@@ -0,0 +1,16 @@
|
||||
cc_binary(
|
||||
name = "ccextractor",
|
||||
srcs = ["ccextractor.c",
|
||||
"ccextractor.h"],
|
||||
deps = [
|
||||
"//src/lib_ccx:lib_ccx",
|
||||
"//src/thirdparty/protobuf-c:protobuf-c",
|
||||
"//src/thirdparty/gpacmp4:gpacmp4",
|
||||
"//src/thirdparty/zlib:zlib",
|
||||
"//src/thirdparty/freetype:freetype"
|
||||
],
|
||||
copts = [ "-Isrc/thirdparty/protobuf-c", "-Isrc/thirdparty/libpng", "-Isrc" ]
|
||||
)
|
||||
|
||||
exports_files (["ccextractor.h"], ["//src/lib_ccx:__pkg__"])
|
||||
|
||||
@@ -9,7 +9,7 @@ option (WITH_HARDSUBX "Build with support for burned-in subtitles" OFF)
|
||||
|
||||
# Version number
|
||||
set (CCEXTRACTOR_VERSION_MAJOR 0)
|
||||
set (CCEXTRACTOR_VERSION_MINOR 85b)
|
||||
set (CCEXTRACTOR_VERSION_MINOR 89)
|
||||
|
||||
# Get project directory
|
||||
get_filename_component(BASE_PROJ_DIR ../ ABSOLUTE)
|
||||
@@ -40,82 +40,79 @@ configure_file (
|
||||
"${PROJECT_SOURCE_DIR}/lib_ccx/compile_info_real.h"
|
||||
)
|
||||
|
||||
add_definitions(-DVERSION_FILE_PRESENT -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP)
|
||||
add_definitions(-DVERSION_FILE_PRESENT -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP -DGPAC_DISABLE_REMOTERY -DNO_GZIP -DGPAC_HAVE_CONFIG_H)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
add_definitions(-DGPAC_64_BITS)
|
||||
endif()
|
||||
|
||||
include_directories ("${PROJECT_SOURCE_DIR}")
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/lib_ccx/")
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/utf8proc/")
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/gpacmp4/")
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/protobuf-c/")
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/zvbi/")
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/lib_hash/")
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/wrappers/")
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/libpng/")
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/zlib/")
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/freetype/include/")
|
||||
aux_source_directory ("${PROJECT_SOURCE_DIR}/protobuf-c/" SOURCEFILE)
|
||||
aux_source_directory ("${PROJECT_SOURCE_DIR}/zvbi/" SOURCEFILE)
|
||||
aux_source_directory ("${PROJECT_SOURCE_DIR}/lib_hash/" SOURCEFILE)
|
||||
aux_source_directory ("${PROJECT_SOURCE_DIR}/wrappers/" SOURCEFILE)
|
||||
aux_source_directory ("${PROJECT_SOURCE_DIR}/libpng/" SOURCEFILE)
|
||||
aux_source_directory ("${PROJECT_SOURCE_DIR}/zlib/" SOURCEFILE)
|
||||
include_directories(${PROJECT_SOURCE_DIR})
|
||||
include_directories(${PROJECT_SOURCE_DIR}/lib_ccx)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/lib_ccx/zvbi)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/thirdparty)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/gpacmp4)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/lib_hash)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libpng)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/zlib)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/freetype/include)
|
||||
aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/gpacmp4/ SOURCEFILE)
|
||||
aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/lib_hash/ SOURCEFILE)
|
||||
aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/libpng/ SOURCEFILE)
|
||||
aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/ SOURCEFILE)
|
||||
aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/zlib/ SOURCEFILE)
|
||||
aux_source_directory(${PROJECT_SOURCE_DIR}/lib_ccx/zvbi/ SOURCEFILE)
|
||||
|
||||
set(UTF8PROC_SOURCE
|
||||
${PROJECT_SOURCE_DIR}/utf8proc/utf8proc.c
|
||||
)
|
||||
set(UTF8PROC_SOURCE ${PROJECT_SOURCE_DIR}/thirdparty/utf8proc/utf8proc.c)
|
||||
|
||||
set(FREETYPE_SOURCE
|
||||
${PROJECT_SOURCE_DIR}/freetype/autofit/autofit.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftbase.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftbbox.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftbdf.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftbitmap.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftcid.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftfntfmt.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftfstype.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftgasp.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftglyph.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftgxval.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftinit.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftlcdfil.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftmm.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftotval.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftpatent.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftpfr.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftstroke.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftsynth.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftsystem.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/fttype1.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/base/ftwinfnt.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/bdf/bdf.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/bzip2/ftbzip2.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/cache/ftcache.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/cff/cff.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/cid/type1cid.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/gzip/ftgzip.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/lzw/ftlzw.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/pcf/pcf.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/pfr/pfr.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/psaux/psaux.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/pshinter/pshinter.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/psnames/psnames.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/raster/raster.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/sfnt/sfnt.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/smooth/smooth.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/truetype/truetype.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/type1/type1.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/type42/type42.c
|
||||
${PROJECT_SOURCE_DIR}/freetype/winfonts/winfnt.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/autofit/autofit.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbase.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbbox.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbdf.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbitmap.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftcid.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftfntfmt.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftfstype.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftgasp.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftglyph.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftgxval.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftinit.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftlcdfil.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftmm.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftotval.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftpatent.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftpfr.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftstroke.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftsynth.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftsystem.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/fttype1.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftwinfnt.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/bdf/bdf.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/bzip2/ftbzip2.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/cache/ftcache.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/cff/cff.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/cid/type1cid.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/gzip/ftgzip.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/lzw/ftlzw.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/pcf/pcf.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/pfr/pfr.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/psaux/psaux.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/pshinter/pshinter.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/psnames/psnames.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/raster/raster.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/sfnt/sfnt.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/smooth/smooth.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/truetype/truetype.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/type1/type1.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/type42/type42.c
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/winfonts/winfnt.c
|
||||
)
|
||||
#Windows specific libraries and linker flags
|
||||
if(WIN32)
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/win_spec_incld/")
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/win_iconv/")
|
||||
aux_source_directory ("${PROJECT_SOURCE_DIR}/win_iconv/" SOURCEFILE)
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/thirdparty/win_spec_incld/")
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/thirdparty/win_iconv/")
|
||||
aux_source_directory ("${PROJECT_SOURCE_DIR}/thirdparty/win_iconv/" SOURCEFILE)
|
||||
set (EXTRA_LIBS ${EXTRA_LIBS} ws2_32 winmm)
|
||||
else (WIN32)
|
||||
# Adding some platform specific library path
|
||||
@@ -132,7 +129,7 @@ endif(MSVC)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")
|
||||
add_subdirectory (lib_ccx)
|
||||
|
||||
aux_source_directory (${PROJECT_SOURCE_DIR} SOURCEFILE)
|
||||
aux_source_directory(${PROJECT_SOURCE_DIR} SOURCEFILE)
|
||||
set (EXTRA_LIBS ${EXTRA_LIBS} ccx)
|
||||
# set (EXTRA_LIBS ${EXTRA_LIBS} m)
|
||||
|
||||
@@ -141,7 +138,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
|
||||
|
||||
set (EXTRA_LIBS ${EXTRA_LIBS} -lz -lm -lpthread)
|
||||
set (EXTRA_LIBS ${EXTRA_LIBS} -lm -lpthread -ldl)
|
||||
|
||||
find_package (PkgConfig)
|
||||
|
||||
@@ -197,8 +194,8 @@ if (PKG_CONFIG_FOUND AND WITH_SHARING)
|
||||
pkg_check_modules (NANOMSG REQUIRED libnanomsg)
|
||||
set (EXTRA_LIBS ${EXTRA_LIBS} ${NANOMSG_STATIC_LIBRARIES})
|
||||
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/protobuf-c/")
|
||||
aux_source_directory ("${PROJECT_SOURCE_DIR}/protobuf-c/" SOURCEFILE)
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/")
|
||||
aux_source_directory ("${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/" SOURCEFILE)
|
||||
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_SHARING")
|
||||
endif (PKG_CONFIG_FOUND AND WITH_SHARING)
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
int activity(struct nk_context *ctx, int x, int y, int width, int height, struct main_tab *main_settings)
|
||||
{
|
||||
static int i;
|
||||
if (nk_begin(ctx, "Activity", nk_rect(x, y, width, height), NK_WINDOW_TITLE|NK_WINDOW_BACKGROUND))
|
||||
if (nk_begin(ctx, "Activity", nk_rect(x, y, width, height), NK_WINDOW_TITLE | NK_WINDOW_BACKGROUND))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 40, 1);
|
||||
for(i = 0; i < main_settings->activity_string_count; i++)
|
||||
for (i = 0; i < main_settings->activity_string_count; i++)
|
||||
nk_label_wrap(ctx, main_settings->activity_string[i]);
|
||||
}
|
||||
nk_end(ctx);
|
||||
|
||||
@@ -8,13 +8,11 @@
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
#include <time.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
|
||||
|
||||
#define PATH_LENGTH 66
|
||||
#define NAME_LENGTH 56
|
||||
#define PREFIX_LENGTH_TRUNCATED 10
|
||||
@@ -33,7 +31,6 @@
|
||||
|
||||
#include "icon_data.c"
|
||||
|
||||
|
||||
//#define WINDOW_WIDTH 1200
|
||||
//#define WINDOW_HEIGHT 800
|
||||
//#define true 1
|
||||
@@ -56,7 +53,6 @@
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
|
||||
|
||||
static struct main_tab main_settings;
|
||||
|
||||
/*Trigger command for CLI*/
|
||||
@@ -64,7 +60,6 @@ char command[20];
|
||||
|
||||
/*Global Variables for Drag and Drop files*/
|
||||
|
||||
|
||||
/* Width and Height of all frames*/
|
||||
const GLint WIDTH_mainPanelAndWindow = 530, HEIGHT_mainPanelandWindow = 550;
|
||||
const GLint WIDTH_termORPreviewPanel = 530, HEIGHT_termORPreviewPanel = 100;
|
||||
@@ -80,38 +75,35 @@ static int tab_screen_height;
|
||||
/*Parameter Constants*/
|
||||
static int modifiedParams = 0;
|
||||
|
||||
|
||||
static void error_callback(int e, const char *d)
|
||||
{
|
||||
printf("Error %d: %s\n", e, d);
|
||||
}
|
||||
|
||||
void drop_callback(GLFWwindow* window, int count, const char **paths)
|
||||
void drop_callback(GLFWwindow *window, int count, const char **paths)
|
||||
{
|
||||
int i,j,k,z,copycount, prefix_length, slash_length, fileNameTruncated_index;
|
||||
|
||||
int i, j, k, z, copycount, prefix_length, slash_length, fileNameTruncated_index;
|
||||
|
||||
printf("Number of selected paths:%d\n", count);
|
||||
|
||||
if(main_settings.filename_count == 0 && main_settings.filenames == NULL)
|
||||
main_settings.filenames = (char**)calloc(count + 1, sizeof(char*));
|
||||
if (main_settings.filename_count == 0 && main_settings.filenames == NULL)
|
||||
main_settings.filenames = (char **)calloc(count + 1, sizeof(char *));
|
||||
else
|
||||
main_settings.filenames = (char**)realloc(main_settings.filenames, (main_settings.filename_count + count + 1) * sizeof(char*));
|
||||
main_settings.filenames = (char **)realloc(main_settings.filenames, (main_settings.filename_count + count + 1) * sizeof(char *));
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
printf("\n%d", main_settings.filename_count);
|
||||
|
||||
main_settings.filenames[main_settings.filename_count] = (char*)calloc((strlen(paths[i])+5), sizeof(char));
|
||||
main_settings.filenames[main_settings.filename_count] = (char *)calloc((strlen(paths[i]) + 5), sizeof(char));
|
||||
main_settings.filenames[main_settings.filename_count][0] = '\"';
|
||||
strcat(main_settings.filenames[main_settings.filename_count], paths[i]);
|
||||
strcat(main_settings.filenames[main_settings.filename_count], "\"");
|
||||
puts(main_settings.filenames[main_settings.filename_count]);
|
||||
puts(main_settings.filenames[main_settings.filename_count]);
|
||||
main_settings.filename_count++;
|
||||
}
|
||||
main_settings.filenames[main_settings.filename_count] = NULL;
|
||||
|
||||
main_settings.filenames[main_settings.filename_count] = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*Rectangle to hold file names*/
|
||||
//void draw_file_rectangle_widget(struct nk_context *ctx, struct nk_font *font)
|
||||
//{
|
||||
@@ -139,7 +131,7 @@ void drop_callback(GLFWwindow* window, int count, const char **paths)
|
||||
// space.y = space.y + 20;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
/*Rectangle to hold extraction info*/
|
||||
@@ -190,7 +182,8 @@ int main(void)
|
||||
glfwSetWindowUserPointer(win, &ctx);
|
||||
glfwSetDropCallback(win, drop_callback);
|
||||
|
||||
if (glewInit() != GLEW_OK) {
|
||||
if (glewInit() != GLEW_OK)
|
||||
{
|
||||
fprintf(stderr, "Failed to setup GLEW\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -210,8 +203,6 @@ int main(void)
|
||||
nk_glfw3_font_stash_end();
|
||||
nk_style_set_font(ctx, &droid->handle);
|
||||
|
||||
|
||||
|
||||
//CHECKBOX VALUES
|
||||
static int show_terminal_check = nk_false;
|
||||
static int show_preview_check = nk_false;
|
||||
@@ -246,9 +237,9 @@ int main(void)
|
||||
media.icons.home = icon_load(home_icon_data, sizeof(home_icon_data));
|
||||
media.icons.directory = icon_load(directory_icon_data, sizeof(directory_icon_data));
|
||||
media.icons.computer = icon_load(computer_icon_data, sizeof(computer_icon_data));
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
media.icons.drives = icon_load(drive_icon_data, sizeof(drive_icon_data));
|
||||
#endif
|
||||
#endif
|
||||
media.icons.desktop = icon_load(desktop_icon_data, sizeof(desktop_icon_data));
|
||||
media.icons.default_file = icon_load(default_icon_data, sizeof(default_icon_data));
|
||||
media.icons.text_file = icon_load(text_icon_data, sizeof(text_icon_data));
|
||||
@@ -257,25 +248,24 @@ int main(void)
|
||||
media.icons.img_file = icon_load(img_icon_data, sizeof(img_icon_data));
|
||||
media.icons.movie_file = icon_load(movie_icon_data, sizeof(movie_icon_data));
|
||||
|
||||
media_init(&media);
|
||||
|
||||
media_init(&media);
|
||||
file_browser_init(&browser, &media);
|
||||
|
||||
file_browser_init(&browser, &media);
|
||||
|
||||
/*Read Last run state*/
|
||||
FILE *loadFile;
|
||||
loadFile = fopen("ccxGUI.ini", "r");
|
||||
if(loadFile != NULL)
|
||||
{
|
||||
printf("File found and reading it!\n");
|
||||
load_data(loadFile, &main_settings, &input, &advanced_input, &output, &decoders, &credits, &debug, &hd_homerun, &burned_subs, &network_settings);
|
||||
fclose(loadFile);
|
||||
}
|
||||
/*Read Last run state*/
|
||||
FILE *loadFile;
|
||||
loadFile = fopen("ccxGUI.ini", "r");
|
||||
if (loadFile != NULL)
|
||||
{
|
||||
printf("File found and reading it!\n");
|
||||
load_data(loadFile, &main_settings, &input, &advanced_input, &output, &decoders, &credits, &debug, &hd_homerun, &burned_subs, &network_settings);
|
||||
fclose(loadFile);
|
||||
}
|
||||
|
||||
/*Main GUI loop*/
|
||||
while (nk_true)
|
||||
{
|
||||
if(glfwWindowShouldClose(win))
|
||||
if (glfwWindowShouldClose(win))
|
||||
{
|
||||
FILE *saveFile;
|
||||
saveFile = fopen("ccxGUI.ini", "w");
|
||||
@@ -287,27 +277,24 @@ int main(void)
|
||||
glfwPollEvents();
|
||||
nk_glfw3_new_frame();
|
||||
|
||||
|
||||
//Popups
|
||||
static int show_progress_details = nk_false;
|
||||
static int show_about_ccx = nk_false;
|
||||
static int show_getting_started = nk_false;
|
||||
|
||||
|
||||
|
||||
//GUI
|
||||
if (nk_begin(ctx, "CCExtractor", nk_rect(0, 0, WIDTH_mainPanelAndWindow, HEIGHT_mainPanelandWindow),
|
||||
NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BACKGROUND))
|
||||
NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BACKGROUND))
|
||||
{
|
||||
|
||||
|
||||
//MENUBAR
|
||||
//MENUBAR
|
||||
nk_menubar_begin(ctx);
|
||||
nk_layout_row_begin(ctx, NK_STATIC, 30, 3);
|
||||
nk_layout_row_push(ctx, 80);
|
||||
if (nk_menu_begin_label(ctx, "Preferences", NK_TEXT_LEFT, nk_vec2(120, 200))) {
|
||||
if (nk_menu_begin_label(ctx, "Preferences", NK_TEXT_LEFT, nk_vec2(120, 200)))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 30, 1);
|
||||
if(nk_menu_item_label(ctx, "Reset Defaults", NK_TEXT_LEFT))
|
||||
if (nk_menu_item_label(ctx, "Reset Defaults", NK_TEXT_LEFT))
|
||||
{
|
||||
remove("ccxGUI.ini");
|
||||
setup_main_settings(&main_settings);
|
||||
@@ -320,14 +307,14 @@ int main(void)
|
||||
setup_debug_tab(&debug);
|
||||
setup_hd_homerun_tab(&hd_homerun);
|
||||
setup_burned_subs_tab(&burned_subs);
|
||||
|
||||
}
|
||||
if (nk_menu_item_label(ctx, "Network Settings", NK_TEXT_LEFT))
|
||||
network_settings.show_network_settings = nk_true;
|
||||
nk_menu_end(ctx);
|
||||
}
|
||||
nk_layout_row_push(ctx, 70);
|
||||
if (nk_menu_begin_label(ctx, "Windows", NK_TEXT_LEFT, nk_vec2(120, 200))) {
|
||||
if (nk_menu_begin_label(ctx, "Windows", NK_TEXT_LEFT, nk_vec2(120, 200)))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 30, 1);
|
||||
nk_checkbox_label(ctx, "Activity", &show_activity_check);
|
||||
nk_checkbox_label(ctx, "Terminal", &show_terminal_check);
|
||||
@@ -344,38 +331,39 @@ int main(void)
|
||||
show_about_ccx = nk_true;
|
||||
nk_menu_end(ctx);
|
||||
}
|
||||
|
||||
//Network Settings
|
||||
|
||||
//Network Settings
|
||||
if (network_settings.show_network_settings)
|
||||
draw_network_popup(ctx, &network_settings);
|
||||
|
||||
//About CCExtractor Popup
|
||||
//About CCExtractor Popup
|
||||
if (show_about_ccx)
|
||||
draw_about_ccx_popup(ctx, &show_about_ccx, &droid_big->handle, &droid_head->handle);
|
||||
|
||||
//Getting Started
|
||||
//Getting Started
|
||||
if (show_getting_started)
|
||||
draw_getting_started_popup(ctx, &show_getting_started);
|
||||
|
||||
//Color Popup
|
||||
//Color Popup
|
||||
if (output.color_popup)
|
||||
draw_color_popup(ctx, &output);
|
||||
|
||||
//File Browser as Popup
|
||||
if(main_settings.scaleWindowForFileBrowser){
|
||||
//File Browser as Popup
|
||||
if (main_settings.scaleWindowForFileBrowser)
|
||||
{
|
||||
int width = 0, height = 0;
|
||||
glfwGetWindowSize(win, &width, &height);
|
||||
glfwSetWindowSize(win, 930, 650);
|
||||
glfwSetWindowSizeLimits(win,930, 650, 930, 650 );
|
||||
glfwSetWindowSizeLimits(win, 930, 650, 930, 650);
|
||||
file_browser_run(&browser, ctx, &main_settings, &output, &debug, &hd_homerun);
|
||||
}
|
||||
|
||||
//Thread popop when file can't be read
|
||||
if(main_settings.threadPopup)
|
||||
//Thread popop when file can't be read
|
||||
if (main_settings.threadPopup)
|
||||
draw_thread_popup(ctx, &main_settings.threadPopup);
|
||||
|
||||
//Thread popup for hd_homerun thread
|
||||
if(hd_homerun.threadPopup)
|
||||
//Thread popup for hd_homerun thread
|
||||
if (hd_homerun.threadPopup)
|
||||
draw_thread_popup(ctx, &hd_homerun.threadPopup);
|
||||
|
||||
nk_layout_row_end(ctx);
|
||||
@@ -383,27 +371,38 @@ int main(void)
|
||||
nk_layout_space_begin(ctx, NK_STATIC, 15, 1);
|
||||
nk_layout_space_end(ctx);
|
||||
|
||||
|
||||
|
||||
/*TABS TRIGGERED IN ADVANCED MODE FLAG*/
|
||||
if (advanced_mode_check)
|
||||
{
|
||||
static int current_tab = 0;
|
||||
enum tab_name { MAIN, INPUT, ADV_INPUT, OUTPUT, DECODERS, CREDITS, DEBUG, HDHOMERUN, BURNEDSUBS };
|
||||
const char *names[] = { "Main", "Input", "Advanced Input", "Output", "Decoders", "Credits", "Debug", "HDHomeRun", "BurnedSubs" };
|
||||
enum tab_name
|
||||
{
|
||||
MAIN,
|
||||
INPUT,
|
||||
ADV_INPUT,
|
||||
OUTPUT,
|
||||
DECODERS,
|
||||
CREDITS,
|
||||
DEBUG,
|
||||
HDHOMERUN,
|
||||
BURNEDSUBS
|
||||
};
|
||||
const char *names[] = {"Main", "Input", "Advanced Input", "Output", "Decoders", "Credits", "Debug", "HDHomeRun", "BurnedSubs"};
|
||||
float id = 0;
|
||||
int i;
|
||||
|
||||
nk_style_push_vec2(ctx, &ctx->style.window.spacing, nk_vec2(0, 0));
|
||||
nk_style_push_float(ctx, &ctx->style.button.rounding, 0);
|
||||
nk_layout_row_begin(ctx, NK_STATIC, 20, 9);
|
||||
for (i = 0; i < 9; ++i) {
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
/*Make sure button perfectly fits text*/
|
||||
const struct nk_user_font *f = ctx->style.font;
|
||||
float text_width = f->width(f->userdata, f->height, names[i], nk_strlen(names[i]));
|
||||
float widget_width = text_width + 3 * ctx->style.button.padding.x;
|
||||
nk_layout_row_push(ctx, widget_width);
|
||||
if (current_tab == i) {
|
||||
if (current_tab == i)
|
||||
{
|
||||
/*Active tab gets highlighted*/
|
||||
struct nk_style_item button_color = ctx->style.button.normal;
|
||||
ctx->style.button.normal = ctx->style.button.active;
|
||||
@@ -420,61 +419,64 @@ int main(void)
|
||||
if (nk_group_begin(ctx, "Advanced Tabs", NK_WINDOW_NO_SCROLLBAR))
|
||||
{
|
||||
nk_style_pop_vec2(ctx);
|
||||
switch (current_tab) {
|
||||
case MAIN:
|
||||
tab_screen_height = 0;
|
||||
break;
|
||||
switch (current_tab)
|
||||
{
|
||||
case MAIN:
|
||||
tab_screen_height = 0;
|
||||
break;
|
||||
|
||||
case INPUT:
|
||||
draw_input_tab(ctx, &tab_screen_height, &input, &decoders);
|
||||
break;
|
||||
case INPUT:
|
||||
draw_input_tab(ctx, &tab_screen_height, &input, &decoders);
|
||||
break;
|
||||
|
||||
case ADV_INPUT:
|
||||
draw_advanced_input_tab(ctx, &tab_screen_height, &advanced_input);
|
||||
break;
|
||||
case ADV_INPUT:
|
||||
draw_advanced_input_tab(ctx, &tab_screen_height, &advanced_input);
|
||||
break;
|
||||
|
||||
case OUTPUT:
|
||||
draw_output_tab(ctx, &tab_screen_height, &output, &main_settings);
|
||||
break;
|
||||
case OUTPUT:
|
||||
draw_output_tab(ctx, &tab_screen_height, &output, &main_settings);
|
||||
break;
|
||||
|
||||
case DECODERS:
|
||||
draw_decoders_tab(ctx, &tab_screen_height, &decoders);
|
||||
break;
|
||||
case DECODERS:
|
||||
draw_decoders_tab(ctx, &tab_screen_height, &decoders);
|
||||
break;
|
||||
|
||||
case CREDITS:
|
||||
draw_credits_tab(ctx, &tab_screen_height, &credits);
|
||||
break;
|
||||
case CREDITS:
|
||||
draw_credits_tab(ctx, &tab_screen_height, &credits);
|
||||
break;
|
||||
|
||||
case DEBUG:
|
||||
draw_debug_tab(ctx, &tab_screen_height, &main_settings, &output, &debug);
|
||||
break;
|
||||
case DEBUG:
|
||||
draw_debug_tab(ctx, &tab_screen_height, &main_settings, &output, &debug);
|
||||
break;
|
||||
|
||||
case HDHOMERUN:
|
||||
draw_hd_homerun_tab(ctx, &tab_screen_height, &hd_homerun, &main_settings);
|
||||
break;
|
||||
case HDHOMERUN:
|
||||
draw_hd_homerun_tab(ctx, &tab_screen_height, &hd_homerun, &main_settings);
|
||||
break;
|
||||
|
||||
case BURNEDSUBS:
|
||||
draw_burned_subs_tab(ctx, &tab_screen_height, &burned_subs);
|
||||
break;
|
||||
case BURNEDSUBS:
|
||||
draw_burned_subs_tab(ctx, &tab_screen_height, &burned_subs);
|
||||
break;
|
||||
}
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
else nk_style_pop_vec2(ctx);
|
||||
else
|
||||
nk_style_pop_vec2(ctx);
|
||||
}
|
||||
|
||||
//ADVANCED MODE FLAG
|
||||
static const float ratio_adv_mode[] = { 0.75f, 0.22f, .03f };
|
||||
static const float ratio_adv_mode[] = {0.75f, 0.22f, .03f};
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 20, 3, ratio_adv_mode);
|
||||
nk_spacing(ctx, 1);
|
||||
nk_checkbox_label(ctx, "Advanced Mode", &advanced_mode_check);
|
||||
|
||||
//RADIO BUTTON 1
|
||||
static const float ratio_button[] = { .10f, .90f };
|
||||
static const float check_extension_ratio[] = { .10f, .53f, .12f, .15f, .10f };
|
||||
//RADIO BUTTON 1
|
||||
static const float ratio_button[] = {.10f, .90f};
|
||||
static const float check_extension_ratio[] = {.10f, .53f, .12f, .15f, .10f};
|
||||
//static int op = FILES;
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 20, 2, ratio_button);
|
||||
nk_spacing(ctx, 1);
|
||||
if (nk_option_label(ctx, "Extract from files below:", main_settings.port_or_files == FILES)) {
|
||||
if (nk_option_label(ctx, "Extract from files below:", main_settings.port_or_files == FILES))
|
||||
{
|
||||
//op = FILES;
|
||||
main_settings.port_or_files = FILES;
|
||||
}
|
||||
@@ -486,7 +488,7 @@ int main(void)
|
||||
nk_checkbox_label(ctx, "Check for common video file extensions", &file_extension_check);
|
||||
if (main_settings.filename_count > 0)
|
||||
{
|
||||
if(nk_button_label(ctx, "Add"))
|
||||
if (nk_button_label(ctx, "Add"))
|
||||
{
|
||||
main_settings.is_file_browser_active = nk_true;
|
||||
main_settings.scaleWindowForFileBrowser = nk_true;
|
||||
@@ -494,7 +496,8 @@ int main(void)
|
||||
|
||||
for (int i = 0; i < main_settings.filename_count; i++)
|
||||
{
|
||||
if (main_settings.is_file_selected[i]) {
|
||||
if (main_settings.is_file_selected[i])
|
||||
{
|
||||
add_remove_button = nk_true;
|
||||
break;
|
||||
}
|
||||
@@ -504,32 +507,29 @@ int main(void)
|
||||
if (add_remove_button)
|
||||
{
|
||||
|
||||
if (nk_button_label(ctx, "Remove")) {
|
||||
for (int i = main_settings.filename_count-1; i != -1; i--)
|
||||
if (main_settings.is_file_selected[i]) {
|
||||
remove_path_entry(&main_settings, i );
|
||||
if (nk_button_label(ctx, "Remove"))
|
||||
{
|
||||
for (int i = main_settings.filename_count - 1; i != -1; i--)
|
||||
if (main_settings.is_file_selected[i])
|
||||
{
|
||||
remove_path_entry(&main_settings, i);
|
||||
main_settings.is_file_selected[i] = nk_false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
if (nk_button_label(ctx, "Clear"))
|
||||
{
|
||||
free(main_settings.filenames);
|
||||
main_settings.filename_count = 0;
|
||||
}
|
||||
else if (nk_button_label(ctx, "Clear"))
|
||||
{
|
||||
free(main_settings.filenames);
|
||||
main_settings.filename_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//RECTANGLE-FILES
|
||||
static const float ratio_rect_files[] = { 0.10f,0.80f };
|
||||
static const float ratio_rect_files[] = {0.10f, 0.80f};
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 180, 2, ratio_rect_files);
|
||||
nk_spacing(ctx, 1);
|
||||
if (nk_group_begin(ctx, "Files in extraction queue:", NK_WINDOW_BORDER | NK_WINDOW_TITLE ))
|
||||
if (nk_group_begin(ctx, "Files in extraction queue:", NK_WINDOW_BORDER | NK_WINDOW_TITLE))
|
||||
{
|
||||
if (main_settings.filename_count != 0)
|
||||
{
|
||||
@@ -539,7 +539,8 @@ int main(void)
|
||||
nk_selectable_label(ctx, truncate_path_string(main_settings.filenames[i]), NK_TEXT_LEFT, &main_settings.is_file_selected[i]);
|
||||
}
|
||||
|
||||
else {
|
||||
else
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 1, 1);
|
||||
nk_spacing(ctx, 1);
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
@@ -554,21 +555,20 @@ int main(void)
|
||||
main_settings.scaleWindowForFileBrowser = nk_true;
|
||||
}
|
||||
nk_spacing(ctx, 1);
|
||||
|
||||
}
|
||||
nk_group_end(ctx);
|
||||
|
||||
}
|
||||
|
||||
//RadioButton 2 along with combobox
|
||||
static const float ratio_port[] = { 0.10f,0.20f,0.20f,0.20f,0.20f,0.10f };
|
||||
//RadioButton 2 along with combobox
|
||||
static const float ratio_port[] = {0.10f, 0.20f, 0.20f, 0.20f, 0.20f, 0.10f};
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 20, 6, ratio_port);
|
||||
nk_spacing(ctx, 1);
|
||||
if (nk_option_label(ctx, "Extract from", main_settings.port_or_files == PORT)) {
|
||||
if (nk_option_label(ctx, "Extract from", main_settings.port_or_files == PORT))
|
||||
{
|
||||
//op = PORT;
|
||||
main_settings.port_or_files = PORT;
|
||||
}
|
||||
main_settings.port_select = nk_combo(ctx, main_settings.port_type, 2, main_settings.port_select, 20, nk_vec2(85,100));
|
||||
main_settings.port_select = nk_combo(ctx, main_settings.port_type, 2, main_settings.port_select, 20, nk_vec2(85, 100));
|
||||
nk_label(ctx, " stream, on port:", NK_TEXT_LEFT);
|
||||
|
||||
//RADDIO BUTTON 2, TEXTEDIT FOR ENTERING PORT NUMBER
|
||||
@@ -584,7 +584,7 @@ int main(void)
|
||||
nk_text(ctx, "Extraction Info:", 16, NK_TEXT_CENTERED);
|
||||
|
||||
//RECTANGLE-INFO
|
||||
static const float ratio_rect_info[] = { 0.10f,0.80f,0.10f };
|
||||
static const float ratio_rect_info[] = {0.10f, 0.80f, 0.10f};
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 75, 2, ratio_rect_info);
|
||||
nk_spacing(ctx, 1);
|
||||
if (nk_group_begin(ctx, "Extraction Info:", NK_WINDOW_BORDER))
|
||||
@@ -592,50 +592,42 @@ int main(void)
|
||||
if (main_settings.filename_count != 0)
|
||||
{
|
||||
nk_layout_row_static(ctx, 18, 380, 1);
|
||||
nk_label(ctx, concat("Input type: ", input.type[input.type_select]), NK_TEXT_LEFT);
|
||||
nk_label(ctx, concat("Output type: ", output.type[output.type_select]), NK_TEXT_LEFT);
|
||||
if(output.is_filename)
|
||||
nk_label(ctx, concat("Output path: ", output.filename), NK_TEXT_LEFT);
|
||||
else
|
||||
nk_label(ctx, "Output path: Default", NK_TEXT_LEFT);
|
||||
if(burned_subs.is_burned_subs)
|
||||
nk_label(ctx, "Hardsubtitles extraction: Yes", NK_TEXT_LEFT);
|
||||
else
|
||||
nk_label(ctx, "Hardsubtitles extraction: No", NK_TEXT_LEFT);
|
||||
|
||||
|
||||
nk_label(ctx, concat("Input type: ", input.type[input.type_select]), NK_TEXT_LEFT);
|
||||
nk_label(ctx, concat("Output type: ", output.type[output.type_select]), NK_TEXT_LEFT);
|
||||
if (output.is_filename)
|
||||
nk_label(ctx, concat("Output path: ", output.filename), NK_TEXT_LEFT);
|
||||
else
|
||||
nk_label(ctx, "Output path: Default", NK_TEXT_LEFT);
|
||||
if (burned_subs.is_burned_subs)
|
||||
nk_label(ctx, "Hardsubtitles extraction: Yes", NK_TEXT_LEFT);
|
||||
else
|
||||
nk_label(ctx, "Hardsubtitles extraction: No", NK_TEXT_LEFT);
|
||||
}
|
||||
nk_group_end(ctx);
|
||||
|
||||
}
|
||||
|
||||
|
||||
nk_layout_space_begin(ctx, NK_STATIC, 10, 1);
|
||||
nk_layout_space_end(ctx);
|
||||
//PROGRESSBAR
|
||||
static const float ratio_progress[] = { 0.10f,0.03f,0.57f,0.03f,0.17f,0.10f };
|
||||
static const float ratio_progress[] = {0.10f, 0.03f, 0.57f, 0.03f, 0.17f, 0.10f};
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 20, 6, ratio_progress);
|
||||
nk_spacing(ctx, 1);
|
||||
nk_spacing(ctx, 1);
|
||||
nk_progress(ctx, &main_settings.progress_cursor, 101, nk_false);
|
||||
|
||||
|
||||
|
||||
//Extract Button
|
||||
nk_spacing(ctx, 1);
|
||||
if (nk_button_label(ctx, "Extract"))
|
||||
{
|
||||
|
||||
setup_and_create_thread(&main_settings, &command);
|
||||
|
||||
}
|
||||
|
||||
|
||||
nk_layout_space_begin(ctx, NK_STATIC, 10, 1);
|
||||
nk_layout_space_end(ctx);
|
||||
|
||||
//PROGRESS_DETAILS_BUTTON
|
||||
if(!show_activity_check)
|
||||
if (!show_activity_check)
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 3);
|
||||
nk_spacing(ctx, 1);
|
||||
@@ -652,14 +644,11 @@ int main(void)
|
||||
|
||||
//build command string
|
||||
command_builder(&command, &main_settings, &network_settings, &input, &advanced_input, &output, &decoders, &credits, &debug, &burned_subs);
|
||||
|
||||
|
||||
|
||||
}
|
||||
nk_end(ctx);
|
||||
|
||||
glfwGetWindowSize(win, &screenWidth, &screenHeight);
|
||||
|
||||
|
||||
if (!main_settings.scaleWindowForFileBrowser)
|
||||
{
|
||||
if (show_activity_check && show_preview_check && show_terminal_check)
|
||||
@@ -734,7 +723,7 @@ int main(void)
|
||||
{
|
||||
glfwSetWindowSize(win, WIDTH_mainPanelAndWindow, HEIGHT_mainPanelandWindow);
|
||||
glfwSetWindowSizeLimits(win, WIDTH_mainPanelAndWindow, HEIGHT_mainPanelandWindow,
|
||||
WIDTH_mainPanelAndWindow, HEIGHT_mainPanelandWindow);
|
||||
WIDTH_mainPanelAndWindow, HEIGHT_mainPanelandWindow);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -743,7 +732,6 @@ int main(void)
|
||||
glfwSetWindowSizeLimits(win, 930, 650, 930, 650);
|
||||
}
|
||||
|
||||
|
||||
glViewport(0, 0, screenWidth, screenHeight);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
/* IMPORTANT: `nk_glfw_render` modifies some global OpenGL state
|
||||
@@ -754,19 +742,19 @@ int main(void)
|
||||
glfwSwapBuffers(win);
|
||||
}
|
||||
|
||||
glDeleteTextures(1,(const GLuint*)&media.icons.home.handle.id);
|
||||
glDeleteTextures(1,(const GLuint*)&media.icons.directory.handle.id);
|
||||
glDeleteTextures(1,(const GLuint*)&media.icons.computer.handle.id);
|
||||
glDeleteTextures(1, (const GLuint *)&media.icons.home.handle.id);
|
||||
glDeleteTextures(1, (const GLuint *)&media.icons.directory.handle.id);
|
||||
glDeleteTextures(1, (const GLuint *)&media.icons.computer.handle.id);
|
||||
#ifdef _WIN32
|
||||
glDeleteTextures(1, (const GLuint*)&media.icons.drives.handle.id);
|
||||
glDeleteTextures(1, (const GLuint *)&media.icons.drives.handle.id);
|
||||
#endif
|
||||
glDeleteTextures(1,(const GLuint*)&media.icons.desktop.handle.id);
|
||||
glDeleteTextures(1,(const GLuint*)&media.icons.default_file.handle.id);
|
||||
glDeleteTextures(1,(const GLuint*)&media.icons.text_file.handle.id);
|
||||
glDeleteTextures(1,(const GLuint*)&media.icons.music_file.handle.id);
|
||||
glDeleteTextures(1,(const GLuint*)&media.icons.font_file.handle.id);
|
||||
glDeleteTextures(1,(const GLuint*)&media.icons.img_file.handle.id);
|
||||
glDeleteTextures(1,(const GLuint*)&media.icons.movie_file.handle.id);
|
||||
glDeleteTextures(1, (const GLuint *)&media.icons.desktop.handle.id);
|
||||
glDeleteTextures(1, (const GLuint *)&media.icons.default_file.handle.id);
|
||||
glDeleteTextures(1, (const GLuint *)&media.icons.text_file.handle.id);
|
||||
glDeleteTextures(1, (const GLuint *)&media.icons.music_file.handle.id);
|
||||
glDeleteTextures(1, (const GLuint *)&media.icons.font_file.handle.id);
|
||||
glDeleteTextures(1, (const GLuint *)&media.icons.img_file.handle.id);
|
||||
glDeleteTextures(1, (const GLuint *)&media.icons.movie_file.handle.id);
|
||||
|
||||
file_browser_free(&browser);
|
||||
//free(main_settings.filenames);
|
||||
@@ -776,14 +764,13 @@ int main(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void setup_main_settings(struct main_tab *main_settings)
|
||||
{
|
||||
|
||||
|
||||
main_settings->is_check_common_extension = nk_false;
|
||||
main_settings->port_num_len = 0;
|
||||
main_settings->port_or_files = FILES;
|
||||
main_settings->port_type = (char**)malloc(2 * sizeof(char*));
|
||||
main_settings->port_type = (char **)malloc(2 * sizeof(char *));
|
||||
main_settings->port_type[0] = "UDP";
|
||||
main_settings->port_type[1] = "TCP";
|
||||
main_settings->port_select = 0;
|
||||
@@ -794,10 +781,10 @@ void setup_main_settings(struct main_tab *main_settings)
|
||||
main_settings->threadPopup = nk_false;
|
||||
}
|
||||
|
||||
char* truncate_path_string(char *filePath)
|
||||
char *truncate_path_string(char *filePath)
|
||||
{
|
||||
char* file_path = strdup(filePath);
|
||||
int i,j,z,slash_length, fileNameTruncated_index,copycount, prefix_length;
|
||||
char *file_path = strdup(filePath);
|
||||
int i, j, z, slash_length, fileNameTruncated_index, copycount, prefix_length;
|
||||
char file_name[PATH_LENGTH], *ptr_slash, fileNameTruncated[NAME_LENGTH];
|
||||
//strcpy(filePath[i], paths[i]);
|
||||
if (strlen(filePath) >= PATH_LENGTH - 1)
|
||||
@@ -824,7 +811,7 @@ char* truncate_path_string(char *filePath)
|
||||
}
|
||||
strncpy(fileNameTruncated, ptr_slash, 47);
|
||||
|
||||
strncpy(file_name, file_path , 7);
|
||||
strncpy(file_name, file_path, 7);
|
||||
file_name[7] = '.';
|
||||
file_name[8] = '.';
|
||||
file_name[9] = '.';
|
||||
@@ -835,7 +822,8 @@ char* truncate_path_string(char *filePath)
|
||||
strcpy(file_path, file_name);
|
||||
}
|
||||
|
||||
else {
|
||||
else
|
||||
{
|
||||
copycount = PATH_LENGTH - 1;
|
||||
prefix_length = copycount - slash_length - 3;
|
||||
strncpy(file_name, file_path, prefix_length);
|
||||
@@ -853,7 +841,7 @@ char* truncate_path_string(char *filePath)
|
||||
}
|
||||
return file_path;
|
||||
}
|
||||
else
|
||||
else
|
||||
return filePath;
|
||||
}
|
||||
|
||||
@@ -864,54 +852,51 @@ void remove_path_entry(struct main_tab *main_settings, int indexToRemove)
|
||||
// printf("%d ", (*array)[i]);
|
||||
//printf("\n");
|
||||
|
||||
char** temp = (char**)calloc(main_settings->filename_count, sizeof(char *)); // allocate an array with a size 1 less than the current one
|
||||
char **temp = (char **)calloc(main_settings->filename_count, sizeof(char *)); // allocate an array with a size 1 less than the current one
|
||||
|
||||
memmove(
|
||||
temp,
|
||||
main_settings->filenames,
|
||||
(indexToRemove + 1) * sizeof(char *)); // copy everything BEFORE the index
|
||||
memmove(
|
||||
temp,
|
||||
main_settings->filenames,
|
||||
(indexToRemove + 1) * sizeof(char *)); // copy everything BEFORE the index
|
||||
|
||||
memmove(
|
||||
temp + indexToRemove,
|
||||
(main_settings->filenames) + (indexToRemove + 1),
|
||||
(main_settings->filename_count - indexToRemove) * sizeof(char *)); // copy everything AFTER the index
|
||||
|
||||
free(main_settings->filenames);
|
||||
main_settings->filenames = temp;
|
||||
main_settings->filename_count--;
|
||||
main_settings->filenames[main_settings->filename_count] = NULL;
|
||||
|
||||
memmove(
|
||||
temp + indexToRemove,
|
||||
(main_settings->filenames) + (indexToRemove + 1),
|
||||
(main_settings->filename_count - indexToRemove) * sizeof(char *)); // copy everything AFTER the index
|
||||
|
||||
free(main_settings->filenames);
|
||||
main_settings->filenames = temp;
|
||||
main_settings->filename_count--;
|
||||
main_settings->filenames[main_settings->filename_count] = NULL;
|
||||
}
|
||||
|
||||
|
||||
struct nk_image
|
||||
icon_load(char icon_data[], int len)
|
||||
{
|
||||
int x,y,n;
|
||||
GLuint tex;
|
||||
int x, y, n;
|
||||
GLuint tex;
|
||||
|
||||
unsigned char *data = stbi_load_from_memory(icon_data, len, &x, &y, &n, 0);
|
||||
if (!data) die("[SDL]: failed to load icons");
|
||||
unsigned char *data = stbi_load_from_memory(icon_data, len, &x, &y, &n, 0);
|
||||
if (!data)
|
||||
die("[SDL]: failed to load icons");
|
||||
|
||||
glGenTextures(1, &tex);
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
glGenTextures(1, &tex);
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
stbi_image_free(data);
|
||||
return nk_image_id((int)tex);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
stbi_image_free(data);
|
||||
return nk_image_id((int)tex);
|
||||
}
|
||||
|
||||
|
||||
char* concat(char* string1, char *string2)
|
||||
char *concat(char *string1, char *string2)
|
||||
{
|
||||
static char prefix[300], suffix[300];
|
||||
strcpy(prefix, string1);
|
||||
strcpy(suffix, string2);
|
||||
return strcat(prefix, suffix);
|
||||
static char prefix[300], suffix[300];
|
||||
strcpy(prefix, string1);
|
||||
strcpy(suffix, string2);
|
||||
return strcat(prefix, suffix);
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
#define MAX_WAIT 10
|
||||
#define PROGRESS_COMPLETE 100
|
||||
|
||||
void* extract_thread(void* extract_args)
|
||||
void *extract_thread(void *extract_args)
|
||||
{
|
||||
struct args_extract *params = (struct args_extract*)extract_args;
|
||||
struct args_extract *params = (struct args_extract *)extract_args;
|
||||
static char term_string[500];
|
||||
strcpy(term_string, params->command_string);
|
||||
strcat(term_string, " ");
|
||||
@@ -20,7 +20,7 @@ void* extract_thread(void* extract_args)
|
||||
pthread_exit(0);
|
||||
}
|
||||
|
||||
void* read_activity_data(void *read_args)
|
||||
void *read_activity_data(void *read_args)
|
||||
{
|
||||
puts("Inside activity thread!");
|
||||
char line[500];
|
||||
@@ -31,13 +31,13 @@ void* read_activity_data(void *read_args)
|
||||
time.tv_nsec = 10000000L;
|
||||
#endif
|
||||
int wait = 0;
|
||||
struct args_extract *read_params = (struct args_extract*)read_args;
|
||||
struct args_extract *read_params = (struct args_extract *)read_args;
|
||||
FILE *file;
|
||||
char current_input[500];
|
||||
int concat_index = 0;
|
||||
file = fopen("ccx.log", "r");
|
||||
|
||||
while(file == NULL)
|
||||
while (file == NULL)
|
||||
{
|
||||
printf("Cannot open ccx.log, trying again.\n");
|
||||
file = fopen("ccx.log", "r");
|
||||
@@ -47,20 +47,23 @@ void* read_activity_data(void *read_args)
|
||||
_sleep(10);
|
||||
#endif
|
||||
wait++;
|
||||
if(wait == MAX_WAIT)
|
||||
if (wait == MAX_WAIT)
|
||||
{
|
||||
read_params->main_threadsettings->threadPopup = nk_true;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
while(!feof(file))
|
||||
while (!feof(file))
|
||||
{
|
||||
if (fgets(current_input, sizeof(current_input), file) == NULL)
|
||||
continue;
|
||||
if (concat_index == 0) {
|
||||
if (concat_index == 0)
|
||||
{
|
||||
strcpy(line, current_input);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(line, current_input);
|
||||
}
|
||||
concat_index++;
|
||||
@@ -68,26 +71,24 @@ void* read_activity_data(void *read_args)
|
||||
continue;
|
||||
|
||||
sscanf(line, "%[^\n]", buffer);
|
||||
if(read_params->main_threadsettings->activity_string_count == 0)
|
||||
if (read_params->main_threadsettings->activity_string_count == 0)
|
||||
read_params->main_threadsettings->activity_string =
|
||||
malloc(sizeof(*read_params->main_threadsettings->activity_string));
|
||||
malloc(sizeof(*read_params->main_threadsettings->activity_string));
|
||||
else
|
||||
read_params->main_threadsettings->activity_string =
|
||||
realloc(read_params->main_threadsettings->activity_string,
|
||||
(read_params->main_threadsettings->activity_string_count + 1)*sizeof(char*));
|
||||
realloc(read_params->main_threadsettings->activity_string,
|
||||
(read_params->main_threadsettings->activity_string_count + 1) * sizeof(char *));
|
||||
|
||||
read_params->main_threadsettings->activity_string[read_params->main_threadsettings->activity_string_count] = strdup(buffer);
|
||||
read_params->main_threadsettings->activity_string_count++;
|
||||
|
||||
|
||||
|
||||
memset(line, 0, sizeof(line));
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
concat_index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void* read_data_from_thread(void* read_args)
|
||||
void *read_data_from_thread(void *read_args)
|
||||
{
|
||||
pthread_t tid_activity;
|
||||
pthread_attr_t attr_activity;
|
||||
@@ -99,10 +100,9 @@ void* read_data_from_thread(void* read_args)
|
||||
time.tv_nsec = 10000000L;
|
||||
#endif
|
||||
|
||||
|
||||
int wait = 0;
|
||||
struct args_extract *read_params = (struct args_extract*)read_args;
|
||||
int unknown1 = 0, unknown2 = 0,progress_count = 0;
|
||||
struct args_extract *read_params = (struct args_extract *)read_args;
|
||||
int unknown1 = 0, unknown2 = 0, progress_count = 0;
|
||||
FILE *file;
|
||||
char prev_line[500];
|
||||
char line[500];
|
||||
@@ -115,12 +115,13 @@ void* read_data_from_thread(void* read_args)
|
||||
/*Setup activity thread*/
|
||||
pthread_attr_init(&attr_activity);
|
||||
int err = pthread_create(&tid_activity, &attr_activity, read_activity_data, read_params);
|
||||
if(!err)
|
||||
if (!err)
|
||||
puts("Activity Thread created");
|
||||
|
||||
file = fopen("gui_report.log", "r");
|
||||
|
||||
while (file == NULL) {
|
||||
while (file == NULL)
|
||||
{
|
||||
printf("Cannot open gui_report.log, trying again.\n");
|
||||
file = fopen("gui_report.log", "r");
|
||||
#if UNIX
|
||||
@@ -129,20 +130,23 @@ void* read_data_from_thread(void* read_args)
|
||||
_sleep(10);
|
||||
#endif
|
||||
wait++;
|
||||
if (wait >= MAX_WAIT) {
|
||||
if (wait >= MAX_WAIT)
|
||||
{
|
||||
read_params->main_threadsettings->threadPopup = nk_true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
while(1)
|
||||
while (1)
|
||||
{
|
||||
if (fgets(current_input, sizeof(current_input), file) == NULL)
|
||||
continue;
|
||||
if (concat_index == 0) {
|
||||
if (concat_index == 0)
|
||||
{
|
||||
strcpy(line, current_input);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(line, current_input);
|
||||
}
|
||||
concat_index++;
|
||||
@@ -150,41 +154,41 @@ void* read_data_from_thread(void* read_args)
|
||||
continue;
|
||||
|
||||
progress_success = sscanf(line, "###PROGRESS#%d#%d#%d", &progress_count, &unknown1, &unknown2);
|
||||
if(progress_success == 3)
|
||||
if (progress_success == 3)
|
||||
read_params->main_threadsettings->progress_cursor = progress_count;
|
||||
subs_success1 = sscanf(line, "###SUBTITLE#%[^#]#%[^#]#%[^\n]", t_start, t_end, subtitle1);
|
||||
subs_success2 = sscanf(line, "###SUBTITLE###%[^\n]", subtitle2);
|
||||
if(subs_success1 == 3)
|
||||
if (subs_success1 == 3)
|
||||
{
|
||||
sprintf(buffer, "%s-%s: %s", t_start, t_end, subtitle1);
|
||||
if(read_params->main_threadsettings->preview_string_count == 0)
|
||||
if (read_params->main_threadsettings->preview_string_count == 0)
|
||||
read_params->main_threadsettings->preview_string =
|
||||
malloc(sizeof(*read_params->main_threadsettings->preview_string));
|
||||
malloc(sizeof(*read_params->main_threadsettings->preview_string));
|
||||
else
|
||||
read_params->main_threadsettings->preview_string =
|
||||
realloc(read_params->main_threadsettings->preview_string,
|
||||
(read_params->main_threadsettings->preview_string_count + 1)*sizeof(char*));
|
||||
realloc(read_params->main_threadsettings->preview_string,
|
||||
(read_params->main_threadsettings->preview_string_count + 1) * sizeof(char *));
|
||||
|
||||
read_params->main_threadsettings->preview_string[read_params->main_threadsettings->preview_string_count] = strdup(buffer);
|
||||
read_params->main_threadsettings->preview_string_count++;
|
||||
}
|
||||
|
||||
if(subs_success2 == 1)
|
||||
if (subs_success2 == 1)
|
||||
{
|
||||
sprintf(buffer, " %s", subtitle2);
|
||||
if(read_params->main_threadsettings->preview_string_count == 0)
|
||||
if (read_params->main_threadsettings->preview_string_count == 0)
|
||||
read_params->main_threadsettings->preview_string =
|
||||
malloc(sizeof(*read_params->main_threadsettings->preview_string));
|
||||
malloc(sizeof(*read_params->main_threadsettings->preview_string));
|
||||
else
|
||||
read_params->main_threadsettings->preview_string =
|
||||
realloc(read_params->main_threadsettings->preview_string,
|
||||
(read_params->main_threadsettings->preview_string_count + 1)*sizeof(char*));
|
||||
realloc(read_params->main_threadsettings->preview_string,
|
||||
(read_params->main_threadsettings->preview_string_count + 1) * sizeof(char *));
|
||||
|
||||
read_params->main_threadsettings->preview_string[read_params->main_threadsettings->preview_string_count] = strdup(buffer);
|
||||
read_params->main_threadsettings->preview_string_count++;
|
||||
}
|
||||
|
||||
if(progress_count == PROGRESS_COMPLETE)
|
||||
if (progress_count == PROGRESS_COMPLETE)
|
||||
break;
|
||||
memset(line, 0, sizeof(line));
|
||||
concat_index = 0;
|
||||
@@ -193,15 +197,15 @@ void* read_data_from_thread(void* read_args)
|
||||
printf("progress count:%d\n", progress_count);
|
||||
fclose(file);
|
||||
printf("File closed\n");
|
||||
for(int i = 0; i<read_params->main_threadsettings->preview_string_count; i++)
|
||||
printf("%s\n",read_params->main_threadsettings->preview_string[i]);
|
||||
for (int i = 0; i < read_params->main_threadsettings->preview_string_count; i++)
|
||||
printf("%s\n", read_params->main_threadsettings->preview_string[i]);
|
||||
pthread_exit(0);
|
||||
}
|
||||
|
||||
void* feed_files_for_extraction(void* file_args)
|
||||
void *feed_files_for_extraction(void *file_args)
|
||||
{
|
||||
printf("Inside feeder\n");
|
||||
|
||||
|
||||
struct args_extract *extract_params = (struct args_extract *)file_args;
|
||||
printf("count:%d\n", extract_params->main_threadsettings->filename_count);
|
||||
extract_params->command_string = extract_params->threadcommand->term_string;
|
||||
@@ -209,15 +213,14 @@ void* feed_files_for_extraction(void* file_args)
|
||||
pthread_t tid_extract, tid_read;
|
||||
pthread_attr_t attr_extract, attr_read;
|
||||
|
||||
|
||||
for(int i = 0; count != 0; i++, count--)
|
||||
for (int i = 0; count != 0; i++, count--)
|
||||
{
|
||||
pthread_t tid_extract, tid_read;
|
||||
pthread_attr_t attr_extract, attr_read;
|
||||
|
||||
pthread_attr_init(&attr_extract);
|
||||
pthread_attr_init(&attr_read);
|
||||
|
||||
|
||||
extract_params->main_threadsettings->is_file_selected[i] = nk_true;
|
||||
extract_args.file_string = extract_params->main_threadsettings->filenames[i];
|
||||
int err1 = pthread_create(&tid_extract, &attr_extract, extract_thread, extract_params);
|
||||
@@ -236,16 +239,14 @@ void* feed_files_for_extraction(void* file_args)
|
||||
|
||||
remove("gui_report.log");
|
||||
remove("ccx.log");
|
||||
|
||||
}
|
||||
printf("File feeding over\n");
|
||||
}
|
||||
|
||||
|
||||
void setup_and_create_thread(struct main_tab *main_settings, struct built_string *command)
|
||||
{
|
||||
extract_args.main_threadsettings = (struct main_tab*)main_settings;
|
||||
extract_args.threadcommand = (struct built_string*)command;
|
||||
extract_args.main_threadsettings = (struct main_tab *)main_settings;
|
||||
extract_args.threadcommand = (struct built_string *)command;
|
||||
|
||||
pthread_attr_init(&attr_launch);
|
||||
int err = pthread_create(&tid_launch, &attr_launch, feed_files_for_extraction, &extract_args);
|
||||
@@ -253,12 +254,11 @@ void setup_and_create_thread(struct main_tab *main_settings, struct built_string
|
||||
printf("Feeder created!\n");
|
||||
}
|
||||
|
||||
|
||||
/*THREAD FUNCTIONS FOR HD_HOMERUN*/
|
||||
void* find_hd_homerun_devices(void *args)
|
||||
void *find_hd_homerun_devices(void *args)
|
||||
{
|
||||
char command[300];
|
||||
extract_args.homerun_thread = (struct hd_homerun_tab*)args;
|
||||
extract_args.homerun_thread = (struct hd_homerun_tab *)args;
|
||||
int wait = 0;
|
||||
FILE *file;
|
||||
char line[200];
|
||||
@@ -271,7 +271,6 @@ void* find_hd_homerun_devices(void *args)
|
||||
time.tv_nsec = 10000000L;
|
||||
#endif
|
||||
|
||||
|
||||
#if HD_HOMERUN
|
||||
strcpy(command, "hdhomerun_config");
|
||||
#else
|
||||
@@ -280,56 +279,55 @@ void* find_hd_homerun_devices(void *args)
|
||||
strcpy(command, " discover >> homerun.log");
|
||||
system(command);
|
||||
|
||||
|
||||
file = fopen("homerun.log", "r");
|
||||
|
||||
while (file == NULL) {
|
||||
printf("Cannot open file! Trying again.\n");
|
||||
file = fopen("homerun.log", "r");
|
||||
while (file == NULL)
|
||||
{
|
||||
printf("Cannot open file! Trying again.\n");
|
||||
file = fopen("homerun.log", "r");
|
||||
#if UNIX
|
||||
nanosleep(&time, NULL);
|
||||
nanosleep(&time, NULL);
|
||||
#else
|
||||
_sleep(10);
|
||||
_sleep(10);
|
||||
#endif
|
||||
wait++;
|
||||
if (wait >= MAX_WAIT) {
|
||||
extract_args.homerun_thread->threadPopup = nk_true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
wait++;
|
||||
if (wait >= MAX_WAIT)
|
||||
{
|
||||
extract_args.homerun_thread->threadPopup = nk_true;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
while(1)
|
||||
while (1)
|
||||
{
|
||||
fgets(line, sizeof(line), file);
|
||||
device_success = sscanf(line, "hdhomerun device %[^\n]", device);
|
||||
if(feof(file))
|
||||
if (feof(file))
|
||||
break;
|
||||
if(device_success == 1)
|
||||
if (device_success == 1)
|
||||
{
|
||||
if(extract_args.homerun_thread->device_num == 0)
|
||||
if (extract_args.homerun_thread->device_num == 0)
|
||||
{
|
||||
extract_args.homerun_thread->devices = malloc(sizeof(char*));
|
||||
extract_args.homerun_thread->devices = malloc(sizeof(char *));
|
||||
extract_args.homerun_thread->devices[extract_args.homerun_thread->device_num] = strdup(device);
|
||||
extract_args.homerun_thread->device_num++;
|
||||
}
|
||||
else
|
||||
{
|
||||
extract_args.homerun_thread->devices = realloc(extract_args.homerun_thread->devices,
|
||||
(extract_args.homerun_thread->device_num + 1)*sizeof(char*));
|
||||
(extract_args.homerun_thread->device_num + 1) * sizeof(char *));
|
||||
extract_args.homerun_thread->devices[extract_args.homerun_thread->device_num] = strdup(device);
|
||||
extract_args.homerun_thread->device_num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("Find device thread finished\n");
|
||||
|
||||
printf("Find device thread finished\n");
|
||||
}
|
||||
|
||||
void* setup_hd_homerun_device(void *args)
|
||||
void *setup_hd_homerun_device(void *args)
|
||||
{
|
||||
char device[20];
|
||||
extract_args.homerun_thread = (struct hd_homerun_tab*)args;
|
||||
extract_args.homerun_thread = (struct hd_homerun_tab *)args;
|
||||
char channel_command[300];
|
||||
char program_command[300];
|
||||
char target_command[300];
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
#include "command_builder.h"
|
||||
|
||||
void command_builder(struct built_string *command,
|
||||
struct main_tab *main_settings,
|
||||
struct network_popup *network_settings,struct input_tab *input,
|
||||
struct advanced_input_tab *advanced_input,
|
||||
struct output_tab *output,
|
||||
struct decoders_tab *decoders,
|
||||
struct credits_tab *credits,
|
||||
struct debug_tab *debug,
|
||||
struct burned_subs_tab *burned_subs)
|
||||
struct main_tab *main_settings,
|
||||
struct network_popup *network_settings, struct input_tab *input,
|
||||
struct advanced_input_tab *advanced_input,
|
||||
struct output_tab *output,
|
||||
struct decoders_tab *decoders,
|
||||
struct credits_tab *credits,
|
||||
struct debug_tab *debug,
|
||||
struct burned_subs_tab *burned_subs)
|
||||
{
|
||||
static char buffer[1000];
|
||||
static char buffer[1000];
|
||||
#ifdef _WIN32
|
||||
strcpy(buffer, "ccextractorwin --gui_mode_reports");
|
||||
#else
|
||||
@@ -38,70 +38,77 @@ void command_builder(struct built_string *command,
|
||||
if (input->is_split)
|
||||
strcat(buffer, " --videoedited");
|
||||
|
||||
if (input->is_process_from) {
|
||||
if (input->is_process_from)
|
||||
{
|
||||
strcat(buffer, " -startat ");
|
||||
strcat(buffer, input->from_time_buffer);
|
||||
}
|
||||
|
||||
if (input->is_process_until) {
|
||||
|
||||
if (input->is_process_until)
|
||||
{
|
||||
strcat(buffer, " -endat ");
|
||||
strcat(buffer, input->until_time_buffer);
|
||||
}
|
||||
|
||||
switch (input->elementary_stream) {
|
||||
case AUTO_DETECT:
|
||||
break;
|
||||
case STREAM_TYPE:
|
||||
strcat(buffer, " -datastreamtype ");
|
||||
strncat(buffer, input->stream_type, input->stream_type_len);
|
||||
break;
|
||||
case STREAM_PID:
|
||||
strcat(buffer, " -datapid ");
|
||||
strncat(buffer, input->stream_pid, input->stream_pid_len);
|
||||
switch (input->elementary_stream)
|
||||
{
|
||||
case AUTO_DETECT:
|
||||
break;
|
||||
case STREAM_TYPE:
|
||||
strcat(buffer, " -datastreamtype ");
|
||||
strncat(buffer, input->stream_type, input->stream_type_len);
|
||||
break;
|
||||
case STREAM_PID:
|
||||
strcat(buffer, " -datapid ");
|
||||
strncat(buffer, input->stream_pid, input->stream_pid_len);
|
||||
}
|
||||
|
||||
if (input->is_assume_mpeg) {
|
||||
if (input->is_assume_mpeg)
|
||||
{
|
||||
strcat(buffer, " -streamtype ");
|
||||
strncat(buffer, input->mpeg_type, input->mpeg_type_len);
|
||||
}
|
||||
|
||||
if(decoders->teletext_dvb == TELETEXT)
|
||||
if (decoders->teletext_dvb == TELETEXT)
|
||||
{
|
||||
switch (input->teletext_decoder) {
|
||||
case AUTO_DECODE:
|
||||
break;
|
||||
case FORCE:
|
||||
strcat(buffer, " -teletext");
|
||||
break;
|
||||
case DISABLE:
|
||||
strcat(buffer, " -noteletext");
|
||||
switch (input->teletext_decoder)
|
||||
{
|
||||
case AUTO_DECODE:
|
||||
break;
|
||||
case FORCE:
|
||||
strcat(buffer, " -teletext");
|
||||
break;
|
||||
case DISABLE:
|
||||
strcat(buffer, " -noteletext");
|
||||
}
|
||||
|
||||
if (input->is_process_teletext_page) {
|
||||
if (input->is_process_teletext_page)
|
||||
{
|
||||
strcat(buffer, " -tpage ");
|
||||
strncat(buffer, input->teletext_page_number, input->teletext_page_numer_len);
|
||||
}
|
||||
}
|
||||
|
||||
switch (input->is_limit) {
|
||||
case NO_LIMIT:
|
||||
break;
|
||||
case LIMITED:
|
||||
strcat(buffer, " --screenfuls ");
|
||||
strcat(buffer, input->screenful_limit_buffer);
|
||||
switch (input->is_limit)
|
||||
{
|
||||
case NO_LIMIT:
|
||||
break;
|
||||
case LIMITED:
|
||||
strcat(buffer, " --screenfuls ");
|
||||
strcat(buffer, input->screenful_limit_buffer);
|
||||
}
|
||||
|
||||
switch (input->clock_input) {
|
||||
case AUTO:
|
||||
break;
|
||||
case GOP:
|
||||
strcat(buffer, " --goptime");
|
||||
break;
|
||||
case PTS:
|
||||
strcat(buffer, " --nogoptime");
|
||||
break;
|
||||
switch (input->clock_input)
|
||||
{
|
||||
case AUTO:
|
||||
break;
|
||||
case GOP:
|
||||
strcat(buffer, " --goptime");
|
||||
break;
|
||||
case PTS:
|
||||
strcat(buffer, " --nogoptime");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*Main tab and network settings*/
|
||||
@@ -109,200 +116,212 @@ void command_builder(struct built_string *command,
|
||||
{
|
||||
switch (main_settings->port_select)
|
||||
{
|
||||
case 0:
|
||||
strcat(buffer, " -udp ");
|
||||
if (!strstr(network_settings->udp_ipv4, "None")) {
|
||||
strncat(buffer, network_settings->udp_ipv4, network_settings->udp_ipv4_len);
|
||||
strcat(buffer, ":");
|
||||
}
|
||||
strncat(buffer, main_settings->port_num, main_settings->port_num_len);
|
||||
break;
|
||||
case 1:
|
||||
strcat(buffer, " -tcp ");
|
||||
strncat(buffer, main_settings->port_num, main_settings->port_num_len);
|
||||
if (!strstr(network_settings->tcp_pass, "None")) {
|
||||
strcat(buffer, " -tcppassword ");
|
||||
strncat(buffer, network_settings->tcp_pass, network_settings->tcp_pass_len);
|
||||
}
|
||||
if (!strstr(network_settings->tcp_desc, "None")) {
|
||||
strcat(buffer, " -tcpdesc ");
|
||||
strncat(buffer, network_settings->tcp_desc, network_settings->tcp_desc_len);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
strcat(buffer, " -udp ");
|
||||
if (!strstr(network_settings->udp_ipv4, "None"))
|
||||
{
|
||||
strncat(buffer, network_settings->udp_ipv4, network_settings->udp_ipv4_len);
|
||||
strcat(buffer, ":");
|
||||
}
|
||||
strncat(buffer, main_settings->port_num, main_settings->port_num_len);
|
||||
break;
|
||||
case 1:
|
||||
strcat(buffer, " -tcp ");
|
||||
strncat(buffer, main_settings->port_num, main_settings->port_num_len);
|
||||
if (!strstr(network_settings->tcp_pass, "None"))
|
||||
{
|
||||
strcat(buffer, " -tcppassword ");
|
||||
strncat(buffer, network_settings->tcp_pass, network_settings->tcp_pass_len);
|
||||
}
|
||||
if (!strstr(network_settings->tcp_desc, "None"))
|
||||
{
|
||||
strcat(buffer, " -tcpdesc ");
|
||||
strncat(buffer, network_settings->tcp_desc, network_settings->tcp_desc_len);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (input->is_live_stream) {
|
||||
if (input->is_live_stream)
|
||||
{
|
||||
strcat(buffer, " -s ");
|
||||
strncat(buffer, input->wait_data_sec, input->wait_data_sec_len);
|
||||
}
|
||||
|
||||
if (input->is_process_from) {
|
||||
if (input->is_process_from)
|
||||
{
|
||||
strcat(buffer, " -startat ");
|
||||
strcat(buffer, input->from_time_buffer);
|
||||
}
|
||||
|
||||
if (input->is_process_until) {
|
||||
if (input->is_process_until)
|
||||
{
|
||||
strcat(buffer, " -endat ");
|
||||
strcat(buffer, input->until_time_buffer);
|
||||
}
|
||||
|
||||
switch (input->elementary_stream) {
|
||||
case AUTO_DETECT:
|
||||
break;
|
||||
case STREAM_TYPE:
|
||||
strcat(buffer, " -datastreamtype ");
|
||||
strncat(buffer, input->stream_type, input->stream_type_len);
|
||||
break;
|
||||
case STREAM_PID:
|
||||
strcat(buffer, " -datapid ");
|
||||
strncat(buffer, input->stream_pid, input->stream_pid_len);
|
||||
switch (input->elementary_stream)
|
||||
{
|
||||
case AUTO_DETECT:
|
||||
break;
|
||||
case STREAM_TYPE:
|
||||
strcat(buffer, " -datastreamtype ");
|
||||
strncat(buffer, input->stream_type, input->stream_type_len);
|
||||
break;
|
||||
case STREAM_PID:
|
||||
strcat(buffer, " -datapid ");
|
||||
strncat(buffer, input->stream_pid, input->stream_pid_len);
|
||||
}
|
||||
|
||||
if (input->is_assume_mpeg) {
|
||||
if (input->is_assume_mpeg)
|
||||
{
|
||||
strcat(buffer, " -streamtype ");
|
||||
strncat(buffer, input->mpeg_type, input->mpeg_type_len);
|
||||
}
|
||||
|
||||
switch (input->teletext_decoder) {
|
||||
case AUTO_DECODE:
|
||||
break;
|
||||
case FORCE:
|
||||
strcat(buffer, " -teletext");
|
||||
break;
|
||||
case DISABLE:
|
||||
strcat(buffer, " -noteletext");
|
||||
switch (input->teletext_decoder)
|
||||
{
|
||||
case AUTO_DECODE:
|
||||
break;
|
||||
case FORCE:
|
||||
strcat(buffer, " -teletext");
|
||||
break;
|
||||
case DISABLE:
|
||||
strcat(buffer, " -noteletext");
|
||||
}
|
||||
|
||||
if (input->is_process_teletext_page) {
|
||||
if (input->is_process_teletext_page)
|
||||
{
|
||||
strcat(buffer, " -tpage ");
|
||||
strncat(buffer, input->teletext_page_number, input->teletext_page_numer_len);
|
||||
}
|
||||
|
||||
switch (input->is_limit) {
|
||||
case NO_LIMIT:
|
||||
break;
|
||||
case LIMITED:
|
||||
strcat(buffer, " --screenfuls ");
|
||||
strcat(buffer, input->screenful_limit_buffer);
|
||||
switch (input->is_limit)
|
||||
{
|
||||
case NO_LIMIT:
|
||||
break;
|
||||
case LIMITED:
|
||||
strcat(buffer, " --screenfuls ");
|
||||
strcat(buffer, input->screenful_limit_buffer);
|
||||
}
|
||||
|
||||
switch (input->clock_input) {
|
||||
case AUTO:
|
||||
break;
|
||||
case GOP:
|
||||
strcat(buffer, " --goptime");
|
||||
break;
|
||||
case PTS:
|
||||
strcat(buffer, " --nogoptime");
|
||||
break;
|
||||
switch (input->clock_input)
|
||||
{
|
||||
case AUTO:
|
||||
break;
|
||||
case GOP:
|
||||
strcat(buffer, " --goptime");
|
||||
break;
|
||||
case PTS:
|
||||
strcat(buffer, " --nogoptime");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*ADVANCED INPUT SETTINGS*/
|
||||
if(advanced_input->is_multiple_program)
|
||||
if (advanced_input->is_multiple_program)
|
||||
{
|
||||
switch(advanced_input->multiple_program)
|
||||
switch (advanced_input->multiple_program)
|
||||
{
|
||||
case FIRST_PROG:
|
||||
strcat(buffer, " -autoprogram");
|
||||
break;
|
||||
case PROG_NUM:
|
||||
strcat(buffer, " -pn ");
|
||||
strcat(buffer, advanced_input->prog_number);
|
||||
break;
|
||||
case FIRST_PROG:
|
||||
strcat(buffer, " -autoprogram");
|
||||
break;
|
||||
case PROG_NUM:
|
||||
strcat(buffer, " -pn ");
|
||||
strcat(buffer, advanced_input->prog_number);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch(advanced_input->set_myth)
|
||||
switch (advanced_input->set_myth)
|
||||
{
|
||||
case AUTO_MYTH:
|
||||
break;
|
||||
case FORCE_MYTH:
|
||||
strcat(buffer, " -myth");
|
||||
break;
|
||||
case DISABLE_MYTH:
|
||||
strcat(buffer, " -nomyth");
|
||||
break;
|
||||
case AUTO_MYTH:
|
||||
break;
|
||||
case FORCE_MYTH:
|
||||
strcat(buffer, " -myth");
|
||||
break;
|
||||
case DISABLE_MYTH:
|
||||
strcat(buffer, " -nomyth");
|
||||
break;
|
||||
}
|
||||
|
||||
if(advanced_input->is_mpeg_90090)
|
||||
if (advanced_input->is_mpeg_90090)
|
||||
strcat(buffer, " -90090");
|
||||
if(advanced_input->is_padding_0000)
|
||||
if (advanced_input->is_padding_0000)
|
||||
strcat(buffer, " -fp");
|
||||
if(advanced_input->is_order_ccinfo)
|
||||
if (advanced_input->is_order_ccinfo)
|
||||
strcat(buffer, " -poc");
|
||||
if(advanced_input->is_win_bug)
|
||||
if (advanced_input->is_win_bug)
|
||||
strcat(buffer, " -wtvconvertfix");
|
||||
if(advanced_input->is_hauppage_file)
|
||||
if (advanced_input->is_hauppage_file)
|
||||
strcat(buffer, " -haup");
|
||||
if(advanced_input->is_process_mp4)
|
||||
if (advanced_input->is_process_mp4)
|
||||
strcat(buffer, " -mp4vidtrack");
|
||||
if(advanced_input->is_ignore_broadcast)
|
||||
if (advanced_input->is_ignore_broadcast)
|
||||
strcat(buffer, " -noautotimeref");
|
||||
|
||||
/*DECODERS TAB*/
|
||||
if(decoders->is_field2)
|
||||
if (decoders->is_field2)
|
||||
strcat(buffer, " -12");
|
||||
|
||||
switch(decoders->channel)
|
||||
switch (decoders->channel)
|
||||
{
|
||||
case CHANNEL_1:
|
||||
break;
|
||||
case CHANNEL_2:
|
||||
strcat(buffer, " -cc2");
|
||||
break;
|
||||
case CHANNEL_1:
|
||||
break;
|
||||
case CHANNEL_2:
|
||||
strcat(buffer, " -cc2");
|
||||
break;
|
||||
}
|
||||
|
||||
if(decoders->is_708)
|
||||
if (decoders->is_708)
|
||||
{
|
||||
strcat(buffer, " -svc ");
|
||||
strncat(buffer, decoders->services, decoders->services_len);
|
||||
}
|
||||
|
||||
switch(decoders->teletext_dvb)
|
||||
switch (decoders->teletext_dvb)
|
||||
{
|
||||
case TELETEXT:
|
||||
if(strcmp(decoders->min_distance, "2"))
|
||||
{
|
||||
strcat(buffer, " -levdistmincnt ");
|
||||
strncat(buffer, decoders->min_distance, decoders->min_distance_len);
|
||||
}
|
||||
if(strcmp(decoders->max_distance, "10"))
|
||||
{
|
||||
strcat(buffer, " -levdistmaxpct ");
|
||||
strncat(buffer, decoders->max_distance, decoders->max_distance_len);
|
||||
}
|
||||
break;
|
||||
case TELETEXT:
|
||||
if (strcmp(decoders->min_distance, "2"))
|
||||
{
|
||||
strcat(buffer, " -levdistmincnt ");
|
||||
strncat(buffer, decoders->min_distance, decoders->min_distance_len);
|
||||
}
|
||||
if (strcmp(decoders->max_distance, "10"))
|
||||
{
|
||||
strcat(buffer, " -levdistmaxpct ");
|
||||
strncat(buffer, decoders->max_distance, decoders->max_distance_len);
|
||||
}
|
||||
break;
|
||||
|
||||
case DVB:
|
||||
strcat(buffer, " -codec dvdsub");
|
||||
break;
|
||||
case DVB:
|
||||
strcat(buffer, " -codec dvdsub");
|
||||
break;
|
||||
}
|
||||
|
||||
/*CREDITS TAB*/
|
||||
if(credits->is_start_text)
|
||||
if (credits->is_start_text)
|
||||
{
|
||||
strcat(buffer, " --startcreditstext \"");
|
||||
strncat(buffer, credits->start_text, credits->start_text_len);
|
||||
strcat(buffer,"\" --startcreditsforatleast ");
|
||||
strcat(buffer, "\" --startcreditsforatleast ");
|
||||
strncat(buffer, credits->start_atleast_sec, credits->start_atleast_sec_len);
|
||||
strcat(buffer, " --startcreditsforatmost ");
|
||||
strncat(buffer, credits->start_atmost_sec, credits->start_atmost_sec_len);
|
||||
if(credits->is_before)
|
||||
if (credits->is_before)
|
||||
{
|
||||
strcat(buffer, " --startcreditsnotbefore ");
|
||||
strcat(buffer, credits->before_time_buffer);
|
||||
}
|
||||
if(credits->is_after)
|
||||
if (credits->is_after)
|
||||
{
|
||||
strcat(buffer, " --startcreditsnotafter ");
|
||||
strcat(buffer, credits->after_time_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
if(credits->is_end_text)
|
||||
if (credits->is_end_text)
|
||||
{
|
||||
strcat(buffer, " --endcreditstext \"");
|
||||
strncat(buffer, credits->end_text, credits->end_text_len);
|
||||
@@ -313,91 +332,94 @@ void command_builder(struct built_string *command,
|
||||
}
|
||||
|
||||
/*DEBUG TAB*/
|
||||
if(debug->is_elementary_stream)
|
||||
if (debug->is_elementary_stream)
|
||||
{
|
||||
strcat(buffer, " -cf ");
|
||||
strncat(buffer, debug->elementary_stream, debug->elementary_stream_len);
|
||||
}
|
||||
if(debug->is_dump_packets)
|
||||
if (debug->is_dump_packets)
|
||||
strcat(buffer, " -debug");
|
||||
if(debug->is_debug_608)
|
||||
if (debug->is_debug_608)
|
||||
strcat(buffer, " -608");
|
||||
if(debug->is_debug_708)
|
||||
if (debug->is_debug_708)
|
||||
strcat(buffer, " -708");
|
||||
if(debug->is_stamp_output)
|
||||
if (debug->is_stamp_output)
|
||||
strcat(buffer, " -goppts");
|
||||
if(debug->is_debug_analysed_vid)
|
||||
if (debug->is_debug_analysed_vid)
|
||||
strcat(buffer, " -vides");
|
||||
if(debug->is_raw_608_708)
|
||||
if (debug->is_raw_608_708)
|
||||
strcat(buffer, " -cbraw");
|
||||
if(debug->is_debug_parsed)
|
||||
if (debug->is_debug_parsed)
|
||||
strcat(buffer, " -parsedebug");
|
||||
if(!strcmp(output->type[output->type_select], "bin"))
|
||||
if (!strcmp(output->type[output->type_select], "bin"))
|
||||
{
|
||||
if(debug->is_disable_sync)
|
||||
if (debug->is_disable_sync)
|
||||
strcat(buffer, " -nosync");
|
||||
if(debug->is_no_padding)
|
||||
if (debug->is_no_padding)
|
||||
strcat(buffer, " -fullbin");
|
||||
}
|
||||
if(debug->is_debug_xds)
|
||||
if (debug->is_debug_xds)
|
||||
strcat(buffer, " -xdsdebug");
|
||||
if(debug->is_output_pat)
|
||||
if (debug->is_output_pat)
|
||||
strcat(buffer, " -parsePAT");
|
||||
if(debug->is_output_pmt)
|
||||
if (debug->is_output_pmt)
|
||||
strcat(buffer, " -parsePMT");
|
||||
if(debug->is_scan_ccdata)
|
||||
if (debug->is_scan_ccdata)
|
||||
strcat(buffer, " -investigate_packets");
|
||||
if(debug->is_output_levenshtein)
|
||||
if (debug->is_output_levenshtein)
|
||||
strcat(buffer, " -deblev");
|
||||
|
||||
/*HARD_BURNED SUBS SETTINGS*/
|
||||
if(burned_subs->is_burned_subs)
|
||||
if (burned_subs->is_burned_subs)
|
||||
{
|
||||
strcat(buffer, " -hardsubx -ocr_mode");
|
||||
switch(burned_subs->ocr_mode)
|
||||
switch (burned_subs->ocr_mode)
|
||||
{
|
||||
case FRAME_WISE:
|
||||
strcat(buffer, " frame");
|
||||
break;
|
||||
case WORD_WISE:
|
||||
strcat(buffer, " word");
|
||||
break;
|
||||
case LETTER_WISE:
|
||||
strcat(buffer, " letter");
|
||||
break;
|
||||
case FRAME_WISE:
|
||||
strcat(buffer, " frame");
|
||||
break;
|
||||
case WORD_WISE:
|
||||
strcat(buffer, " word");
|
||||
break;
|
||||
case LETTER_WISE:
|
||||
strcat(buffer, " letter");
|
||||
break;
|
||||
}
|
||||
|
||||
strcat(buffer, " -min_sub_duration ");
|
||||
strcat(buffer, burned_subs->min_duration);
|
||||
|
||||
if(!burned_subs->subs_color_select && burned_subs->color_type == PRESET)
|
||||
if (!burned_subs->subs_color_select && burned_subs->color_type == PRESET)
|
||||
sprintf(buffer, "%s -whiteness_thresh %d", buffer, burned_subs->luminance_threshold);
|
||||
|
||||
sprintf(buffer, "%s -conf_thresh %d", buffer, burned_subs->confidence_threshold);
|
||||
|
||||
if(burned_subs->is_italic)
|
||||
if (burned_subs->is_italic)
|
||||
strcat(buffer, " -detect_italics");
|
||||
}
|
||||
|
||||
//Output
|
||||
{
|
||||
strcat(buffer, " -out=");
|
||||
strcat(buffer, output->type[output->type_select]);
|
||||
if (output->is_filename) {
|
||||
strcat(buffer, " -o \"");
|
||||
strncat(buffer, output->filename, output->filename_len);
|
||||
strcat(buffer, "\"");
|
||||
}
|
||||
strcat(buffer, " -out=");
|
||||
strcat(buffer, output->type[output->type_select]);
|
||||
if (output->is_filename)
|
||||
{
|
||||
strcat(buffer, " -o \"");
|
||||
strncat(buffer, output->filename, output->filename_len);
|
||||
strcat(buffer, "\"");
|
||||
}
|
||||
|
||||
if (output->is_delay) {
|
||||
strcat(buffer, " -delay ");
|
||||
strcat(buffer, output->delay_sec_buffer);
|
||||
}
|
||||
if (output->is_delay)
|
||||
{
|
||||
strcat(buffer, " -delay ");
|
||||
strcat(buffer, output->delay_sec_buffer);
|
||||
}
|
||||
|
||||
if (output->is_export_xds)
|
||||
strcat(buffer, " -xds");
|
||||
if (output->is_export_xds)
|
||||
strcat(buffer, " -xds");
|
||||
|
||||
switch (output->encoding) {
|
||||
switch (output->encoding)
|
||||
{
|
||||
case LATIN:
|
||||
strcat(buffer, " -latin1");
|
||||
break;
|
||||
@@ -407,41 +429,43 @@ void command_builder(struct built_string *command,
|
||||
case UTF:
|
||||
strcat(buffer, " -utf8");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (output->is_bom)
|
||||
strcat(buffer, " -bom");
|
||||
else
|
||||
strcat(buffer, " -nobom");
|
||||
if (output->is_bom)
|
||||
strcat(buffer, " -bom");
|
||||
else
|
||||
strcat(buffer, " -nobom");
|
||||
|
||||
if (output->is_cap_standard)
|
||||
strcat(buffer, " --sentencecap");
|
||||
if (output->is_cap_standard)
|
||||
strcat(buffer, " --sentencecap");
|
||||
|
||||
if (output->is_cap_file) {
|
||||
strcat(buffer, " --capfile \"");
|
||||
strncat(buffer, output->cap_dictionary, output->cap_dictionary_len);
|
||||
strcat(buffer, "\"");
|
||||
}
|
||||
if (output->is_cap_file)
|
||||
{
|
||||
strcat(buffer, " --capfile \"");
|
||||
strncat(buffer, output->cap_dictionary, output->cap_dictionary_len);
|
||||
strcat(buffer, "\"");
|
||||
}
|
||||
|
||||
switch (output->line_ending)
|
||||
{
|
||||
switch (output->line_ending)
|
||||
{
|
||||
case CRLF:
|
||||
break;
|
||||
case LF:
|
||||
strcat(buffer, " -lf");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (output->is_center)
|
||||
strcat(buffer, " -trim");
|
||||
if (output->is_center)
|
||||
strcat(buffer, " -trim");
|
||||
|
||||
if (output->is_dash)
|
||||
strcat(buffer, " -autodash");
|
||||
if (output->is_dash)
|
||||
strcat(buffer, " -autodash");
|
||||
|
||||
if (output->no_typesetting)
|
||||
strcat(buffer, " --notypesetting");
|
||||
if (output->no_typesetting)
|
||||
strcat(buffer, " --notypesetting");
|
||||
|
||||
switch (output->font_color) {
|
||||
switch (output->font_color)
|
||||
{
|
||||
case NO_COLOR:
|
||||
strcat(buffer, " --nofontcolor");
|
||||
break;
|
||||
@@ -449,10 +473,10 @@ void command_builder(struct built_string *command,
|
||||
strcat(buffer, " --defaultcolor #");
|
||||
strcat(buffer, output->color_hex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (output->onetime_or_realtime)
|
||||
{
|
||||
switch (output->onetime_or_realtime)
|
||||
{
|
||||
case ONETIME:
|
||||
strcat(buffer, " --norollup");
|
||||
break;
|
||||
@@ -460,23 +484,21 @@ void command_builder(struct built_string *command,
|
||||
strcat(buffer, " -dru");
|
||||
switch (output->roll_limit_select)
|
||||
{
|
||||
case 1:
|
||||
strcat(buffer, " -ru1");
|
||||
break;
|
||||
case 2:
|
||||
strcat(buffer, " -ru2");
|
||||
break;
|
||||
case 3:
|
||||
strcat(buffer, " -ru3");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 1:
|
||||
strcat(buffer, " -ru1");
|
||||
break;
|
||||
case 2:
|
||||
strcat(buffer, " -ru2");
|
||||
break;
|
||||
case 3:
|
||||
strcat(buffer, " -ru3");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memset(command->term_string, 0, sizeof(command->term_string));
|
||||
strncpy(command->term_string, buffer, strlen(buffer));
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#ifndef STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
@@ -24,8 +24,7 @@
|
||||
#include "ccextractorGUI.h"
|
||||
#include "tabs.h"
|
||||
|
||||
void
|
||||
die(const char *fmt, ...)
|
||||
void die(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
@@ -35,36 +34,38 @@ die(const char *fmt, ...)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
char*
|
||||
file_load(const char* path, size_t* siz)
|
||||
char *
|
||||
file_load(const char *path, size_t *siz)
|
||||
{
|
||||
char *buf;
|
||||
FILE *fd = fopen(path, "rb");
|
||||
if (!fd) die("Failed to open file: %s\n", path);
|
||||
if (!fd)
|
||||
die("Failed to open file: %s\n", path);
|
||||
fseek(fd, 0, SEEK_END);
|
||||
*siz = (size_t)ftell(fd);
|
||||
fseek(fd, 0, SEEK_SET);
|
||||
buf = (char*)calloc(*siz, 1);
|
||||
buf = (char *)calloc(*siz, 1);
|
||||
fread(buf, *siz, 1, fd);
|
||||
fclose(fd);
|
||||
return buf;
|
||||
}
|
||||
|
||||
char*
|
||||
char *
|
||||
str_duplicate(const char *src)
|
||||
{
|
||||
char *ret;
|
||||
size_t len = strlen(src);
|
||||
if (!len) return 0;
|
||||
ret = (char*)malloc(len + 1);
|
||||
if (!ret) return 0;
|
||||
if (!len)
|
||||
return 0;
|
||||
ret = (char *)malloc(len + 1);
|
||||
if (!ret)
|
||||
return 0;
|
||||
memcpy(ret, src, len);
|
||||
ret[len] = '\0';
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
dir_free_list(char **list, size_t size)
|
||||
void dir_free_list(char **list, size_t size)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < size; ++i)
|
||||
@@ -72,7 +73,7 @@ dir_free_list(char **list, size_t size)
|
||||
free(list);
|
||||
}
|
||||
|
||||
char**
|
||||
char **
|
||||
dir_list(const char *dir, int return_subdirs, size_t *count)
|
||||
{
|
||||
size_t n = 0;
|
||||
@@ -99,13 +100,16 @@ dir_list(const char *dir, int return_subdirs, size_t *count)
|
||||
size = 0;
|
||||
|
||||
z = opendir(dir);
|
||||
if (z != none) {
|
||||
if (z != none)
|
||||
{
|
||||
int nonempty = 1;
|
||||
struct dirent *data = readdir(z);
|
||||
nonempty = (data != NULL);
|
||||
if (!nonempty) return NULL;
|
||||
if (!nonempty)
|
||||
return NULL;
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
DIR *y;
|
||||
char *p;
|
||||
int is_subdir;
|
||||
@@ -115,18 +119,23 @@ dir_list(const char *dir, int return_subdirs, size_t *count)
|
||||
strncpy(buffer + n, data->d_name, MAX_PATH_LEN - n);
|
||||
y = opendir(buffer);
|
||||
is_subdir = (y != NULL);
|
||||
if (y != NULL) closedir(y);
|
||||
if (y != NULL)
|
||||
closedir(y);
|
||||
|
||||
if ((return_subdirs && is_subdir) || (!is_subdir && !return_subdirs)) {
|
||||
if (!size) {
|
||||
results = (char**)calloc(sizeof(char*), capacity);
|
||||
if ((return_subdirs && is_subdir) || (!is_subdir && !return_subdirs))
|
||||
{
|
||||
if (!size)
|
||||
{
|
||||
results = (char **)calloc(sizeof(char *), capacity);
|
||||
}
|
||||
else if (size >= capacity) {
|
||||
else if (size >= capacity)
|
||||
{
|
||||
void *old = results;
|
||||
capacity = capacity * 2;
|
||||
results = (char**)realloc(results, capacity * sizeof(char*));
|
||||
results = (char **)realloc(results, capacity * sizeof(char *));
|
||||
assert(results);
|
||||
if (!results) free(old);
|
||||
if (!results)
|
||||
free(old);
|
||||
}
|
||||
p = str_duplicate(data->d_name);
|
||||
results[size++] = p;
|
||||
@@ -134,13 +143,14 @@ dir_list(const char *dir, int return_subdirs, size_t *count)
|
||||
} while ((data = readdir(z)) != NULL);
|
||||
}
|
||||
|
||||
if (z) closedir(z);
|
||||
if (z)
|
||||
closedir(z);
|
||||
*count = size;
|
||||
return results;
|
||||
}
|
||||
|
||||
struct file_group
|
||||
FILE_GROUP(enum file_groups group, const char *name, struct nk_image *icon)
|
||||
FILE_GROUP(enum file_groups group, const char *name, struct nk_image *icon)
|
||||
{
|
||||
struct file_group fg;
|
||||
fg.group = group;
|
||||
@@ -150,7 +160,7 @@ struct file_group
|
||||
}
|
||||
|
||||
struct file
|
||||
FILE_DEF(enum file_types type, const char *suffix, enum file_groups group)
|
||||
FILE_DEF(enum file_types type, const char *suffix, enum file_groups group)
|
||||
{
|
||||
struct file fd;
|
||||
fd.type = type;
|
||||
@@ -159,8 +169,8 @@ struct file
|
||||
return fd;
|
||||
}
|
||||
|
||||
struct nk_image*
|
||||
media_icon_for_file(struct media *media, const char *file)
|
||||
struct nk_image *
|
||||
media_icon_for_file(struct media *media, const char *file)
|
||||
{
|
||||
int i = 0;
|
||||
const char *s = file;
|
||||
@@ -169,12 +179,15 @@ struct nk_image*
|
||||
memset(suffix, 0, sizeof(suffix));
|
||||
|
||||
/* extract suffix .xxx from file */
|
||||
while (*s++ != '\0') {
|
||||
while (*s++ != '\0')
|
||||
{
|
||||
if (found && i < 3)
|
||||
suffix[i++] = *s;
|
||||
|
||||
if (*s == '.') {
|
||||
if (found) {
|
||||
if (*s == '.')
|
||||
{
|
||||
if (found)
|
||||
{
|
||||
found = 0;
|
||||
break;
|
||||
}
|
||||
@@ -183,13 +196,16 @@ struct nk_image*
|
||||
}
|
||||
|
||||
/* check for all file definition of all groups for fitting suffix*/
|
||||
for (i = 0; i < FILE_MAX && found; ++i) {
|
||||
for (i = 0; i < FILE_MAX && found; ++i)
|
||||
{
|
||||
struct file *d = &media->files[i];
|
||||
{
|
||||
const char *f = d->suffix;
|
||||
s = suffix;
|
||||
while (f && *f && *s && *s == *f) {
|
||||
s++; f++;
|
||||
while (f && *f && *s && *s == *f)
|
||||
{
|
||||
s++;
|
||||
f++;
|
||||
}
|
||||
|
||||
/* found correct file definition so */
|
||||
@@ -201,8 +217,7 @@ struct nk_image*
|
||||
return &media->icons.default_file;
|
||||
}
|
||||
|
||||
void
|
||||
media_init(struct media *media)
|
||||
void media_init(struct media *media)
|
||||
{
|
||||
/* file groups */
|
||||
struct icons *icons = &media->icons;
|
||||
@@ -232,8 +247,7 @@ media_init(struct media *media)
|
||||
media->files[FILE_GIF] = FILE_DEF(FILE_GIF, "gif", FILE_GROUP_IMAGE);
|
||||
}
|
||||
|
||||
void
|
||||
file_browser_reload_directory_content(struct file_browser *browser, const char *path)
|
||||
void file_browser_reload_directory_content(struct file_browser *browser, const char *path)
|
||||
{
|
||||
strncpy(browser->directory, path, MAX_PATH_LEN);
|
||||
dir_free_list(browser->files, browser->file_count);
|
||||
@@ -243,8 +257,7 @@ file_browser_reload_directory_content(struct file_browser *browser, const char *
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void
|
||||
get_drives(struct file_browser *browser)
|
||||
void get_drives(struct file_browser *browser)
|
||||
{
|
||||
static int drive_num;
|
||||
static char drive_list[50][4];
|
||||
@@ -258,7 +271,8 @@ get_drives(struct file_browser *browser)
|
||||
{
|
||||
printf("cannot find any drives! try again with different settings/permissions");
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
puts("File opened");
|
||||
while ((c = getc(file)) != EOF)
|
||||
{
|
||||
@@ -272,7 +286,6 @@ get_drives(struct file_browser *browser)
|
||||
continue;
|
||||
|
||||
prev_char = c;
|
||||
|
||||
}
|
||||
}
|
||||
printf("drive nums:%d\n", drive_num);
|
||||
@@ -280,17 +293,16 @@ get_drives(struct file_browser *browser)
|
||||
for (int i = 0; i < drive_num; i++)
|
||||
strcat(drive_list[i], ":\\");
|
||||
|
||||
|
||||
browser->drives_num = drive_num;
|
||||
browser->drives = (char**)calloc(drive_num + 1, sizeof(char*));
|
||||
browser->drives = (char **)calloc(drive_num + 1, sizeof(char *));
|
||||
for (int i = 0; i < drive_num; i++)
|
||||
{
|
||||
browser->drives[i] = (char*)calloc(strlen(drive_list[i]), sizeof(char));
|
||||
browser->drives[i] = (char *)calloc(strlen(drive_list[i]), sizeof(char));
|
||||
browser->drives[i] = strdup(drive_list[i]);
|
||||
}
|
||||
browser->drives[browser->drives_num] = NULL;
|
||||
|
||||
for (int i = 0; i< drive_num; i++)
|
||||
for (int i = 0; i < drive_num; i++)
|
||||
puts(browser->drives[i]);
|
||||
|
||||
fclose(file);
|
||||
@@ -298,8 +310,7 @@ get_drives(struct file_browser *browser)
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
file_browser_init(struct file_browser *browser, struct media *media)
|
||||
void file_browser_init(struct file_browser *browser, struct media *media)
|
||||
{
|
||||
memset(browser, 0, sizeof(*browser));
|
||||
browser->media = media;
|
||||
@@ -311,9 +322,11 @@ file_browser_init(struct file_browser *browser, struct media *media)
|
||||
/* load files and sub-directory list */
|
||||
const char *home = getenv("HOME");
|
||||
#ifdef _WIN32
|
||||
if (!home) home = getenv("USERPROFILE");
|
||||
if (!home)
|
||||
home = getenv("USERPROFILE");
|
||||
#else
|
||||
if (!home) home = getpwuid(getuid());
|
||||
if (!home)
|
||||
home = getpwuid(getuid());
|
||||
#endif
|
||||
{
|
||||
size_t l;
|
||||
@@ -341,8 +354,7 @@ file_browser_init(struct file_browser *browser, struct media *media)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
file_browser_free(struct file_browser *browser)
|
||||
void file_browser_free(struct file_browser *browser)
|
||||
{
|
||||
if (browser->files)
|
||||
dir_free_list(browser->files, browser->file_count);
|
||||
@@ -353,24 +365,22 @@ file_browser_free(struct file_browser *browser)
|
||||
memset(browser, 0, sizeof(*browser));
|
||||
}
|
||||
|
||||
int
|
||||
file_browser_run(struct file_browser *browser,
|
||||
struct nk_context *ctx,
|
||||
struct main_tab *main_settings,
|
||||
struct output_tab *output,
|
||||
struct debug_tab *debug,
|
||||
struct hd_homerun_tab *hd_homerun)
|
||||
int file_browser_run(struct file_browser *browser,
|
||||
struct nk_context *ctx,
|
||||
struct main_tab *main_settings,
|
||||
struct output_tab *output,
|
||||
struct debug_tab *debug,
|
||||
struct hd_homerun_tab *hd_homerun)
|
||||
{
|
||||
static int isFileAdded = nk_false;
|
||||
int ret = 0;
|
||||
struct media *media = browser->media;
|
||||
struct nk_rect total_space;
|
||||
|
||||
|
||||
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "File Browser", NK_WINDOW_CLOSABLE | NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_MOVABLE,
|
||||
nk_rect(0, 0, 930, 650)))
|
||||
nk_rect(0, 0, 930, 650)))
|
||||
{
|
||||
static float ratio[] = { 0.25f, NK_UNDEFINED };
|
||||
static float ratio[] = {0.25f, NK_UNDEFINED};
|
||||
float spacing_x = ctx->style.window.spacing.x;
|
||||
|
||||
/* output path directory selector in the menubar */
|
||||
@@ -380,7 +390,8 @@ file_browser_run(struct file_browser *browser,
|
||||
char *d = browser->directory;
|
||||
char *begin = d + 1;
|
||||
nk_layout_row_dynamic(ctx, 25, 6);
|
||||
while (*d++) {
|
||||
while (*d++)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (*d == '\\')
|
||||
#else
|
||||
@@ -388,7 +399,8 @@ file_browser_run(struct file_browser *browser,
|
||||
#endif
|
||||
{
|
||||
*d = '\0';
|
||||
if (nk_button_label(ctx, begin)) {
|
||||
if (nk_button_label(ctx, begin))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
*d++ = '\\';
|
||||
#else
|
||||
@@ -451,100 +463,112 @@ file_browser_run(struct file_browser *browser,
|
||||
|
||||
cols = 4;
|
||||
rows = count / cols;
|
||||
for (i = 0; i <= rows; i += 1) {
|
||||
{size_t n = j + cols;
|
||||
nk_layout_row_dynamic(ctx, 135, (int)cols);
|
||||
for (; j < count && j < n; ++j) {
|
||||
/* draw one row of icons */
|
||||
if (j < browser->dir_count) {
|
||||
/* draw and execute directory buttons */
|
||||
if (nk_button_image(ctx, media->icons.directory))
|
||||
index = (int)j;
|
||||
}
|
||||
else {
|
||||
/* draw and execute files buttons */
|
||||
struct nk_image *icon;
|
||||
size_t fileIndex = ((size_t)j - browser->dir_count);
|
||||
icon = media_icon_for_file(media, browser->files[fileIndex]);
|
||||
if (nk_button_image(ctx, *icon)) {
|
||||
strncpy(browser->file, browser->directory, MAX_PATH_LEN);
|
||||
n = strlen(browser->file);
|
||||
strncpy(browser->file + n, browser->files[fileIndex], MAX_PATH_LEN - n);
|
||||
ret = 1;
|
||||
for (i = 0; i <= rows; i += 1)
|
||||
{
|
||||
{
|
||||
size_t n = j + cols;
|
||||
nk_layout_row_dynamic(ctx, 135, (int)cols);
|
||||
for (; j < count && j < n; ++j)
|
||||
{
|
||||
/* draw one row of icons */
|
||||
if (j < browser->dir_count)
|
||||
{
|
||||
/* draw and execute directory buttons */
|
||||
if (nk_button_image(ctx, media->icons.directory))
|
||||
index = (int)j;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* draw and execute files buttons */
|
||||
struct nk_image *icon;
|
||||
size_t fileIndex = ((size_t)j - browser->dir_count);
|
||||
icon = media_icon_for_file(media, browser->files[fileIndex]);
|
||||
if (nk_button_image(ctx, *icon))
|
||||
{
|
||||
strncpy(browser->file, browser->directory, MAX_PATH_LEN);
|
||||
n = strlen(browser->file);
|
||||
strncpy(browser->file + n, browser->files[fileIndex], MAX_PATH_LEN - n);
|
||||
ret = 1;
|
||||
|
||||
if (hd_homerun->is_homerun_browser_active)
|
||||
{
|
||||
hd_homerun->location_len = strlen(browser->file);
|
||||
strncpy(hd_homerun->location, browser->file, hd_homerun->location_len);
|
||||
isFileAdded = nk_true;
|
||||
hd_homerun->is_homerun_browser_active = nk_false;
|
||||
break;
|
||||
}
|
||||
if (debug->is_debug_browser_active)
|
||||
{
|
||||
debug->elementary_stream_len = strlen(browser->file);
|
||||
strcpy(debug->elementary_stream, browser->file);
|
||||
isFileAdded = nk_true;
|
||||
debug->is_debug_browser_active = nk_false;
|
||||
break;
|
||||
}
|
||||
if (output->is_output_browser_active)
|
||||
{
|
||||
output->filename_len = strlen(browser->file);
|
||||
strcpy(output->filename, browser->file);
|
||||
isFileAdded = nk_true;
|
||||
output->is_output_browser_active = nk_false;
|
||||
break;
|
||||
}
|
||||
if (output->is_cap_browser_active)
|
||||
{
|
||||
output->cap_dictionary_len = strlen(browser->file);
|
||||
strcpy(output->cap_dictionary, browser->file);
|
||||
isFileAdded = nk_true;
|
||||
output->is_cap_browser_active = nk_false;
|
||||
break;
|
||||
}
|
||||
if (main_settings->is_file_browser_active)
|
||||
{
|
||||
if (main_settings->filename_count == 0)
|
||||
main_settings->filenames = (char **)calloc(2, sizeof(char *));
|
||||
else
|
||||
main_settings->filenames = (char **)realloc(main_settings->filenames, (main_settings->filename_count + 2) * sizeof(char *));
|
||||
|
||||
if (hd_homerun->is_homerun_browser_active)
|
||||
{
|
||||
hd_homerun->location_len = strlen(browser->file);
|
||||
strncpy(hd_homerun->location, browser->file, hd_homerun->location_len);
|
||||
isFileAdded = nk_true;
|
||||
hd_homerun->is_homerun_browser_active = nk_false;
|
||||
break;
|
||||
main_settings->filenames[main_settings->filename_count] = (char *)calloc((strlen(browser->file) + 5), sizeof(char));
|
||||
main_settings->filenames[main_settings->filename_count][0] = '\"';
|
||||
strcat(main_settings->filenames[main_settings->filename_count], browser->file);
|
||||
strcat(main_settings->filenames[main_settings->filename_count], "\"");
|
||||
main_settings->filename_count++;
|
||||
main_settings->filenames[main_settings->filename_count] = NULL;
|
||||
isFileAdded = nk_true;
|
||||
main_settings->is_file_browser_active = nk_false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (debug->is_debug_browser_active)
|
||||
{
|
||||
debug->elementary_stream_len = strlen(browser->file);
|
||||
strcpy(debug->elementary_stream, browser->file);
|
||||
isFileAdded = nk_true;
|
||||
debug->is_debug_browser_active = nk_false;
|
||||
break;
|
||||
}
|
||||
if (output->is_output_browser_active)
|
||||
{
|
||||
output->filename_len = strlen(browser->file);
|
||||
strcpy(output->filename, browser->file);
|
||||
isFileAdded = nk_true;
|
||||
output->is_output_browser_active = nk_false;
|
||||
break;
|
||||
}
|
||||
if (output->is_cap_browser_active)
|
||||
{
|
||||
output->cap_dictionary_len = strlen(browser->file);
|
||||
strcpy(output->cap_dictionary, browser->file);
|
||||
isFileAdded = nk_true;
|
||||
output->is_cap_browser_active = nk_false;
|
||||
break;
|
||||
}
|
||||
if (main_settings->is_file_browser_active)
|
||||
{
|
||||
if (main_settings->filename_count == 0)
|
||||
main_settings->filenames = (char**)calloc(2, sizeof(char*));
|
||||
else
|
||||
main_settings->filenames = (char**)realloc(main_settings->filenames, (main_settings->filename_count + 2) * sizeof(char*));
|
||||
|
||||
main_settings->filenames[main_settings->filename_count] = (char*)calloc((strlen(browser->file) + 5), sizeof(char));
|
||||
main_settings->filenames[main_settings->filename_count][0] = '\"';
|
||||
strcat(main_settings->filenames[main_settings->filename_count], browser->file);
|
||||
strcat(main_settings->filenames[main_settings->filename_count], "\"");
|
||||
main_settings->filename_count++;
|
||||
main_settings->filenames[main_settings->filename_count] = NULL;
|
||||
isFileAdded = nk_true;
|
||||
main_settings->is_file_browser_active = nk_false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}}
|
||||
{size_t n = k + cols;
|
||||
nk_layout_row_dynamic(ctx, 20, (int)cols);
|
||||
for (; k < count && k < n; k++) {
|
||||
/* draw one row of labels */
|
||||
if (k < browser->dir_count) {
|
||||
nk_label(ctx, browser->directories[k], NK_TEXT_CENTERED);
|
||||
}
|
||||
{
|
||||
size_t n = k + cols;
|
||||
nk_layout_row_dynamic(ctx, 20, (int)cols);
|
||||
for (; k < count && k < n; k++)
|
||||
{
|
||||
/* draw one row of labels */
|
||||
if (k < browser->dir_count)
|
||||
{
|
||||
nk_label(ctx, browser->directories[k], NK_TEXT_CENTERED);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t t = k - browser->dir_count;
|
||||
nk_label(ctx, browser->files[t], NK_TEXT_CENTERED);
|
||||
}
|
||||
}
|
||||
else {
|
||||
size_t t = k - browser->dir_count;
|
||||
nk_label(ctx, browser->files[t], NK_TEXT_CENTERED);
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
if (index != -1) {
|
||||
if (index != -1)
|
||||
{
|
||||
size_t n = strlen(browser->directory);
|
||||
strncpy(browser->directory + n, browser->directories[index], MAX_PATH_LEN - n);
|
||||
n = strlen(browser->directory);
|
||||
if (n < MAX_PATH_LEN - 1) {
|
||||
if (n < MAX_PATH_LEN - 1)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
browser->directory[n] = '\\';
|
||||
#else
|
||||
@@ -555,10 +579,9 @@ file_browser_run(struct file_browser *browser,
|
||||
file_browser_reload_directory_content(browser, browser->directory);
|
||||
}
|
||||
nk_group_end(ctx);
|
||||
|
||||
|
||||
}
|
||||
if (isFileAdded) {
|
||||
if (isFileAdded)
|
||||
{
|
||||
isFileAdded = nk_false;
|
||||
main_settings->scaleWindowForFileBrowser = nk_false;
|
||||
nk_popup_close(ctx);
|
||||
@@ -567,9 +590,9 @@ file_browser_run(struct file_browser *browser,
|
||||
nk_popup_end(ctx);
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
main_settings->scaleWindowForFileBrowser = nk_false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ void setup_network_settings(struct network_popup *network_settings)
|
||||
|
||||
void draw_network_popup(struct nk_context *ctx, struct network_popup *network_settings)
|
||||
{
|
||||
const float save_ok_ratio[] = { 0.8f,0.1f,0.1f };
|
||||
const float udp_tcp_ratio[] = { 0.45f,0.1f,0.45f };
|
||||
const float save_ok_ratio[] = {0.8f, 0.1f, 0.1f};
|
||||
const float udp_tcp_ratio[] = {0.45f, 0.1f, 0.45f};
|
||||
static char udp_ipv4_buffer[30];
|
||||
static int udp_ipv4_len[30];
|
||||
static char tcp_pass_buf[30];
|
||||
@@ -36,12 +36,12 @@ void draw_network_popup(struct nk_context *ctx, struct network_popup *network_se
|
||||
static int send_port_len[30];
|
||||
static char send_host_buf[30];
|
||||
static int send_host_len[30];
|
||||
const char network_attr[][30] = { "-udp port:", "-udp [host:]port:","-sendto host[:port]:","-tcp port:","-tcppassword password:", "-tcpdesc description:" };
|
||||
static struct nk_rect s = { 20,30,480,500 };
|
||||
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "Network Settings", NK_WINDOW_CLOSABLE|NK_WINDOW_NO_SCROLLBAR, s))
|
||||
const char network_attr[][30] = {"-udp port:", "-udp [host:]port:", "-sendto host[:port]:", "-tcp port:", "-tcppassword password:", "-tcpdesc description:"};
|
||||
static struct nk_rect s = {20, 30, 480, 500};
|
||||
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "Network Settings", NK_WINDOW_CLOSABLE | NK_WINDOW_NO_SCROLLBAR, s))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 220, 1);
|
||||
if(nk_group_begin(ctx, "Receive", NK_WINDOW_TITLE ))
|
||||
if (nk_group_begin(ctx, "Receive", NK_WINDOW_TITLE))
|
||||
{
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 21, 3, udp_tcp_ratio);
|
||||
nk_spacing(ctx, 1);
|
||||
@@ -64,7 +64,7 @@ void draw_network_popup(struct nk_context *ctx, struct network_popup *network_se
|
||||
}
|
||||
|
||||
nk_layout_row_dynamic(ctx, 200, 1);
|
||||
if (nk_group_begin(ctx, "Send", NK_WINDOW_TITLE ))
|
||||
if (nk_group_begin(ctx, "Send", NK_WINDOW_TITLE))
|
||||
{
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 21, 3, udp_tcp_ratio);
|
||||
nk_spacing(ctx, 1);
|
||||
@@ -82,16 +82,18 @@ void draw_network_popup(struct nk_context *ctx, struct network_popup *network_se
|
||||
/*nk_layout_row_static(ctx, 20, 200, 2);
|
||||
nk_label(ctx, network_attr[5], NK_TEXT_LEFT);
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, text_buffer[5], &text_len[5], 50, nk_filter_default);*/
|
||||
|
||||
|
||||
//OK Button
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 27, 3, save_ok_ratio);
|
||||
nk_spacing(ctx, 1);
|
||||
if (nk_button_label(ctx, "Save")) {
|
||||
if (nk_button_label(ctx, "Save"))
|
||||
{
|
||||
network_settings->save_network_settings = nk_true;
|
||||
network_settings->show_network_settings = nk_false;
|
||||
nk_popup_close(ctx);
|
||||
}
|
||||
if (nk_button_label(ctx, "OK")) {
|
||||
if (nk_button_label(ctx, "OK"))
|
||||
{
|
||||
network_settings->save_network_settings = nk_false;
|
||||
network_settings->show_network_settings = nk_false;
|
||||
nk_popup_close(ctx);
|
||||
@@ -105,7 +107,7 @@ void draw_network_popup(struct nk_context *ctx, struct network_popup *network_se
|
||||
|
||||
void draw_getting_started_popup(struct nk_context *ctx, int *show_getting_started)
|
||||
{
|
||||
static struct nk_rect s = { 20,30,480,500 };
|
||||
static struct nk_rect s = {20, 30, 480, 500};
|
||||
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "Getting Started", NK_WINDOW_CLOSABLE, s))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 80, 1);
|
||||
@@ -118,15 +120,15 @@ void draw_getting_started_popup(struct nk_context *ctx, int *show_getting_starte
|
||||
|
||||
void draw_about_ccx_popup(struct nk_context *ctx, int *show_about_ccx, struct nk_user_font *droid_big, struct nk_user_font *droid_head)
|
||||
{
|
||||
const float ccx_ratio[] = { 0.3f,0.4f,0.3f };
|
||||
const float ok_ratio[] = { 0.9f,0.1f };
|
||||
static struct nk_rect s = { 20,30,480,500};
|
||||
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "About CCExtractor", NK_WINDOW_CLOSABLE|NK_WINDOW_NO_SCROLLBAR, s))
|
||||
const float ccx_ratio[] = {0.3f, 0.4f, 0.3f};
|
||||
const float ok_ratio[] = {0.9f, 0.1f};
|
||||
static struct nk_rect s = {20, 30, 480, 500};
|
||||
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "About CCExtractor", NK_WINDOW_CLOSABLE | NK_WINDOW_NO_SCROLLBAR, s))
|
||||
{
|
||||
nk_style_push_font(ctx, droid_big);
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 30, 3, ccx_ratio);
|
||||
nk_spacing(ctx, 1);
|
||||
nk_label_wrap(ctx, "About CCExtractor"/*, NK_TEXT_LEFT*/);
|
||||
nk_label_wrap(ctx, "About CCExtractor" /*, NK_TEXT_LEFT*/);
|
||||
nk_style_pop_font(ctx);
|
||||
|
||||
nk_layout_row_dynamic(ctx, 390, 1);
|
||||
@@ -204,7 +206,7 @@ void draw_about_ccx_popup(struct nk_context *ctx, int *show_about_ccx, struct nk
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
nk_label_wrap(ctx, "- Dish Network files");
|
||||
nk_layout_row_dynamic(ctx, 80, 1);
|
||||
nk_label_wrap(ctx, "Usually, if you record a TV show with your capture card and CCExtractor produces the expected result, it will work for your all recordings.If it doesn't, which means that your card uses a format CCExtractor can't handle, please contact me and we'll try to make it work.");
|
||||
nk_label_wrap(ctx, "Usually, if you record a TV show with your capture card and CCExtractor produces the expected result, it will work for your all recordings.If it doesn't, which means that your card uses a format CCExtractor can't handle, please contact me and we'll try to make it work.");
|
||||
|
||||
nk_style_push_font(ctx, droid_head);
|
||||
nk_layout_row_dynamic(ctx, 23, 1);
|
||||
@@ -230,13 +232,13 @@ void draw_about_ccx_popup(struct nk_context *ctx, int *show_about_ccx, struct nk
|
||||
nk_layout_row_dynamic(ctx, 23, 1);
|
||||
nk_label_wrap(ctx, "Send me an email: carlos@ccextractor.org");
|
||||
|
||||
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 27, 2, ok_ratio);
|
||||
nk_spacing(ctx,1);
|
||||
if (nk_button_label(ctx, "OK")) {
|
||||
nk_spacing(ctx, 1);
|
||||
if (nk_button_label(ctx, "OK"))
|
||||
{
|
||||
*show_about_ccx = nk_false;
|
||||
nk_popup_close(ctx);
|
||||
}
|
||||
@@ -248,11 +250,11 @@ void draw_about_ccx_popup(struct nk_context *ctx, int *show_about_ccx, struct nk
|
||||
|
||||
void draw_progress_details_popup(struct nk_context *ctx, int *show_progress_details, struct main_tab *main_settings)
|
||||
{
|
||||
static struct nk_rect s = { 20,30,480,500 };
|
||||
static struct nk_rect s = {20, 30, 480, 500};
|
||||
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "Progress Details of Extraction", NK_WINDOW_CLOSABLE, s))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
for( int i = 0; i < main_settings->activity_string_count; i++)
|
||||
for (int i = 0; i < main_settings->activity_string_count; i++)
|
||||
nk_label_wrap(ctx, main_settings->activity_string[i]);
|
||||
nk_popup_end(ctx);
|
||||
}
|
||||
@@ -262,15 +264,16 @@ void draw_progress_details_popup(struct nk_context *ctx, int *show_progress_deta
|
||||
|
||||
void draw_color_popup(struct nk_context *ctx, struct output_tab *output)
|
||||
{
|
||||
static struct nk_rect s = { 250,250,200,230 };
|
||||
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "Color Picker", NK_WINDOW_TITLE |NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER, s))
|
||||
static struct nk_rect s = {250, 250, 200, 230};
|
||||
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "Color Picker", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER, s))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 160, 1);
|
||||
output->color_rgb = nk_color_picker(ctx, output->color_rgb, NK_RGBA);
|
||||
|
||||
|
||||
nk_layout_row_dynamic(ctx, 25, 3);
|
||||
nk_spacing(ctx, 1);
|
||||
if (nk_button_label(ctx, "OK")) {
|
||||
if (nk_button_label(ctx, "OK"))
|
||||
{
|
||||
show_color_from_picker = nk_true;
|
||||
output->color_popup = nk_false;
|
||||
nk_popup_close(ctx);
|
||||
@@ -283,23 +286,21 @@ void draw_color_popup(struct nk_context *ctx, struct output_tab *output)
|
||||
output->color_popup = nk_false;
|
||||
}
|
||||
|
||||
|
||||
void draw_thread_popup(struct nk_context *ctx, int *show_thread_popup)
|
||||
{
|
||||
static struct nk_rect s = { 100, 100, 300, 175 };
|
||||
static const float ratio[] = { 0.85f, 0.15f };
|
||||
static struct nk_rect s = {100, 100, 300, 175};
|
||||
static const float ratio[] = {0.85f, 0.15f};
|
||||
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "File Read Error",
|
||||
NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER, s))
|
||||
NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER, s))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
nk_label(ctx, "Cannot read file.", NK_TEXT_CENTERED);
|
||||
nk_layout_row_dynamic(ctx, 60, 1);
|
||||
nk_label_wrap(ctx, "Make sure the directory isn't write protected OR you are running the program with write permissions.");
|
||||
|
||||
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 2, ratio);
|
||||
nk_spacing(ctx, 1);
|
||||
if(nk_button_label(ctx, "OK"))
|
||||
if (nk_button_label(ctx, "OK"))
|
||||
{
|
||||
*show_thread_popup = nk_false;
|
||||
nk_popup_close(ctx);
|
||||
|
||||
@@ -8,13 +8,11 @@
|
||||
int preview(struct nk_context *ctx, int x, int y, int width, int height, struct main_tab *main_settings)
|
||||
{
|
||||
static int i;
|
||||
if (nk_begin(ctx, "Preview", nk_rect(x, y, width, height), NK_WINDOW_TITLE|NK_WINDOW_BACKGROUND))
|
||||
if (nk_begin(ctx, "Preview", nk_rect(x, y, width, height), NK_WINDOW_TITLE | NK_WINDOW_BACKGROUND))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
for( i = 0; i < main_settings->preview_string_count; i++)
|
||||
for (i = 0; i < main_settings->preview_string_count; i++)
|
||||
nk_label_wrap(ctx, main_settings->preview_string[i]);
|
||||
|
||||
|
||||
}
|
||||
nk_end(ctx);
|
||||
return !nk_window_is_closed(ctx, "Preview");
|
||||
|
||||
@@ -4,24 +4,24 @@
|
||||
#include "popups.h"
|
||||
|
||||
void load_data(FILE *file,
|
||||
struct main_tab* main_settings,
|
||||
struct input_tab* input,
|
||||
struct advanced_input_tab* advanced_input,
|
||||
struct output_tab* output,
|
||||
struct decoders_tab* decoders,
|
||||
struct credits_tab* credits,
|
||||
struct debug_tab* debug,
|
||||
struct hd_homerun_tab* hd_homerun,
|
||||
struct burned_subs_tab* burned_subs,
|
||||
struct network_popup* network_settings)
|
||||
struct main_tab *main_settings,
|
||||
struct input_tab *input,
|
||||
struct advanced_input_tab *advanced_input,
|
||||
struct output_tab *output,
|
||||
struct decoders_tab *decoders,
|
||||
struct credits_tab *credits,
|
||||
struct debug_tab *debug,
|
||||
struct hd_homerun_tab *hd_homerun,
|
||||
struct burned_subs_tab *burned_subs,
|
||||
struct network_popup *network_settings)
|
||||
{
|
||||
int null_int,r ,g, b;
|
||||
int null_int, r, g, b;
|
||||
char null_char[260];
|
||||
|
||||
//Read main_tab data
|
||||
fscanf(file, "port_or_files:%d\n", &main_settings->port_or_files);
|
||||
fscanf(file, "port_num_len:%d\n", &main_settings->port_num_len);
|
||||
if( main_settings->port_num_len > 0)
|
||||
if (main_settings->port_num_len > 0)
|
||||
fscanf(file, "port_num:%[^\n]\n", main_settings->port_num);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
@@ -34,7 +34,7 @@ void load_data(FILE *file,
|
||||
fscanf(file, "is_split:%d\n", &input->is_split);
|
||||
fscanf(file, "is_live_stream:%d\n", &input->is_live_stream);
|
||||
fscanf(file, "wait_data_sec_len:%d\n", &input->wait_data_sec_len);
|
||||
if(input->wait_data_sec_len > 0)
|
||||
if (input->wait_data_sec_len > 0)
|
||||
fscanf(file, "wait_data_sec:%[^\n]\n", input->wait_data_sec);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
@@ -48,17 +48,17 @@ void load_data(FILE *file,
|
||||
fscanf(file, "elementary_stream:%d\n", &input->elementary_stream);
|
||||
fscanf(file, "is_assume_mpeg:%d\n", &input->is_assume_mpeg);
|
||||
fscanf(file, "stream_type_len:%d\n", &input->stream_type_len);
|
||||
if( input->stream_type_len > 0)
|
||||
if (input->stream_type_len > 0)
|
||||
fscanf(file, "stream_type:%[^\n]\n", input->stream_type);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
fscanf(file, "stream_pid_len:%d\n", &input->stream_pid_len);
|
||||
if(input->stream_pid_len > 0)
|
||||
if (input->stream_pid_len > 0)
|
||||
fscanf(file, "stream_pid:%[^\n]\n", input->stream_pid);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
fscanf(file, "mpeg_type_len:%d\n", &input->mpeg_type_len);
|
||||
if(input->mpeg_type_len > 0)
|
||||
if (input->mpeg_type_len > 0)
|
||||
fscanf(file, "mpeg_type:%[^\n]\n", input->mpeg_type);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
@@ -66,7 +66,7 @@ void load_data(FILE *file,
|
||||
fscanf(file, "teletext_decoder:%d\n", &input->teletext_decoder);
|
||||
fscanf(file, "is_process_teletext_page:%d\n", &input->is_process_teletext_page);
|
||||
fscanf(file, "teletext_page_number_len:%d\n", &input->teletext_page_numer_len);
|
||||
if(input->teletext_page_numer_len)
|
||||
if (input->teletext_page_numer_len)
|
||||
fscanf(file, "teletext_page_number:%[^\n]\n", input->teletext_page_number);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
@@ -79,7 +79,7 @@ void load_data(FILE *file,
|
||||
fscanf(file, "is_multiple_program:%d\n", &advanced_input->is_multiple_program);
|
||||
fscanf(file, "multiple_program:%d\n", &advanced_input->multiple_program);
|
||||
fscanf(file, "prog_number_len:%d\n", &advanced_input->prog_number_len);
|
||||
if(advanced_input->prog_number_len)
|
||||
if (advanced_input->prog_number_len)
|
||||
fscanf(file, "prog_number:%[^\n]\n", advanced_input->prog_number);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
@@ -97,7 +97,7 @@ void load_data(FILE *file,
|
||||
fscanf(file, "type_select:%d\n", &output->type_select);
|
||||
fscanf(file, "is_filename:%d\n", &output->is_filename);
|
||||
fscanf(file, "filename_len:%d\n", &output->filename_len);
|
||||
if(output->filename_len > 0)
|
||||
if (output->filename_len > 0)
|
||||
fscanf(file, "filename:%[^\n]\n", output->filename);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
@@ -137,24 +137,23 @@ void load_data(FILE *file,
|
||||
fscanf(file, "channel:%d\n", &decoders->channel);
|
||||
fscanf(file, "is_708:%d\n", &decoders->is_708);
|
||||
fscanf(file, "services_len:%d\n", &decoders->services_len);
|
||||
if(decoders->services_len > 0)
|
||||
if (decoders->services_len > 0)
|
||||
fscanf(file, "services:%[^\n]\n", decoders->services);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
|
||||
fscanf(file, "teletext_dvb:%d\n", &decoders->teletext_dvb);
|
||||
fscanf(file, "min_distance_len:%d\n", &decoders->min_distance_len);
|
||||
if(decoders->min_distance_len > 0)
|
||||
if (decoders->min_distance_len > 0)
|
||||
fscanf(file, "min_distance:%[^\n]\n", decoders->min_distance);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
fscanf(file, "max_distance_len:%d\n", &decoders->max_distance_len);
|
||||
if(decoders->max_distance_len > 0)
|
||||
if (decoders->max_distance_len > 0)
|
||||
fscanf(file, "max_distance:%[^\n]\n", decoders->max_distance);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
|
||||
|
||||
//Read credits tab data
|
||||
fscanf(file, "is_start_text:%d\n", &credits->is_start_text);
|
||||
|
||||
@@ -163,25 +162,25 @@ void load_data(FILE *file,
|
||||
fscanf(file, "before_time_buffer:%[^\n]\n", credits->before_time_buffer);
|
||||
fscanf(file, "after_time_buffer:%[^\n]\n", credits->after_time_buffer);
|
||||
fscanf(file, "start_atmost_sec_len:%d\n", &credits->start_atmost_sec_len);
|
||||
if(credits->start_atmost_sec_len > 0)
|
||||
if (credits->start_atmost_sec_len > 0)
|
||||
fscanf(file, "start_atmost_sec:%[^\n]\n", credits->start_atmost_sec);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
fscanf(file, "start_atleast_sec_len:%d\n", &credits->start_atleast_sec_len);
|
||||
if(credits->start_atleast_sec_len > 0)
|
||||
if (credits->start_atleast_sec_len > 0)
|
||||
fscanf(file, "start_atleast_sec:%[^\n]\n", credits->start_atleast_sec);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n",null_char);
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
|
||||
fscanf(file, "is_end_text:%d\n", &credits->is_end_text);
|
||||
fscanf(file, "end_atmost_sec_len:%d\n", &credits->end_atmost_sec_len);
|
||||
if(credits->end_atmost_sec_len > 0)
|
||||
if (credits->end_atmost_sec_len > 0)
|
||||
fscanf(file, "end_atmost_sec:%[^\n]\n", credits->end_atmost_sec);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
|
||||
fscanf(file, "end_atleast_sec_len:%d\n", &credits->end_atleast_sec_len);
|
||||
if(credits->end_atleast_sec_len > 0)
|
||||
if (credits->end_atleast_sec_len > 0)
|
||||
fscanf(file, "end_atleast_sec:%[^\n]\n", credits->end_atleast_sec);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
@@ -190,11 +189,10 @@ void load_data(FILE *file,
|
||||
fscanf(file, "end_text_len:%d\n", &credits->end_text_len);
|
||||
read_credits(file, credits);
|
||||
|
||||
|
||||
//Read debug tab data
|
||||
fscanf(file, "is_elementary_stream:%d\n", &debug->is_elementary_stream);
|
||||
fscanf(file, "elementary_stream_len:%d\n", &debug->elementary_stream_len);
|
||||
if(debug->elementary_stream_len > 0)
|
||||
if (debug->elementary_stream_len > 0)
|
||||
fscanf(file, "elementary_stream:%[^\n]\n", debug->elementary_stream);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
@@ -216,51 +214,49 @@ void load_data(FILE *file,
|
||||
|
||||
//Read HD Homerun Tab data
|
||||
fscanf(file, "location_len:%d\n", &hd_homerun->location_len);
|
||||
if(hd_homerun->location_len > 0)
|
||||
if (hd_homerun->location_len > 0)
|
||||
fscanf(file, "location:%[^\n]\n", hd_homerun->location);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
fscanf(file, "tuner_len:%d\n", &hd_homerun->tuner_len);
|
||||
if(hd_homerun->tuner_len >0)
|
||||
if (hd_homerun->tuner_len > 0)
|
||||
fscanf(file, "tuner:%[^\n]\n", hd_homerun->tuner);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
fscanf(file, "channel_len:%d\n", &hd_homerun->channel_len);
|
||||
if(hd_homerun->channel_len > 0)
|
||||
if (hd_homerun->channel_len > 0)
|
||||
fscanf(file, "channel:%[^\n]\n", hd_homerun->channel);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
fscanf(file, "program_len:%d\n", &hd_homerun->program_len);
|
||||
if(hd_homerun->program_len > 0)
|
||||
if (hd_homerun->program_len > 0)
|
||||
fscanf(file, "program:%[^\n]\n", hd_homerun->program);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
fscanf(file, "ipv4_address_len:%d\n", &hd_homerun->ipv4_address_len);
|
||||
if(hd_homerun->ipv4_address_len > 0)
|
||||
if (hd_homerun->ipv4_address_len > 0)
|
||||
fscanf(file, "ipv4_address:%[^\n]\n", hd_homerun->ipv4_address);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
fscanf(file, "port_number_len:%d\n", &hd_homerun->port_number_len);
|
||||
if(hd_homerun->port_number_len > 0)
|
||||
if (hd_homerun->port_number_len > 0)
|
||||
fscanf(file, "port_number:%[^\n]\n", hd_homerun->port_number);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
|
||||
|
||||
|
||||
//Read Burned Subs tab data
|
||||
fscanf(file, "is_burnded_subs:%d\n", &burned_subs->is_burned_subs);
|
||||
fscanf(file, "color_type:%d\n", &burned_subs->color_type);
|
||||
fscanf(file, "sub_color_select:%d\n", &burned_subs->subs_color_select);
|
||||
fscanf(file, "custom_hue_len:%d\n", &burned_subs->custom_hue_len);
|
||||
if(burned_subs->custom_hue_len > 0)
|
||||
if (burned_subs->custom_hue_len > 0)
|
||||
fscanf(file, "custom_hue:%[^\n]\n", burned_subs->custom_hue);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
|
||||
fscanf(file, "ocr_mode:%d\n", &burned_subs->ocr_mode);
|
||||
fscanf(file, "min_duration_len:%d\n", &burned_subs->min_duration_len);
|
||||
if(burned_subs->min_duration_len > 0)
|
||||
if (burned_subs->min_duration_len > 0)
|
||||
fscanf(file, "min_duration:%[^\n]\n", burned_subs->min_duration);
|
||||
else
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
@@ -291,22 +287,22 @@ void load_data(FILE *file,
|
||||
else
|
||||
fscanf(file, "send_port:%[^\n]\n", null_char);
|
||||
fscanf(file, "send_host_len:%d\n", &network_settings->send_host_len);
|
||||
if(network_settings->send_host_len > 0)
|
||||
if (network_settings->send_host_len > 0)
|
||||
fscanf(file, "send_host:%[^\n]\n", network_settings->send_host);
|
||||
fscanf(file, "send_host:%[^\n]\n", null_char);
|
||||
}
|
||||
|
||||
void save_data(FILE *file,
|
||||
struct main_tab* main_settings,
|
||||
struct input_tab* input,
|
||||
struct advanced_input_tab* advanced_input,
|
||||
struct output_tab* output,
|
||||
struct decoders_tab* decoders,
|
||||
struct credits_tab* credits,
|
||||
struct debug_tab* debug,
|
||||
struct hd_homerun_tab* hd_homerun,
|
||||
struct burned_subs_tab* burned_subs,
|
||||
struct network_popup* network_settings)
|
||||
struct main_tab *main_settings,
|
||||
struct input_tab *input,
|
||||
struct advanced_input_tab *advanced_input,
|
||||
struct output_tab *output,
|
||||
struct decoders_tab *decoders,
|
||||
struct credits_tab *credits,
|
||||
struct debug_tab *debug,
|
||||
struct hd_homerun_tab *hd_homerun,
|
||||
struct burned_subs_tab *burned_subs,
|
||||
struct network_popup *network_settings)
|
||||
{
|
||||
//Write main_tab data
|
||||
fprintf(file, "port_or_files:%d\n", main_settings->port_or_files);
|
||||
@@ -401,7 +397,6 @@ void save_data(FILE *file,
|
||||
fprintf(file, "max_distance_len:%d\n", decoders->max_distance_len);
|
||||
fprintf(file, "max_distance:%s\n", decoders->max_distance);
|
||||
|
||||
|
||||
//Write credits tab data
|
||||
fprintf(file, "is_start_text:%d\n", credits->is_start_text);
|
||||
|
||||
@@ -423,7 +418,6 @@ void save_data(FILE *file,
|
||||
fprintf(file, "end_text_len:%d\n", credits->end_text_len);
|
||||
write_credits(file, credits);
|
||||
|
||||
|
||||
//Write debug tab data
|
||||
fprintf(file, "is_elementary_stream:%d\n", debug->is_elementary_stream);
|
||||
fprintf(file, "elementary_stream_len:%d\n", debug->elementary_stream_len);
|
||||
@@ -458,8 +452,6 @@ void save_data(FILE *file,
|
||||
fprintf(file, "port_number_len:%d\n", hd_homerun->port_number_len);
|
||||
fprintf(file, "port_number:%s\n", hd_homerun->port_number);
|
||||
|
||||
|
||||
|
||||
//Write Burned Subs tab data
|
||||
fprintf(file, "is_burnded_subs:%d\n", burned_subs->is_burned_subs);
|
||||
fprintf(file, "color_type:%d\n", burned_subs->color_type);
|
||||
@@ -488,56 +480,55 @@ void save_data(FILE *file,
|
||||
fprintf(file, "send_port:%s\n", network_settings->send_port);
|
||||
fprintf(file, "send_host_len:%d\n", network_settings->send_host_len);
|
||||
fprintf(file, "send_host:%s\n", network_settings->send_host);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void write_credits(FILE* file, struct credits_tab* credits)
|
||||
void write_credits(FILE *file, struct credits_tab *credits)
|
||||
{
|
||||
//Number of newlines in end_text
|
||||
static int newlines_end;
|
||||
//Number of newlines in start_text
|
||||
static int newlines_start;
|
||||
int newline_char = 10; // '\n' is 10 in ascii encoding
|
||||
for(int i = 0; i < credits->start_text_len; i++)
|
||||
for (int i = 0; i < credits->start_text_len; i++)
|
||||
{
|
||||
if(credits->start_text[i] == newline_char)
|
||||
if (credits->start_text[i] == newline_char)
|
||||
newlines_start++;
|
||||
}
|
||||
|
||||
for(int i = 0; i < credits->end_text_len; i++)
|
||||
for (int i = 0; i < credits->end_text_len; i++)
|
||||
{
|
||||
if(credits->end_text[i] == newline_char)
|
||||
if (credits->end_text[i] == newline_char)
|
||||
newlines_end++;
|
||||
}
|
||||
|
||||
fprintf(file, "start_text:%d\n", newlines_start);
|
||||
if(credits->start_text_len > 0)
|
||||
if (credits->start_text_len > 0)
|
||||
fprintf(file, "%s\n", credits->start_text);
|
||||
fprintf(file, "end_text:%d\n", newlines_end);
|
||||
if(credits->end_text_len > 0)
|
||||
if (credits->end_text_len > 0)
|
||||
fprintf(file, "%s\n", credits->end_text);
|
||||
}
|
||||
|
||||
void read_credits(FILE* file, struct credits_tab* credits)
|
||||
void read_credits(FILE *file, struct credits_tab *credits)
|
||||
{
|
||||
//Number of newlines in end_text
|
||||
static int newlines_end;
|
||||
//Number of newlines in start_text
|
||||
static int newlines_start;
|
||||
static char buffer[1000], null_char[260];
|
||||
if(credits->start_text_len == 0)
|
||||
if (credits->start_text_len == 0)
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
else
|
||||
{
|
||||
fscanf(file, "start_text:%d\n", &newlines_start);
|
||||
for(int i = 0; i != newlines_start + 1; i++)
|
||||
for (int i = 0; i != newlines_start + 1; i++)
|
||||
{
|
||||
static char line[200];
|
||||
fscanf(file, "%[^\n]\n", line);
|
||||
if(!(i == newlines_start))
|
||||
if (!(i == newlines_start))
|
||||
strcat(line, "\n");
|
||||
if(strlen(buffer) > 0)
|
||||
if (strlen(buffer) > 0)
|
||||
strcat(buffer, line);
|
||||
else
|
||||
strcpy(buffer, line);
|
||||
@@ -548,18 +539,18 @@ void read_credits(FILE* file, struct credits_tab* credits)
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
}
|
||||
|
||||
if(credits->end_text_len == 0)
|
||||
if (credits->end_text_len == 0)
|
||||
fscanf(file, "%[^\n]\n", null_char);
|
||||
else
|
||||
{
|
||||
fscanf(file, "end_text:%d\n", &newlines_end);
|
||||
for(int i = 0; i != newlines_end + 1; i++)
|
||||
for (int i = 0; i != newlines_end + 1; i++)
|
||||
{
|
||||
static char line[200];
|
||||
fscanf(file, "%[^\n]\n", line);
|
||||
if(!(i == newlines_end))
|
||||
if (!(i == newlines_end))
|
||||
strcat(line, "\n");
|
||||
if(strlen(buffer) > 0)
|
||||
if (strlen(buffer) > 0)
|
||||
strcat(buffer, line);
|
||||
else
|
||||
strcpy(buffer, line);
|
||||
@@ -567,6 +558,4 @@ void read_credits(FILE* file, struct credits_tab* credits)
|
||||
memset(credits->end_text, 0, sizeof(credits->end_text));
|
||||
strcpy(credits->end_text, buffer);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
343
src/GUI/tabs.c
343
src/GUI/tabs.c
@@ -36,7 +36,7 @@ void setup_output_tab(struct output_tab *output)
|
||||
//Encoding
|
||||
output->encoding = UTF;
|
||||
output->is_bom = nk_false;
|
||||
|
||||
|
||||
//Capitalization
|
||||
output->is_cap_standard = nk_false;
|
||||
output->is_cap_file = nk_false;
|
||||
@@ -55,7 +55,7 @@ void setup_output_tab(struct output_tab *output)
|
||||
//Roll-up Captions
|
||||
output->onetime_or_realtime = ONETIME;
|
||||
output->roll_limit_select = 0;
|
||||
output->roll_limit = (char**)malloc(4 * sizeof(char *));
|
||||
output->roll_limit = (char **)malloc(4 * sizeof(char *));
|
||||
output->roll_limit[0] = "No Limit";
|
||||
output->roll_limit[1] = "1 Line";
|
||||
output->roll_limit[2] = "2 Lines";
|
||||
@@ -176,14 +176,13 @@ void setup_credits_tab(struct credits_tab *credits)
|
||||
credits->end_atleast_sec_len = strlen(credits->end_atleast_sec);
|
||||
strcpy(credits->end_atmost_sec, "3");
|
||||
credits->end_atmost_sec_len = strlen(credits->end_atmost_sec);
|
||||
|
||||
}
|
||||
|
||||
void setup_hd_homerun_tab(struct hd_homerun_tab *hd_homerun)
|
||||
{
|
||||
hd_homerun->is_homerun_browser_active = nk_false;
|
||||
hd_homerun->location_len = 0;
|
||||
hd_homerun->devices = (char**)malloc(3 * sizeof(char *));
|
||||
hd_homerun->devices = (char **)malloc(3 * sizeof(char *));
|
||||
hd_homerun->device_num = 0;
|
||||
strcpy(hd_homerun->tuner, "0");
|
||||
hd_homerun->tuner_len = strlen(hd_homerun->tuner);
|
||||
@@ -194,7 +193,7 @@ void setup_hd_homerun_tab(struct hd_homerun_tab *hd_homerun)
|
||||
void setup_burned_subs_tab(struct burned_subs_tab *burned_subs)
|
||||
{
|
||||
burned_subs->is_burned_subs = nk_false;
|
||||
burned_subs->subs_color = (char**)malloc(7 * sizeof(char *));
|
||||
burned_subs->subs_color = (char **)malloc(7 * sizeof(char *));
|
||||
burned_subs->subs_color[0] = "white";
|
||||
burned_subs->subs_color[1] = "yellow";
|
||||
burned_subs->subs_color[2] = "green";
|
||||
@@ -211,21 +210,20 @@ void setup_burned_subs_tab(struct burned_subs_tab *burned_subs)
|
||||
burned_subs->is_italic = nk_false;
|
||||
}
|
||||
|
||||
|
||||
/*Tab specific functions*/
|
||||
void draw_input_tab(struct nk_context *ctx, int *tab_screen_height, struct input_tab *input,
|
||||
struct decoders_tab *decoders)
|
||||
struct decoders_tab *decoders)
|
||||
{
|
||||
const float screenful_limit_ratio[] = { 0.47f, 0.3f };
|
||||
const float screenful_limit_ratio[] = {0.47f, 0.3f};
|
||||
static struct time from_time, until_time;
|
||||
const float stream_type_pid_ratio[] = { 0.7f,0.3f };
|
||||
const float mpeg_type_ratio[] = { 0.7f,0.3f };
|
||||
const float teletext_page_ratio[] = { 0.75f,0.25f };
|
||||
const float stream_teletext_ratio[] = { 0.5f, 0.501f };
|
||||
const float wait_data_ratio[] = { 0.6f, 0.25f, 0.15f };
|
||||
const float gen_type_ratio[] = { 0.3f, 0.7f };
|
||||
const float gen_time_ratio[] = { 0.6f ,0.401f};
|
||||
const char *split_type[] = { "Individual Files", "Parts of same video. Cut by generic tool", "Parts of same video. Cut by video tool" };
|
||||
const float stream_type_pid_ratio[] = {0.7f, 0.3f};
|
||||
const float mpeg_type_ratio[] = {0.7f, 0.3f};
|
||||
const float teletext_page_ratio[] = {0.75f, 0.25f};
|
||||
const float stream_teletext_ratio[] = {0.5f, 0.501f};
|
||||
const float wait_data_ratio[] = {0.6f, 0.25f, 0.15f};
|
||||
const float gen_type_ratio[] = {0.3f, 0.7f};
|
||||
const float gen_time_ratio[] = {0.6f, 0.401f};
|
||||
const char *split_type[] = {"Individual Files", "Parts of same video. Cut by generic tool", "Parts of same video. Cut by video tool"};
|
||||
static int split_num;
|
||||
*tab_screen_height = 472;
|
||||
|
||||
@@ -262,7 +260,8 @@ void draw_input_tab(struct nk_context *ctx, int *tab_screen_height, struct input
|
||||
nk_checkbox_label(ctx, "Process From: (HH:MM:SS)", &input->is_process_from);
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
|
||||
if (nk_combo_begin_label(ctx, input->from_time_buffer, nk_vec2(180, 250))) {
|
||||
if (nk_combo_begin_label(ctx, input->from_time_buffer, nk_vec2(180, 250)))
|
||||
{
|
||||
sprintf(input->from_time_buffer, "%02d:%02d:%02d", from_time.hours, from_time.minutes, from_time.seconds);
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
from_time.seconds = nk_propertyi(ctx, "#Seconds:", 0, from_time.seconds, 60, 1, 1);
|
||||
@@ -271,13 +270,13 @@ void draw_input_tab(struct nk_context *ctx, int *tab_screen_height, struct input
|
||||
nk_combo_end(ctx);
|
||||
}
|
||||
|
||||
|
||||
//Process Until
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
nk_checkbox_label(ctx, "Process Until: (HH:MM:SS)", &input->is_process_until);
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
|
||||
if (nk_combo_begin_label(ctx, input->until_time_buffer, nk_vec2(180, 250))) {
|
||||
if (nk_combo_begin_label(ctx, input->until_time_buffer, nk_vec2(180, 250)))
|
||||
{
|
||||
sprintf(input->until_time_buffer, "%02d:%02d:%02d", until_time.hours, until_time.minutes, until_time.seconds);
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
until_time.seconds = nk_propertyi(ctx, "#Seconds:", 0, until_time.seconds, 60, 1, 1);
|
||||
@@ -294,17 +293,20 @@ void draw_input_tab(struct nk_context *ctx, int *tab_screen_height, struct input
|
||||
if (nk_group_begin(ctx, "Elementary Stream", NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_TITLE | NK_WINDOW_BORDER))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if (nk_option_label(ctx, "Auto", input->elementary_stream == AUTO_DETECT)) {
|
||||
if (nk_option_label(ctx, "Auto", input->elementary_stream == AUTO_DETECT))
|
||||
{
|
||||
input->elementary_stream = AUTO_DETECT;
|
||||
}
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 2, stream_type_pid_ratio);
|
||||
if (nk_option_label(ctx, "Process stream of type:", input->elementary_stream == STREAM_TYPE)) {
|
||||
if (nk_option_label(ctx, "Process stream of type:", input->elementary_stream == STREAM_TYPE))
|
||||
{
|
||||
input->elementary_stream = STREAM_TYPE;
|
||||
}
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, input->stream_type, &input->stream_type_len, 9, nk_filter_decimal);
|
||||
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 2, stream_type_pid_ratio);
|
||||
if (nk_option_label(ctx, "Process stream with PID:", input->elementary_stream == STREAM_PID)) {
|
||||
if (nk_option_label(ctx, "Process stream with PID:", input->elementary_stream == STREAM_PID))
|
||||
{
|
||||
input->elementary_stream = STREAM_PID;
|
||||
}
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, input->stream_pid, &input->stream_pid_len, 9, nk_filter_decimal);
|
||||
@@ -313,7 +315,7 @@ void draw_input_tab(struct nk_context *ctx, int *tab_screen_height, struct input
|
||||
nk_checkbox_label(ctx, "Assume MPEG type is:", &input->is_assume_mpeg);
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, input->mpeg_type, &input->mpeg_type_len, 9, nk_filter_decimal);
|
||||
|
||||
if(input->teletext_decoder == FORCE)
|
||||
if (input->teletext_decoder == FORCE)
|
||||
{
|
||||
input->elementary_stream = STREAM_PID;
|
||||
}
|
||||
@@ -323,22 +325,26 @@ void draw_input_tab(struct nk_context *ctx, int *tab_screen_height, struct input
|
||||
//Teletext Group
|
||||
if (nk_group_begin(ctx, "Teletext", NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_TITLE | NK_WINDOW_BORDER))
|
||||
{
|
||||
if(decoders->teletext_dvb == DVB){
|
||||
if (decoders->teletext_dvb == DVB)
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 40, 1);
|
||||
nk_label_colored_wrap(ctx, "Teletext is disabled in Decoders->Teletext or DVB.", nk_rgb(255, 56, 38));
|
||||
}
|
||||
else
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if (nk_option_label(ctx, "Auto", input->teletext_decoder == AUTO_DECODE)) {
|
||||
if (nk_option_label(ctx, "Auto", input->teletext_decoder == AUTO_DECODE))
|
||||
{
|
||||
input->teletext_decoder = AUTO_DECODE;
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
if (nk_option_label(ctx, "Force Teletext decoder", input->teletext_decoder == FORCE)) {
|
||||
if (nk_option_label(ctx, "Force Teletext decoder", input->teletext_decoder == FORCE))
|
||||
{
|
||||
input->teletext_decoder = FORCE;
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
if (nk_option_label(ctx, "Disable Teletext decoder", input->teletext_decoder == DISABLE)) {
|
||||
if (nk_option_label(ctx, "Disable Teletext decoder", input->teletext_decoder == DISABLE))
|
||||
{
|
||||
input->teletext_decoder = DISABLE;
|
||||
}
|
||||
|
||||
@@ -350,26 +356,24 @@ void draw_input_tab(struct nk_context *ctx, int *tab_screen_height, struct input
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
|
||||
|
||||
//Screenfuls limit group
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 95, 2, stream_teletext_ratio);
|
||||
if (nk_group_begin(ctx, "'Screenfuls' limit", NK_WINDOW_BORDER | NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR))
|
||||
{
|
||||
int screenful_limits = atoi(input->screenful_limit_buffer);
|
||||
|
||||
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if (nk_option_label(ctx, "No limit", input->is_limit == NO_LIMIT))
|
||||
{
|
||||
input->is_limit = NO_LIMIT;
|
||||
}
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 2, screenful_limit_ratio);
|
||||
if (nk_option_label(ctx, "Screenful Limit:", input->is_limit == LIMITED)) {
|
||||
if (nk_option_label(ctx, "Screenful Limit:", input->is_limit == LIMITED))
|
||||
{
|
||||
input->is_limit = LIMITED;
|
||||
}
|
||||
screenful_limits = nk_propertyi(ctx, "", 0, screenful_limits, 999, 1, 1);
|
||||
sprintf(input->screenful_limit_buffer, "%d", screenful_limits);
|
||||
|
||||
|
||||
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
@@ -382,10 +386,12 @@ void draw_input_tab(struct nk_context *ctx, int *tab_screen_height, struct input
|
||||
{
|
||||
input->clock_input = AUTO;
|
||||
}
|
||||
if (nk_option_label(ctx, "GOP", input->clock_input == GOP)) {
|
||||
if (nk_option_label(ctx, "GOP", input->clock_input == GOP))
|
||||
{
|
||||
input->clock_input = GOP;
|
||||
}
|
||||
if (nk_option_label(ctx, "PTS", input->clock_input == PTS)) {
|
||||
if (nk_option_label(ctx, "PTS", input->clock_input == PTS))
|
||||
{
|
||||
input->clock_input = PTS;
|
||||
}
|
||||
nk_group_end(ctx);
|
||||
@@ -395,24 +401,24 @@ void draw_input_tab(struct nk_context *ctx, int *tab_screen_height, struct input
|
||||
void draw_advanced_input_tab(struct nk_context *ctx, int *tab_screen_height, struct advanced_input_tab *advanced_input)
|
||||
{
|
||||
*tab_screen_height = 472;
|
||||
const float prog_myth_ratio[] = { 0.5f, 0.5f };
|
||||
const float prog_num_ratio[] = { 0.67f, 0.03f, 0.3f };
|
||||
const float prog_myth_ratio[] = {0.5f, 0.5f};
|
||||
const float prog_num_ratio[] = {0.67f, 0.03f, 0.3f};
|
||||
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 125, 2, prog_myth_ratio);
|
||||
|
||||
//Multiple Programs Group
|
||||
if(nk_group_begin(ctx, "Multiple Programs", NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_TITLE))
|
||||
if (nk_group_begin(ctx, "Multiple Programs", NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_TITLE))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
nk_checkbox_label(ctx, "File contains multiple programs", &advanced_input->is_multiple_program);
|
||||
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if(nk_option_label(ctx, "Process first suitable program", advanced_input->multiple_program == FIRST_PROG))
|
||||
if (nk_option_label(ctx, "Process first suitable program", advanced_input->multiple_program == FIRST_PROG))
|
||||
{
|
||||
advanced_input->multiple_program = FIRST_PROG;
|
||||
}
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 3, prog_num_ratio);
|
||||
if(nk_option_label(ctx, "Process program with #", advanced_input->multiple_program == PROG_NUM))
|
||||
if (nk_option_label(ctx, "Process program with #", advanced_input->multiple_program == PROG_NUM))
|
||||
{
|
||||
advanced_input->multiple_program = PROG_NUM;
|
||||
}
|
||||
@@ -423,22 +429,22 @@ void draw_advanced_input_tab(struct nk_context *ctx, int *tab_screen_height, str
|
||||
}
|
||||
|
||||
//Myth TV group
|
||||
if(nk_group_begin(ctx, "Myth TV", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
|
||||
if (nk_group_begin(ctx, "Myth TV", NK_WINDOW_TITLE | NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if(nk_option_label(ctx, "Auto", advanced_input->set_myth == AUTO_MYTH))
|
||||
if (nk_option_label(ctx, "Auto", advanced_input->set_myth == AUTO_MYTH))
|
||||
{
|
||||
advanced_input->set_myth = AUTO_MYTH;
|
||||
}
|
||||
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if(nk_option_label(ctx, "Force usage of Myth TV decoder", advanced_input->set_myth == FORCE_MYTH))
|
||||
if (nk_option_label(ctx, "Force usage of Myth TV decoder", advanced_input->set_myth == FORCE_MYTH))
|
||||
{
|
||||
advanced_input->set_myth = FORCE_MYTH;
|
||||
}
|
||||
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if(nk_option_label(ctx, "Disable Myth TV decoder", advanced_input->set_myth == DISABLE_MYTH))
|
||||
if (nk_option_label(ctx, "Disable Myth TV decoder", advanced_input->set_myth == DISABLE_MYTH))
|
||||
{
|
||||
advanced_input->set_myth = DISABLE_MYTH;
|
||||
}
|
||||
@@ -448,7 +454,7 @@ void draw_advanced_input_tab(struct nk_context *ctx, int *tab_screen_height, str
|
||||
|
||||
//Miscellaneous group
|
||||
nk_layout_row_dynamic(ctx, 210, 1);
|
||||
if(nk_group_begin(ctx, "Miscellaneous", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
|
||||
if (nk_group_begin(ctx, "Miscellaneous", NK_WINDOW_TITLE | NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
nk_checkbox_label(ctx, "Use 90090 as MPEG clock frequency instead of 90000 (needed for some DVDs", &advanced_input->is_mpeg_90090);
|
||||
@@ -465,36 +471,35 @@ void draw_advanced_input_tab(struct nk_context *ctx, int *tab_screen_height, str
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
nk_checkbox_label(ctx, "Ignore broadcast date info (only affects Teletext in timed transcript with -datets)", &advanced_input->is_ignore_broadcast);
|
||||
|
||||
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void draw_output_tab(struct nk_context *ctx, int *tab_screen_height, struct output_tab *output, struct main_tab *main_settings)
|
||||
{
|
||||
const float roll_limit_ratio[] = { 0.55f, 0.45f };
|
||||
const float roll_limit_ratio[] = {0.55f, 0.45f};
|
||||
nk_flags active;
|
||||
static int len;
|
||||
static int cap_len;
|
||||
static int color_len = 6;
|
||||
const float gen_enc_ratio[] = { 0.701f, 0.302f };
|
||||
const float type_ratio[] = { 0.3f,0.7f };
|
||||
const float out_file_ratio[] = { 0.3f,0.53f,0.17f };
|
||||
const float cap_file_ratio[] = { 0.2f,0.63f,0.17f };
|
||||
const float delay_ratio[] = { 0.5f, 0.2f, 0.3f };
|
||||
const float color_roll_ratio[] = { 0.6f,0.401f };
|
||||
const float color_check_ratio[] = { 0.6f,0.23f,0.07f,0.1f };
|
||||
const float gen_enc_ratio[] = {0.701f, 0.302f};
|
||||
const float type_ratio[] = {0.3f, 0.7f};
|
||||
const float out_file_ratio[] = {0.3f, 0.53f, 0.17f};
|
||||
const float cap_file_ratio[] = {0.2f, 0.63f, 0.17f};
|
||||
const float delay_ratio[] = {0.5f, 0.2f, 0.3f};
|
||||
const float color_roll_ratio[] = {0.6f, 0.401f};
|
||||
const float color_check_ratio[] = {0.6f, 0.23f, 0.07f, 0.1f};
|
||||
*tab_screen_height = 472;
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 160, 2, gen_enc_ratio);
|
||||
|
||||
//General Group
|
||||
if (nk_group_begin(ctx, "General", NK_WINDOW_TITLE |NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
if (nk_group_begin(ctx, "General", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
{
|
||||
int delay_secs = atoi(output->delay_sec_buffer);
|
||||
//Output Type
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 20, 2, type_ratio);
|
||||
nk_label(ctx, "Output Type:", NK_TEXT_LEFT);
|
||||
output->type_select = nk_combo(ctx, output->type, 13, output->type_select, 25, nk_vec2(225, 200));
|
||||
output->type_select = nk_combo(ctx, output->type, 13, output->type_select, 25, nk_vec2(225, 200));
|
||||
|
||||
//Output File
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 3, out_file_ratio);
|
||||
@@ -512,7 +517,7 @@ void draw_output_tab(struct nk_context *ctx, int *tab_screen_height, struct outp
|
||||
delay_secs = nk_propertyi(ctx, "", 0, delay_secs, 1000, 1, 1);
|
||||
sprintf(output->delay_sec_buffer, "%d", delay_secs);
|
||||
nk_label(ctx, "seconds", NK_TEXT_LEFT);
|
||||
|
||||
|
||||
//Export XDS info
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
nk_checkbox_label(ctx, "Export XDS information (transcripts)", &output->is_export_xds);
|
||||
@@ -520,19 +525,22 @@ void draw_output_tab(struct nk_context *ctx, int *tab_screen_height, struct outp
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
//Encoding Group
|
||||
if (nk_group_begin(ctx, "Encoding", NK_WINDOW_TITLE |NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
if (nk_group_begin(ctx, "Encoding", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
{
|
||||
static int option = UTF;
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if (nk_option_label(ctx, "Latin", output->encoding == LATIN)) {
|
||||
if (nk_option_label(ctx, "Latin", output->encoding == LATIN))
|
||||
{
|
||||
output->encoding = LATIN;
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if (nk_option_label(ctx, "Unicode", output->encoding == UNIC)) {
|
||||
if (nk_option_label(ctx, "Unicode", output->encoding == UNIC))
|
||||
{
|
||||
output->encoding = UNIC;
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if (nk_option_label(ctx, "UTF-8", output->encoding == UTF)) {
|
||||
if (nk_option_label(ctx, "UTF-8", output->encoding == UTF))
|
||||
{
|
||||
output->encoding = UTF;
|
||||
}
|
||||
|
||||
@@ -543,10 +551,9 @@ void draw_output_tab(struct nk_context *ctx, int *tab_screen_height, struct outp
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
|
||||
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 100, 2, gen_enc_ratio);
|
||||
//Capitalization Group
|
||||
if(nk_group_begin(ctx, "Capitalization", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
if (nk_group_begin(ctx, "Capitalization", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
nk_checkbox_label(ctx, "Standard capitalization rules.", &output->is_cap_standard);
|
||||
@@ -564,14 +571,16 @@ void draw_output_tab(struct nk_context *ctx, int *tab_screen_height, struct outp
|
||||
}
|
||||
|
||||
//Line Endings
|
||||
if (nk_group_begin(ctx, "Line Endings:", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR |NK_WINDOW_BORDER))
|
||||
if (nk_group_begin(ctx, "Line Endings:", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if (nk_option_label(ctx, "CRLF (Windows)", output->line_ending == CRLF)) {
|
||||
if (nk_option_label(ctx, "CRLF (Windows)", output->line_ending == CRLF))
|
||||
{
|
||||
output->line_ending = CRLF;
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
if (nk_option_label(ctx, "LF (UNIX-like)", output->line_ending == LF)) {
|
||||
if (nk_option_label(ctx, "LF (UNIX-like)", output->line_ending == LF))
|
||||
{
|
||||
output->line_ending = LF;
|
||||
}
|
||||
|
||||
@@ -588,20 +597,22 @@ void draw_output_tab(struct nk_context *ctx, int *tab_screen_height, struct outp
|
||||
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
nk_checkbox_label(ctx, "Add dash (-) when speaker changes (for .srt)", &output->is_dash);
|
||||
|
||||
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
nk_checkbox_label(ctx, "Don't add typesetting tags(bold, italic, etc.)", &output->no_typesetting);
|
||||
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if(nk_option_label(ctx, "Don't add color information", output->font_color == NO_COLOR)) {
|
||||
if (nk_option_label(ctx, "Don't add color information", output->font_color == NO_COLOR))
|
||||
{
|
||||
output->font_color = NO_COLOR;
|
||||
}
|
||||
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 20, 4, color_check_ratio);
|
||||
if (nk_option_label(ctx, "Default color (RRGGBB)#", output->font_color == DEFAULT_COLOR)) {
|
||||
if (nk_option_label(ctx, "Default color (RRGGBB)#", output->font_color == DEFAULT_COLOR))
|
||||
{
|
||||
output->font_color = DEFAULT_COLOR;
|
||||
}
|
||||
active = nk_edit_string(ctx, NK_EDIT_FIELD|NK_EDIT_SIG_ENTER, output->color_hex, &color_len, 7, nk_filter_hex);
|
||||
active = nk_edit_string(ctx, NK_EDIT_FIELD | NK_EDIT_SIG_ENTER, output->color_hex, &color_len, 7, nk_filter_hex);
|
||||
nk_label(ctx, "or", NK_TEXT_CENTERED);
|
||||
if (nk_button_color(ctx, output->color_rgb))
|
||||
output->color_popup = nk_true;
|
||||
@@ -617,17 +628,15 @@ void draw_output_tab(struct nk_context *ctx, int *tab_screen_height, struct outp
|
||||
printf("%d%d%d", output->color_rgb.r, output->color_rgb.g, output->color_rgb.b);
|
||||
}*/
|
||||
|
||||
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Roll-up Captions Group
|
||||
if (nk_group_begin(ctx, "Roll-up Captions", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
if (nk_option_label(ctx, "Letters appear in realtime", output->onetime_or_realtime == REALTIME)) {
|
||||
if (nk_option_label(ctx, "Letters appear in realtime", output->onetime_or_realtime == REALTIME))
|
||||
{
|
||||
output->onetime_or_realtime = REALTIME;
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
@@ -637,7 +646,8 @@ void draw_output_tab(struct nk_context *ctx, int *tab_screen_height, struct outp
|
||||
output->roll_limit_select = nk_combo(ctx, output->roll_limit, 4, output->roll_limit_select, 25, nk_vec2(80, 80));
|
||||
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if (nk_option_label(ctx, "Letters appear line by line", output->onetime_or_realtime == ONETIME)) {
|
||||
if (nk_option_label(ctx, "Letters appear line by line", output->onetime_or_realtime == ONETIME))
|
||||
{
|
||||
output->onetime_or_realtime = ONETIME;
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
@@ -645,23 +655,21 @@ void draw_output_tab(struct nk_context *ctx, int *tab_screen_height, struct outp
|
||||
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void draw_decoders_tab(struct nk_context *ctx, int *tab_screen_height, struct decoders_tab *decoders)
|
||||
{
|
||||
*tab_screen_height = 472;
|
||||
const float field_channel_ratio[] = { 0.5f, 0.5f };
|
||||
const float services_ratio[] = { 0.3f, 0.002f, 0.2f };
|
||||
const float min_distance_ratio[] = { 0.45f, 0.01f, 0.2f };
|
||||
const float max_distance_ratio[] = { 0.73f, 0.01f, 0.2f };
|
||||
const float field_channel_ratio[] = {0.5f, 0.5f};
|
||||
const float services_ratio[] = {0.3f, 0.002f, 0.2f};
|
||||
const float min_distance_ratio[] = {0.45f, 0.01f, 0.2f};
|
||||
const float max_distance_ratio[] = {0.73f, 0.01f, 0.2f};
|
||||
|
||||
nk_layout_row_dynamic(ctx, 160, 1);
|
||||
if(nk_group_begin(ctx, "608 Decoder", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
|
||||
if (nk_group_begin(ctx, "608 Decoder", NK_WINDOW_TITLE | NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR))
|
||||
{
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 85, 2, field_channel_ratio);
|
||||
if(nk_group_begin(ctx, "Field", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR))
|
||||
if (nk_group_begin(ctx, "Field", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
nk_checkbox_label(ctx, "Extract captions from field 1", &decoders->is_field1);
|
||||
@@ -670,15 +678,15 @@ void draw_decoders_tab(struct nk_context *ctx, int *tab_screen_height, struct de
|
||||
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
if(nk_group_begin(ctx, "Channel", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR))
|
||||
if (nk_group_begin(ctx, "Channel", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if(nk_option_label(ctx, "Extract captions from channel 1", decoders->channel == CHANNEL_1))
|
||||
if (nk_option_label(ctx, "Extract captions from channel 1", decoders->channel == CHANNEL_1))
|
||||
{
|
||||
decoders->channel = CHANNEL_1;
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
if(nk_option_label(ctx, "Extract captions from channel 2", decoders->channel == CHANNEL_2))
|
||||
if (nk_option_label(ctx, "Extract captions from channel 2", decoders->channel == CHANNEL_2))
|
||||
{
|
||||
decoders->channel = CHANNEL_2;
|
||||
}
|
||||
@@ -687,15 +695,14 @@ void draw_decoders_tab(struct nk_context *ctx, int *tab_screen_height, struct de
|
||||
|
||||
nk_layout_row_dynamic(ctx, 40, 1);
|
||||
nk_label_wrap(ctx, "In general, if you want English subtitles you don't need to use these options. "
|
||||
"If you want the second language (usually "
|
||||
"Spanish), you may need to try other combinations.");
|
||||
|
||||
"If you want the second language (usually "
|
||||
"Spanish), you may need to try other combinations.");
|
||||
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
|
||||
nk_layout_row_dynamic(ctx, 125, 1);
|
||||
if(nk_group_begin(ctx, "708 Decoder", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
|
||||
if (nk_group_begin(ctx, "708 Decoder", NK_WINDOW_TITLE | NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
nk_checkbox_label(ctx, "Enable 708 Decoder", &decoders->is_708);
|
||||
@@ -705,29 +712,31 @@ void draw_decoders_tab(struct nk_context *ctx, int *tab_screen_height, struct de
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, decoders->services, &decoders->services_len, 15, nk_filter_ascii);
|
||||
nk_layout_row_dynamic(ctx, 45, 1);
|
||||
nk_label_wrap(ctx, "The service list is a comma separated list of services to process. "
|
||||
"Valid values: 1 to 63. Ranges are NOT supported.");
|
||||
"Valid values: 1 to 63. Ranges are NOT supported.");
|
||||
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
|
||||
nk_layout_row_dynamic(ctx, 63, 1);
|
||||
if(nk_group_begin(ctx, "Teletext or DVB (if both are present)", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
|
||||
if (nk_group_begin(ctx, "Teletext or DVB (if both are present)", NK_WINDOW_TITLE | NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx,20, 2);
|
||||
if(nk_option_label(ctx, "Teletext", decoders->teletext_dvb == TELETEXT)){
|
||||
nk_layout_row_dynamic(ctx, 20, 2);
|
||||
if (nk_option_label(ctx, "Teletext", decoders->teletext_dvb == TELETEXT))
|
||||
{
|
||||
decoders->teletext_dvb = TELETEXT;
|
||||
}
|
||||
if(nk_option_label(ctx, "DVB", decoders->teletext_dvb == DVB)){
|
||||
if (nk_option_label(ctx, "DVB", decoders->teletext_dvb == DVB))
|
||||
{
|
||||
decoders->teletext_dvb = DVB;
|
||||
}
|
||||
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
|
||||
if(decoders->teletext_dvb == TELETEXT)
|
||||
if (decoders->teletext_dvb == TELETEXT)
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 95, 1);
|
||||
if(nk_group_begin(ctx, "Teletext line duplication", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
|
||||
if (nk_group_begin(ctx, "Teletext line duplication", NK_WINDOW_TITLE | NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR))
|
||||
{
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 3, min_distance_ratio);
|
||||
nk_label(ctx, "Minimum allowed distance (default 2)", NK_TEXT_LEFT);
|
||||
@@ -738,7 +747,6 @@ void draw_decoders_tab(struct nk_context *ctx, int *tab_screen_height, struct de
|
||||
nk_spacing(ctx, 1);
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, decoders->max_distance, &decoders->max_distance_len, 3, nk_filter_decimal);
|
||||
|
||||
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
}
|
||||
@@ -747,14 +755,14 @@ void draw_decoders_tab(struct nk_context *ctx, int *tab_screen_height, struct de
|
||||
void draw_credits_tab(struct nk_context *ctx, int *tab_screen_height, struct credits_tab *credits)
|
||||
{
|
||||
static struct time before_time, after_time;
|
||||
const float start_time_ratio[] = { 0.005f, 0.26f, 0.18f, 0.1f, 0.25f, 0.18f };
|
||||
const float atleast_atmost_ratio[] = { 0.005f, 0.28, 0.1f, 0.36f, 0.1f, 0.1f };
|
||||
const float start_time_ratio[] = {0.005f, 0.26f, 0.18f, 0.1f, 0.25f, 0.18f};
|
||||
const float atleast_atmost_ratio[] = {0.005f, 0.28, 0.1f, 0.36f, 0.1f, 0.1f};
|
||||
static int start_atleast_int, start_atmost_int;
|
||||
*tab_screen_height = 472;
|
||||
|
||||
//Start Credits Group
|
||||
nk_layout_row_dynamic(ctx, 210, 1);
|
||||
if(nk_group_begin(ctx, "Start Credits", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
|
||||
if (nk_group_begin(ctx, "Start Credits", NK_WINDOW_TITLE | NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
nk_checkbox_label(ctx, "Enable, write below text as soon as possible.", &credits->is_start_text);
|
||||
@@ -766,8 +774,8 @@ void draw_credits_tab(struct nk_context *ctx, int *tab_screen_height, struct cre
|
||||
nk_spacing(ctx, 1);
|
||||
nk_checkbox_label(ctx, "Before (MM:SS)", &credits->is_before);
|
||||
|
||||
|
||||
if (nk_combo_begin_label(ctx, credits->before_time_buffer, nk_vec2(100, 100))) {
|
||||
if (nk_combo_begin_label(ctx, credits->before_time_buffer, nk_vec2(100, 100)))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
sprintf(credits->before_time_buffer, "%02d:%02d", before_time.minutes, before_time.seconds);
|
||||
before_time.seconds = nk_propertyi(ctx, "#S:", 0, before_time.seconds, 60, 1, 1);
|
||||
@@ -779,8 +787,8 @@ void draw_credits_tab(struct nk_context *ctx, int *tab_screen_height, struct cre
|
||||
|
||||
nk_checkbox_label(ctx, "After (MM:SS)", &credits->is_after);
|
||||
|
||||
|
||||
if (nk_combo_begin_label(ctx, credits->after_time_buffer, nk_vec2(100, 100))) {
|
||||
if (nk_combo_begin_label(ctx, credits->after_time_buffer, nk_vec2(100, 100)))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
sprintf(credits->after_time_buffer, "%02d:%02d", after_time.minutes, after_time.seconds);
|
||||
after_time.seconds = nk_propertyi(ctx, "#S:", 0, after_time.seconds, 60, 1, 1);
|
||||
@@ -801,13 +809,13 @@ void draw_credits_tab(struct nk_context *ctx, int *tab_screen_height, struct cre
|
||||
|
||||
//End Credits Group
|
||||
nk_layout_row_dynamic(ctx, 180, 1);
|
||||
if(nk_group_begin(ctx, "End Credits", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
|
||||
if (nk_group_begin(ctx, "End Credits", NK_WINDOW_TITLE | NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
nk_checkbox_label(ctx, "Enable, write below text after last caption and as close as possible to video end.", &credits->is_end_text);
|
||||
nk_layout_row_dynamic(ctx, 85, 1);
|
||||
nk_edit_string(ctx, NK_EDIT_BOX, credits->end_text, &credits->end_text_len, 1000, nk_filter_ascii);
|
||||
nk_layout_row(ctx,NK_DYNAMIC, 25, 6, atleast_atmost_ratio);
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 6, atleast_atmost_ratio);
|
||||
nk_spacing(ctx, 1);
|
||||
nk_label(ctx, "Display credits at least", NK_TEXT_LEFT);
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, credits->end_atleast_sec, &credits->end_atleast_sec_len, 3, nk_filter_decimal);
|
||||
@@ -820,18 +828,18 @@ void draw_credits_tab(struct nk_context *ctx, int *tab_screen_height, struct cre
|
||||
}
|
||||
|
||||
void draw_debug_tab(struct nk_context *ctx, int *tab_screen_height,
|
||||
struct main_tab *main_settings,
|
||||
struct output_tab *output,
|
||||
struct debug_tab *debug)
|
||||
struct main_tab *main_settings,
|
||||
struct output_tab *output,
|
||||
struct debug_tab *debug)
|
||||
{
|
||||
*tab_screen_height = 472;
|
||||
const float stream_ratio[] = { 0.45f, 0.45f, 0.1f };
|
||||
const float stream_ratio[] = {0.45f, 0.45f, 0.1f};
|
||||
nk_layout_row_dynamic(ctx, 4, 1);
|
||||
nk_spacing(ctx, 1);
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 3, stream_ratio);
|
||||
nk_checkbox_label(ctx, "Write elementary stream to this file", &debug->is_elementary_stream);
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, debug->elementary_stream, &debug->elementary_stream_len, 260, nk_filter_ascii);
|
||||
if(nk_button_label(ctx, "Browse"))
|
||||
if (nk_button_label(ctx, "Browse"))
|
||||
{
|
||||
debug->is_debug_browser_active = nk_true;
|
||||
main_settings->scaleWindowForFileBrowser = nk_true;
|
||||
@@ -858,14 +866,13 @@ void draw_debug_tab(struct nk_context *ctx, int *tab_screen_height,
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
nk_checkbox_label(ctx, "Print debug info for parse container files (only for ASF files at the moment).", &debug->is_debug_parsed);
|
||||
|
||||
if(!(strcmp(output->type[output->type_select], "bin")))
|
||||
if (!(strcmp(output->type[output->type_select], "bin")))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
nk_checkbox_label(ctx, "Disable sync code when there's a timeline gap.", &debug->is_disable_sync);
|
||||
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
nk_checkbox_label(ctx, "Don't remove trailing padding blocks.", &debug->is_no_padding);
|
||||
|
||||
}
|
||||
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
@@ -885,19 +892,19 @@ void draw_debug_tab(struct nk_context *ctx, int *tab_screen_height,
|
||||
}
|
||||
|
||||
void draw_hd_homerun_tab(struct nk_context *ctx, int *tab_screen_height,
|
||||
struct hd_homerun_tab *hd_homerun,
|
||||
struct main_tab *main_settings)
|
||||
struct hd_homerun_tab *hd_homerun,
|
||||
struct main_tab *main_settings)
|
||||
{
|
||||
*tab_screen_height = 472;
|
||||
int setup_device = nk_false;
|
||||
const float location_ratio[] = { 0.35f, 0.5f, 0.15f };
|
||||
const float devices_ratio[] = { 0.8f, 0.2f };
|
||||
const float tuner_ratio[] = { .35f, 0.4f, 0.13 };
|
||||
const float channel_ratio[] = { 0.35f, 0.4f };
|
||||
const float program_ratio[] = { 0.35f, 0.4f };
|
||||
const float done_ratio[] = { 0.45f, 0.1f };
|
||||
const float ipv4_ratio[] = { 0.35f, 0.4f};
|
||||
const float port_ratio[] = { 0.35f, 0.4f };
|
||||
const float location_ratio[] = {0.35f, 0.5f, 0.15f};
|
||||
const float devices_ratio[] = {0.8f, 0.2f};
|
||||
const float tuner_ratio[] = {.35f, 0.4f, 0.13};
|
||||
const float channel_ratio[] = {0.35f, 0.4f};
|
||||
const float program_ratio[] = {0.35f, 0.4f};
|
||||
const float done_ratio[] = {0.45f, 0.1f};
|
||||
const float ipv4_ratio[] = {0.35f, 0.4f};
|
||||
const float port_ratio[] = {0.35f, 0.4f};
|
||||
static int before_selected, after_selected;
|
||||
static int done = nk_false;
|
||||
#if HD_HOMERUN
|
||||
@@ -907,21 +914,21 @@ void draw_hd_homerun_tab(struct nk_context *ctx, int *tab_screen_height,
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 3, location_ratio);
|
||||
nk_label(ctx, "'hdhomerun_config' utility*:", NK_TEXT_LEFT);
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, hd_homerun->location, &hd_homerun->location_len, 260, nk_filter_ascii);
|
||||
if(nk_button_label(ctx, "Browse"))
|
||||
if (nk_button_label(ctx, "Browse"))
|
||||
{
|
||||
hd_homerun->is_homerun_browser_active = nk_true;
|
||||
main_settings->scaleWindowForFileBrowser = nk_true;
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 40, 1);
|
||||
nk_label_wrap(ctx, "*Absolute location of 'hdhomerun_config' executable. Displaying this message means "
|
||||
"either utility is not installed or environment variables aren't set for proper detection.");
|
||||
"either utility is not installed or environment variables aren't set for proper detection.");
|
||||
|
||||
#endif
|
||||
nk_layout_row_dynamic(ctx, 120, 1);
|
||||
if(nk_group_begin(ctx, "Choose a device:", NK_WINDOW_TITLE|NK_WINDOW_BORDER))
|
||||
if (nk_group_begin(ctx, "Choose a device:", NK_WINDOW_TITLE | NK_WINDOW_BORDER))
|
||||
{
|
||||
|
||||
if(hd_homerun->device_num == 0)
|
||||
if (hd_homerun->device_num == 0)
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
nk_label_wrap(ctx, "No devices found, yet. Please check your settings and try again.");
|
||||
@@ -929,22 +936,22 @@ void draw_hd_homerun_tab(struct nk_context *ctx, int *tab_screen_height,
|
||||
else
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
for(int i = 0; i < hd_homerun->device_num; i++)
|
||||
for (int i = 0; i < hd_homerun->device_num; i++)
|
||||
{
|
||||
nk_selectable_label(ctx, hd_homerun->devices[i], NK_TEXT_LEFT, &hd_homerun->device_select[i]);
|
||||
if(hd_homerun->device_select[i])
|
||||
if (hd_homerun->device_select[i])
|
||||
{
|
||||
before_selected = i - 1;
|
||||
after_selected = i + 1;
|
||||
for( int j = 0; j <= before_selected; j++)
|
||||
for (int j = 0; j <= before_selected; j++)
|
||||
hd_homerun->device_select[j] = nk_false;
|
||||
for(int j = after_selected; j < hd_homerun->device_num; j++)
|
||||
for (int j = after_selected; j < hd_homerun->device_num; j++)
|
||||
hd_homerun->device_select[j] = nk_false;
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < hd_homerun->device_num; i++)
|
||||
for (int i = 0; i < hd_homerun->device_num; i++)
|
||||
{
|
||||
if(hd_homerun->device_select[i] == nk_true)
|
||||
if (hd_homerun->device_select[i] == nk_true)
|
||||
{
|
||||
hd_homerun->selected = i;
|
||||
break;
|
||||
@@ -954,24 +961,22 @@ void draw_hd_homerun_tab(struct nk_context *ctx, int *tab_screen_height,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 2, devices_ratio);
|
||||
nk_spacing(ctx, 1);
|
||||
if(hd_homerun->selected == -1)
|
||||
if (hd_homerun->selected == -1)
|
||||
{
|
||||
if(nk_button_label(ctx, "Find Devices"))
|
||||
if (nk_button_label(ctx, "Find Devices"))
|
||||
{
|
||||
pthread_attr_init(&attr_find);
|
||||
|
||||
int err = pthread_create(&tid_find, &attr_find, find_hd_homerun_devices, hd_homerun);
|
||||
if(!err)
|
||||
if (!err)
|
||||
printf("Find Device thread created!\n");
|
||||
|
||||
}
|
||||
}
|
||||
if(hd_homerun->selected != -1 && done == nk_false)
|
||||
if (hd_homerun->selected != -1 && done == nk_false)
|
||||
{
|
||||
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 3, tuner_ratio);
|
||||
@@ -986,7 +991,7 @@ void draw_hd_homerun_tab(struct nk_context *ctx, int *tab_screen_height,
|
||||
nk_label(ctx, "Program number for extraction:", NK_TEXT_LEFT);
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, hd_homerun->program, &hd_homerun->program_len, 10, nk_filter_decimal);
|
||||
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 2,ipv4_ratio);
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 2, ipv4_ratio);
|
||||
nk_label(ctx, "Target IPv4 address:", NK_TEXT_LEFT);
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, hd_homerun->ipv4_address, &hd_homerun->ipv4_address_len, 16, nk_filter_ascii);
|
||||
|
||||
@@ -994,18 +999,17 @@ void draw_hd_homerun_tab(struct nk_context *ctx, int *tab_screen_height,
|
||||
nk_label(ctx, "Target Port number:", NK_TEXT_LEFT);
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, hd_homerun->port_number, &hd_homerun->port_number_len, 7, nk_filter_decimal);
|
||||
|
||||
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 2, done_ratio);
|
||||
nk_spacing(ctx, 1);
|
||||
if(nk_button_label(ctx, "Done"))
|
||||
if (nk_button_label(ctx, "Done"))
|
||||
{
|
||||
pthread_attr_init(&attr_setup);
|
||||
int err = pthread_create(&tid_setup, &attr_setup, setup_hd_homerun_device, hd_homerun);
|
||||
if(!err)
|
||||
printf("Setup Device thread created!\n");
|
||||
pthread_attr_init(&attr_setup);
|
||||
int err = pthread_create(&tid_setup, &attr_setup, setup_hd_homerun_device, hd_homerun);
|
||||
if (!err)
|
||||
printf("Setup Device thread created!\n");
|
||||
|
||||
pthread_join(tid_setup, NULL);
|
||||
done = nk_true;
|
||||
pthread_join(tid_setup, NULL);
|
||||
done = nk_true;
|
||||
}
|
||||
}
|
||||
if (done == nk_true)
|
||||
@@ -1015,19 +1019,16 @@ void draw_hd_homerun_tab(struct nk_context *ctx, int *tab_screen_height,
|
||||
nk_layout_row_dynamic(ctx, 20, 1);
|
||||
nk_label(ctx, "Please start CCExtractor with UDP settings if not started.", NK_TEXT_CENTERED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void draw_burned_subs_tab(struct nk_context *ctx, int *tab_screen_height, struct burned_subs_tab *burned_subs)
|
||||
{
|
||||
*tab_screen_height = 472;
|
||||
const float color_mode_ratio[] = { 0.65f, 0.351f};
|
||||
const float preset_ratio[] = { 0.4f, 0.5f };
|
||||
const float custom_ratio[] = { 0.4f, 0.5f};
|
||||
const float delay_ratio[] = { 0.4f, 0.2f, 0.2f };
|
||||
const float threshold_ratio[] = { 0.9f, 0.1f };
|
||||
const float color_mode_ratio[] = {0.65f, 0.351f};
|
||||
const float preset_ratio[] = {0.4f, 0.5f};
|
||||
const float custom_ratio[] = {0.4f, 0.5f};
|
||||
const float delay_ratio[] = {0.4f, 0.2f, 0.2f};
|
||||
const float threshold_ratio[] = {0.9f, 0.1f};
|
||||
static char buffer[5];
|
||||
|
||||
nk_layout_row_dynamic(ctx, 30, 1);
|
||||
@@ -1038,16 +1039,18 @@ void draw_burned_subs_tab(struct nk_context *ctx, int *tab_screen_height, struct
|
||||
#endif
|
||||
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 140, 2, color_mode_ratio);
|
||||
if(nk_group_begin(ctx, "Subtitle Color", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
if (nk_group_begin(ctx, "Subtitle Color", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
{
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 2, preset_ratio);
|
||||
if(nk_option_label(ctx, "Preset color:", burned_subs->color_type == PRESET)){
|
||||
if (nk_option_label(ctx, "Preset color:", burned_subs->color_type == PRESET))
|
||||
{
|
||||
burned_subs->color_type = PRESET;
|
||||
}
|
||||
burned_subs->subs_color_select = nk_combo(ctx, burned_subs->subs_color, 7, burned_subs->subs_color_select, 25, nk_vec2(100, 100));
|
||||
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 2, custom_ratio);
|
||||
if(nk_option_label(ctx, "Custom Hue:", burned_subs->color_type == CUSTOM)){
|
||||
if (nk_option_label(ctx, "Custom Hue:", burned_subs->color_type == CUSTOM))
|
||||
{
|
||||
burned_subs->color_type = CUSTOM;
|
||||
}
|
||||
nk_edit_string(ctx, NK_EDIT_SIMPLE, burned_subs->custom_hue, &burned_subs->custom_hue_len, 4, nk_filter_decimal);
|
||||
@@ -1059,29 +1062,32 @@ void draw_burned_subs_tab(struct nk_context *ctx, int *tab_screen_height, struct
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
|
||||
if(nk_group_begin(ctx, "OCR mode", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER))
|
||||
if (nk_group_begin(ctx, "OCR mode", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
if(nk_option_label(ctx, "Frame - wise", burned_subs->ocr_mode == FRAME_WISE)){
|
||||
if (nk_option_label(ctx, "Frame - wise", burned_subs->ocr_mode == FRAME_WISE))
|
||||
{
|
||||
burned_subs->ocr_mode = FRAME_WISE;
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
if(nk_option_label(ctx, "Word - wise", burned_subs->ocr_mode == WORD_WISE)){
|
||||
if (nk_option_label(ctx, "Word - wise", burned_subs->ocr_mode == WORD_WISE))
|
||||
{
|
||||
burned_subs->ocr_mode = WORD_WISE;
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 25, 1);
|
||||
if(nk_option_label(ctx, "Letter - wise", burned_subs->ocr_mode == LETTER_WISE)){
|
||||
if (nk_option_label(ctx, "Letter - wise", burned_subs->ocr_mode == LETTER_WISE))
|
||||
{
|
||||
burned_subs->ocr_mode = LETTER_WISE;
|
||||
}
|
||||
|
||||
if(burned_subs->is_italic)
|
||||
if (burned_subs->is_italic)
|
||||
{
|
||||
burned_subs->ocr_mode = WORD_WISE;
|
||||
}
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
nk_layout_row_dynamic(ctx, 120, 1);
|
||||
if(nk_group_begin(ctx, "Minimum Subtitle Duration", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER))
|
||||
if (nk_group_begin(ctx, "Minimum Subtitle Duration", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
{
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 25, 3, delay_ratio);
|
||||
nk_label(ctx, "Set the minimum subtitle duration to:", NK_TEXT_LEFT);
|
||||
@@ -1094,10 +1100,10 @@ void draw_burned_subs_tab(struct nk_context *ctx, int *tab_screen_height, struct
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
|
||||
if(!burned_subs->subs_color_select && burned_subs->color_type == PRESET)
|
||||
if (!burned_subs->subs_color_select && burned_subs->color_type == PRESET)
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 60, 1);
|
||||
if(nk_group_begin(ctx, "Luminance Threshold", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
if (nk_group_begin(ctx, "Luminance Threshold", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
{
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 20, 2, threshold_ratio);
|
||||
nk_slider_int(ctx, 0, &burned_subs->luminance_threshold, 100, 1);
|
||||
@@ -1109,7 +1115,7 @@ void draw_burned_subs_tab(struct nk_context *ctx, int *tab_screen_height, struct
|
||||
}
|
||||
|
||||
nk_layout_row_dynamic(ctx, 60, 1);
|
||||
if(nk_group_begin(ctx, "Confidence Threshold", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
if (nk_group_begin(ctx, "Confidence Threshold", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
|
||||
{
|
||||
nk_layout_row(ctx, NK_DYNAMIC, 20, 2, threshold_ratio);
|
||||
nk_slider_int(ctx, 0, &burned_subs->confidence_threshold, 100, 1);
|
||||
@@ -1121,5 +1127,4 @@ void draw_burned_subs_tab(struct nk_context *ctx, int *tab_screen_height, struct
|
||||
|
||||
nk_layout_row_dynamic(ctx, 30, 1);
|
||||
nk_checkbox_label(ctx, "Enable italics detection.", &burned_subs->is_italic);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ static int
|
||||
terminal(struct nk_context *ctx, int x, int y, int width, int height, char *command)
|
||||
{
|
||||
if (nk_begin(ctx, "Terminal", nk_rect(x, y, width, height),
|
||||
NK_WINDOW_TITLE|NK_WINDOW_BACKGROUND ))
|
||||
NK_WINDOW_TITLE | NK_WINDOW_BACKGROUND))
|
||||
{
|
||||
nk_layout_row_dynamic(ctx, 60, 1);
|
||||
nk_label_wrap(ctx, command);
|
||||
|
||||
@@ -9,48 +9,47 @@ License: GPL 2.0
|
||||
|
||||
volatile int terminate_asap = 0;
|
||||
|
||||
struct ccx_s_options ccx_options;
|
||||
struct lib_ccx_ctx *signal_ctx;
|
||||
|
||||
void sigusr1_handler(int sig)
|
||||
{
|
||||
mprint("Caught SIGUSR1. Filename Change Requested\n");
|
||||
change_filename_requested = 1;
|
||||
mprint("Caught SIGUSR1. Filename Change Requested\n");
|
||||
change_filename_requested = 1;
|
||||
}
|
||||
|
||||
|
||||
void sigterm_handler(int sig)
|
||||
{
|
||||
printf("Received SIGTERM, terminating as soon as possible.\n");
|
||||
terminate_asap = 1;
|
||||
printf("Received SIGTERM, terminating as soon as possible.\n");
|
||||
terminate_asap = 1;
|
||||
}
|
||||
|
||||
|
||||
void sigint_handler(int sig)
|
||||
{
|
||||
if (ccx_options.print_file_reports)
|
||||
print_file_report(signal_ctx);
|
||||
if (ccx_options.print_file_reports)
|
||||
print_file_report(signal_ctx);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
void print_end_msg(void)
|
||||
{
|
||||
mprint("Issues? Open a ticket here\n");
|
||||
mprint("https://github.com/CCExtractor/ccextractor/issues\n");
|
||||
mprint("Issues? Open a ticket here\n");
|
||||
mprint("https://github.com/CCExtractor/ccextractor/issues\n");
|
||||
}
|
||||
|
||||
|
||||
int api_start(struct ccx_s_options api_options)
|
||||
{
|
||||
struct lib_ccx_ctx *ctx;
|
||||
struct lib_cc_decode *dec_ctx = NULL;
|
||||
int ret = 0, tmp;
|
||||
enum ccx_stream_mode_enum stream_mode;
|
||||
struct lib_ccx_ctx *ctx = NULL; // Context for libs
|
||||
struct lib_cc_decode *dec_ctx = NULL; // Context for decoder
|
||||
int ret = 0, tmp = 0;
|
||||
enum ccx_stream_mode_enum stream_mode = CCX_SM_ELEMENTARY_OR_NOT_FOUND;
|
||||
|
||||
#if defined(ENABLE_OCR) && defined(_WIN32)
|
||||
setMsgSeverity(LEPT_MSG_SEVERITY);
|
||||
setMsgSeverity(LEPT_MSG_SEVERITY);
|
||||
#endif
|
||||
#ifdef ENABLE_HARDSUBX
|
||||
if(api_options.hardsubx)
|
||||
if (api_options.hardsubx)
|
||||
{
|
||||
// Perform burned in subtitle extraction
|
||||
hardsubx(&api_options);
|
||||
@@ -58,98 +57,93 @@ int api_start(struct ccx_s_options api_options)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialize CCExtractor libraries
|
||||
ctx = init_libraries(&api_options);
|
||||
#ifdef ENABLE_PYTHON
|
||||
int i=0;
|
||||
// Initialize CCExtractor libraries
|
||||
ctx = init_libraries(&api_options);
|
||||
|
||||
while(i<api_options.python_param_count)
|
||||
{
|
||||
free(api_options.python_params[i]);
|
||||
i++;
|
||||
}
|
||||
#endif
|
||||
if (!ctx && errno == ENOMEM)
|
||||
fatal (EXIT_NOT_ENOUGH_MEMORY, "Not enough memory, could not initialize libraries\n");
|
||||
else if (!ctx && errno == EINVAL)
|
||||
fatal (CCX_COMMON_EXIT_BUG_BUG, "Invalid option to CCextractor Library\n");
|
||||
else if (!ctx && errno == EPERM)
|
||||
fatal (CCX_COMMON_EXIT_FILE_CREATION_FAILED, "Unable to create output file: Operation not permitted.\n");
|
||||
else if (!ctx && errno == EACCES)
|
||||
fatal (CCX_COMMON_EXIT_FILE_CREATION_FAILED, "Unable to create output file: Permission denied\n");
|
||||
else if (!ctx)
|
||||
fatal (EXIT_NOT_CLASSIFIED, "Unable to create Library Context %d\n",errno);
|
||||
if (!ctx)
|
||||
{
|
||||
if (errno == ENOMEM)
|
||||
fatal(EXIT_NOT_ENOUGH_MEMORY, "Not enough memory, could not initialize libraries\n");
|
||||
else if (errno == EINVAL)
|
||||
fatal(CCX_COMMON_EXIT_BUG_BUG, "Invalid option to CCextractor Library\n");
|
||||
else if (errno == EPERM)
|
||||
fatal(CCX_COMMON_EXIT_FILE_CREATION_FAILED, "Unable to create output file: Operation not permitted.\n");
|
||||
else if (errno == EACCES)
|
||||
fatal(CCX_COMMON_EXIT_FILE_CREATION_FAILED, "Unable to create output file: Permission denied\n");
|
||||
else
|
||||
fatal(EXIT_NOT_CLASSIFIED, "Unable to create Library Context %d\n", errno);
|
||||
}
|
||||
|
||||
#ifdef WITH_LIBCURL
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
/* get a curl handle */
|
||||
curl = curl_easy_init();
|
||||
/* get a curl handle */
|
||||
curl = curl_easy_init();
|
||||
if (!curl)
|
||||
{
|
||||
curl_global_cleanup(); // Must be done even on init fail
|
||||
fatal (EXIT_NOT_CLASSIFIED, "Unable to init curl.");
|
||||
fatal(EXIT_NOT_CLASSIFIED, "Unable to init curl.");
|
||||
}
|
||||
#endif
|
||||
|
||||
int show_myth_banner = 0;
|
||||
int show_myth_banner = 0;
|
||||
|
||||
params_dump(ctx);
|
||||
params_dump(ctx);
|
||||
|
||||
// default teletext page
|
||||
if (tlt_config.page > 0) {
|
||||
// dec to BCD, magazine pages numbers are in BCD (ETSI 300 706)
|
||||
tlt_config.page = ((tlt_config.page / 100) << 8) | (((tlt_config.page / 10) % 10) << 4) | (tlt_config.page % 10);
|
||||
}
|
||||
// default teletext page
|
||||
if (tlt_config.page > 0)
|
||||
{
|
||||
// dec to BCD, magazine pages numbers are in BCD (ETSI 300 706)
|
||||
tlt_config.page = ((tlt_config.page / 100) << 8) | (((tlt_config.page / 10) % 10) << 4) | (tlt_config.page % 10);
|
||||
}
|
||||
|
||||
if (api_options.transcript_settings.xds)
|
||||
{
|
||||
if (api_options.write_format != CCX_OF_TRANSCRIPT)
|
||||
{
|
||||
api_options.transcript_settings.xds = 0;
|
||||
mprint ("Warning: -xds ignored, XDS can only be exported to transcripts at this time.\n");
|
||||
}
|
||||
}
|
||||
if (api_options.transcript_settings.xds)
|
||||
{
|
||||
if (api_options.write_format != CCX_OF_TRANSCRIPT)
|
||||
{
|
||||
api_options.transcript_settings.xds = 0;
|
||||
mprint("Warning: -xds ignored, XDS can only be exported to transcripts at this time.\n");
|
||||
}
|
||||
}
|
||||
|
||||
time_t start, final;
|
||||
time(&start);
|
||||
|
||||
time_t start, final;
|
||||
time(&start);
|
||||
|
||||
if (api_options.binary_concat)
|
||||
{
|
||||
ctx->total_inputsize=get_total_file_size(ctx);
|
||||
if (ctx->total_inputsize < 0)
|
||||
{
|
||||
switch (ctx->total_inputsize)
|
||||
{
|
||||
case -1*ENOENT:
|
||||
fatal(EXIT_NO_INPUT_FILES, "Failed to open one of the input file(s): File does not exist.");
|
||||
case -1*EACCES:
|
||||
fatal(EXIT_READ_ERROR, "Failed to open input file: Unable to access");
|
||||
case -1*EINVAL:
|
||||
fatal(EXIT_READ_ERROR, "Failed to open input file: Invalid opening flag.");
|
||||
case -1*EMFILE:
|
||||
fatal(EXIT_TOO_MANY_INPUT_FILES, "Failed to open input file: Too many files are open.");
|
||||
default:
|
||||
fatal(EXIT_READ_ERROR, "Failed to open input file: Reason unknown");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (api_options.binary_concat)
|
||||
{
|
||||
ctx->total_inputsize = get_total_file_size(ctx);
|
||||
if (ctx->total_inputsize < 0)
|
||||
{
|
||||
switch (ctx->total_inputsize)
|
||||
{
|
||||
case -1 * ENOENT:
|
||||
fatal(EXIT_NO_INPUT_FILES, "Failed to open one of the input file(s): File does not exist.");
|
||||
case -1 * EACCES:
|
||||
fatal(EXIT_READ_ERROR, "Failed to open input file: Unable to access");
|
||||
case -1 * EINVAL:
|
||||
fatal(EXIT_READ_ERROR, "Failed to open input file: Invalid opening flag.");
|
||||
case -1 * EMFILE:
|
||||
fatal(EXIT_TOO_MANY_INPUT_FILES, "Failed to open input file: Too many files are open.");
|
||||
default:
|
||||
fatal(EXIT_READ_ERROR, "Failed to open input file: Reason unknown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
signal_ctx = ctx;
|
||||
m_signal(SIGINT, sigint_handler);
|
||||
m_signal(SIGTERM, sigterm_handler);
|
||||
m_signal(SIGUSR1, sigusr1_handler);
|
||||
signal_ctx = ctx;
|
||||
m_signal(SIGINT, sigint_handler);
|
||||
m_signal(SIGTERM, sigterm_handler);
|
||||
m_signal(SIGUSR1, sigusr1_handler);
|
||||
#endif
|
||||
terminate_asap = 0;
|
||||
terminate_asap = 0;
|
||||
|
||||
#ifdef ENABLE_SHARING
|
||||
if (api_options.translate_enabled && ctx->num_input_files > 1)
|
||||
if (api_options.translate_enabled && ctx->num_input_files > 1)
|
||||
{
|
||||
mprint("[share] WARNING: simultaneous translation of several input files is not supported yet\n");
|
||||
api_options.translate_enabled = 0;
|
||||
api_options.sharing_enabled = 0;
|
||||
api_options.sharing_enabled = 0;
|
||||
}
|
||||
if (api_options.translate_enabled)
|
||||
{
|
||||
@@ -157,380 +151,314 @@ int api_start(struct ccx_s_options api_options)
|
||||
ccx_share_launch_translator(api_options.translate_langs, api_options.translate_key);
|
||||
}
|
||||
#endif //ENABLE_SHARING
|
||||
ret = 0;
|
||||
while (switch_to_next_file(ctx, 0))
|
||||
{
|
||||
prepare_for_new_file(ctx);
|
||||
ret = 0;
|
||||
while (switch_to_next_file(ctx, 0))
|
||||
{
|
||||
prepare_for_new_file(ctx);
|
||||
#ifdef ENABLE_SHARING
|
||||
if (api_options.sharing_enabled)
|
||||
if (api_options.sharing_enabled)
|
||||
ccx_share_start(ctx->basefilename);
|
||||
#endif //ENABLE_SHARING
|
||||
|
||||
stream_mode = ctx->demux_ctx->get_stream_mode(ctx->demux_ctx);
|
||||
// Disable sync check for raw formats - they have the right timeline.
|
||||
// Also true for bin formats, but -nosync might have created a
|
||||
// broken timeline for debug purposes.
|
||||
// Disable too in MP4, specs doesn't say that there can't be a jump
|
||||
switch (stream_mode)
|
||||
{
|
||||
case CCX_SM_MCPOODLESRAW:
|
||||
case CCX_SM_RCWT:
|
||||
case CCX_SM_MP4:
|
||||
stream_mode = ctx->demux_ctx->get_stream_mode(ctx->demux_ctx);
|
||||
// Disable sync check for raw formats - they have the right timeline.
|
||||
// Also true for bin formats, but -nosync might have created a
|
||||
// broken timeline for debug purposes.
|
||||
// Disable too in MP4, specs doesn't say that there can't be a jump
|
||||
switch (stream_mode)
|
||||
{
|
||||
case CCX_SM_MCPOODLESRAW:
|
||||
case CCX_SM_RCWT:
|
||||
case CCX_SM_MP4:
|
||||
#ifdef WTV_DEBUG
|
||||
case CCX_SM_HEX_DUMP:
|
||||
case CCX_SM_HEX_DUMP:
|
||||
#endif
|
||||
ccx_common_timing_settings.disable_sync_check = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* -----------------------------------------------------------------
|
||||
MAIN LOOP
|
||||
----------------------------------------------------------------- */
|
||||
switch (stream_mode)
|
||||
{
|
||||
case CCX_SM_ELEMENTARY_OR_NOT_FOUND:
|
||||
if (!api_options.use_gop_as_pts) // If !0 then the user selected something
|
||||
api_options.use_gop_as_pts = 1; // Force GOP timing for ES
|
||||
ccx_common_timing_settings.is_elementary_stream = 1;
|
||||
case CCX_SM_TRANSPORT:
|
||||
case CCX_SM_PROGRAM:
|
||||
case CCX_SM_ASF:
|
||||
case CCX_SM_WTV:
|
||||
case CCX_SM_GXF:
|
||||
case CCX_SM_MXF:
|
||||
ccx_common_timing_settings.disable_sync_check = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* -----------------------------------------------------------------
|
||||
MAIN LOOP
|
||||
----------------------------------------------------------------- */
|
||||
switch (stream_mode)
|
||||
{
|
||||
case CCX_SM_ELEMENTARY_OR_NOT_FOUND:
|
||||
if (!api_options.use_gop_as_pts) // If !0 then the user selected something
|
||||
api_options.use_gop_as_pts = 1; // Force GOP timing for ES
|
||||
ccx_common_timing_settings.is_elementary_stream = 1;
|
||||
case CCX_SM_TRANSPORT:
|
||||
case CCX_SM_PROGRAM:
|
||||
case CCX_SM_ASF:
|
||||
case CCX_SM_WTV:
|
||||
case CCX_SM_GXF:
|
||||
case CCX_SM_MXF:
|
||||
#ifdef ENABLE_FFMPEG
|
||||
case CCX_SM_FFMPEG:
|
||||
case CCX_SM_FFMPEG:
|
||||
#endif
|
||||
if (!api_options.use_gop_as_pts) // If !0 then the user selected something
|
||||
api_options.use_gop_as_pts = 0;
|
||||
if (api_options.ignore_pts_jumps)
|
||||
ccx_common_timing_settings.disable_sync_check = 1;
|
||||
mprint ("\rAnalyzing data in general mode\n");
|
||||
tmp = general_loop(ctx);
|
||||
if (!ret) ret = tmp;
|
||||
break;
|
||||
case CCX_SM_MCPOODLESRAW:
|
||||
mprint ("\rAnalyzing data in McPoodle raw mode\n");
|
||||
tmp = raw_loop(ctx);
|
||||
if (!ret) ret = tmp;
|
||||
break;
|
||||
case CCX_SM_RCWT:
|
||||
mprint ("\rAnalyzing data in CCExtractor's binary format\n");
|
||||
tmp = rcwt_loop(ctx);
|
||||
if (!ret) ret = tmp;
|
||||
break;
|
||||
case CCX_SM_MYTH:
|
||||
mprint ("\rAnalyzing data in MythTV mode\n");
|
||||
show_myth_banner = 1;
|
||||
tmp = myth_loop(ctx);
|
||||
if (!ret) ret = tmp;
|
||||
break;
|
||||
case CCX_SM_MP4:
|
||||
mprint ("\rAnalyzing data with GPAC (MP4 library)\n");
|
||||
close_input_file(ctx); // No need to have it open. GPAC will do it for us
|
||||
if (ctx->current_file == -1) // We don't have a file to open, must be stdin, and GPAC is incompatible with stdin
|
||||
{
|
||||
fatal (EXIT_INCOMPATIBLE_PARAMETERS, "MP4 requires an actual file, it's not possible to read from a stream, including stdin.\n");
|
||||
}
|
||||
if(api_options.extract_chapters)
|
||||
{
|
||||
tmp = dumpchapters(ctx, &ctx->mp4_cfg, ctx->inputfile[ctx->current_file]);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = processmp4(ctx, &ctx->mp4_cfg, ctx->inputfile[ctx->current_file]);
|
||||
}
|
||||
if (api_options.print_file_reports)
|
||||
print_file_report(ctx);
|
||||
if (!ret) ret = tmp;
|
||||
break;
|
||||
case CCX_SM_MKV:
|
||||
mprint ("\rAnalyzing data in Matroska mode\n");
|
||||
tmp = matroska_loop(ctx);
|
||||
if (!ret) ret = tmp;
|
||||
break;
|
||||
if (!api_options.use_gop_as_pts) // If !0 then the user selected something
|
||||
api_options.use_gop_as_pts = 0;
|
||||
if (api_options.ignore_pts_jumps)
|
||||
ccx_common_timing_settings.disable_sync_check = 1;
|
||||
mprint("\rAnalyzing data in general mode\n");
|
||||
tmp = general_loop(ctx);
|
||||
if (!ret)
|
||||
ret = tmp;
|
||||
break;
|
||||
case CCX_SM_MCPOODLESRAW:
|
||||
mprint("\rAnalyzing data in McPoodle raw mode\n");
|
||||
tmp = raw_loop(ctx);
|
||||
if (!ret)
|
||||
ret = tmp;
|
||||
break;
|
||||
case CCX_SM_RCWT:
|
||||
mprint("\rAnalyzing data in CCExtractor's binary format\n");
|
||||
tmp = rcwt_loop(ctx);
|
||||
if (!ret)
|
||||
ret = tmp;
|
||||
break;
|
||||
case CCX_SM_MYTH:
|
||||
mprint("\rAnalyzing data in MythTV mode\n");
|
||||
show_myth_banner = 1;
|
||||
tmp = myth_loop(ctx);
|
||||
if (!ret)
|
||||
ret = tmp;
|
||||
break;
|
||||
case CCX_SM_MP4:
|
||||
mprint("\rAnalyzing data with GPAC (MP4 library)\n");
|
||||
close_input_file(ctx); // No need to have it open. GPAC will do it for us
|
||||
if (ctx->current_file == -1) // We don't have a file to open, must be stdin, and GPAC is incompatible with stdin
|
||||
{
|
||||
fatal(EXIT_INCOMPATIBLE_PARAMETERS, "MP4 requires an actual file, it's not possible to read from a stream, including stdin.\n");
|
||||
}
|
||||
if (api_options.extract_chapters)
|
||||
{
|
||||
tmp = dumpchapters(ctx, &ctx->mp4_cfg, ctx->inputfile[ctx->current_file]);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = processmp4(ctx, &ctx->mp4_cfg, ctx->inputfile[ctx->current_file]);
|
||||
}
|
||||
if (api_options.print_file_reports)
|
||||
print_file_report(ctx);
|
||||
if (!ret)
|
||||
ret = tmp;
|
||||
break;
|
||||
case CCX_SM_MKV:
|
||||
mprint("\rAnalyzing data in Matroska mode\n");
|
||||
tmp = matroska_loop(ctx);
|
||||
if (!ret)
|
||||
ret = tmp;
|
||||
break;
|
||||
#ifdef WTV_DEBUG
|
||||
case CCX_SM_HEX_DUMP:
|
||||
case CCX_SM_HEX_DUMP:
|
||||
close_input_file(ctx); // process_hex will open it in text mode
|
||||
process_hex (ctx, ctx->inputfile[0]);
|
||||
process_hex(ctx, ctx->inputfile[0]);
|
||||
break;
|
||||
#endif
|
||||
case CCX_SM_AUTODETECT:
|
||||
fatal(CCX_COMMON_EXIT_BUG_BUG, "Cannot be reached!");
|
||||
break;
|
||||
}
|
||||
list_for_each_entry(dec_ctx, &ctx->dec_ctx_head, list, struct lib_cc_decode)
|
||||
{
|
||||
mprint("\n");
|
||||
dbg_print(CCX_DMT_DECODER_608, "\nTime stamps after last caption block was written:\n");
|
||||
dbg_print(CCX_DMT_DECODER_608, "GOP: %s \n", print_mstime_static(gop_time.ms) );
|
||||
case CCX_SM_AUTODETECT:
|
||||
fatal(CCX_COMMON_EXIT_BUG_BUG, "Cannot be reached!");
|
||||
break;
|
||||
}
|
||||
list_for_each_entry(dec_ctx, &ctx->dec_ctx_head, list, struct lib_cc_decode)
|
||||
{
|
||||
mprint("\n");
|
||||
dbg_print(CCX_DMT_DECODER_608, "\nTime stamps after last caption block was written:\n");
|
||||
dbg_print(CCX_DMT_DECODER_608, "GOP: %s \n", print_mstime_static(gop_time.ms));
|
||||
|
||||
dbg_print(CCX_DMT_DECODER_608, "GOP: %s (%+3dms incl.)\n",
|
||||
print_mstime_static((LLONG)(gop_time.ms
|
||||
-first_gop_time.ms
|
||||
+get_fts_max(dec_ctx->timing)-fts_at_gop_start)),
|
||||
(int)(get_fts_max(dec_ctx->timing)-fts_at_gop_start));
|
||||
// When padding is active the CC block time should be within
|
||||
// 1000/29.97 us of the differences.
|
||||
dbg_print(CCX_DMT_DECODER_608, "Max. FTS: %s (without caption blocks since then)\n",
|
||||
print_mstime_static(get_fts_max(dec_ctx->timing)));
|
||||
dbg_print(CCX_DMT_DECODER_608, "GOP: %s (%+3dms incl.)\n",
|
||||
print_mstime_static((LLONG)(gop_time.ms - first_gop_time.ms + get_fts_max(dec_ctx->timing) - fts_at_gop_start)),
|
||||
(int)(get_fts_max(dec_ctx->timing) - fts_at_gop_start));
|
||||
// When padding is active the CC block time should be within
|
||||
// 1000/29.97 us of the differences.
|
||||
dbg_print(CCX_DMT_DECODER_608, "Max. FTS: %s (without caption blocks since then)\n",
|
||||
print_mstime_static(get_fts_max(dec_ctx->timing)));
|
||||
|
||||
if (dec_ctx->codec == CCX_CODEC_ATSC_CC)
|
||||
{
|
||||
mprint ("\nTotal frames time: %s (%u frames at %.2ffps)\n",
|
||||
print_mstime_static( (LLONG)(total_frames_count*1000/current_fps) ),
|
||||
total_frames_count, current_fps);
|
||||
}
|
||||
if (dec_ctx->codec == CCX_CODEC_ATSC_CC)
|
||||
{
|
||||
mprint("\nTotal frames time: %s (%u frames at %.2ffps)\n",
|
||||
print_mstime_static((LLONG)(total_frames_count * 1000 / current_fps)),
|
||||
total_frames_count, current_fps);
|
||||
}
|
||||
|
||||
if (dec_ctx->stat_hdtv)
|
||||
{
|
||||
mprint ("\rCC type 0: %d (%s)\n", dec_ctx->cc_stats[0], cc_types[0]);
|
||||
mprint ("CC type 1: %d (%s)\n", dec_ctx->cc_stats[1], cc_types[1]);
|
||||
mprint ("CC type 2: %d (%s)\n", dec_ctx->cc_stats[2], cc_types[2]);
|
||||
mprint ("CC type 3: %d (%s)\n", dec_ctx->cc_stats[3], cc_types[3]);
|
||||
}
|
||||
// Add one frame as fts_max marks the beginning of the last frame,
|
||||
// but we need the end.
|
||||
dec_ctx->timing->fts_global += dec_ctx->timing->fts_max + (LLONG) (1000.0/current_fps);
|
||||
// CFS: At least in Hauppage mode, cb_field can be responsible for ALL the
|
||||
// timing (cb_fields having a huge number and fts_now and fts_global being 0 all
|
||||
// the time), so we need to take that into account in fts_global before resetting
|
||||
// counters.
|
||||
if (cb_field1!=0)
|
||||
dec_ctx->timing->fts_global += cb_field1*1001/3;
|
||||
else if (cb_field2!=0)
|
||||
dec_ctx->timing->fts_global += cb_field2*1001/3;
|
||||
else
|
||||
dec_ctx->timing->fts_global += cb_708*1001/3;
|
||||
// Reset counters - This is needed if some captions are still buffered
|
||||
// and need to be written after the last file is processed.
|
||||
cb_field1 = 0; cb_field2 = 0; cb_708 = 0;
|
||||
dec_ctx->timing->fts_now = 0;
|
||||
dec_ctx->timing->fts_max = 0;
|
||||
if (dec_ctx->stat_hdtv)
|
||||
{
|
||||
mprint("\rCC type 0: %d (%s)\n", dec_ctx->cc_stats[0], cc_types[0]);
|
||||
mprint("CC type 1: %d (%s)\n", dec_ctx->cc_stats[1], cc_types[1]);
|
||||
mprint("CC type 2: %d (%s)\n", dec_ctx->cc_stats[2], cc_types[2]);
|
||||
mprint("CC type 3: %d (%s)\n", dec_ctx->cc_stats[3], cc_types[3]);
|
||||
}
|
||||
// Add one frame as fts_max marks the beginning of the last frame,
|
||||
// but we need the end.
|
||||
dec_ctx->timing->fts_global += dec_ctx->timing->fts_max + (LLONG)(1000.0 / current_fps);
|
||||
// CFS: At least in Hauppage mode, cb_field can be responsible for ALL the
|
||||
// timing (cb_fields having a huge number and fts_now and fts_global being 0 all
|
||||
// the time), so we need to take that into account in fts_global before resetting
|
||||
// counters.
|
||||
if (cb_field1 != 0)
|
||||
dec_ctx->timing->fts_global += cb_field1 * 1001 / 3;
|
||||
else if (cb_field2 != 0)
|
||||
dec_ctx->timing->fts_global += cb_field2 * 1001 / 3;
|
||||
else
|
||||
dec_ctx->timing->fts_global += cb_708 * 1001 / 3;
|
||||
// Reset counters - This is needed if some captions are still buffered
|
||||
// and need to be written after the last file is processed.
|
||||
cb_field1 = 0;
|
||||
cb_field2 = 0;
|
||||
cb_708 = 0;
|
||||
dec_ctx->timing->fts_now = 0;
|
||||
dec_ctx->timing->fts_max = 0;
|
||||
|
||||
#ifdef ENABLE_SHARING
|
||||
if (api_options.sharing_enabled)
|
||||
if (api_options.sharing_enabled)
|
||||
{
|
||||
ccx_share_stream_done(ctx->basefilename);
|
||||
ccx_share_stop();
|
||||
}
|
||||
#endif //ENABLE_SHARING
|
||||
|
||||
if (dec_ctx->total_pulldownframes)
|
||||
mprint ("incl. pulldown frames: %s (%u frames at %.2ffps)\n",
|
||||
print_mstime_static( (LLONG)(dec_ctx->total_pulldownframes*1000/current_fps) ),
|
||||
dec_ctx->total_pulldownframes, current_fps);
|
||||
if (dec_ctx->timing->pts_set >= 1 && dec_ctx->timing->min_pts != 0x01FFFFFFFFLL)
|
||||
{
|
||||
LLONG postsyncms = (LLONG) (dec_ctx->frames_since_last_gop*1000/current_fps);
|
||||
mprint ("\nMin PTS: %s\n",
|
||||
print_mstime_static( dec_ctx->timing->min_pts/(MPEG_CLOCK_FREQ/1000) - dec_ctx->timing->fts_offset));
|
||||
if (pts_big_change)
|
||||
mprint ("(Reference clock was reset at some point, Min PTS is approximated)\n");
|
||||
mprint ("Max PTS: %s\n",
|
||||
print_mstime_static( dec_ctx->timing->sync_pts/(MPEG_CLOCK_FREQ/1000) + postsyncms));
|
||||
if (dec_ctx->total_pulldownframes)
|
||||
mprint("incl. pulldown frames: %s (%u frames at %.2ffps)\n",
|
||||
print_mstime_static((LLONG)(dec_ctx->total_pulldownframes * 1000 / current_fps)),
|
||||
dec_ctx->total_pulldownframes, current_fps);
|
||||
if (dec_ctx->timing->pts_set >= 1 && dec_ctx->timing->min_pts != 0x01FFFFFFFFLL)
|
||||
{
|
||||
LLONG postsyncms = (LLONG)(dec_ctx->frames_since_last_gop * 1000 / current_fps);
|
||||
mprint("\nMin PTS: %s\n",
|
||||
print_mstime_static(dec_ctx->timing->min_pts / (MPEG_CLOCK_FREQ / 1000) - dec_ctx->timing->fts_offset));
|
||||
if (pts_big_change)
|
||||
mprint("(Reference clock was reset at some point, Min PTS is approximated)\n");
|
||||
mprint("Max PTS: %s\n",
|
||||
print_mstime_static(dec_ctx->timing->sync_pts / (MPEG_CLOCK_FREQ / 1000) + postsyncms));
|
||||
|
||||
mprint ("Length: %s\n",
|
||||
print_mstime_static( dec_ctx->timing->sync_pts/(MPEG_CLOCK_FREQ/1000) + postsyncms
|
||||
- dec_ctx->timing->min_pts/(MPEG_CLOCK_FREQ/1000) + dec_ctx->timing->fts_offset ));
|
||||
}
|
||||
mprint("Length: %s\n",
|
||||
print_mstime_static(dec_ctx->timing->sync_pts / (MPEG_CLOCK_FREQ / 1000) + postsyncms - dec_ctx->timing->min_pts / (MPEG_CLOCK_FREQ / 1000) + dec_ctx->timing->fts_offset));
|
||||
}
|
||||
|
||||
// dvr-ms files have invalid GOPs
|
||||
if (gop_time.inited && first_gop_time.inited && stream_mode != CCX_SM_ASF)
|
||||
{
|
||||
mprint("\nInitial GOP time: %s\n",
|
||||
print_mstime_static(first_gop_time.ms));
|
||||
mprint("Final GOP time: %s%+3dF\n",
|
||||
print_mstime_static(gop_time.ms),
|
||||
dec_ctx->frames_since_last_gop);
|
||||
mprint("Diff. GOP length: %s%+3dF",
|
||||
print_mstime_static(gop_time.ms - first_gop_time.ms),
|
||||
dec_ctx->frames_since_last_gop);
|
||||
mprint(" (%s)\n\n",
|
||||
print_mstime_static(gop_time.ms - first_gop_time.ms + (LLONG)((dec_ctx->frames_since_last_gop) * 1000 / 29.97)));
|
||||
}
|
||||
|
||||
// dvr-ms files have invalid GOPs
|
||||
if (gop_time.inited && first_gop_time.inited && stream_mode != CCX_SM_ASF)
|
||||
{
|
||||
mprint ("\nInitial GOP time: %s\n",
|
||||
print_mstime_static(first_gop_time.ms));
|
||||
mprint ("Final GOP time: %s%+3dF\n",
|
||||
print_mstime_static(gop_time.ms),
|
||||
dec_ctx->frames_since_last_gop);
|
||||
mprint ("Diff. GOP length: %s%+3dF",
|
||||
print_mstime_static(gop_time.ms - first_gop_time.ms),
|
||||
dec_ctx->frames_since_last_gop);
|
||||
mprint (" (%s)\n\n",
|
||||
print_mstime_static(gop_time.ms - first_gop_time.ms
|
||||
+(LLONG) ((dec_ctx->frames_since_last_gop)*1000/29.97)) );
|
||||
}
|
||||
if (dec_ctx->false_pict_header)
|
||||
mprint("Number of likely false picture headers (discarded): %d\n", dec_ctx->false_pict_header);
|
||||
if (dec_ctx->num_key_frames)
|
||||
mprint("Number of key frames: %d\n", dec_ctx->num_key_frames);
|
||||
|
||||
if (dec_ctx->false_pict_header)
|
||||
mprint ("Number of likely false picture headers (discarded): %d\n",dec_ctx->false_pict_header);
|
||||
if (dec_ctx->num_key_frames)
|
||||
mprint("Number of key frames: %d\n", dec_ctx->num_key_frames);
|
||||
if (dec_ctx->stat_numuserheaders)
|
||||
mprint("Total user data fields: %d\n", dec_ctx->stat_numuserheaders);
|
||||
if (dec_ctx->stat_dvdccheaders)
|
||||
mprint("DVD-type user data fields: %d\n", dec_ctx->stat_dvdccheaders);
|
||||
if (dec_ctx->stat_scte20ccheaders)
|
||||
mprint("SCTE-20 type user data fields: %d\n", dec_ctx->stat_scte20ccheaders);
|
||||
if (dec_ctx->stat_replay4000headers)
|
||||
mprint("ReplayTV 4000 user data fields: %d\n", dec_ctx->stat_replay4000headers);
|
||||
if (dec_ctx->stat_replay5000headers)
|
||||
mprint("ReplayTV 5000 user data fields: %d\n", dec_ctx->stat_replay5000headers);
|
||||
if (dec_ctx->stat_hdtv)
|
||||
mprint("HDTV type user data fields: %d\n", dec_ctx->stat_hdtv);
|
||||
if (dec_ctx->stat_dishheaders)
|
||||
mprint("Dish Network user data fields: %d\n", dec_ctx->stat_dishheaders);
|
||||
if (dec_ctx->stat_divicom)
|
||||
{
|
||||
mprint("CEA608/Divicom user data fields: %d\n", dec_ctx->stat_divicom);
|
||||
|
||||
if (dec_ctx->stat_numuserheaders)
|
||||
mprint("Total user data fields: %d\n", dec_ctx->stat_numuserheaders);
|
||||
if (dec_ctx->stat_dvdccheaders)
|
||||
mprint("DVD-type user data fields: %d\n", dec_ctx->stat_dvdccheaders);
|
||||
if (dec_ctx->stat_scte20ccheaders)
|
||||
mprint("SCTE-20 type user data fields: %d\n", dec_ctx->stat_scte20ccheaders);
|
||||
if (dec_ctx->stat_replay4000headers)
|
||||
mprint("ReplayTV 4000 user data fields: %d\n", dec_ctx->stat_replay4000headers);
|
||||
if (dec_ctx->stat_replay5000headers)
|
||||
mprint("ReplayTV 5000 user data fields: %d\n", dec_ctx->stat_replay5000headers);
|
||||
if (dec_ctx->stat_hdtv)
|
||||
mprint("HDTV type user data fields: %d\n", dec_ctx->stat_hdtv);
|
||||
if (dec_ctx->stat_dishheaders)
|
||||
mprint("Dish Network user data fields: %d\n", dec_ctx->stat_dishheaders);
|
||||
if (dec_ctx->stat_divicom)
|
||||
{
|
||||
mprint("CEA608/Divicom user data fields: %d\n", dec_ctx->stat_divicom);
|
||||
mprint("\n\nNOTE! The CEA 608 / Divicom standard encoding for closed\n");
|
||||
mprint("caption is not well understood!\n\n");
|
||||
mprint("Please submit samples to the developers.\n\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
mprint("\n\nNOTE! The CEA 608 / Divicom standard encoding for closed\n");
|
||||
mprint("caption is not well understood!\n\n");
|
||||
mprint("Please submit samples to the developers.\n\n\n");
|
||||
}
|
||||
if (is_decoder_processed_enough(ctx) == CCX_TRUE)
|
||||
break;
|
||||
} // file loop
|
||||
close_input_file(ctx);
|
||||
|
||||
}
|
||||
prepare_for_new_file(ctx); // To reset counters used by handle_end_of_data()
|
||||
|
||||
if(is_decoder_processed_enough(ctx) == CCX_TRUE)
|
||||
break;
|
||||
} // file loop
|
||||
close_input_file(ctx);
|
||||
free((void *) ctx->extension);
|
||||
time(&final);
|
||||
|
||||
prepare_for_new_file (ctx); // To reset counters used by handle_end_of_data()
|
||||
|
||||
|
||||
time (&final);
|
||||
|
||||
long proc_time=(long) (final-start);
|
||||
mprint ("\rDone, processing time = %ld seconds\n", proc_time);
|
||||
long proc_time = (long)(final - start);
|
||||
mprint("\rDone, processing time = %ld seconds\n", proc_time);
|
||||
#if 0
|
||||
if (proc_time>0)
|
||||
if (proc_time > 0)
|
||||
{
|
||||
LLONG ratio=(get_fts_max()/10)/proc_time;
|
||||
unsigned s1=(unsigned) (ratio/100);
|
||||
unsigned s2=(unsigned) (ratio%100);
|
||||
mprint ("Performance (real length/process time) = %u.%02u\n",
|
||||
LLONG ratio = (get_fts_max() / 10) / proc_time;
|
||||
unsigned s1 = (unsigned)(ratio / 100);
|
||||
unsigned s2 = (unsigned)(ratio % 100);
|
||||
mprint("Performance (real length/process time) = %u.%02u\n",
|
||||
s1, s2);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (is_decoder_processed_enough(ctx) == CCX_TRUE)
|
||||
{
|
||||
mprint ("\rNote: Processing was canceled before all data was processed because\n");
|
||||
mprint ("\rone or more user-defined limits were reached.\n");
|
||||
}
|
||||
if (is_decoder_processed_enough(ctx) == CCX_TRUE)
|
||||
{
|
||||
mprint("\rNote: Processing was canceled before all data was processed because\n");
|
||||
mprint("\rone or more user-defined limits were reached.\n");
|
||||
}
|
||||
|
||||
#ifdef CURL
|
||||
if (curl)
|
||||
if (curl)
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
curl_global_cleanup();
|
||||
#endif
|
||||
dinit_libraries(&ctx);
|
||||
dinit_libraries(&ctx);
|
||||
|
||||
if (!ret)
|
||||
mprint("\nNo captions were found in input.\n");
|
||||
if (!ret)
|
||||
mprint("\nNo captions were found in input.\n");
|
||||
|
||||
print_end_msg();
|
||||
print_end_msg();
|
||||
|
||||
if (show_myth_banner)
|
||||
{
|
||||
mprint("NOTICE: Due to the major rework in 0.49, we needed to change part of the timing\n");
|
||||
mprint("code in the MythTV's branch. Please report results to the address above. If\n");
|
||||
mprint("something is broken it will be fixed. Thanks\n");
|
||||
}
|
||||
return ret ? EXIT_OK : EXIT_NO_CAPTIONS;
|
||||
if (show_myth_banner)
|
||||
{
|
||||
mprint("NOTICE: Due to the major rework in 0.49, we needed to change part of the timing\n");
|
||||
mprint("code in the MythTV's branch. Please report results to the address above. If\n");
|
||||
mprint("something is broken it will be fixed. Thanks\n");
|
||||
}
|
||||
return ret ? EXIT_OK : EXIT_NO_CAPTIONS;
|
||||
}
|
||||
|
||||
struct ccx_s_options* api_init_options()
|
||||
struct ccx_s_options *api_init_options()
|
||||
{
|
||||
init_options(&ccx_options);
|
||||
return &ccx_options;
|
||||
init_options(&ccx_options);
|
||||
return &ccx_options;
|
||||
}
|
||||
|
||||
void check_configuration_file(struct ccx_s_options api_options)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
parse_configuration(&api_options);
|
||||
}
|
||||
|
||||
#ifdef PYTHON_API
|
||||
int compile_params(struct ccx_s_options *api_options,int argc)
|
||||
{
|
||||
//adding the parameter ./ccextractor to the list of python_params for further parsing
|
||||
api_options->python_params = realloc(api_options->python_params, (api_options->python_param_count+1) * sizeof *api_options->python_params);
|
||||
api_options->python_params[api_options->python_param_count] = malloc(strlen("./ccextractor")+1);
|
||||
strcpy(api_options->python_params[api_options->python_param_count], "./ccextractor");
|
||||
api_options->python_param_count++;
|
||||
|
||||
char* temp = api_options->python_params[api_options->python_param_count-1];
|
||||
for (int i = api_options->python_param_count-1; i > 0; i--)
|
||||
api_options->python_params[i] = api_options->python_params[i-1];
|
||||
api_options->python_params[0] = temp;
|
||||
|
||||
int ret = parse_parameters (api_options, api_options->python_param_count, api_options->python_params);
|
||||
api_options->messages_target = CCX_MESSAGES_QUIET;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void api_add_param(struct ccx_s_options* api_options,char* arg)
|
||||
{
|
||||
api_options->python_params = realloc(api_options->python_params, (api_options->python_param_count+1) * sizeof *api_options->python_params);
|
||||
api_options->python_params[api_options->python_param_count] = malloc(strlen(arg)+1);
|
||||
strcpy(api_options->python_params[api_options->python_param_count], arg);
|
||||
api_options->python_param_count++;
|
||||
}
|
||||
|
||||
void py_callback(char *line, int encoding)
|
||||
{
|
||||
assert ( PyFunction_Check(py_callback_func) );
|
||||
PyObject* args = Py_BuildValue("(si)",line,encoding);
|
||||
PyObject_CallObject((PyObject*)py_callback_func, args);
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper function to print the i-th param submitted by the user.
|
||||
* Helpful for debugging
|
||||
*/
|
||||
char * api_param(struct ccx_s_options* api_options, int count)
|
||||
{
|
||||
return api_options->python_params[count];
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper function to get the total number of params provided by the user.
|
||||
* Helpful for debugging
|
||||
*/
|
||||
int api_param_count(struct ccx_s_options* api_options)
|
||||
{
|
||||
return api_options->python_param_count;
|
||||
}
|
||||
#endif // PYTHON_API
|
||||
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
setlocale(LC_ALL, "");
|
||||
struct ccx_s_options* api_options = api_init_options();
|
||||
check_configuration_file(*api_options);
|
||||
#ifdef PYTHON_API
|
||||
for(int i = 1; i < argc; i++)
|
||||
api_add_param(api_options,argv[i]);
|
||||
#endif
|
||||
|
||||
#ifdef PYTHON_API
|
||||
int compile_ret = compile_params(api_options,argc);
|
||||
#else
|
||||
int compile_ret = parse_parameters (api_options, argc, argv);
|
||||
#endif
|
||||
|
||||
if (compile_ret == EXIT_NO_INPUT_FILES)
|
||||
{
|
||||
print_usage ();
|
||||
fatal (EXIT_NO_INPUT_FILES, "(This help screen was shown because there were no input files)\n");
|
||||
}
|
||||
else if (compile_ret == EXIT_WITH_HELP)
|
||||
{
|
||||
return EXIT_OK;
|
||||
}
|
||||
else if (compile_ret != EXIT_OK)
|
||||
{
|
||||
exit(compile_ret);
|
||||
}
|
||||
|
||||
int start_ret = api_start(*api_options);
|
||||
return start_ret;
|
||||
setlocale(LC_ALL, ""); // Supports non-English CCs
|
||||
|
||||
struct ccx_s_options *api_options = api_init_options();
|
||||
parse_configuration(api_options);
|
||||
// If "ccextractor.cnf" is present, takes options from it.
|
||||
// See docs/ccextractor.cnf.sample for more info.
|
||||
|
||||
int compile_ret = parse_parameters(api_options, argc, argv);
|
||||
|
||||
if (compile_ret == EXIT_NO_INPUT_FILES)
|
||||
{
|
||||
print_usage();
|
||||
fatal(EXIT_NO_INPUT_FILES, "(This help screen was shown because there were no input files)\n");
|
||||
}
|
||||
else if (compile_ret == EXIT_WITH_HELP)
|
||||
{
|
||||
return EXIT_OK;
|
||||
}
|
||||
else if (compile_ret != EXIT_OK)
|
||||
{
|
||||
exit(compile_ret);
|
||||
}
|
||||
|
||||
int start_ret = api_start(*api_options);
|
||||
return start_ret;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_OCR
|
||||
#include <allheaders.h>
|
||||
#include <leptonica/allheaders.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -28,25 +28,12 @@ CURLcode res;
|
||||
#define LEPT_MSG_SEVERITY L_SEVERITY_NONE
|
||||
#endif
|
||||
|
||||
#ifdef PYTHON_API
|
||||
#include "Python.h"
|
||||
#include "funcobject.h"
|
||||
|
||||
PyObject* py_callback_func;
|
||||
void api_add_param(struct ccx_s_options* api_options,char* arg);
|
||||
int compile_params(struct ccx_s_options *api_options,int argc);
|
||||
void py_callback(char *line, int encoding);
|
||||
int api_param_count(struct ccx_s_options* api_options);
|
||||
char * api_param(struct ccx_s_options* api_options, int count);
|
||||
#endif
|
||||
|
||||
|
||||
struct ccx_s_options ccx_options;
|
||||
struct lib_ccx_ctx *signal_ctx;
|
||||
extern struct ccx_s_options ccx_options;
|
||||
extern struct lib_ccx_ctx *signal_ctx;
|
||||
//volatile int terminate_asap = 0;
|
||||
|
||||
struct ccx_s_options* api_init_options();
|
||||
void check_configuration_file(struct ccx_s_options api_options);
|
||||
|
||||
int api_start(struct ccx_s_options api_options);
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,309 +0,0 @@
|
||||
/*
|
||||
* GPAC - Multimedia Framework C SDK
|
||||
*
|
||||
* Authors: Jean Le Feuvre
|
||||
* Copyright (c) Telecom ParisTech 2006-2012
|
||||
* All rights reserved
|
||||
*
|
||||
* This file is part of GPAC / ISO Media File Format sub-project
|
||||
*
|
||||
* GPAC is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GPAC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gpac/internal/isomedia_dev.h>
|
||||
|
||||
#ifndef GPAC_DISABLE_ISOM
|
||||
|
||||
void ilst_del(GF_Box *s)
|
||||
{
|
||||
GF_ItemListBox *ptr = (GF_ItemListBox *)s;
|
||||
if (ptr == NULL) return;
|
||||
gf_free(ptr);
|
||||
}
|
||||
|
||||
GF_Err ilst_Read(GF_Box *s, GF_BitStream *bs)
|
||||
{
|
||||
GF_Err e;
|
||||
u32 sub_type;
|
||||
GF_Box *a;
|
||||
GF_ItemListBox *ptr = (GF_ItemListBox *)s;
|
||||
while (ptr->size) {
|
||||
/*if no ilst type coded, break*/
|
||||
sub_type = gf_bs_peek_bits(bs, 32, 0);
|
||||
if (sub_type) {
|
||||
e = gf_isom_box_parse(&a, bs);
|
||||
if (e) return e;
|
||||
ISOM_DECREASE_SIZE(ptr, a->size);
|
||||
gf_list_add(ptr->other_boxes, a);
|
||||
} else {
|
||||
gf_bs_read_u32(bs);
|
||||
ISOM_DECREASE_SIZE(ptr, 4);
|
||||
}
|
||||
}
|
||||
return GF_OK;
|
||||
}
|
||||
|
||||
GF_Box *ilst_New()
|
||||
{
|
||||
ISOM_DECL_BOX_ALLOC(GF_ItemListBox, GF_ISOM_BOX_TYPE_ILST);
|
||||
tmp->other_boxes = gf_list_new();
|
||||
return (GF_Box *)tmp;
|
||||
}
|
||||
|
||||
#ifndef GPAC_DISABLE_ISOM_WRITE
|
||||
|
||||
GF_Err ilst_Write(GF_Box *s, GF_BitStream *bs)
|
||||
{
|
||||
GF_Err e;
|
||||
// GF_ItemListBox *ptr = (GF_ItemListBox *)s;
|
||||
|
||||
e = gf_isom_box_write_header(s, bs);
|
||||
if (e) return e;
|
||||
|
||||
return GF_OK;
|
||||
}
|
||||
|
||||
|
||||
GF_Err ilst_Size(GF_Box *s)
|
||||
{
|
||||
return GF_OK;
|
||||
}
|
||||
|
||||
#endif /*GPAC_DISABLE_ISOM_WRITE*/
|
||||
|
||||
void ilst_item_del(GF_Box *s)
|
||||
{
|
||||
GF_ListItemBox *ptr = (GF_ListItemBox *) s;
|
||||
if (ptr == NULL) return;
|
||||
if (ptr->data != NULL) {
|
||||
if (ptr->data->data) gf_free(ptr->data->data);
|
||||
gf_free(ptr->data);
|
||||
}
|
||||
gf_free(ptr);
|
||||
}
|
||||
|
||||
GF_Err ilst_item_Read(GF_Box *s,GF_BitStream *bs)
|
||||
{
|
||||
GF_Err e;
|
||||
u32 sub_type;
|
||||
GF_Box *a = NULL;
|
||||
GF_ListItemBox *ptr = (GF_ListItemBox *)s;
|
||||
|
||||
/*iTunes way: there's a data atom containing the data*/
|
||||
sub_type = gf_bs_peek_bits(bs, 32, 4);
|
||||
if (sub_type == GF_ISOM_BOX_TYPE_DATA ) {
|
||||
e = gf_isom_box_parse(&a, bs);
|
||||
if (e) return e;
|
||||
ISOM_DECREASE_SIZE(ptr, a->size);
|
||||
|
||||
if (a && ptr->data) gf_isom_box_del((GF_Box *) ptr->data);
|
||||
ptr->data = (GF_DataBox *)a;
|
||||
}
|
||||
/*QT way*/
|
||||
else {
|
||||
ptr->data->type = 0;
|
||||
ptr->data->dataSize = gf_bs_read_u16(bs);
|
||||
gf_bs_read_u16(bs);
|
||||
ptr->data->data = (char *) gf_malloc(sizeof(char)*(ptr->data->dataSize + 1));
|
||||
gf_bs_read_data(bs, ptr->data->data, ptr->data->dataSize);
|
||||
ptr->data->data[ptr->data->dataSize] = 0;
|
||||
ISOM_DECREASE_SIZE(ptr, ptr->data->dataSize);
|
||||
}
|
||||
return GF_OK;
|
||||
}
|
||||
|
||||
GF_Box *ilst_item_New(u32 type)
|
||||
{
|
||||
ISOM_DECL_BOX_ALLOC(GF_ListItemBox, type);
|
||||
|
||||
tmp->data = (GF_DataBox *)gf_isom_box_new(GF_ISOM_BOX_TYPE_DATA);
|
||||
|
||||
if (tmp->data == NULL) {
|
||||
gf_free(tmp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (GF_Box *)tmp;
|
||||
}
|
||||
|
||||
#ifndef GPAC_DISABLE_ISOM_WRITE
|
||||
|
||||
GF_Err ilst_item_Write(GF_Box *s, GF_BitStream *bs)
|
||||
{
|
||||
GF_Err e;
|
||||
GF_ListItemBox *ptr = (GF_ListItemBox *) s;
|
||||
|
||||
e = gf_isom_box_write_header(s, bs);
|
||||
if (e) return e;
|
||||
|
||||
/*iTune way*/
|
||||
if (ptr->data->type) return gf_isom_box_write((GF_Box* )ptr->data, bs);
|
||||
/*QT way*/
|
||||
gf_bs_write_u16(bs, ptr->data->dataSize);
|
||||
gf_bs_write_u16(bs, 0);
|
||||
gf_bs_write_data(bs, ptr->data->data, ptr->data->dataSize);
|
||||
return GF_OK;
|
||||
}
|
||||
|
||||
GF_Err ilst_item_Size(GF_Box *s)
|
||||
{
|
||||
GF_Err e;
|
||||
GF_ListItemBox *ptr = (GF_ListItemBox *)s;
|
||||
|
||||
/*iTune way*/
|
||||
if (ptr->data && ptr->data->type) {
|
||||
e = gf_isom_box_size((GF_Box *)ptr->data);
|
||||
if (e) return e;
|
||||
ptr->size += ptr->data->size;
|
||||
}
|
||||
/*QT way*/
|
||||
else if (ptr->data) {
|
||||
ptr->size += ptr->data->dataSize + 4;
|
||||
}
|
||||
return GF_OK;
|
||||
}
|
||||
|
||||
#endif /*GPAC_DISABLE_ISOM_WRITE*/
|
||||
|
||||
void databox_del(GF_Box *s)
|
||||
{
|
||||
GF_DataBox *ptr = (GF_DataBox *) s;
|
||||
if (ptr == NULL) return;
|
||||
if (ptr->data)
|
||||
gf_free(ptr->data);
|
||||
gf_free(ptr);
|
||||
|
||||
}
|
||||
|
||||
GF_Err databox_Read(GF_Box *s,GF_BitStream *bs)
|
||||
{
|
||||
GF_DataBox *ptr = (GF_DataBox *)s;
|
||||
|
||||
ptr->reserved = gf_bs_read_int(bs, 32);
|
||||
ISOM_DECREASE_SIZE(ptr, 4);
|
||||
|
||||
if (ptr->size) {
|
||||
ptr->dataSize = (u32) ptr->size;
|
||||
ptr->data = (char*)gf_malloc(ptr->dataSize * sizeof(ptr->data[0]) + 1);
|
||||
if (ptr->data == NULL) return GF_OUT_OF_MEM;
|
||||
ptr->data[ptr->dataSize] = 0;
|
||||
gf_bs_read_data(bs, ptr->data, ptr->dataSize);
|
||||
}
|
||||
|
||||
return GF_OK;
|
||||
}
|
||||
|
||||
GF_Box *databox_New()
|
||||
{
|
||||
ISOM_DECL_BOX_ALLOC(GF_DataBox, GF_ISOM_BOX_TYPE_DATA);
|
||||
|
||||
return (GF_Box *)tmp;
|
||||
}
|
||||
|
||||
#ifndef GPAC_DISABLE_ISOM_WRITE
|
||||
|
||||
GF_Err databox_Write(GF_Box *s, GF_BitStream *bs)
|
||||
{
|
||||
GF_Err e;
|
||||
GF_DataBox *ptr = (GF_DataBox *) s;
|
||||
|
||||
e = gf_isom_full_box_write(s, bs);
|
||||
if (e) return e;
|
||||
gf_bs_write_int(bs, ptr->reserved, 32);
|
||||
if(ptr->data != NULL && ptr->dataSize > 0) {
|
||||
gf_bs_write_data(bs, ptr->data, ptr->dataSize);
|
||||
}
|
||||
return GF_OK;
|
||||
}
|
||||
|
||||
GF_Err databox_Size(GF_Box *s)
|
||||
{
|
||||
GF_DataBox *ptr = (GF_DataBox *)s;
|
||||
|
||||
ptr->size += 4;
|
||||
if(ptr->data != NULL && ptr->dataSize > 0) {
|
||||
ptr->size += ptr->dataSize;
|
||||
}
|
||||
return GF_OK;
|
||||
}
|
||||
|
||||
#endif /*GPAC_DISABLE_ISOM_WRITE*/
|
||||
|
||||
GF_MetaBox *gf_isom_apple_get_meta_extensions(GF_ISOFile *mov)
|
||||
{
|
||||
u32 i;
|
||||
GF_MetaBox *meta;
|
||||
GF_UserDataMap *map;
|
||||
|
||||
if (!mov || !mov->moov) return NULL;
|
||||
|
||||
if (!mov->moov->udta) return NULL;
|
||||
map = udta_getEntry(mov->moov->udta, GF_ISOM_BOX_TYPE_META, NULL);
|
||||
if (!map) return NULL;
|
||||
|
||||
for(i = 0; i < gf_list_count(map->other_boxes); i++) {
|
||||
meta = (GF_MetaBox*)gf_list_get(map->other_boxes, i);
|
||||
|
||||
if(meta != NULL && meta->handler != NULL && meta->handler->handlerType == GF_ISOM_HANDLER_TYPE_MDIR) return meta;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef GPAC_DISABLE_ISOM_WRITE
|
||||
GF_MetaBox *gf_isom_apple_create_meta_extensions(GF_ISOFile *mov)
|
||||
{
|
||||
GF_Err e;
|
||||
u32 i;
|
||||
GF_MetaBox *meta;
|
||||
GF_UserDataMap *map;
|
||||
|
||||
if (!mov || !mov->moov) return NULL;
|
||||
|
||||
if (!mov->moov->udta) {
|
||||
e = moov_AddBox((GF_Box*)mov->moov, gf_isom_box_new(GF_ISOM_BOX_TYPE_UDTA));
|
||||
if (e) return NULL;
|
||||
}
|
||||
|
||||
map = udta_getEntry(mov->moov->udta, GF_ISOM_BOX_TYPE_META, NULL);
|
||||
if (map) {
|
||||
for(i = 0; i < gf_list_count(map->other_boxes); i++) {
|
||||
meta = (GF_MetaBox*)gf_list_get(map->other_boxes, i);
|
||||
|
||||
if(meta != NULL && meta->handler != NULL && meta->handler->handlerType == GF_ISOM_HANDLER_TYPE_MDIR) return meta;
|
||||
}
|
||||
}
|
||||
|
||||
meta = (GF_MetaBox *)gf_isom_box_new(GF_ISOM_BOX_TYPE_META);
|
||||
|
||||
if(meta != NULL) {
|
||||
meta->handler = (GF_HandlerBox *)gf_isom_box_new(GF_ISOM_BOX_TYPE_HDLR);
|
||||
if(meta->handler == NULL) {
|
||||
gf_isom_box_del((GF_Box *)meta);
|
||||
return NULL;
|
||||
}
|
||||
meta->handler->handlerType = GF_ISOM_HANDLER_TYPE_MDIR;
|
||||
if (!meta->other_boxes) meta->other_boxes = gf_list_new();
|
||||
gf_list_add(meta->other_boxes, gf_isom_box_new(GF_ISOM_BOX_TYPE_ILST));
|
||||
udta_AddBox((GF_Box *)mov->moov->udta, (GF_Box *)meta);
|
||||
}
|
||||
|
||||
return meta;
|
||||
}
|
||||
#endif /*GPAC_DISABLE_ISOM_WRITE*/
|
||||
|
||||
|
||||
#endif /*GPAC_DISABLE_ISOM*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,327 +0,0 @@
|
||||
/*
|
||||
* GPAC - Multimedia Framework C SDK
|
||||
*
|
||||
* Authors: Jean Le Feuvre
|
||||
* Copyright (c) Telecom ParisTech 2000-2012
|
||||
* All rights reserved
|
||||
*
|
||||
* This file is part of GPAC / Authoring Tools sub-project
|
||||
*
|
||||
* GPAC is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GPAC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GF_PARSERS_AV_H_
|
||||
#define _GF_PARSERS_AV_H_
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file <gpac/avparse.h>
|
||||
* \brief Utility tools for audio and video raw media parsing.
|
||||
*/
|
||||
|
||||
/*! \defgroup media_grp Media Tools
|
||||
* You will find in this module the documentation of all media tools in GPAC.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
* \addtogroup avp_grp AV Parsing
|
||||
* \ingroup media_grp
|
||||
* \brief Utility tools for audio and video raw media parsing.
|
||||
*
|
||||
*This section documents the audio and video parsing functions of the GPAC framework.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#include <gpac/bitstream.h>
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
Reduces input width/height to common aspect ration num/denum values
|
||||
\param width width of the aspect ratio
|
||||
\param height height of the aspect ratio
|
||||
*/
|
||||
void gf_media_reduce_aspect_ratio(u32 *width, u32 *height);
|
||||
|
||||
/*!
|
||||
Reduces input FPS to a more compact value (eg 25000/1000 -> 25/1)
|
||||
\param timescale timescale of the aspect ratio
|
||||
\param sample_dur sample duration of the aspect ratio in the given timescale
|
||||
*/
|
||||
void gf_media_get_reduced_frame_rate(u32 *timescale, u32 *sample_dur);
|
||||
|
||||
|
||||
/*basic MPEG (1,2,4) visual object parser (DSI extraction and timing/framing)*/
|
||||
typedef struct
|
||||
{
|
||||
/*video PL*/
|
||||
u8 VideoPL;
|
||||
u8 RAP_stream, objectType, has_shape, enh_layer;
|
||||
/*video resolution*/
|
||||
u16 width, height;
|
||||
/*pixel aspect ratio*/
|
||||
u8 par_num, par_den;
|
||||
|
||||
u16 clock_rate;
|
||||
u8 NumBitsTimeIncrement;
|
||||
u32 time_increment;
|
||||
/*for MPEG 1/2*/
|
||||
Double fps;
|
||||
|
||||
u32 next_object_start;
|
||||
} GF_M4VDecSpecInfo;
|
||||
|
||||
|
||||
typedef struct __tag_m4v_parser GF_M4VParser;
|
||||
|
||||
#ifndef GPAC_DISABLE_AV_PARSERS
|
||||
|
||||
GF_M4VParser *gf_m4v_parser_new(char *data, u64 data_size, Bool mpeg12video);
|
||||
GF_M4VParser *gf_m4v_parser_bs_new(GF_BitStream *bs, Bool mpeg12video);
|
||||
void gf_m4v_parser_del(GF_M4VParser *m4v);
|
||||
GF_Err gf_m4v_parse_config(GF_M4VParser *m4v, GF_M4VDecSpecInfo *dsi);
|
||||
|
||||
/*get a frame (can contain GOP). The parser ALWAYS resync on the next object in the bitstream
|
||||
thus you can seek the bitstream to copy the payload without re-seeking it */
|
||||
GF_Err gf_m4v_parse_frame(GF_M4VParser *m4v, GF_M4VDecSpecInfo dsi, u8 *frame_type, u32 *time_inc, u64 *size, u64 *start, Bool *is_coded);
|
||||
/*returns current object start in bitstream*/
|
||||
u64 gf_m4v_get_object_start(GF_M4VParser *m4v);
|
||||
/*returns 1 if current object is a valid MPEG-4 Visual object*/
|
||||
Bool gf_m4v_is_valid_object_type(GF_M4VParser *m4v);
|
||||
/*decodes DSI/VOSHeader for MPEG4*/
|
||||
GF_Err gf_m4v_get_config(char *rawdsi, u32 rawdsi_size, GF_M4VDecSpecInfo *dsi);
|
||||
/*decodes DSI/VOSHeader for MPEG12*/
|
||||
GF_Err gf_mpegv12_get_config(char *rawdsi, u32 rawdsi_size, GF_M4VDecSpecInfo *dsi);
|
||||
|
||||
/*rewrites PL code in DSI*/
|
||||
void gf_m4v_rewrite_pl(char **io_dsi, u32 *io_dsi_len, u8 PL);
|
||||
/*rewrites PAR code in DSI. Negative values will remove the par*/
|
||||
GF_Err gf_m4v_rewrite_par(char **o_data, u32 *o_dataLen, s32 par_n, s32 par_d);
|
||||
|
||||
#endif /*GPAC_DISABLE_AV_PARSERS*/
|
||||
|
||||
/*returns readable description of profile*/
|
||||
const char *gf_m4v_get_profile_name(u8 video_pl);
|
||||
|
||||
#ifndef GPAC_DISABLE_AV_PARSERS
|
||||
s32 gf_mv12_next_start_code(unsigned char *pbuffer, u32 buflen, u32 *optr, u32 *scode);
|
||||
s32 gf_mv12_next_slice_start(unsigned char *pbuffer, u32 startoffset, u32 buflen, u32 *slice_offset);
|
||||
|
||||
#endif /* GPAC_DISABLE_AV_PARSERS*/
|
||||
|
||||
#ifndef GPAC_DISABLE_AV_PARSERS
|
||||
|
||||
/*MP3 tools*/
|
||||
u8 gf_mp3_num_channels(u32 hdr);
|
||||
u16 gf_mp3_sampling_rate(u32 hdr);
|
||||
u16 gf_mp3_window_size(u32 hdr);
|
||||
u32 gf_mp3_bit_rate(u32 hdr);
|
||||
u8 gf_mp3_object_type_indication(u32 hdr);
|
||||
u8 gf_mp3_layer(u32 hdr);
|
||||
u16 gf_mp3_frame_size(u32 hdr);
|
||||
u32 gf_mp3_get_next_header(FILE* in);
|
||||
u32 gf_mp3_get_next_header_mem(const char *buffer, u32 size, u32 *pos);
|
||||
|
||||
#endif /*GPAC_DISABLE_AV_PARSERS*/
|
||||
|
||||
u8 gf_mp3_version(u32 hdr);
|
||||
const char *gf_mp3_version_name(u32 hdr);
|
||||
|
||||
|
||||
|
||||
#if !defined(GPAC_DISABLE_AV_PARSERS) && !defined (GPAC_DISABLE_OGG)
|
||||
|
||||
/*vorbis tools*/
|
||||
typedef struct
|
||||
{
|
||||
u32 sample_rate, channels, version;
|
||||
s32 max_r, avg_r, low_r;
|
||||
u32 min_block, max_block;
|
||||
|
||||
/*do not touch, parser private*/
|
||||
Bool is_init;
|
||||
u32 modebits;
|
||||
Bool mode_flag[64];
|
||||
} GF_VorbisParser;
|
||||
|
||||
/*call with vorbis header packets - you MUST initialize the structure to 0 before!!
|
||||
returns 1 if success, 0 if error.*/
|
||||
Bool gf_vorbis_parse_header(GF_VorbisParser *vp, char *data, u32 data_len);
|
||||
/*returns 0 if init error or not a vorbis frame, otherwise returns the number of audio samples
|
||||
in this frame*/
|
||||
u32 gf_vorbis_check_frame(GF_VorbisParser *vp, char *data, u32 data_length);
|
||||
|
||||
#endif /*!defined(GPAC_DISABLE_AV_PARSERS) && !defined (GPAC_DISABLE_OGG)*/
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
GF_M4A_AAC_MAIN = 1,
|
||||
GF_M4A_AAC_LC = 2,
|
||||
GF_M4A_AAC_SSR = 3,
|
||||
GF_M4A_AAC_LTP = 4,
|
||||
GF_M4A_AAC_SBR = 5,
|
||||
GF_M4A_AAC_SCALABLE = 6,
|
||||
GF_M4A_TWINVQ = 7,
|
||||
GF_M4A_CELP = 8,
|
||||
GF_M4A_HVXC = 9,
|
||||
GF_M4A_TTSI = 12,
|
||||
GF_M4A_MAIN_SYNTHETIC = 13,
|
||||
GF_M4A_WAVETABLE_SYNTHESIS = 14,
|
||||
GF_M4A_GENERAL_MIDI = 15,
|
||||
GF_M4A_ALGO_SYNTH_AUDIO_FX = 16,
|
||||
GF_M4A_ER_AAC_LC = 17,
|
||||
GF_M4A_ER_AAC_LTP = 19,
|
||||
GF_M4A_ER_AAC_SCALABLE = 20,
|
||||
GF_M4A_ER_TWINVQ = 21,
|
||||
GF_M4A_ER_BSAC = 22,
|
||||
GF_M4A_ER_AAC_LD = 23,
|
||||
GF_M4A_ER_CELP = 24,
|
||||
GF_M4A_ER_HVXC = 25,
|
||||
GF_M4A_ER_HILN = 26,
|
||||
GF_M4A_ER_PARAMETRIC = 27,
|
||||
GF_M4A_SSC = 28,
|
||||
GF_M4A_AAC_PS = 29,
|
||||
GF_M4A_LAYER1 = 32,
|
||||
GF_M4A_LAYER2 = 33,
|
||||
GF_M4A_LAYER3 = 34,
|
||||
GF_M4A_DST = 35,
|
||||
GF_M4A_ALS = 36
|
||||
};
|
||||
|
||||
#ifndef GPAC_DISABLE_AV_PARSERS
|
||||
|
||||
static const u32 GF_M4ASampleRates[] =
|
||||
{
|
||||
96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050,
|
||||
16000, 12000, 11025, 8000, 7350, 0, 0, 0
|
||||
};
|
||||
|
||||
/*new values should now be defined in 23001-8*/
|
||||
static const u32 GF_M4ANumChannels[] =
|
||||
{
|
||||
1, 2, 3, 4, 5, 6, 8, 2, 3, 4, 7, 8, 24, 8, 12, 10, 12, 14
|
||||
};
|
||||
|
||||
/*returns channel config value (as written in AAC DSI) for the given number of channels*/
|
||||
u32 gf_m4a_get_channel_cfg(u32 nb_chan);
|
||||
|
||||
/*get Audio type from dsi. return audio codec type:*/
|
||||
typedef struct
|
||||
{
|
||||
u32 nb_chan;
|
||||
u32 base_object_type, base_sr, base_sr_index;
|
||||
/*SBR*/
|
||||
Bool has_sbr;
|
||||
u32 sbr_object_type, sbr_sr, sbr_sr_index;
|
||||
/*PS*/
|
||||
Bool has_ps;
|
||||
/*PL indication*/
|
||||
u8 audioPL;
|
||||
|
||||
/*program config element*/
|
||||
Bool program_config_element_present, mono_mixdown_present, stereo_mixdown_present, matrix_mixdown_idx_present, pseudo_surround_enable ;
|
||||
u8 element_instance_tag, object_type, sampling_frequency_index, num_front_channel_elements, num_side_channel_elements, num_back_channel_elements, num_lfe_channel_elements, num_assoc_data_elements, num_valid_cc_elements;
|
||||
u8 mono_mixdown_element_number, stereo_mixdown_element_number, matrix_mixdown_idx;
|
||||
|
||||
u8 front_element_is_cpe[15], front_element_tag_select[15];
|
||||
u8 side_element_is_cpe[15], side_element_tag_select[15];
|
||||
u8 back_element_is_cpe[15], back_element_tag_select[15];
|
||||
u8 lfe_element_tag_select[15];
|
||||
u8 assoc_data_element_tag_select[15];
|
||||
u8 cc_element_is_ind_sw[15], valid_cc_element_tag_select[15];
|
||||
u8 comment_field_bytes;
|
||||
u8 comments[255];
|
||||
} GF_M4ADecSpecInfo;
|
||||
|
||||
/*parses dsi and updates audioPL*/
|
||||
GF_Err gf_m4a_get_config(char *dsi, u32 dsi_size, GF_M4ADecSpecInfo *cfg);
|
||||
/*gets audioPL for given cfg*/
|
||||
u32 gf_m4a_get_profile(GF_M4ADecSpecInfo *cfg);
|
||||
|
||||
GF_Err gf_m4a_write_config(GF_M4ADecSpecInfo *cfg, char **dsi, u32 *dsi_size);
|
||||
GF_Err gf_m4a_write_config_bs(GF_BitStream *bs, GF_M4ADecSpecInfo *cfg);
|
||||
GF_Err gf_m4a_parse_config(GF_BitStream *bs, GF_M4ADecSpecInfo *cfg, Bool size_known);
|
||||
|
||||
#endif /*GPAC_DISABLE_AV_PARSERS*/
|
||||
|
||||
const char *gf_m4a_object_type_name(u32 objectType);
|
||||
const char *gf_m4a_get_profile_name(u8 audio_pl);
|
||||
|
||||
#ifndef GPAC_DISABLE_AV_PARSERS
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 bitrate;
|
||||
u32 sample_rate;
|
||||
u32 framesize;
|
||||
u32 channels;
|
||||
u16 substreams; //bit-mask, used for channel map > 5.1
|
||||
/*only set if full parse*/
|
||||
u8 fscod, bsid, bsmod, acmod, lfon, brcode;
|
||||
} GF_AC3Header;
|
||||
|
||||
Bool gf_ac3_parser(u8 *buffer, u32 buffer_size, u32 *pos, GF_AC3Header *out_hdr, Bool full_parse);
|
||||
Bool gf_ac3_parser_bs(GF_BitStream *bs, GF_AC3Header *hdr, Bool full_parse);
|
||||
Bool gf_eac3_parser_bs(GF_BitStream *bs, GF_AC3Header *hdr, Bool full_parse);
|
||||
u32 gf_ac3_get_channels(u32 acmod);
|
||||
u32 gf_ac3_get_bitrate(u32 brcode);
|
||||
|
||||
GF_Err gf_avc_get_sps_info(char *sps, u32 sps_size, u32 *sps_id, u32 *width, u32 *height, s32 *par_n, s32 *par_d);
|
||||
GF_Err gf_avc_get_pps_info(char *pps, u32 pps_size, u32 *pps_id, u32 *sps_id);
|
||||
|
||||
//hevc_state is optional but shall be used for layer extensions since all size info is in VPS and not SPS
|
||||
GF_Err gf_hevc_get_sps_info(char *sps_data, u32 sps_size, u32 *sps_id, u32 *width, u32 *height, s32 *par_n, s32 *par_d);
|
||||
#endif /*GPAC_DISABLE_AV_PARSERS*/
|
||||
|
||||
//get chroma format name from chroma format (1: 420, 2: 422, 3: 444
|
||||
const char * gf_avc_hevc_get_chroma_format_name(u8 chroma_format);
|
||||
/*get AVC profile name from profile indication*/
|
||||
const char *gf_avc_get_profile_name(u8 profile_idc);
|
||||
/*returns true if given profile is in range extensions*/
|
||||
Bool gf_avc_is_rext_profile(u8 profile_idc);
|
||||
/*get HEVC profile name from profile indication*/
|
||||
const char *gf_hevc_get_profile_name(u8 profile_idc);
|
||||
|
||||
|
||||
/*gets image size (bs must contain the whole image)
|
||||
@OTI: image type (JPEG=0x6C, PNG=0x6D)
|
||||
@width, height: image resolution - for jpeg max size if thumbnail included*/
|
||||
void gf_img_parse(GF_BitStream *bs, u8 *OTI, u32 *mtype, u32 *width, u32 *height, char **dsi, u32 *dsi_len);
|
||||
|
||||
GF_Err gf_img_jpeg_dec(char *jpg, u32 jpg_size, u32 *width, u32 *height, u32 *pixel_format, char *dst, u32 *dst_size, u32 dst_nb_comp);
|
||||
|
||||
GF_Err gf_img_png_dec(char *png, u32 png_size, u32 *width, u32 *height, u32 *pixel_format, char *dst, u32 *dst_size);
|
||||
GF_Err gf_img_file_dec(char *png_file, u32 *oti, u32 *width, u32 *height, u32 *pixel_format, char **dst, u32 *dst_size);
|
||||
GF_Err gf_img_png_enc(char *data, u32 width, u32 height, s32 stride, u32 pixel_format, char *dst, u32 *dst_size);
|
||||
GF_Err gf_img_png_enc_file(char *data, u32 width, u32 height, s32 stride, u32 pixel_format, char *dst_file);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*_GF_PARSERS_AV_H_*/
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* GPAC - Multimedia Framework C SDK
|
||||
*
|
||||
* Authors: Jean Le Feuvre
|
||||
* Copyright (c) Telecom ParisTech 2000-2012
|
||||
* All rights reserved
|
||||
*
|
||||
* This file is part of GPAC / common tools sub-project
|
||||
*
|
||||
* GPAC is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GPAC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GF_BASE_CODING_H_
|
||||
#define _GF_BASE_CODING_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file <gpac/base_coding.h>
|
||||
* \brief Base 16 and 64 coding.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \addtogroup bascod_grp Base coding
|
||||
* \ingroup utils_grp
|
||||
* \brief Base 16 and 64 coding
|
||||
*
|
||||
* This section documents the base encoding and decoding functions of the GPAC framework.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <gpac/tools.h>
|
||||
|
||||
#ifndef GPAC_DISABLE_CORE_TOOLS
|
||||
|
||||
/*!
|
||||
*\brief base64 encoder
|
||||
*
|
||||
*Encodes a data buffer to Base64
|
||||
*\param in_buffer input data buffer
|
||||
*\param in_buffer_size input data buffer size
|
||||
*\param out_buffer output Base64 buffer location
|
||||
*\param out_buffer_size output Base64 buffer allocated size
|
||||
*\return size of the encoded Base64 buffer
|
||||
*\note the encoded data buffer is not NULL-terminated.
|
||||
*/
|
||||
u32 gf_base64_encode(const char *in_buffer, u32 in_buffer_size, char *out_buffer, u32 out_buffer_size);
|
||||
/*!
|
||||
*\brief base64 decoder
|
||||
*
|
||||
*Decodes a Base64 buffer to data
|
||||
*\param in_buffer input Base64 buffer
|
||||
*\param in_buffer_size input Base64 buffer size
|
||||
*\param out_buffer output data buffer location
|
||||
*\param out_buffer_size output data buffer allocated size
|
||||
*\return size of the decoded buffer
|
||||
*/
|
||||
u32 gf_base64_decode(char *in_buffer, u32 in_buffer_size, char *out_buffer, u32 out_buffer_size);
|
||||
|
||||
/*!
|
||||
*\brief base16 encoder
|
||||
*
|
||||
*Encodes a data buffer to Base16
|
||||
*\param in_buffer input data buffer
|
||||
*\param in_buffer_size input data buffer size
|
||||
*\param out_buffer output Base16 buffer location
|
||||
*\param out_buffer_size output Base16 buffer allocated size
|
||||
*\return size of the encoded Base16 buffer
|
||||
*\note the encoded data buffer is not NULL-terminated.
|
||||
*/
|
||||
u32 gf_base16_encode(char *in_buffer, u32 in_buffer_size, char *out_buffer, u32 out_buffer_size);
|
||||
|
||||
/*!
|
||||
*\brief base16 decoder
|
||||
*
|
||||
*Decodes a Base16 buffer to data
|
||||
*\param in_buffer input Base16 buffer
|
||||
*\param in_buffer_size input Base16 buffer size
|
||||
*\param out_buffer output data buffer location
|
||||
*\param out_buffer_size output data buffer allocated size
|
||||
*\return size of the decoded buffer
|
||||
*/
|
||||
u32 gf_base16_decode(char *in_buffer, u32 in_buffer_size, char *out_buffer, u32 out_buffer_size);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*GPAC_DISABLE_CORE_TOOLS*/
|
||||
|
||||
#endif /*_GF_BASE_CODING_H_*/
|
||||
@@ -1,565 +0,0 @@
|
||||
/*
|
||||
* GPAC - Multimedia Framework C SDK
|
||||
*
|
||||
* Authors: Jean Le Feuvre
|
||||
* Copyright (c) Telecom ParisTech 2000-2012
|
||||
* All rights reserved
|
||||
*
|
||||
* This file is part of GPAC / common tools sub-project
|
||||
*
|
||||
* GPAC is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GPAC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GF_BITSTREAM_H_
|
||||
#define _GF_BITSTREAM_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file <gpac/bitstream.h>
|
||||
* \brief bitstream reading and writing.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \addtogroup bs_grp Bitstream
|
||||
* \ingroup utils_grp
|
||||
* \brief BitStream object
|
||||
*
|
||||
* This section documents the bitstream object of the GPAC framework.
|
||||
* \note Unless specified, all functions assume Big-Endian ordering of data in the bitstream.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <gpac/tools.h>
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
GF_BITSTREAM_READ = 0,
|
||||
GF_BITSTREAM_WRITE
|
||||
};
|
||||
|
||||
typedef struct __tag_bitstream GF_BitStream;
|
||||
|
||||
/*!
|
||||
* \brief bitstream constructor
|
||||
*
|
||||
* Constructs a bitstream from a buffer (read or write mode)
|
||||
* \param buffer buffer to read or write. In WRITE mode, this can be NULL to let the bitstream object dynamically allocate memory, in which case the size param is ignored.
|
||||
* \param size size of the buffer given.
|
||||
* \param mode operation mode for this bitstream: GF_BITSTREAM_READ for read, GF_BITSTREAM_WRITE for write.
|
||||
* \return new bitstream object
|
||||
* \note In write mode on an existing data buffer, data overflow is never signaled but simply ignored, it is the caller responsability to ensure it
|
||||
* does not write more than possible.
|
||||
*/
|
||||
GF_BitStream *gf_bs_new(const char *buffer, u64 size, u32 mode);
|
||||
|
||||
/*!
|
||||
* \brief bitstream reassignment
|
||||
*
|
||||
* Reassigns a bitstream in GF_BITSTREAM_READ mode to a new buffer
|
||||
* \param bs the bitstream to reassign
|
||||
* \param buffer buffer to read
|
||||
* \param size size of the buffer given.
|
||||
* \return error code if any
|
||||
*/
|
||||
GF_Err gf_bs_reassign_buffer(GF_BitStream *bs, const char *buffer, u64 size);
|
||||
|
||||
/*!
|
||||
* \brief bitstream constructor from file handle
|
||||
*
|
||||
* Creates a bitstream from a file handle.
|
||||
* \param f handle of the file to use. This handle must be created with binary mode.
|
||||
* \param mode operation mode for this bitstream: GF_BITSTREAM_READ for read, GF_BITSTREAM_WRITE for write.
|
||||
* \return new bitstream object
|
||||
* \note - You have to open your file in the appropriated mode:\n
|
||||
* - GF_BITSTREAM_READ: bitstream is constructed for reading\n
|
||||
* - GF_BITSTREAM_WRITE: bitstream is constructed for writing\n
|
||||
* \note - you may use any of these modes for a file with read/write access.
|
||||
* \warning RESULTS ARE UNEXPECTED IF YOU TOUCH THE FILE WHILE USING THE BITSTREAM.
|
||||
*/
|
||||
GF_BitStream *gf_bs_from_file(FILE *f, u32 mode);
|
||||
/*!
|
||||
* \brief bitstream destructor from file handle
|
||||
*
|
||||
* Deletes the bitstream object. If the buffer was created by the bitstream, it is deleted if still present.
|
||||
*/
|
||||
void gf_bs_del(GF_BitStream *bs);
|
||||
|
||||
/*!
|
||||
* \brief sets bitstream write cache size
|
||||
*
|
||||
* Sets the write cache size for file-based bitstreams.
|
||||
* \param bs the target bitstream
|
||||
* \param size size of the write cache in bytes
|
||||
* \return error if any.
|
||||
*/
|
||||
GF_Err gf_bs_set_output_buffering(GF_BitStream *bs, u32 size);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief gets bitstream write cache size
|
||||
*
|
||||
* Gets the write cache size for file-based bitstreams.
|
||||
* \param bs the target bitstream
|
||||
* \return size of the write cache in bytes, 0 if no cache
|
||||
*/
|
||||
u32 gf_bs_get_output_buffering(GF_BitStream *bs);
|
||||
|
||||
/*!
|
||||
* \brief integer reading
|
||||
*
|
||||
* Reads an integer coded on a number of bit.
|
||||
* \param bs the target bitstream
|
||||
* \param nBits the number of bits to read
|
||||
* \return the integer value read.
|
||||
*/
|
||||
u32 gf_bs_read_int(GF_BitStream *bs, u32 nBits);
|
||||
/*!
|
||||
* \brief large integer reading
|
||||
*
|
||||
* Reads a large integer coded on a number of bit bigger than 32.
|
||||
* \param bs the target bitstream
|
||||
* \param nBits the number of bits to read
|
||||
* \return the large integer value read.
|
||||
*/
|
||||
u64 gf_bs_read_long_int(GF_BitStream *bs, u32 nBits);
|
||||
/*!
|
||||
* \brief float reading
|
||||
*
|
||||
* Reads a float coded as IEEE 32 bit format.
|
||||
* \param bs the target bitstream
|
||||
* \return the float value read.
|
||||
*/
|
||||
Float gf_bs_read_float(GF_BitStream *bs);
|
||||
/*!
|
||||
* \brief double reading
|
||||
*
|
||||
* Reads a double coded as IEEE 64 bit format.
|
||||
* \param bs the target bitstream
|
||||
* \return the double value read.
|
||||
*/
|
||||
Double gf_bs_read_double(GF_BitStream *bs);
|
||||
/*!
|
||||
* \brief data reading
|
||||
*
|
||||
* Reads a data buffer
|
||||
* \param bs the target bitstream
|
||||
* \param data the data buffer to be filled
|
||||
* \param nbBytes the amount of bytes to read
|
||||
* \return the number of bytes actually read.
|
||||
* \warning the data buffer passed must be large enough to hold the desired amount of bytes.
|
||||
*/
|
||||
u32 gf_bs_read_data(GF_BitStream *bs, char *data, u32 nbBytes);
|
||||
|
||||
/*!
|
||||
* \brief align char reading
|
||||
*
|
||||
* Reads an integer coded on 8 bits starting at a byte boundary in the bitstream.
|
||||
* \warning you must not use this function if the bitstream is not aligned
|
||||
* \param bs the target bitstream
|
||||
* \return the char value read.
|
||||
*/
|
||||
u32 gf_bs_read_u8(GF_BitStream *bs);
|
||||
|
||||
/*!
|
||||
* \brief align char reading until reaching the given value
|
||||
*
|
||||
* Reads an integer coded on 8 bits starting at a byte boundary in the bitstream until
|
||||
* the given appears on the bitstream.
|
||||
* \note the bytes read in the bitstream will only be update if the delimiter is found
|
||||
* \param bs the target bitstream
|
||||
* \param delimiter the stop condition
|
||||
* \param out the resulting value
|
||||
* \param max_length the maximum length of the output
|
||||
* \return the number of value read.
|
||||
*/
|
||||
u32 gf_bs_read_u8_until_delimiter(GF_BitStream *bs, u8 delimiter, u8* out, u32 max_length);
|
||||
|
||||
/*!
|
||||
* \brief align short reading
|
||||
*
|
||||
* Reads an integer coded on 16 bits starting at a byte boundary in the bitstream.
|
||||
* \warning you must not use this function if the bitstream is not aligned
|
||||
* \param bs the target bitstream
|
||||
* \return the short value read.
|
||||
*/
|
||||
u32 gf_bs_read_u16(GF_BitStream *bs);
|
||||
/*!
|
||||
* \brief align 24-bit integer reading
|
||||
*
|
||||
* Reads an integer coded on 24 bits starting at a byte boundary in the bitstream.
|
||||
* \warning you must not use this function if the bitstream is not aligned
|
||||
* \param bs the target bitstream
|
||||
* \return the integer value read.
|
||||
*/
|
||||
u32 gf_bs_read_u24(GF_BitStream *bs);
|
||||
/*!
|
||||
* \brief align integer reading
|
||||
*
|
||||
* Reads an integer coded on 32 bits starting at a byte boundary in the bitstream.
|
||||
* \warning you must not use this function if the bitstream is not aligned
|
||||
* \param bs the target bitstream
|
||||
* \return the integer value read.
|
||||
*/
|
||||
u32 gf_bs_read_u32(GF_BitStream *bs);
|
||||
/*!
|
||||
* \brief align large integer reading
|
||||
*
|
||||
* Reads an integer coded on 64 bits starting at a byte boundary in the bitstream.
|
||||
* \warning you must not use this function if the bitstream is not aligned
|
||||
* \param bs the target bitstream
|
||||
* \return the large integer value read.
|
||||
*/
|
||||
u64 gf_bs_read_u64(GF_BitStream *bs);
|
||||
/*!
|
||||
* \brief little endian integer reading
|
||||
*
|
||||
* Reads an integer coded on 32 bits in little-endian order.
|
||||
* \param bs the target bitstream
|
||||
* \return the integer value read.
|
||||
*/
|
||||
u32 gf_bs_read_u32_le(GF_BitStream *bs);
|
||||
/*!
|
||||
* \brief little endian integer reading
|
||||
*
|
||||
* Reads an integer coded on 16 bits in little-endian order.
|
||||
* \param bs the target bitstream
|
||||
* \return the integer value read.
|
||||
*/
|
||||
u16 gf_bs_read_u16_le(GF_BitStream *bs);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief variable length integer reading
|
||||
*
|
||||
* Reads an integer coded on a variable number of 4-bits chunks. The number of chunks is given by the number of non-0 bits at the beginning.
|
||||
* \param bs the target bitstream
|
||||
* \return the integer value read.
|
||||
*/
|
||||
u32 gf_bs_read_vluimsbf5(GF_BitStream *bs);
|
||||
|
||||
/*!
|
||||
* \brief bit position
|
||||
*
|
||||
* Returns current bit position in the bitstream - only works in memory mode.
|
||||
* \param bs the target bitstream
|
||||
* \return the integer value read.
|
||||
*/
|
||||
u32 gf_bs_get_bit_offset(GF_BitStream *bs);
|
||||
|
||||
/*!
|
||||
* \brief current bit position
|
||||
*
|
||||
* Returns bit position in the current byte of the bitstream - only works in memory mode.
|
||||
* \param bs the target bitstream
|
||||
* \return the integer value read.
|
||||
*/
|
||||
u32 gf_bs_get_bit_position(GF_BitStream *bs);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief integer writing
|
||||
*
|
||||
* Writes an integer on a given number of bits.
|
||||
* \param bs the target bitstream
|
||||
* \param value the integer to write
|
||||
* \param nBits number of bits used to code the integer
|
||||
*/
|
||||
void gf_bs_write_int(GF_BitStream *bs, s32 value, s32 nBits);
|
||||
/*!
|
||||
* \brief large integer writing
|
||||
*
|
||||
* Writes an integer on a given number of bits greater than 32.
|
||||
* \param bs the target bitstream
|
||||
* \param value the large integer to write
|
||||
* \param nBits number of bits used to code the integer
|
||||
*/
|
||||
void gf_bs_write_long_int(GF_BitStream *bs, s64 value, s32 nBits);
|
||||
/*!
|
||||
* \brief float writing
|
||||
*
|
||||
* Writes a float in IEEE 32 bits format.
|
||||
* \param bs the target bitstream
|
||||
* \param value the float to write
|
||||
*/
|
||||
void gf_bs_write_float(GF_BitStream *bs, Float value);
|
||||
/*!
|
||||
* \brief double writing
|
||||
*
|
||||
* Writes a double in IEEE 64 bits format.
|
||||
* \param bs the target bitstream
|
||||
* \param value the double to write
|
||||
*/
|
||||
void gf_bs_write_double(GF_BitStream *bs, Double value);
|
||||
/*!
|
||||
* \brief data writing
|
||||
*
|
||||
* Writes a data buffer.
|
||||
* \param bs the target bitstream
|
||||
* \param data the data to write
|
||||
* \param nbBytes number of data bytes to write
|
||||
*/
|
||||
u32 gf_bs_write_data(GF_BitStream *bs, const char *data, u32 nbBytes);
|
||||
|
||||
/*!
|
||||
* \brief align char writing
|
||||
*
|
||||
* Writes an integer on 8 bits starting at a byte boundary in the bitstream.
|
||||
* \warning you must not use this function if the bitstream is not aligned
|
||||
* \param bs the target bitstream
|
||||
* \param value the char value to write
|
||||
*/
|
||||
void gf_bs_write_u8(GF_BitStream *bs, u32 value);
|
||||
/*!
|
||||
* \brief align short writing
|
||||
*
|
||||
* Writes an integer on 16 bits starting at a byte boundary in the bitstream.
|
||||
* \warning you must not use this function if the bitstream is not aligned
|
||||
* \param bs the target bitstream
|
||||
* \param value the short value to write
|
||||
*/
|
||||
void gf_bs_write_u16(GF_BitStream *bs, u32 value);
|
||||
/*!
|
||||
* \brief align 24-bits integer writing
|
||||
*
|
||||
* Writes an integer on 24 bits starting at a byte boundary in the bitstream.
|
||||
* \warning you must not use this function if the bitstream is not aligned
|
||||
* \param bs the target bitstream
|
||||
* \param value the integer value to write
|
||||
*/
|
||||
void gf_bs_write_u24(GF_BitStream *bs, u32 value);
|
||||
/*!
|
||||
* \brief align integer writing
|
||||
*
|
||||
* Writes an integer on 32 bits starting at a byte boundary in the bitstream.
|
||||
* \warning you must not use this function if the bitstream is not aligned
|
||||
* \param bs the target bitstream
|
||||
* \param value the integer value to write
|
||||
*/
|
||||
void gf_bs_write_u32(GF_BitStream *bs, u32 value);
|
||||
|
||||
/*!
|
||||
* \brief align large integer writing
|
||||
*
|
||||
* Writes an integer on 64 bits starting at a byte boundary in the bitstream.
|
||||
* \warning you must not use this function if the bitstream is not aligned
|
||||
* \param bs the target bitstream
|
||||
* \param value the large integer value to write
|
||||
*/
|
||||
void gf_bs_write_u64(GF_BitStream *bs, u64 value);
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \brief little endian integer writing
|
||||
*
|
||||
* Writes an integer on 32 bits in little-endian order.
|
||||
* \param bs the target bitstream
|
||||
* \param value the integer value to write
|
||||
*/
|
||||
void gf_bs_write_u32_le(GF_BitStream *bs, u32 value);
|
||||
/*!
|
||||
* \brief little endian short writing
|
||||
*
|
||||
* Writes an integer on 16 bits in little-endian order.
|
||||
* \param bs the target bitstream
|
||||
* \param value the short value to write
|
||||
*/
|
||||
void gf_bs_write_u16_le(GF_BitStream *bs, u32 value);
|
||||
|
||||
/*!
|
||||
* \brief write byte multiple times
|
||||
*
|
||||
* Writes a give byte multiple times.
|
||||
* \param bs the target bitstream
|
||||
* \param byte the byte value to write
|
||||
* \param count the number of times the byte should be written
|
||||
* \return the number of bytes written
|
||||
*/
|
||||
u32 gf_bs_write_byte(GF_BitStream *bs, u8 byte, u32 count);
|
||||
|
||||
/*!
|
||||
* \brief end of bitstream management
|
||||
*
|
||||
* Assigns a notification callback function for end of stream signaling in read mode
|
||||
* \param bs the target bitstream
|
||||
* \param EndOfStream the notification function to use
|
||||
* \param par opaque user data passed to the bitstream
|
||||
*/
|
||||
void gf_bs_set_eos_callback(GF_BitStream *bs, void (*EndOfStream)(void *par), void *par);
|
||||
|
||||
/*!
|
||||
* \brief bitstream alignment
|
||||
*
|
||||
* Aligns bitstream to next byte boundary. In write mode, this will write 0 bit values until alignment.
|
||||
* \param bs the target bitstream
|
||||
* \return the number of bits read/written until alignment
|
||||
*/
|
||||
u8 gf_bs_align(GF_BitStream *bs);
|
||||
/*!
|
||||
* \brief capacity query
|
||||
*
|
||||
* Returns the number of bytes still available in the bitstream in read mode.
|
||||
* \param bs the target bitstream
|
||||
* \return the number of bytes still available in read mode, -1 in write modes.
|
||||
*/
|
||||
u64 gf_bs_available(GF_BitStream *bs);
|
||||
/*!
|
||||
* \brief buffer fetching
|
||||
*
|
||||
* Fetches the internal bitstream buffer in write mode. If a buffer was given at the bitstream construction, or if the bitstream is in read mode, this does nothing.
|
||||
* \param bs the target bitstream
|
||||
* \param output address of the memory block allocated by the bitstream.
|
||||
* \param outSize size of the allocated memory block.
|
||||
* \note
|
||||
* It is the user responsability to destroy the allocated buffer
|
||||
* Once this function has been called, the internal bitstream buffer is reseted.
|
||||
*/
|
||||
void gf_bs_get_content(GF_BitStream *bs, char **output, u32 *outSize);
|
||||
|
||||
/*!
|
||||
* \brief buffer fetching
|
||||
*
|
||||
* Fetches the internal bitstream buffer in write mode. If a buffer was given at the bitstream construction, or if the bitstream is in read mode, this does nothing. Retrieves both the allocated buffer size and the written size
|
||||
* \param bs the target bitstream
|
||||
* \param output address of the memory block allocated by the bitstream.
|
||||
* \param outSize number of bytes written in the allocated memory block.
|
||||
* \param allocSize size of the allocated memory block.
|
||||
* \note
|
||||
* It is the user responsability to destroy the allocated buffer
|
||||
* Once this function has been called, the internal bitstream buffer is reseted.
|
||||
*/
|
||||
void gf_bs_get_content_no_truncate(GF_BitStream *bs, char **output, u32 *outSize, u32 *allocSize);
|
||||
|
||||
/*!
|
||||
* \brief byte skipping
|
||||
*
|
||||
* Skips bytes in the bitstream. In Write mode, this will write the 0 integer value for memory-based bitstreams or seek the stream
|
||||
for file-based bitstream.
|
||||
* \param bs the target bitstream
|
||||
* \param nbBytes the number of bytes to skip
|
||||
*/
|
||||
void gf_bs_skip_bytes(GF_BitStream *bs, u64 nbBytes);
|
||||
|
||||
/*!
|
||||
*\brief bitstream seeking
|
||||
*
|
||||
*Seeks the bitstream to a given offset after the beginning of the stream. This will perform alignment of the bitstream in all modes.
|
||||
*\warning Results are unpredictable if seeking beyond the bitstream end is performed.
|
||||
*\param bs the target bitstream
|
||||
*\param offset buffer/file offset to seek to
|
||||
*/
|
||||
GF_Err gf_bs_seek(GF_BitStream *bs, u64 offset);
|
||||
|
||||
/*!
|
||||
*\brief bitstream truncation
|
||||
*
|
||||
*Truncates the bitstream at the current position
|
||||
*\param bs the target bitstream
|
||||
*/
|
||||
void gf_bs_truncate(GF_BitStream *bs);
|
||||
|
||||
/*!
|
||||
*\brief bit peeking
|
||||
*
|
||||
*Peeks a given number of bits (read without moving the position indicator) for read modes only.
|
||||
*\param bs the target bitstream
|
||||
*\param numBits the number of bits to peek
|
||||
*\param byte_offset
|
||||
* if set, bitstream is aligned and moved from byte_offset before peeking (byte-aligned picking)
|
||||
* otherwise, bitstream is not aligned and bits are peeked from current state
|
||||
*\return the integer value read
|
||||
*/
|
||||
u32 gf_bs_peek_bits(GF_BitStream *bs, u32 numBits, u64 byte_offset);
|
||||
|
||||
/*!
|
||||
*\brief bit reservoir query
|
||||
*
|
||||
* Queries the number of bits available in read mode.
|
||||
*\param bs the target bitstream
|
||||
*\return number of available bits if position is in the last byte of the buffer/stream, 8 otherwise
|
||||
*/
|
||||
u8 gf_bs_bits_available(GF_BitStream *bs);
|
||||
|
||||
/*!
|
||||
*\brief position query
|
||||
*
|
||||
*Returns the reading/writting position in the buffer/file.
|
||||
*\param bs the target bitstream
|
||||
*\return the read/write position of the bitstream
|
||||
*/
|
||||
u64 gf_bs_get_position(GF_BitStream *bs);
|
||||
|
||||
/*!
|
||||
*\brief size query
|
||||
*
|
||||
*Returns the size of the associated buffer/file.
|
||||
*\param bs the target bitstream
|
||||
*\return the size of the bitstream
|
||||
*/
|
||||
u64 gf_bs_get_size(GF_BitStream *bs);
|
||||
/*!
|
||||
*\brief file-based size query
|
||||
*
|
||||
*Returns the size of a file-based bitstream and force a seek to end of file. This is used in case the file handle
|
||||
*describes a file being constructed on disk while being read?
|
||||
*
|
||||
*\param bs the target bitstream
|
||||
*\return the disk size of the associated file
|
||||
*/
|
||||
u64 gf_bs_get_refreshed_size(GF_BitStream *bs);
|
||||
|
||||
|
||||
/*!
|
||||
*\brief transfer content from source bitstream to destination bitstream
|
||||
*
|
||||
*Returns the size of the associated buffer/file.
|
||||
*\param dst the target bitstream
|
||||
*\param src the source bitstream.
|
||||
*\return error if any
|
||||
*/
|
||||
GF_Err gf_bs_transfer(GF_BitStream *dst, GF_BitStream *src);
|
||||
|
||||
|
||||
/*!
|
||||
*\brief Flushes bitstream contet to disk
|
||||
*
|
||||
*Flushes bitstream contet to disk
|
||||
*\param bs the target bitstream
|
||||
*/
|
||||
void gf_bs_flush(GF_BitStream *bs);
|
||||
|
||||
/*!
|
||||
*\brief Reassigns FILE object for stream-based bitstreams
|
||||
*
|
||||
*Reassigns FILE object for stream-based bitstreams. Automatically sets the stream position to the bitstream position
|
||||
*\param bs the target bitstream
|
||||
*\param stream the new stream to assign
|
||||
*/
|
||||
void gf_bs_reassign(GF_BitStream *bs, FILE *stream);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*_GF_BITSTREAM_H_*/
|
||||
|
||||
@@ -1,297 +0,0 @@
|
||||
/*
|
||||
* GPAC - Multimedia Framework C SDK
|
||||
*
|
||||
* Authors: Jean Le Feuvre
|
||||
* Copyright (c) Telecom ParisTech 2000-2012
|
||||
* All rights reserved
|
||||
*
|
||||
* This file is part of GPAC / common tools interfaces
|
||||
*
|
||||
* GPAC is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GPAC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _GF_COLOR_H_
|
||||
#define _GF_COLOR_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <gpac/constants.h>
|
||||
#include <gpac/maths.h>
|
||||
#include <gpac/tools.h>
|
||||
|
||||
|
||||
/*!
|
||||
* \file <gpac/color.h>
|
||||
* \brief Color conversion.
|
||||
*/
|
||||
|
||||
/*!
|
||||
*\addtogroup color_grp Color
|
||||
*\ingroup utils_grp
|
||||
*\brief Color tools
|
||||
*
|
||||
*This section documents color tools for image processing and color conversion
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/*!\brief Video framebuffer object
|
||||
*
|
||||
*The video framebuffer object represents uncompressed color data like images in a variety of formats. Data in
|
||||
*the video framebuffer MUST be continuous.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/*!Width of the video framebuffer */
|
||||
u32 width;
|
||||
/*!Height of the video framebuffer */
|
||||
u32 height;
|
||||
/*!Horizontal pitch of the video framebuffer (number of bytes to skip to go to next (right) pixel in the buffer). May be
|
||||
negative for some framebuffers (embedded devices). 0 means linear frame buffer (pitch_x==bytes per pixel)*/
|
||||
s32 pitch_x;
|
||||
/*!Vertical pitch of the video framebuffer (number of bytes to skip to go down one line in the buffer). May be
|
||||
negative for some framebuffers (embedded devices)*/
|
||||
s32 pitch_y;
|
||||
/*!Pixel format of the video framebuffer*/
|
||||
u32 pixel_format;
|
||||
/*!pointer to the beginning of the video memory (top-left corner)*/
|
||||
char *video_buffer;
|
||||
/*!indicates that the video data reside on systems memory or video card one*/
|
||||
Bool is_hardware_memory;
|
||||
/*!indicates U and V (and optional alpha) buffers in case of planar video with separated component. If not set, all components are in the video_buffer pointer*/
|
||||
char *u_ptr, *v_ptr, *a_ptr;
|
||||
/*! alpha value for this surface*/
|
||||
u8 global_alpha;
|
||||
} GF_VideoSurface;
|
||||
|
||||
/*!\brief Video Window object
|
||||
*
|
||||
*The video window object represents a rectangle in framebuffer coordinate system
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/*!left-most coordinate of the rectangle*/
|
||||
u32 x;
|
||||
/*!top-most coordinate of the rectangle*/
|
||||
u32 y;
|
||||
/*!width of the rectangle*/
|
||||
u32 w;
|
||||
/*!height of the rectangle*/
|
||||
u32 h;
|
||||
} GF_Window;
|
||||
|
||||
|
||||
/*!\brief color matrix object
|
||||
*
|
||||
*The Color transformation matrix object allows complete color space transformation (shift, rotate, skew, add).\n
|
||||
*The matrix coefs are in rgba order, hence the color RGBA is transformed to:
|
||||
\code
|
||||
R' m0 m1 m2 m3 m4 R
|
||||
G' m5 m6 m7 m8 m9 G
|
||||
B' = m10 m11 m12 m13 m14 x B
|
||||
A' m15 m16 m17 m18 m19 A
|
||||
0 0 0 0 0 1 0
|
||||
\endcode
|
||||
*Coeficients are in intensity scale, ranging from 0 to \ref FIX_ONE.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/*!color matrix coefficient*/
|
||||
Fixed m[20];
|
||||
/*!internal flag to speed up things when matrix is identity. This is a read only flag, do not modify it*/
|
||||
u32 identity;
|
||||
} GF_ColorMatrix;
|
||||
|
||||
/*!\brief ARGB color object
|
||||
*
|
||||
*The color type used in the GPAC framework represents colors in the form 0xAARRGGBB, with each component ranging from 0 to 255
|
||||
*/
|
||||
typedef u32 GF_Color;
|
||||
/*!\hideinitializer color formating macro from alpha, red, green and blue components expressed as integers ranging from 0 to 255*/
|
||||
#define GF_COL_ARGB(a, r, g, b) ((a)<<24 | (r)<<16 | (g)<<8 | (b))
|
||||
/*!\hideinitializer color formating macro from alpha, red, green and blue components expressed as fixed numbers ranging from 0 to \ref FIX_ONE*/
|
||||
#define GF_COL_ARGB_FIXED(_a, _r, _g, _b) GF_COL_ARGB(FIX2INT(255*(_a)), FIX2INT(255*(_r)), FIX2INT(255*(_g)), FIX2INT(255*(_b)))
|
||||
/*!\hideinitializer gets alpha component of a color*/
|
||||
#define GF_COL_A(c) (u8) ((c)>>24)
|
||||
/*!\hideinitializer gets red component of a color*/
|
||||
#define GF_COL_R(c) (u8) ( ((c)>>16) & 0xFF)
|
||||
/*!\hideinitializer gets green component of a color*/
|
||||
#define GF_COL_G(c) (u8) ( ((c)>>8) & 0xFF)
|
||||
/*!\hideinitializer gets blue component of a color*/
|
||||
#define GF_COL_B(c) (u8) ( (c) & 0xFF)
|
||||
/*!\hideinitializer 16-bits color formating macro from red, green and blue components*/
|
||||
#define GF_COL_565(r, g, b) (u16) (((r & 248)<<8) + ((g & 252)<<3) + (b>>3))
|
||||
/*!\hideinitializer 15-bits color formating macro from red, green and blue components*/
|
||||
#define GF_COL_555(r, g, b) (u16) (((r & 248)<<7) + ((g & 248)<<2) + (b>>3))
|
||||
/*!\hideinitializer 15-bits color formating macro from red, green and blue components*/
|
||||
#define GF_COL_444(r, g, b) (u16) (((r & 240)<<4) + ((g & 240)) + ((b & 240)>>4))
|
||||
/*!\hideinitializer 16-bits alphagrey color formating macro alpha and grey components*/
|
||||
#define GF_COL_AG(a, g) (u16) ( (a << 8) | g)
|
||||
/*!\hideinitializer transfoms a 32-bits color into a 16-bits one.\note alpha component is lost*/
|
||||
#define GF_COL_TO_565(c) (((GF_COL_R(c) & 248)<<8) + ((GF_COL_G(c) & 252)<<3) + (GF_COL_B(c)>>3))
|
||||
/*!\hideinitializer transfoms a 32-bits color into a 15-bits one.\note alpha component is lost*/
|
||||
#define GF_COL_TO_555(c) (((GF_COL_R(c) & 248)<<7) + ((GF_COL_G(c) & 248)<<2) + (GF_COL_B(c)>>3))
|
||||
/*!\hideinitializer transfoms a 32-bits color into a 16-bits alphagrey one.\note red component is used for grey, green and blue components are lost.*/
|
||||
#define GF_COL_TO_AG(c) ( (GF_COL_A(c) << 8) | GF_COL_R(c))
|
||||
/*!\hideinitializer transfoms a 32-bits color into a 15-bits one.\note alpha component is lost*/
|
||||
#define GF_COL_TO_444(c) (((GF_COL_R(c) & 240)<<4) + ((GF_COL_G(c) & 240)) + ((GF_COL_B(c)>>4) & 240) )
|
||||
|
||||
/*!Parses color from HTML name or hexa representation
|
||||
*\param name name of the color to parse
|
||||
*\return GF_Color value with alpha set to 0xFF if successfull, 0 otherwise
|
||||
*/
|
||||
GF_Color gf_color_parse(const char *name);
|
||||
|
||||
/*!Gets color from HTML name or hexa representation
|
||||
*\param col color to identify
|
||||
*\return name of the color if successfull, NULL otherwise
|
||||
*/
|
||||
const char *gf_color_get_name(GF_Color col);
|
||||
|
||||
/*!Inits a color matrix to identity*/
|
||||
void gf_cmx_init(GF_ColorMatrix *_this);
|
||||
/*!Inits all coefficients of a color matrix
|
||||
*\param _this color matrix to initialize
|
||||
*\param coefs list of the 20 fixed numbers to copy
|
||||
*/
|
||||
void gf_cmx_set_all(GF_ColorMatrix *_this, Fixed *coefs);
|
||||
/*!Inits all coefficients of a color matrix
|
||||
*\param _this color matrix to initialize
|
||||
*\param mrr red-to-red multiplication factor
|
||||
*\param mrg red-to-green multiplication factor
|
||||
*\param mrb red-to-blue multiplication factor
|
||||
*\param mra red-to-alpha multiplication factor
|
||||
*\param tr red translation factor
|
||||
*\param mgr green-to-red multiplication factor
|
||||
*\param mgg green-to-green multiplication factor
|
||||
*\param mgb green-to-blue multiplication factor
|
||||
*\param mga green-to-alpha multiplication factor
|
||||
*\param tg green translation factor
|
||||
*\param mbr blue-to-red multiplication factor
|
||||
*\param mbg blue-to-green multiplication factor
|
||||
*\param mbb blue-to-blue multiplication factor
|
||||
*\param mba blue-to-alpha multiplication factor
|
||||
*\param tb blue translation factor
|
||||
*\param mar alpha-to-red multiplication factor
|
||||
*\param mag alpha-to-green multiplication factor
|
||||
*\param mab alpha-to-blue multiplication factor
|
||||
*\param maa alpha-to-alpha multiplication factor
|
||||
*\param ta alpha translation factor
|
||||
*/
|
||||
void gf_cmx_set(GF_ColorMatrix *_this,
|
||||
Fixed mrr, Fixed mrg, Fixed mrb, Fixed mra, Fixed tr,
|
||||
Fixed mgr, Fixed mgg, Fixed mgb, Fixed mga, Fixed tg,
|
||||
Fixed mbr, Fixed mbg, Fixed mbb, Fixed mba, Fixed tb,
|
||||
Fixed mar, Fixed mag, Fixed mab, Fixed maa, Fixed ta);
|
||||
/*!Inits a matrix from another matrix
|
||||
*\param _this color matrix to initialize
|
||||
*\param from color matrix to copy from
|
||||
*/
|
||||
void gf_cmx_copy(GF_ColorMatrix *_this, GF_ColorMatrix *from);
|
||||
/*!\brief color matrix multiplication
|
||||
*
|
||||
*Multiplies a color matrix by another one. Result is _this*with
|
||||
*\param _this color matrix to transform. Once the function called, _this will contain the resulting color matrix
|
||||
*\param with color matrix to add
|
||||
*/
|
||||
void gf_cmx_multiply(GF_ColorMatrix *_this, GF_ColorMatrix *with);
|
||||
/*!\brief color matrix transform
|
||||
*
|
||||
*Transforms a color with a given color matrix
|
||||
*\param _this color matrix to use.
|
||||
*\param col color to transform
|
||||
*\return transformed color
|
||||
*/
|
||||
GF_Color gf_cmx_apply(GF_ColorMatrix *_this, GF_Color col);
|
||||
/*!\brief color components matrix transform
|
||||
*
|
||||
*Transforms color components with a given color matrix
|
||||
*\param _this color matrix to use.
|
||||
*\param a pointer to alpha component. Once the function is called, a contains the transformed alpha component
|
||||
*\param r pointer to red component. Once the function is called, r contains the transformed red component
|
||||
*\param g pointer to green component. Once the function is called, g contains the transformed green component
|
||||
*\param b pointer to blue component. Once the function is called, b contains the transformed blue component
|
||||
*/
|
||||
void gf_cmx_apply_fixed(GF_ColorMatrix *_this, Fixed *a, Fixed *r, Fixed *g, Fixed *b);
|
||||
|
||||
|
||||
/*!\brief Color Key descriptor
|
||||
*
|
||||
*The ColorKey object represents a ColorKey with low and high threshold keying
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/*!color key R, G, and B components*/
|
||||
u8 r, g, b;
|
||||
/*!Alpha value for opaque (non-keyed) pixels*/
|
||||
u8 alpha;
|
||||
/*!low variance threshold*/
|
||||
u8 low;
|
||||
/*!high variance threshold*/
|
||||
u8 high;
|
||||
} GF_ColorKey;
|
||||
|
||||
/*!\brief stretches two video surfaces
|
||||
*
|
||||
* Software stretch of source surface ont destination surface.
|
||||
*\param dst destination surface
|
||||
*\param src source surface
|
||||
*\param dst_wnd destination rectangle. If null the entire destination surface is used
|
||||
*\param src_wnd source rectangle. If null the entire source surface is used
|
||||
*\param alpha blend factor of source over alpha
|
||||
*\param flip flips the source
|
||||
*\param colorKey makes source pixel matching the color key transparent
|
||||
*\param cmat applies color matrix to the source
|
||||
*\return error code if any
|
||||
*/
|
||||
GF_Err gf_stretch_bits(GF_VideoSurface *dst, GF_VideoSurface *src, GF_Window *dst_wnd, GF_Window *src_wnd, u8 alpha, Bool flip, GF_ColorKey *colorKey, GF_ColorMatrix * cmat);
|
||||
|
||||
|
||||
/*!\brief copies YUV 420 10 bits to YUV destination (only YUV420 8 bits supported)
|
||||
*
|
||||
* Software stretch of source surface ont destination surface.
|
||||
*\param vs_dst destination surface
|
||||
*\param pY source Y plane
|
||||
*\param pU source U plane. if NULL, the U plane is located after the Y plane
|
||||
*\param pV source V plane. if NULL, the V plane is located after the U plane
|
||||
*\param src_stride source stride in bytes
|
||||
*\param src_width source width in pixels
|
||||
*\param src_height source height in pixels
|
||||
*\param src_wnd source rectangle. If null the entire source surface is used
|
||||
*\param swap_uv If GF_TRUE, swaps U and V components.
|
||||
*\return error code if any
|
||||
*/
|
||||
GF_Err gf_color_write_yv12_10_to_yuv(GF_VideoSurface *vs_dst, unsigned char *pY, unsigned char *pU, unsigned char*pV, u32 src_stride, u32 src_width, u32 src_height, const GF_Window *src_wnd, Bool swap_uv);
|
||||
|
||||
/*! @} */
|
||||
|
||||
|
||||
GF_Err gf_color_write_yuv422_10_to_yuv422(GF_VideoSurface *vs_dst, unsigned char *pY, unsigned char *pU, unsigned char*pV, u32 src_stride, u32 src_width, u32 src_height, const GF_Window *src_wnd, Bool swap_uv);
|
||||
GF_Err gf_color_write_yuv444_10_to_yuv444(GF_VideoSurface *vs_dst, unsigned char *pY, unsigned char *pU, unsigned char*pV, u32 src_stride, u32 src_width, u32 src_height, const GF_Window *src_wnd, Bool swap_uv);
|
||||
GF_Err gf_color_write_yuv422_10_to_yuv(GF_VideoSurface *vs_dst, unsigned char *pY, unsigned char *pU, unsigned char*pV, u32 src_stride, u32 src_width, u32 src_height, const GF_Window *src_wnd, Bool swap_uv);
|
||||
GF_Err gf_color_write_yuv444_10_to_yuv(GF_VideoSurface *vs_dst, unsigned char *pY, unsigned char *pU, unsigned char*pV, u32 src_stride, u32 src_width, u32 src_height, const GF_Window *src_wnd, Bool swap_uv);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*_GF_COLOR_H_*/
|
||||
|
||||
@@ -1,235 +0,0 @@
|
||||
/*
|
||||
* GPAC - Multimedia Framework C SDK
|
||||
*
|
||||
* Authors: Jean Le Feuvre
|
||||
* Copyright (c) Telecom ParisTech 2000-2012
|
||||
* All rights reserved
|
||||
*
|
||||
* This file is part of GPAC / common tools sub-project
|
||||
*
|
||||
* GPAC is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GPAC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GF_CONFIG_FILE_H_
|
||||
#define _GF_CONFIG_FILE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file <gpac/config_file.h>
|
||||
* \brief configuration file.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \addtogroup cfg_grp Configuration File
|
||||
* \ingroup utils_grp
|
||||
* \brief Configuration File object
|
||||
*
|
||||
* This section documents the configuration file object of the GPAC framework.
|
||||
* This file is formatted as the INI file mode of WIN32 in sections and keys.\n
|
||||
*\note For more information on the GPAC configuration file itself, please refer to the GPAC configuration help provided with GPAC.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <gpac/tools.h>
|
||||
|
||||
|
||||
typedef struct __tag_config GF_Config;
|
||||
|
||||
/*!
|
||||
* \brief configuration file initialization
|
||||
*
|
||||
* Constructs a configuration file from fileName. If fileName is NULL, the default GPAC configuration file is loaded with the
|
||||
* proper module directory, font directory and other default options. If fileName is non-NULL no configuration file is found,
|
||||
* a "light" default configuration file is created.
|
||||
*\param file name of the configuration file, or NULL for default file
|
||||
*\param new_cfg Boolean set to true if a new configuration file has been created
|
||||
*\return the configuration file object, NULL if the file could not be created
|
||||
*/
|
||||
GF_Config *gf_cfg_init(const char *file, Bool *new_cfg);
|
||||
|
||||
/*!
|
||||
* \brief configuration file constructor
|
||||
*
|
||||
* Constructs a configuration file.
|
||||
*\param filePath directory the file is located in
|
||||
*\param fileName name of the configuration file
|
||||
*\return the configuration file object, NULL if the file does not exist
|
||||
*/
|
||||
GF_Config *gf_cfg_new(const char *filePath, const char *fileName);
|
||||
/*!
|
||||
* \brief alternative configuration file constructor
|
||||
*
|
||||
* Constructs a configuration file. If file does not exist, configuration will be still created
|
||||
*\param filePath directory the file is located in
|
||||
*\param fileName name of the configuration file
|
||||
*\return the configuration file object, never NULL, even if file does not exist
|
||||
*/
|
||||
GF_Config *gf_cfg_force_new(const char *filePath, const char *fileName);
|
||||
/*!
|
||||
* \brief configuration file destructor
|
||||
*
|
||||
*Destroys the configuration file and saves it if needed.
|
||||
*\param cfgFile the target configuration file
|
||||
*/
|
||||
void gf_cfg_del(GF_Config *cfgFile);
|
||||
/*!
|
||||
* \brief configuration file destructor
|
||||
*
|
||||
*Destroys the configuration file and removes the file from disk.
|
||||
*\param cfgFile the target configuration file
|
||||
*/
|
||||
void gf_cfg_remove(GF_Config *cfgFile);
|
||||
/*!
|
||||
* \brief configuration saving
|
||||
*
|
||||
*Saves the configuration file if modified.
|
||||
*\param cfgFile the target configuration file
|
||||
*/
|
||||
GF_Err gf_cfg_save(GF_Config *cfgFile);
|
||||
/*!
|
||||
* \brief key value query
|
||||
*
|
||||
*Gets a key value from its section and name.
|
||||
*\param cfgFile the target configuration file
|
||||
*\param secName the desired key parent section name
|
||||
*\param keyName the desired key name
|
||||
*\return the desired key value if found, NULL otherwise.
|
||||
*/
|
||||
const char *gf_cfg_get_key(GF_Config *cfgFile, const char *secName, const char *keyName);
|
||||
/*!
|
||||
* \brief key value query ignoring case
|
||||
*
|
||||
*Gets a key value from its section and name. Comparison is performed while ignoring case.
|
||||
*\param cfgFile the target configuration file
|
||||
*\param secName the desired key parent section name (case ignored)
|
||||
*\param keyName the desired key name (case ignored)
|
||||
*\return the desired key value if found, NULL otherwise.
|
||||
*/
|
||||
const char *gf_cfg_get_ikey(GF_Config *cfgFile, const char *secName, const char *keyName);
|
||||
/*!
|
||||
* \brief key value update
|
||||
*
|
||||
*Sets a key value from its section and name.
|
||||
*\param cfgFile the target configuration file
|
||||
*\param secName the desired key parent section name
|
||||
*\param keyName the desired key name
|
||||
*\param keyValue the desired key value
|
||||
*\note this will also create both section and key if they are not found in the configuration file
|
||||
*/
|
||||
GF_Err gf_cfg_set_key(GF_Config *cfgFile, const char *secName, const char *keyName, const char *keyValue);
|
||||
/*!
|
||||
* \brief section count query
|
||||
*
|
||||
*Gets the number of sections in the configuration file
|
||||
*\param cfgFile the target configuration file
|
||||
*\return the number of sections
|
||||
*/
|
||||
u32 gf_cfg_get_section_count(GF_Config *cfgFile);
|
||||
/*!
|
||||
* \brief section name query
|
||||
*
|
||||
*Gets a section name based on its index
|
||||
*\param cfgFile the target configuration file
|
||||
*\param secIndex 0-based index of the section to query
|
||||
*\return the section name if found, NULL otherwise
|
||||
*/
|
||||
const char *gf_cfg_get_section_name(GF_Config *cfgFile, u32 secIndex);
|
||||
/*!
|
||||
* \brief key count query
|
||||
*
|
||||
*Gets the number of keys in a section of the configuration file
|
||||
*\param cfgFile the target configuration file
|
||||
*\param secName the target section
|
||||
*\return the number of keys in the section
|
||||
*/
|
||||
u32 gf_cfg_get_key_count(GF_Config *cfgFile, const char *secName);
|
||||
/*!
|
||||
* \brief key count query
|
||||
*
|
||||
*Gets the number of keys in a section of the configuration file
|
||||
*\param cfgFile the target configuration file
|
||||
*\param secName the target section
|
||||
*\param keyIndex 0-based index of the key in the section
|
||||
*\return the key name if found, NULL otherwise
|
||||
*/
|
||||
const char *gf_cfg_get_key_name(GF_Config *cfgFile, const char *secName, u32 keyIndex);
|
||||
|
||||
/*!
|
||||
* \brief key insertion
|
||||
*
|
||||
*Inserts a new key in a given section. Returns an error if a key with the given name
|
||||
*already exists in the section
|
||||
*\param cfgFile the target configuration file
|
||||
*\param secName the target section
|
||||
*\param keyName the name of the target key
|
||||
*\param keyValue the value for the new key
|
||||
*\param index the 0-based index position of the new key
|
||||
*/
|
||||
GF_Err gf_cfg_insert_key(GF_Config *cfgFile, const char *secName, const char *keyName, const char *keyValue, u32 index);
|
||||
|
||||
/*!
|
||||
* \brief section destrouction
|
||||
*
|
||||
*Removes all entries in the given section
|
||||
*\param cfgFile the target configuration file
|
||||
*\param secName the target section
|
||||
*/
|
||||
void gf_cfg_del_section(GF_Config *cfgFile, const char *secName);
|
||||
|
||||
/*!
|
||||
* get a sub key (separator is ':') in a given key in a given section. Returns an error if the key does not exist
|
||||
*\param cfgFile the target configuration file
|
||||
*\param secName the target section
|
||||
*\param keyName the name of the target key
|
||||
*\param sub_index the 0-based index position of the sub key*/
|
||||
const char *gf_cfg_get_sub_key(GF_Config *cfgFile, const char *secName, const char *keyName,u32 sub_index);
|
||||
|
||||
/*!
|
||||
* Get the full filename associated with this config file
|
||||
* The caller is responsible for freeing memory
|
||||
* \param iniFile The Configuration
|
||||
* \return a newly allocated filename
|
||||
*/
|
||||
char * gf_cfg_get_filename(GF_Config *iniFile);
|
||||
|
||||
/*!
|
||||
* Set the full filename associated with this config file
|
||||
* \param iniFile The Configuration
|
||||
* \param fileName new filename for the config
|
||||
* \return erroro code
|
||||
*/
|
||||
GF_Err gf_cfg_set_filename(GF_Config *iniFile, const char * fileName);
|
||||
|
||||
|
||||
/*!
|
||||
* Do not save results to file
|
||||
* \param iniFile The Configuration
|
||||
* \return error code
|
||||
*/
|
||||
GF_Err gf_cfg_discard_changes(GF_Config *iniFile);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*_GF_CONFIG_FILE_H_*/
|
||||
|
||||
@@ -1,301 +0,0 @@
|
||||
/*
|
||||
* GPAC - Multimedia Framework C SDK
|
||||
*
|
||||
* Authors: Jean Le Feuvre
|
||||
* Copyright (c) Telecom ParisTech 2008-2012
|
||||
* All rights reserved
|
||||
*
|
||||
* This file is part of GPAC
|
||||
*
|
||||
* GPAC is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GPAC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _GF_CONFIG_H_
|
||||
#define _GF_CONFIG_H_
|
||||
|
||||
#define GPAC_CONFIGURATION "(static configuration file)"
|
||||
|
||||
/*this file defines all common macros for libgpac compilation
|
||||
except for symbian32 which uses .mmp directives ... */
|
||||
|
||||
/*Configuration for visual studio, 32/64 bits */
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE)
|
||||
|
||||
#ifndef GPAC_MP4BOX_MINI
|
||||
|
||||
#define GPAC_HAS_SSL
|
||||
|
||||
#define GPAC_HAS_SPIDERMONKEY
|
||||
#define GPAC_HAS_JPEG
|
||||
#define GPAC_HAS_PNG
|
||||
|
||||
/*IPv6 enabled - for win32, this is evaluated at compile time, !! do not uncomment !!*/
|
||||
|
||||
//#define GPAC_MEMORY_TRACKING
|
||||
|
||||
/*Win32 IPv6 is evaluated at compile time, !! do not uncomment !!*/
|
||||
//#define GPAC_HAS_IPV6
|
||||
|
||||
#define GPAC_HAS_GLU
|
||||
|
||||
#endif /*GPAC_MP4BOX_MINI*/
|
||||
|
||||
/*Configuration for WindowsCE 32 bits */
|
||||
#elif defined(_WIN32_WCE)
|
||||
|
||||
#ifndef GPAC_FIXED_POINT
|
||||
#define GPAC_FIXED_POINT
|
||||
#endif
|
||||
|
||||
/*use intel fixed-point*/
|
||||
//#define GPAC_USE_IGPP
|
||||
/*use intel fixed-point with high precision*/
|
||||
//#define GPAC_USE_IGPP_HP
|
||||
|
||||
#if defined(GPAC_USE_IGPP) && defined(GPAC_USE_IGPP_HP)
|
||||
#error "Only one of GPAC_USE_IGPP and GPAC_USE_IGPP_HP can be defined"
|
||||
#endif
|
||||
|
||||
#if !defined(GPAC_DISABLE_3D) && !defined(GPAC_USE_TINYGL) && !defined(GPAC_USE_GLES1X)
|
||||
#define GPAC_USE_GLES1X
|
||||
#endif
|
||||
|
||||
|
||||
#define GPAC_HAS_SPIDERMONKEY
|
||||
#define GPAC_HAS_JPEG
|
||||
#define GPAC_HAS_PNG
|
||||
|
||||
/*comment this line if you don't have a GLU32 version for Windows Mobile*/
|
||||
//#define GPAC_HAS_GLU
|
||||
|
||||
|
||||
/*Configuration for Android */
|
||||
#elif defined(GPAC_CONFIG_ANDROID)
|
||||
|
||||
#ifndef GPAC_ANDROID
|
||||
#define GPAC_ANDROID
|
||||
#endif
|
||||
|
||||
#define GPAC_HAS_IPV6
|
||||
#define GPAC_USE_GLES1X
|
||||
/*don't use fixed-point version on Android, not needed*/
|
||||
//#define GPAC_FIXED_POINT
|
||||
|
||||
#define GPAC_HAS_SPIDERMONKEY
|
||||
#define GPAC_HAS_JPEG
|
||||
#define GPAC_HAS_PNG
|
||||
|
||||
/*Configuration for XCode OSX (not iOS) */
|
||||
#elif defined(GPAC_CONFIG_DARWIN) && !defined(GPAC_IPHONE)
|
||||
|
||||
#define GPAC_HAS_IPV6
|
||||
#define GPAC_HAS_SSL
|
||||
|
||||
//64-bits OSX
|
||||
#ifdef __LP64__
|
||||
#define GPAC_64_BITS
|
||||
#endif
|
||||
|
||||
#define GPAC_HAS_SPIDERMONKEY
|
||||
#define GPAC_HAS_JPEG
|
||||
#define GPAC_HAS_PNG
|
||||
#define GPAC_HAS_GLU
|
||||
|
||||
//#define GPAC_MEMORY_TRACKING
|
||||
/*Configuration for XCode iOS*/
|
||||
#elif defined(GPAC_CONFIG_DARWIN) && defined(GPAC_IPHONE)
|
||||
|
||||
//64-bits iOS
|
||||
#ifdef __LP64__
|
||||
#define GPAC_64_BITS
|
||||
#endif
|
||||
|
||||
#define GPAC_HAS_SPIDERMONKEY
|
||||
#define GPAC_HAS_JPEG
|
||||
#define GPAC_HAS_PNG
|
||||
|
||||
/*don't use fixed-point version on iOS, not needed*/
|
||||
//#define GPAC_FIXED_POINT
|
||||
|
||||
//#define GPAC_USE_GLES1X
|
||||
#define GPAC_USE_GLES2
|
||||
|
||||
// glu port available in gpac extra libs
|
||||
#define GPAC_HAS_GLU
|
||||
|
||||
/*extra libs supported on iOS*/
|
||||
#define GPAC_HAS_FAAD
|
||||
#define GPAC_HAS_MAD
|
||||
#define GPAC_HAS_FFMPEG
|
||||
#define GPAC_HAS_SDL
|
||||
#define GPAC_HAS_FREETYPE
|
||||
|
||||
#define GPAC_HAS_IPV6
|
||||
#define GPAC_HAS_SSL
|
||||
|
||||
|
||||
/*Configuration for Symbian*/
|
||||
#elif defined(__SYMBIAN32__)
|
||||
|
||||
#ifndef GPAC_FIXED_POINT
|
||||
#define GPAC_FIXED_POINT
|
||||
#endif
|
||||
|
||||
#define GPAC_HAS_SPIDERMONKEY
|
||||
#define GPAC_HAS_JPEG
|
||||
#define GPAC_HAS_PNG
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*disables player */
|
||||
//#define GPAC_DISABLE_PLAYER
|
||||
|
||||
/*disables scene manager */
|
||||
//#define GPAC_DISABLE_SMGR
|
||||
|
||||
/*disables core tools */
|
||||
//#define GPAC_DISABLE_CORE_TOOLS
|
||||
|
||||
/*disables zlib */
|
||||
#ifndef GPAC_MP4BOX_MINI
|
||||
//#define GPAC_DISABLE_ZLIB
|
||||
#else
|
||||
#define GPAC_DISABLE_ZLIB
|
||||
#endif
|
||||
|
||||
/*disables SVG scene graph*/
|
||||
//#define GPAC_DISABLE_SVG
|
||||
|
||||
/*disables VRML/BIFS scene graphs*/
|
||||
//#define GPAC_DISABLE_VRML
|
||||
|
||||
/*disables X3D scene graphs*/
|
||||
//#define GPAC_DISABLE_X3D
|
||||
|
||||
/*disables MPEG-4 OD Framework - this only minimalize the set of OD features used, however all cannot be removed*/
|
||||
//#define GPAC_MINIMAL_ODF
|
||||
|
||||
/*disables BIFS coding*/
|
||||
//#define GPAC_DISABLE_BIFS
|
||||
|
||||
/*disables LASeR coder*/
|
||||
//#define GPAC_DISABLE_LASER
|
||||
//#define GPAC_DISABLE_SAF
|
||||
|
||||
/*disables BIFS Engine support - TODO - merge DIMS and LASeR into BENG and rename it*/
|
||||
//#define GPAC_DISABLE_SENG
|
||||
|
||||
/*disables Cubic QTVR importing*/
|
||||
//#define GPAC_DISABLE_QTVR
|
||||
|
||||
/*disables AVILib support*/
|
||||
//#define GPAC_DISABLE_AVILIB
|
||||
|
||||
/*disables OGG support*/
|
||||
//#define GPAC_DISABLE_OGG
|
||||
|
||||
/*disables MPEG2 PS support*/
|
||||
//#define GPAC_DISABLE_MPEG2PS
|
||||
|
||||
/*disables MPEG2 TS demux support*/
|
||||
//#define GPAC_DISABLE_MPEG2TS
|
||||
|
||||
/*disables MPEG2 TS Mux support*/
|
||||
//#define GPAC_DISABLE_MPEG2TS_MUX
|
||||
|
||||
/*disables all media import functions*/
|
||||
//#define GPAC_DISABLE_MEDIA_IMPORT
|
||||
|
||||
/*disable all AV parsing functions*/
|
||||
//#define GPAC_DISABLE_AV_PARSERS
|
||||
|
||||
/*disables all media export functions*/
|
||||
//#define GPAC_DISABLE_MEDIA_EXPORT
|
||||
|
||||
/*disables SWF importer*/
|
||||
//#define GPAC_DISABLE_SWF_IMPORT
|
||||
|
||||
/*disables all media export functions*/
|
||||
//#define GPAC_DISABLE_SCENE_STATS
|
||||
|
||||
/*disables scene -> MP4 encoder*/
|
||||
//#define GPAC_DISABLE_SCENE_ENCODER
|
||||
|
||||
/*disables ISOM -> scene decoder*/
|
||||
//#define GPAC_DISABLE_LOADER_ISOM
|
||||
|
||||
/*disables BT/WRL/X3DV -> scene decoder*/
|
||||
//#define GPAC_DISABLE_LOADER_BT
|
||||
|
||||
/*disables XMTA/X3D -> scene decoder*/
|
||||
//#define GPAC_DISABLE_LOADER_XMT
|
||||
|
||||
/*disables mcrypt*/
|
||||
//#define GPAC_DISABLE_MCRYPT
|
||||
|
||||
/*disables all ISO FF*/
|
||||
//#define GPAC_DISABLE_ISOM
|
||||
|
||||
/*disables ISO FF hint tracks*/
|
||||
//#define GPAC_DISABLE_ISOM_HINTING
|
||||
|
||||
/*disables ISO FF writing*/
|
||||
//#define GPAC_DISABLE_ISOM_WRITE
|
||||
|
||||
/*disables ISO FF fragments*/
|
||||
//#define GPAC_DISABLE_ISOM_FRAGMENTS
|
||||
|
||||
/*disables scene graph */
|
||||
//#define GPAC_DISABLE_SCENEGRAPH
|
||||
|
||||
/*disables scene graph textual dump*/
|
||||
//#define GPAC_DISABLE_SCENE_DUMP
|
||||
|
||||
/*disables OD graph textual dump*/
|
||||
//#define GPAC_DISABLE_OD_DUMP
|
||||
|
||||
/*disables OD graph textual dump*/
|
||||
//#define GPAC_DISABLE_ISOM_DUMP
|
||||
|
||||
/*disables IETF RTP/SDP/RTSP*/
|
||||
//#define GPAC_DISABLE_STREAMING
|
||||
|
||||
/*disables dashclient */
|
||||
//#define GPAC_DISABLE_DASH_CLIENT
|
||||
|
||||
/*disables Timed Text support */
|
||||
//#define GPAC_DISABLE_TTXT
|
||||
|
||||
/*disables TTML */
|
||||
//#define GPAC_DISABLE_TTML
|
||||
|
||||
/*disables WebVTT */
|
||||
//#define GPAC_DISABLE_VTT
|
||||
|
||||
/*disables DASH MPD */
|
||||
//#define GPAC_DISABLE_MPD
|
||||
|
||||
/*disables HEVC */
|
||||
//#define GPAC_DISABLE_HEVC
|
||||
|
||||
/*disables VOBSUB */
|
||||
//#define GPAC_DISABLE_VOBSUB
|
||||
|
||||
|
||||
#endif /*_GF_CONFIG_H_*/
|
||||
|
||||
@@ -1,904 +0,0 @@
|
||||
/*
|
||||
* GPAC - Multimedia Framework C SDK
|
||||
*
|
||||
* Authors: Jean Le Feuvre
|
||||
* Copyright (c) Telecom ParisTech 2000-2012
|
||||
* All rights reserved
|
||||
*
|
||||
* This file is part of GPAC / exported constants
|
||||
*
|
||||
* GPAC is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GPAC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GF_CONSTANTS_H_
|
||||
#define _GF_CONSTANTS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file <gpac/constants.h>
|
||||
* \brief Most constants defined in GPAC are in this file.
|
||||
*/
|
||||
|
||||
|
||||
/*! \addtogroup cst_grp Constants
|
||||
* \brief Constants used within GPAC
|
||||
*
|
||||
* This section documents some constants used in the GPAC framework which are not related to
|
||||
* any specific sub-project.
|
||||
* \ingroup utils_grp
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Supported file types
|
||||
* \hideinitializer
|
||||
*
|
||||
* Supported file types in most operations (file playback, editing, saving ...).
|
||||
*/
|
||||
typedef enum {
|
||||
GF_FILE_TYPE_NOT_SUPPORTED = 0,
|
||||
GF_FILE_TYPE_ISO_MEDIA = 1,
|
||||
GF_FILE_TYPE_BT_WRL_X3DV = 2,
|
||||
GF_FILE_TYPE_XMT_X3D = 3,
|
||||
GF_FILE_TYPE_SVG = 4,
|
||||
GF_FILE_TYPE_SWF = 5,
|
||||
GF_FILE_TYPE_LSR_SAF = 6,
|
||||
} GF_FileType;
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Supported media stream types
|
||||
* \hideinitializer
|
||||
*
|
||||
* Supported media stream types for media objects.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*!MPEG-4 Object Descriptor Stream*/
|
||||
GF_STREAM_OD = 0x01,
|
||||
/*!MPEG-4 Object Clock Reference Stream*/
|
||||
GF_STREAM_OCR = 0x02,
|
||||
/*!MPEG-4 Scene Description Stream*/
|
||||
GF_STREAM_SCENE = 0x03,
|
||||
/*!Visual Stream (Video, Image or MPEG-4 SNHC Tools)*/
|
||||
GF_STREAM_VISUAL = 0x04,
|
||||
/*!Audio Stream (Audio, MPEG-4 Structured-Audio Tools)*/
|
||||
GF_STREAM_AUDIO = 0x05,
|
||||
/*!MPEG-7 Description Stream*/
|
||||
GF_STREAM_MPEG7 = 0x06,
|
||||
/*!MPEG-4 Intellectual Property Management and Protection Stream*/
|
||||
GF_STREAM_IPMP = 0x07,
|
||||
/*!MPEG-4 Object Content Information Stream*/
|
||||
GF_STREAM_OCI = 0x08,
|
||||
/*!MPEG-4 MPEGlet Stream*/
|
||||
GF_STREAM_MPEGJ = 0x09,
|
||||
/*!MPEG-4 User Interaction Stream*/
|
||||
GF_STREAM_INTERACT = 0x0A,
|
||||
/*!MPEG-4 IPMP Tool Stream*/
|
||||
GF_STREAM_IPMP_TOOL = 0x0B,
|
||||
/*!MPEG-4 Font Data Stream*/
|
||||
GF_STREAM_FONT = 0x0C,
|
||||
/*!MPEG-4 Streaming Text Stream*/
|
||||
GF_STREAM_TEXT = 0x0D,
|
||||
|
||||
/* From 0x20 to Ox3F, this is the user private range */
|
||||
|
||||
/*!Nero Digital Subpicture Stream*/
|
||||
GF_STREAM_ND_SUBPIC = 0x38,
|
||||
|
||||
/*GPAC internal stream types*/
|
||||
|
||||
|
||||
/*!GPAC Private Scene streams\n
|
||||
*\n\note
|
||||
*this stream type (MPEG-4 user-private) is reserved for streams only used to create a scene decoder
|
||||
*handling the scene without input streams, as is the case for file readers (BT/VRML/XML..).\n
|
||||
*The decoderSpecificInfo carried is as follows:
|
||||
\code
|
||||
u32 file_size: total file size
|
||||
char file_name[dsi_size - sizeof(u32)]: local file name.
|
||||
\n\note: File may be a cache file, it is the decoder responsability to check if the file is completely
|
||||
downloaded before parsing if needed.
|
||||
\endcode
|
||||
*The inBufferLength param for decoders using these streams is the stream clock in ms (no input data is given).\n
|
||||
*The "dummy_in" module is available to generate these streams for common files, and also takes care of proper
|
||||
clock init in case of seeking.\n
|
||||
*This is a reentrant stream type: if any media object with this streamtype also exist in the scene, they will be
|
||||
*attached to the scene decoder (except when a new inline scene is detected, in which case a new decoder will
|
||||
*be created). This allows for animation/sprite usage along with the systems timing/stream management.\n
|
||||
*\n
|
||||
*the objectTypeIndication currently in use for these streams are documented below\n
|
||||
*/
|
||||
GF_STREAM_PRIVATE_SCENE = 0x20,
|
||||
|
||||
/*!GPAC Private Media streams\n
|
||||
*\n\note
|
||||
*this stream type (MPEG-4 user-private) is reserved for media streams bypassing GPAC for decoding
|
||||
and composition. The media decoder is only in charge of repositioning the video output, and the compositor will
|
||||
draw an empty rectangle if using alpha composition
|
||||
|
||||
*The decoderSpecificInfo carried only contains an opaque pointer in the data field, which depends on the underlying InputServce provider
|
||||
|
||||
*the objectTypeIndication currently in use for these streams are documented below\n
|
||||
*/
|
||||
GF_STREAM_PRIVATE_MEDIA = 0x21,
|
||||
|
||||
/*used internally to signal that the OTI carries a 4CC code, typically media subtype (stsd entry in file format)*/
|
||||
GF_STREAM_4CC = 0xF0
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* Media Object types
|
||||
*
|
||||
* This type provides a hint to network modules which may have to generate an service descriptor on the fly.
|
||||
* They occur only if objects/services used in the scene are not referenced through ObjectDescriptors (MPEG-4)
|
||||
* but direct through URL
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*!service descriptor expected is of undefined type. This should be treated like GF_MEDIA_OBJECT_SCENE*/
|
||||
GF_MEDIA_OBJECT_UNDEF = 0,
|
||||
/*!service descriptor expected is of SCENE type and shall contain a scene stream and OD one if needed*/
|
||||
GF_MEDIA_OBJECT_SCENE,
|
||||
/*!service descriptor expected is of SCENE UPDATES type (animation streams)*/
|
||||
GF_MEDIA_OBJECT_UPDATES,
|
||||
/*!service descriptor expected is of VISUAL type*/
|
||||
GF_MEDIA_OBJECT_VIDEO,
|
||||
/*!service descriptor expected is of AUDIO type*/
|
||||
GF_MEDIA_OBJECT_AUDIO,
|
||||
/*!service descriptor expected is of TEXT type (3GPP/MPEG4)*/
|
||||
GF_MEDIA_OBJECT_TEXT,
|
||||
/*!service descriptor expected is of UserInteraction type (MPEG-4 InputSensor)*/
|
||||
GF_MEDIA_OBJECT_INTERACT
|
||||
};
|
||||
|
||||
/*! All Media Objects inserted through URLs and not MPEG-4 OD Framework use this ODID*/
|
||||
#define GF_MEDIA_EXTERNAL_ID 1050
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Pixel Formats
|
||||
*
|
||||
* Supported pixel formats for everything using video
|
||||
*/
|
||||
#ifndef GF_4CC
|
||||
#define GF_4CC(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d))
|
||||
#endif
|
||||
typedef enum
|
||||
{
|
||||
/*!8 bit GREY */
|
||||
GF_PIXEL_GREYSCALE = GF_4CC('G','R','E','Y'),
|
||||
/*!16 bit greyscale*/
|
||||
GF_PIXEL_ALPHAGREY = GF_4CC('G','R','A','L'),
|
||||
/*!12 bit RGB on 16 bits (4096 colors)*/
|
||||
GF_PIXEL_RGB_444 = GF_4CC('R','4','4','4'),
|
||||
/*!15 bit RGB*/
|
||||
GF_PIXEL_RGB_555 = GF_4CC('R','5','5','5'),
|
||||
/*!16 bit RGB*/
|
||||
GF_PIXEL_RGB_565 = GF_4CC('R','5','6','5'),
|
||||
/*!24 bit RGB*/
|
||||
GF_PIXEL_RGB_24 = GF_4CC('R','G','B','3'),
|
||||
/*!24 bit BGR*/
|
||||
GF_PIXEL_BGR_24 = GF_4CC('B','G','R','3'),
|
||||
/*!32 bit RGB. Component ordering in bytes is B-G-R-X.*/
|
||||
GF_PIXEL_RGB_32 = GF_4CC('R','G','B','4'),
|
||||
/*!32 bit BGR. Component ordering in bytes is R-G-B-X.*/
|
||||
GF_PIXEL_BGR_32 = GF_4CC('B','G','R','4'),
|
||||
|
||||
/*!32 bit ARGB. Component ordering in bytes is B-G-R-A.*/
|
||||
GF_PIXEL_ARGB = GF_4CC('A','R','G','B'),
|
||||
/*!32 bit RGBA (openGL like). Component ordering in bytes is R-G-B-A.*/
|
||||
GF_PIXEL_RGBA = GF_4CC('R','G','B', 'A'),
|
||||
/*!RGB24 + depth plane. Component ordering in bytes is R-G-B-D.*/
|
||||
GF_PIXEL_RGBD = GF_4CC('R', 'G', 'B', 'D'),
|
||||
/*!RGB24 + depth plane (7 lower bits) + shape mask. Component ordering in bytes is R-G-B-(S+D).*/
|
||||
GF_PIXEL_RGBDS = GF_4CC('3', 'C', 'D', 'S'),
|
||||
/*!Stereo RGB24 */
|
||||
GF_PIXEL_RGBS = GF_4CC('R', 'G', 'B', 'S'),
|
||||
/*!Stereo RGBA. Component ordering in bytes is R-G-B-A. */
|
||||
GF_PIXEL_RGBAS = GF_4CC('R', 'G', 'A', 'S'),
|
||||
|
||||
/*internal format for OpenGL using pachek RGB 24 bit plus planar depth plane at the end of the image*/
|
||||
GF_PIXEL_RGB_24_DEPTH = GF_4CC('R', 'G', 'B', 'd'),
|
||||
|
||||
/*!YUV packed format*/
|
||||
GF_PIXEL_YUY2 = GF_4CC('Y','U','Y','2'),
|
||||
/*!YUV packed format*/
|
||||
GF_PIXEL_YVYU = GF_4CC('Y','V','Y','U'),
|
||||
/*!YUV packed format*/
|
||||
GF_PIXEL_UYVY = GF_4CC('U','Y','V','Y'),
|
||||
/*!YUV packed format*/
|
||||
GF_PIXEL_VYUY = GF_4CC('V','Y','U','Y'),
|
||||
/*!YUV packed format*/
|
||||
GF_PIXEL_Y422 = GF_4CC('Y','4','2','2'),
|
||||
/*!YUV packed format*/
|
||||
GF_PIXEL_UYNV = GF_4CC('U','Y','N','V'),
|
||||
/*!YUV packed format*/
|
||||
GF_PIXEL_YUNV = GF_4CC('Y','U','N','V'),
|
||||
/*!YUV packed format*/
|
||||
GF_PIXEL_V422 = GF_4CC('V','4','2','2'),
|
||||
|
||||
/*!YUV planar format*/
|
||||
GF_PIXEL_YV12 = GF_4CC('Y','V','1','2'),
|
||||
/*!YUV planar format*/
|
||||
GF_PIXEL_IYUV = GF_4CC('I','Y','U','V'),
|
||||
/*!YUV planar format*/
|
||||
GF_PIXEL_I420 = GF_4CC('I','4','2','0'),
|
||||
/*!YUV planar format*/
|
||||
GF_PIXEL_I444 = GF_4CC('I','4','4','4'),
|
||||
/*!420 Y planar UV interleaved*/
|
||||
GF_PIXEL_NV21 = GF_4CC('N','V','2','1'),
|
||||
/*!420 Y planar VU interleaved (U and V swapped) */
|
||||
GF_PIXEL_NV12 = GF_4CC('N','V','1','2'),
|
||||
/*!420 Y planar VU interleaved (U and V swapped), 10 bits */
|
||||
GF_PIXEL_NV12_10 = GF_4CC('N','1','2','0'),
|
||||
|
||||
/*!YV12 + Alpha plane*/
|
||||
GF_PIXEL_YUVA = GF_4CC('Y', 'U', 'V', 'A'),
|
||||
|
||||
/*!YV12 + Depth plane*/
|
||||
GF_PIXEL_YUVD = GF_4CC('Y', 'U', 'V', 'D'),
|
||||
|
||||
/*!YUV planar format in 10 bits mode, all components are stored as shorts*/
|
||||
GF_PIXEL_YV12_10 = GF_4CC('Y','0','1','0'),
|
||||
|
||||
GF_PIXEL_YUV422 = GF_4CC('Y','4','4','2'),
|
||||
GF_PIXEL_YUV422_10 = GF_4CC('Y','2','1','0'),
|
||||
GF_PIXEL_YUV444 = GF_4CC('Y','4','4','4'),
|
||||
GF_PIXEL_YUV444_10 = GF_4CC('Y','4','1','0')
|
||||
|
||||
} GF_PixelFormat;
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Scene ObjectTypeIndication Formats
|
||||
*
|
||||
* Supported ObjectTypeIndication for scene description streams. *_FILE_* are only used with private scene streams
|
||||
* and only carry the file name for the scene. Other internal stream types can be used in a real streaming environment
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*!OTI for BIFS v1*/
|
||||
GPAC_OTI_SCENE_BIFS = 0x01,
|
||||
/*!OTI for OD v1*/
|
||||
GPAC_OTI_OD_V1 = 0x01,
|
||||
/*!OTI for BIFS v2*/
|
||||
GPAC_OTI_SCENE_BIFS_V2 = 0x02,
|
||||
/*!OTI for OD v2*/
|
||||
GPAC_OTI_OD_V2 = 0x02,
|
||||
/*!OTI for BIFS InputSensor streams*/
|
||||
GPAC_OTI_SCENE_INTERACT = 0x03,
|
||||
/*!OTI for streams with extended BIFS config*/
|
||||
GPAC_OTI_SCENE_BIFS_EXTENDED = 0x04,
|
||||
/*!OTI for AFX streams with AFXConfig*/
|
||||
GPAC_OTI_SCENE_AFX = 0x05,
|
||||
/*!OTI for Font data streams */
|
||||
GPAC_OTI_FONT = 0x06,
|
||||
/*!OTI for synthesized texture streams */
|
||||
GPAC_OTI_SCENE_SYNTHESIZED_TEXTURE = 0x07,
|
||||
/*!OTI for streaming text streams */
|
||||
GPAC_OTI_TEXT_MPEG4 = 0x08,
|
||||
/*!OTI for LASeR streams*/
|
||||
GPAC_OTI_SCENE_LASER = 0x09,
|
||||
/*!OTI for SAF streams*/
|
||||
GPAC_OTI_SCENE_SAF = 0x0A,
|
||||
|
||||
/*!OTI for MPEG-4 Video Part 2 streams*/
|
||||
GPAC_OTI_VIDEO_MPEG4_PART2 = 0x20,
|
||||
/*!OTI for MPEG-4 Video Part 10 (H.264 | AVC ) streams*/
|
||||
GPAC_OTI_VIDEO_AVC = 0x21,
|
||||
/*!OTI for AVC Parameter sets streams*/
|
||||
GPAC_OTI_VIDEO_AVC_PS = 0x22,
|
||||
/*!OTI for HEVC video */
|
||||
GPAC_OTI_VIDEO_HEVC = 0x23,
|
||||
/*!OTI for H264-SVC streams*/
|
||||
GPAC_OTI_VIDEO_SVC = 0x24,
|
||||
/*!OTI for HEVC layered streams*/
|
||||
GPAC_OTI_VIDEO_LHVC = 0x25,
|
||||
/*!OTI for H264-SVC streams*/
|
||||
GPAC_OTI_VIDEO_MVC = 0x29,
|
||||
/*!OTI for MPEG-4 AAC streams*/
|
||||
GPAC_OTI_AUDIO_AAC_MPEG4 = 0x40,
|
||||
|
||||
/*!OTI for MPEG-2 Visual Simple Profile streams*/
|
||||
GPAC_OTI_VIDEO_MPEG2_SIMPLE = 0x60,
|
||||
/*!OTI for MPEG-2 Visual Main Profile streams*/
|
||||
GPAC_OTI_VIDEO_MPEG2_MAIN = 0x61,
|
||||
/*!OTI for MPEG-2 Visual SNR Profile streams*/
|
||||
GPAC_OTI_VIDEO_MPEG2_SNR = 0x62,
|
||||
/*!OTI for MPEG-2 Visual SNR Profile streams*/
|
||||
GPAC_OTI_VIDEO_MPEG2_SPATIAL = 0x63,
|
||||
/*!OTI for MPEG-2 Visual SNR Profile streams*/
|
||||
GPAC_OTI_VIDEO_MPEG2_HIGH = 0x64,
|
||||
/*!OTI for MPEG-2 Visual SNR Profile streams*/
|
||||
GPAC_OTI_VIDEO_MPEG2_422 = 0x65,
|
||||
|
||||
|
||||
/*!OTI for MPEG-2 AAC Main Profile streams*/
|
||||
GPAC_OTI_AUDIO_AAC_MPEG2_MP = 0x66,
|
||||
/*!OTI for MPEG-2 AAC Low Complexity Profile streams*/
|
||||
GPAC_OTI_AUDIO_AAC_MPEG2_LCP = 0x67,
|
||||
/*!OTI for MPEG-2 AAC Scalable Sampling Rate Profile streams*/
|
||||
GPAC_OTI_AUDIO_AAC_MPEG2_SSRP = 0x68,
|
||||
/*!OTI for MPEG-2 Audio Part 3 streams*/
|
||||
GPAC_OTI_AUDIO_MPEG2_PART3 = 0x69,
|
||||
/*!OTI for MPEG-1 Video streams*/
|
||||
GPAC_OTI_VIDEO_MPEG1 = 0x6A,
|
||||
/*!OTI for MPEG-1 Audio streams*/
|
||||
GPAC_OTI_AUDIO_MPEG1 = 0x6B,
|
||||
/*!OTI for JPEG streams*/
|
||||
GPAC_OTI_IMAGE_JPEG = 0x6C,
|
||||
/*!OTI for PNG streams*/
|
||||
GPAC_OTI_IMAGE_PNG = 0x6D,
|
||||
/*!OTI for JPEG-2000 streams*/
|
||||
GPAC_OTI_IMAGE_JPEG_2000 = 0x6E,
|
||||
|
||||
/*!
|
||||
* \brief Extra ObjectTypeIndication
|
||||
*
|
||||
* ObjectTypeIndication for media (audio/video) codecs not defined in MPEG-4. Since GPAC signals streams through MPEG-4 Descriptions,
|
||||
* it needs extensions for non-MPEG-4 streams such as AMR, H263 , etc.\n
|
||||
*\note The decoder specific info for such streams is always carried encoded, with the following syntax:\n
|
||||
* DSI Syntax for audio streams
|
||||
\code
|
||||
* u32 codec_four_cc: the codec 4CC reg code / codec id for ffmpeg
|
||||
* u32 sample_rate: sampling rate or 0 if unknown
|
||||
* u16 nb_channels: num channels or 0 if unknown
|
||||
* u16 frame_size: num audio samples per frame or 0 if unknown
|
||||
* u8 nb_bits_per_sample: nb bits or 0 if unknown
|
||||
* u8 num_frames_per_au: num audio frames per AU (used in 3GPP, max 15), 0 if unknown
|
||||
* char *data: per-codec extensions till end of DSI bitstream
|
||||
\endcode
|
||||
\n
|
||||
* DSI Syntax for video streams
|
||||
\code
|
||||
* u32 codec_four_cc: the codec 4CC reg code / codec id for ffmpeg
|
||||
* u16 width: video width or 0 if unknown
|
||||
* u16 height: video height or 0 if unknown
|
||||
* char *data: per-codec extensions till end of DSI bitstream
|
||||
\endcode
|
||||
*/
|
||||
GPAC_OTI_MEDIA_GENERIC = 0x80,
|
||||
/*!
|
||||
* \brief FFMPEG ObjectTypeIndication
|
||||
*
|
||||
* ObjectTypeIndication for FFMPEG codecs not defined in MPEG-4. FFMPEG uses the base GPAC_OTI_MEDIA_GENERIC specific info formats, and extends it as follows:
|
||||
\code
|
||||
* u32 bit_rate: the stream rate or 0 if unknown
|
||||
* u32 codec_tag: FFMPEG codec tag as defined in libavcodec
|
||||
* char *data: codec extensions till end of DSI bitstream
|
||||
\endcode
|
||||
*/
|
||||
GPAC_OTI_MEDIA_FFMPEG = 0x81,
|
||||
|
||||
/*!OTI for EVRC Voice streams*/
|
||||
GPAC_OTI_AUDIO_EVRC_VOICE = 0xA0,
|
||||
/*!OTI for SMV Voice streams*/
|
||||
GPAC_OTI_AUDIO_SMV_VOICE = 0xA1,
|
||||
/*!OTI for 3GPP2 CMF streams*/
|
||||
GPAC_OTI_3GPP2_CMF = 0xA2,
|
||||
/*!OTI for SMPTE VC-1 Video streams*/
|
||||
GPAC_OTI_VIDEO_SMPTE_VC1 = 0xA3,
|
||||
/*!OTI for Dirac Video streams*/
|
||||
GPAC_OTI_VIDEO_DIRAC = 0xA4,
|
||||
/*!OTI for AC-3 audio streams*/
|
||||
GPAC_OTI_AUDIO_AC3 = 0xA5,
|
||||
/*!OTI for enhanced AC-3 audio streams*/
|
||||
GPAC_OTI_AUDIO_EAC3 = 0xA6,
|
||||
/*!OTI for DRA audio streams*/
|
||||
GPAC_OTI_AUDIO_DRA = 0xA7,
|
||||
/*!OTI for ITU G719 audio streams*/
|
||||
GPAC_OTI_AUDIO_ITU_G719 = 0xA8,
|
||||
/*!OTI for DTS Coherent Acoustics audio streams*/
|
||||
GPAC_OTI_AUDIO_DTS_CA = 0xA9,
|
||||
/*!OTI for DTS-HD High Resolution audio streams*/
|
||||
GPAC_OTI_AUDIO_DTS_HD_HR = 0xAA,
|
||||
/*!OTI for DTS-HD Master audio streams*/
|
||||
GPAC_OTI_AUDIO_DTS_HD_MASTER = 0xAB,
|
||||
|
||||
/*!OTI for dummy streams (dsi = file name) using the generic context loader (BIFS/VRML/SWF/...) - GPAC internal*/
|
||||
GPAC_OTI_PRIVATE_SCENE_GENERIC = 0xC0,
|
||||
/*!OTI for SVG dummy stream (dsi = file name) - GPAC internal*/
|
||||
GPAC_OTI_PRIVATE_SCENE_SVG = 0xC1,
|
||||
/*!OTI for LASeR/SAF+XML dummy stream (dsi = file name) - GPAC internal*/
|
||||
GPAC_OTI_PRIVATE_SCENE_LASER = 0xC2,
|
||||
/*!OTI for XBL dummy streams (dsi = file name) - GPAC internal*/
|
||||
GPAC_OTI_PRIVATE_SCENE_XBL = 0xC3,
|
||||
/*!OTI for EPG dummy streams (dsi = null) - GPAC internal*/
|
||||
GPAC_OTI_PRIVATE_SCENE_EPG = 0xC4,
|
||||
/*!OTI for WGT dummy streams (dsi = null) - GPAC internal*/
|
||||
GPAC_OTI_PRIVATE_SCENE_WGT = 0xC5,
|
||||
/*!OTI for VTT dummy stream (dsi = file name) - GPAC internal*/
|
||||
GPAC_OTI_PRIVATE_SCENE_VTT = 0xC6,
|
||||
|
||||
/*!OTI for streaming SVG - GPAC internal*/
|
||||
GPAC_OTI_SCENE_SVG = 0xD0,
|
||||
/*!OTI for streaming SVG + gz - GPAC internal*/
|
||||
GPAC_OTI_SCENE_SVG_GZ = 0xD1,
|
||||
/*!OTI for DIMS (dsi = 3GPP DIMS configuration) - GPAC internal*/
|
||||
GPAC_OTI_SCENE_DIMS = 0xD2,
|
||||
/*!OTI for streaming VTT - GPAC internal*/
|
||||
GPAC_OTI_SCENE_VTT = 0xD3,
|
||||
/*!OTI for streaming VTT from MP4- GPAC internal*/
|
||||
GPAC_OTI_SCENE_VTT_MP4 = 0xD4,
|
||||
/*!OTI for streaming simple text from MP4- GPAC internal*/
|
||||
GPAC_OTI_SCENE_SIMPLE_TEXT_MP4 = 0xD5,
|
||||
|
||||
/*!
|
||||
* \brief OGG ObjectTypeIndication
|
||||
*
|
||||
* Object type indication for all OGG media. The DSI contains all intitialization ogg packets for the codec
|
||||
* and is formated as follows:\n
|
||||
*\code
|
||||
while (dsi_size) {
|
||||
bit(16) packet_size;
|
||||
char packet[packet_size];
|
||||
dsi_size -= packet_size;
|
||||
}\endcode
|
||||
*/
|
||||
GPAC_OTI_MEDIA_OGG = 0xDD,
|
||||
GPAC_OTI_MEDIA_THEORA = 0xDF,
|
||||
|
||||
GPAC_OTI_MEDIA_SUBPIC = 0xE0,
|
||||
|
||||
/*!OTI for 13K Voice / QCELP audio streams*/
|
||||
GPAC_OTI_AUDIO_13K_VOICE = 0xE1,
|
||||
|
||||
/*!OTI for RAW media streams. Input data is directly dispatched to the composition memory. The DSI contains is formated (MSBF) as follows:\n
|
||||
* DSI Syntax for audio streams
|
||||
\code
|
||||
* u32 sample_rate: sampling rate
|
||||
* u16 nb_channels: num channels
|
||||
* u16 nb_bits_per_sample: num of bits per audio sample
|
||||
* u32 frame_size: max size of audio frame in byte
|
||||
* u32 channel_config: GPAC mask of GF_AUDIO_CH_ constants, or 0 if unknown
|
||||
\endcode
|
||||
\n
|
||||
* DSI Syntax for video streams
|
||||
\code
|
||||
* u32 codec_four_cc: the codec 4CC reg code / codec id for ffmpeg
|
||||
* u16 width: video width or 0 if unknown
|
||||
* u16 height: video height or 0 if unknown
|
||||
* u32 frame_size: size of the video frame
|
||||
* u32 stride: horizontal stride of the video frame
|
||||
\endcode
|
||||
*/
|
||||
GPAC_OTI_RAW_MEDIA_STREAM = 0x101,
|
||||
|
||||
/*!OTI for LIBPLAYER private streams. The data pointer in the DSI is the libplayer handle object*/
|
||||
GPAC_OTI_PRIVATE_MEDIA_LIBPLAYER = 0xF1
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* \brief AFX Object Code
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*!3D Mesh Compression*/
|
||||
GPAC_AFX_3DMC = 0x00,
|
||||
/*!Wavelet Subdivision Surface*/
|
||||
GPAC_AFX_WAVELET_SUBDIVISION = 0x01,
|
||||
/*!MeshGrid*/
|
||||
GPAC_AFX_MESHGRID = 0x02,
|
||||
/*!Coordinate Interpolator*/
|
||||
GPAC_AFX_COORDINATE_INTERPOLATOR = 0x03,
|
||||
/*!Orientation Interpolator*/
|
||||
GPAC_AFX_ORIENTATION_INTERPOLATOR = 0x04,
|
||||
/*!Position Interpolator*/
|
||||
GPAC_AFX_POSITION_INTERPOLATOR = 0x05,
|
||||
/*!Octree Image*/
|
||||
GPAC_AFX_OCTREE_IMAGE = 0x06,
|
||||
/*!BBA*/
|
||||
GPAC_AFX_BBA = 0x07,
|
||||
/*!PointTexture*/
|
||||
GPAC_AFX_POINT_TEXTURE = 0x08,
|
||||
/*!3DMC Extension*/
|
||||
GPAC_AFX_3DMC_EXT = 0x09,
|
||||
/*!FootPrint representation*/
|
||||
GPAC_AFX_FOOTPRINT = 0x0A,
|
||||
/*!Animated Mesh Compression*/
|
||||
GPAC_AFX_ANIMATED_MESH = 0x0B,
|
||||
/*!Scalable Complexity*/
|
||||
GPAC_AFX_SCALABLE_COMPLEXITY = 0x0C,
|
||||
};
|
||||
|
||||
|
||||
/*channel cfg flags - DECODERS MUST OUTPUT STEREO/MULTICHANNEL IN THIS ORDER*/
|
||||
/*!
|
||||
* \brief Audio Channel Configuration
|
||||
*
|
||||
* Audio channel flags for spatialization.
|
||||
\note Decoders must output stereo/multichannel audio channels in this order in the decoded audio frame.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*!Left Audio Channel*/
|
||||
GF_AUDIO_CH_FRONT_LEFT = (1),
|
||||
/*!Right Audio Channel*/
|
||||
GF_AUDIO_CH_FRONT_RIGHT = (1<<1),
|
||||
/*!Center Audio Channel - may also be used to signal monophonic audio*/
|
||||
GF_AUDIO_CH_FRONT_CENTER = (1<<2),
|
||||
/*!LFE Audio Channel*/
|
||||
GF_AUDIO_CH_LFE = (1<<3),
|
||||
/*!Back Left Audio Channel*/
|
||||
GF_AUDIO_CH_BACK_LEFT = (1 << 4),
|
||||
/*!Back Right Audio Channel*/
|
||||
GF_AUDIO_CH_BACK_RIGHT = (1 << 5),
|
||||
/*Between left and center in front Audio Channel*/
|
||||
GF_AUDIO_CH_LEFT_CENTER = (1 << 6),
|
||||
/*Between right and center in front Audio Channel*/
|
||||
GF_AUDIO_CH_RIGHT_CENTER = (1 << 7),
|
||||
/*!Back Center Audio Channel*/
|
||||
GF_AUDIO_CH_BACK_CENTER = (1 << 8),
|
||||
/*!Side Left Audio Channel*/
|
||||
GF_AUDIO_CH_SIDE_LEFT = (1<<9),
|
||||
/*!Side Right Audio Channel*/
|
||||
GF_AUDIO_CH_SIDE_RIGHT = (1<<10),
|
||||
/*!top Audio Channel*/
|
||||
GF_AUDIO_CH_TOP_CENTER = (1 << 11),
|
||||
/*!between left and center above Audio Channel*/
|
||||
GF_AUDIO_CH_TOP_FRONT_LEFT = (1 << 12),
|
||||
/*!above center Audio Channel*/
|
||||
GF_AUDIO_CH_TOP_FRONT_CENTER = (1 << 13),
|
||||
/*!between right and center above Audio Channel*/
|
||||
GF_AUDIO_CH_TOP_FRONT_RIGHT = (1 << 14),
|
||||
/*!Back Left High Audio Channel*/
|
||||
GF_AUDIO_CH_TOP_BACK_LEFT = (1 << 15),
|
||||
/*!Back top High Audio Channel*/
|
||||
GF_AUDIO_CH_TOP_BACK_CENTER = (1 << 16),
|
||||
/*!Back Right High Audio Channel*/
|
||||
GF_AUDIO_CH_TOP_BACK_RIGHT = (1 << 17)
|
||||
};
|
||||
|
||||
#define SPEAKER_TOP_BACK_LEFT 0x8000
|
||||
#define SPEAKER_TOP_BACK_CENTER 0x10000
|
||||
#define SPEAKER_TOP_BACK_RIGHT 0x20000
|
||||
|
||||
|
||||
|
||||
/*DIMS unit flags */
|
||||
/*!
|
||||
* \brief DIMS Unit header flags
|
||||
*
|
||||
* DIMS Unit header flags as 3GPP TS 26.142.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*!S: is-Scene: DIMS unit contains a complete document (svg)*/
|
||||
GF_DIMS_UNIT_S = 1,
|
||||
/*!M: is-RAP: DIMS unit is a random access point*/
|
||||
GF_DIMS_UNIT_M = 1<<1,
|
||||
/*!I: is-Redundant: DIMS unit is made of redundant data*/
|
||||
GF_DIMS_UNIT_I = 1<<2,
|
||||
/*!D: redundant-exit: DIMS unit is the end of redundant data*/
|
||||
GF_DIMS_UNIT_D = 1<<3,
|
||||
/*!P: priority: DIMS unit is high priority*/
|
||||
GF_DIMS_UNIT_P = 1<<4,
|
||||
/*!C: compressed: DIMS unit is compressed*/
|
||||
GF_DIMS_UNIT_C = 1<<5
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* AVC NAL unit types
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*! Non IDR AVC slice*/
|
||||
GF_AVC_NALU_NON_IDR_SLICE = 1,
|
||||
/*! DP_A AVC slice*/
|
||||
GF_AVC_NALU_DP_A_SLICE = 2,
|
||||
/*! DP_B AVC slice*/
|
||||
GF_AVC_NALU_DP_B_SLICE = 3,
|
||||
/*! DP_C AVC slice*/
|
||||
GF_AVC_NALU_DP_C_SLICE = 4,
|
||||
/*! IDR AVC slice*/
|
||||
GF_AVC_NALU_IDR_SLICE = 5,
|
||||
/*! SEI Message*/
|
||||
GF_AVC_NALU_SEI = 6,
|
||||
/*! Sequence Parameter Set */
|
||||
GF_AVC_NALU_SEQ_PARAM = 7,
|
||||
/*! Picture Parameter Set*/
|
||||
GF_AVC_NALU_PIC_PARAM = 8,
|
||||
/*! Access Unit delimiter*/
|
||||
GF_AVC_NALU_ACCESS_UNIT = 9,
|
||||
/*! End of Sequence*/
|
||||
GF_AVC_NALU_END_OF_SEQ = 10,
|
||||
/*! End of stream*/
|
||||
GF_AVC_NALU_END_OF_STREAM = 11,
|
||||
/*! Filler data*/
|
||||
GF_AVC_NALU_FILLER_DATA = 12,
|
||||
/*! Sequence Parameter Set Extension*/
|
||||
GF_AVC_NALU_SEQ_PARAM_EXT = 13,
|
||||
/*! SVC preffix*/
|
||||
GF_AVC_NALU_SVC_PREFIX_NALU = 14,
|
||||
/*! SVC subsequence parameter set*/
|
||||
GF_AVC_NALU_SVC_SUBSEQ_PARAM = 15,
|
||||
/*! Auxiliary slice*/
|
||||
GF_AVC_NALU_SLICE_AUX = 19,
|
||||
/*! SVC slice*/
|
||||
GF_AVC_NALU_SVC_SLICE = 20,
|
||||
/*! View and dependency representation delimiter */
|
||||
GF_AVC_NALU_VDRD = 24
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* AVC slice types
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*! P slice*/
|
||||
GF_AVC_TYPE_P = 0,
|
||||
/*! B slice*/
|
||||
GF_AVC_TYPE_B = 1,
|
||||
/*! I slice*/
|
||||
GF_AVC_TYPE_I = 2,
|
||||
/*! SP slice*/
|
||||
GF_AVC_TYPE_SP = 3,
|
||||
/*! SI slice*/
|
||||
GF_AVC_TYPE_SI = 4,
|
||||
/*! Type2 P slice*/
|
||||
GF_AVC_TYPE2_P = 5,
|
||||
/*! Type2 B slice*/
|
||||
GF_AVC_TYPE2_B = 6,
|
||||
/*! Type2 I slice*/
|
||||
GF_AVC_TYPE2_I = 7,
|
||||
/*! Type2 SP slice*/
|
||||
GF_AVC_TYPE2_SP = 8,
|
||||
/*! Type2 SI slice*/
|
||||
GF_AVC_TYPE2_SI = 9
|
||||
};
|
||||
|
||||
/*!
|
||||
HEVC NAL unit types
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*! Trail N HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_TRAIL_N = 0,
|
||||
/*! Trail R HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_TRAIL_R = 1,
|
||||
/*! TSA N HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_TSA_N = 2,
|
||||
/*! TSA R HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_TSA_R = 3,
|
||||
/*! STSA N HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_STSA_N = 4,
|
||||
/*! STSA R HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_STSA_R = 5,
|
||||
/*! RADL N HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_RADL_N = 6,
|
||||
/*! RADL R HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_RADL_R = 7,
|
||||
/*! RASL N HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_RASL_N = 8,
|
||||
/*! RASL R HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_RASL_R = 9,
|
||||
/*! BLA LP HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_BLA_W_LP = 16,
|
||||
/*! BLA DLP HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_BLA_W_DLP = 17,
|
||||
/*! BLA no LP HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_BLA_N_LP = 18,
|
||||
/*! IDR DLP HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_IDR_W_DLP = 19,
|
||||
/*! IDR HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_IDR_N_LP = 20,
|
||||
/*! CRA HEVC slice*/
|
||||
GF_HEVC_NALU_SLICE_CRA = 21,
|
||||
/*! Video Parameter Set*/
|
||||
GF_HEVC_NALU_VID_PARAM = 32,
|
||||
/*! Sequence Parameter Set*/
|
||||
GF_HEVC_NALU_SEQ_PARAM = 33,
|
||||
/*! Picture Parameter Set*/
|
||||
GF_HEVC_NALU_PIC_PARAM = 34,
|
||||
/*! AU delimiter*/
|
||||
GF_HEVC_NALU_ACCESS_UNIT = 35,
|
||||
/*! End of sequence*/
|
||||
GF_HEVC_NALU_END_OF_SEQ = 36,
|
||||
/*! End of stream*/
|
||||
GF_HEVC_NALU_END_OF_STREAM = 37,
|
||||
/*! Filler Data*/
|
||||
GF_HEVC_NALU_FILLER_DATA = 38,
|
||||
/*! prefix SEI message*/
|
||||
GF_HEVC_NALU_SEI_PREFIX = 39,
|
||||
/*! suffix SEI message*/
|
||||
GF_HEVC_NALU_SEI_SUFFIX = 40,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*! Number of defined QCELP rate sizes*/
|
||||
static const unsigned int GF_QCELP_RATE_TO_SIZE_NB = 7;
|
||||
/*! QCELP rate sizes - note that these sizes INCLUDE the rate_type header byte*/
|
||||
static const unsigned int GF_QCELP_RATE_TO_SIZE [] = {0, 1, 1, 4, 2, 8, 3, 17, 4, 35, 5, 8, 14, 1};
|
||||
|
||||
/*! Number of defined EVRC rate sizes*/
|
||||
static const unsigned int GF_SMV_EVRC_RATE_TO_SIZE_NB = 6;
|
||||
/*! EVRC rate sizes - note that these sizes INCLUDE the rate_type header byte*/
|
||||
static const unsigned int GF_SMV_EVRC_RATE_TO_SIZE [] = {0, 1, 1, 3, 2, 6, 3, 11, 4, 23, 5, 1};
|
||||
|
||||
/*! AMR frame sizes*/
|
||||
static const unsigned int GF_AMR_FRAME_SIZE[16] = { 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 };
|
||||
/*! AMR WB frame sizes*/
|
||||
static const unsigned int GF_AMR_WB_FRAME_SIZE[16] = { 17, 23, 32, 36, 40, 46, 50, 58, 60, 5, 5, 0, 0, 0, 0, 0 };
|
||||
|
||||
|
||||
/*! out-of-band sample description index for 3GPP (128 and 255 reserved in RFC)*/
|
||||
#define GF_RTP_TX3G_SIDX_OFFSET 129
|
||||
|
||||
|
||||
/*! RFC6381 codec name max length*/
|
||||
#define RFC6381_CODEC_NAME_SIZE_MAX 100
|
||||
|
||||
/*! @} */
|
||||
|
||||
#define GF_VENDOR_GPAC GF_4CC('G', 'P', 'A', 'C')
|
||||
|
||||
/* ID3v2 tags from mpegts.c */
|
||||
typedef enum {
|
||||
ID3V2_FRAME_AENC = GF_4CC('A','E','N','C'),
|
||||
ID3V2_FRAME_APIC = GF_4CC('A','P','I','C'),
|
||||
ID3V2_FRAME_COMM = GF_4CC('C','O','M','M'),
|
||||
ID3V2_FRAME_COMR = GF_4CC('C','O','M','R'),
|
||||
ID3V2_FRAME_ENCR = GF_4CC('E','N','C','R'),
|
||||
ID3V2_FRAME_EQUA = GF_4CC('E','Q','U','A'),
|
||||
ID3V2_FRAME_ETCO = GF_4CC('E','T','C','O'),
|
||||
ID3V2_FRAME_GEOB = GF_4CC('G','E','O','B'),
|
||||
ID3V2_FRAME_GRID = GF_4CC('G','R','I','D'),
|
||||
ID3V2_FRAME_IPLS = GF_4CC('I','P','L','S'),
|
||||
ID3V2_FRAME_LINK = GF_4CC('L','I','N','K'),
|
||||
ID3V2_FRAME_MCDI = GF_4CC('M','C','D','I'),
|
||||
ID3V2_FRAME_MLLT = GF_4CC('M','L','L','T'),
|
||||
ID3V2_FRAME_OWNE = GF_4CC('O','W','N','E'),
|
||||
ID3V2_FRAME_PRIV = GF_4CC('P','R','I','V'),
|
||||
ID3V2_FRAME_PCNT = GF_4CC('P','C','N','T'),
|
||||
ID3V2_FRAME_POPM = GF_4CC('P','O','P','M'),
|
||||
ID3V2_FRAME_POSS = GF_4CC('P','O','S','S'),
|
||||
ID3V2_FRAME_RBUF = GF_4CC('R','B','U','F'),
|
||||
ID3V2_FRAME_RVAD = GF_4CC('R','V','A','D'),
|
||||
ID3V2_FRAME_RVRB = GF_4CC('R','V','R','B'),
|
||||
ID3V2_FRAME_SYLT = GF_4CC('S','Y','L','T'),
|
||||
ID3V2_FRAME_SYTC = GF_4CC('S','Y','T','C'),
|
||||
ID3V2_FRAME_TALB = GF_4CC('T','E','N','C'),
|
||||
ID3V2_FRAME_TBPM = GF_4CC('T','B','P','M'),
|
||||
ID3V2_FRAME_TCOM = GF_4CC('T','C','O','M'),
|
||||
ID3V2_FRAME_TCON = GF_4CC('T','C','O','N'),
|
||||
ID3V2_FRAME_TCOP = GF_4CC('T','C','O','P'),
|
||||
ID3V2_FRAME_TDAT = GF_4CC('T','D','A','T'),
|
||||
ID3V2_FRAME_TDLY = GF_4CC('T','D','L','Y'),
|
||||
ID3V2_FRAME_TENC = GF_4CC('T','E','N','C'),
|
||||
ID3V2_FRAME_TEXT = GF_4CC('T','E','X','T'),
|
||||
ID3V2_FRAME_TFLT = GF_4CC('T','F','L','T'),
|
||||
ID3V2_FRAME_TIME = GF_4CC('T','I','M','E'),
|
||||
ID3V2_FRAME_TIT1 = GF_4CC('T','I','T','1'),
|
||||
ID3V2_FRAME_TIT2 = GF_4CC('T','I','T','2'),
|
||||
ID3V2_FRAME_TIT3 = GF_4CC('T','I','T','3'),
|
||||
ID3V2_FRAME_TKEY = GF_4CC('T','K','E','Y'),
|
||||
ID3V2_FRAME_TLAN = GF_4CC('T','L','A','N'),
|
||||
ID3V2_FRAME_TLEN = GF_4CC('T','L','E','N'),
|
||||
ID3V2_FRAME_TMED = GF_4CC('T','M','E','D'),
|
||||
ID3V2_FRAME_TOAL = GF_4CC('T','O','A','L'),
|
||||
ID3V2_FRAME_TOFN = GF_4CC('T','O','F','N'),
|
||||
ID3V2_FRAME_TOLY = GF_4CC('T','O','L','Y'),
|
||||
ID3V2_FRAME_TOPE = GF_4CC('T','O','P','E'),
|
||||
ID3V2_FRAME_TORY = GF_4CC('T','O','R','Y'),
|
||||
ID3V2_FRAME_TOWN = GF_4CC('T','O','W','N'),
|
||||
ID3V2_FRAME_TPE1 = GF_4CC('T','P','E','1'),
|
||||
ID3V2_FRAME_TPE2 = GF_4CC('T','P','E','2'),
|
||||
ID3V2_FRAME_TPE3 = GF_4CC('T','P','E','3'),
|
||||
ID3V2_FRAME_TPE4 = GF_4CC('T','P','E','4'),
|
||||
ID3V2_FRAME_TPOS = GF_4CC('T','P','E','5'),
|
||||
ID3V2_FRAME_TPUB = GF_4CC('T','P','U','B'),
|
||||
ID3V2_FRAME_TRCK = GF_4CC('T','R','C','K'),
|
||||
ID3V2_FRAME_TRDA = GF_4CC('T','R','D','A'),
|
||||
ID3V2_FRAME_TRSN = GF_4CC('T','R','S','N'),
|
||||
ID3V2_FRAME_TRSO = GF_4CC('T','R','S','O'),
|
||||
ID3V2_FRAME_TSIZ = GF_4CC('T','S','I','Z'),
|
||||
ID3V2_FRAME_TSRC = GF_4CC('T','S','R','C'),
|
||||
ID3V2_FRAME_TSSE = GF_4CC('T','S','S','E'),
|
||||
ID3V2_FRAME_TYER = GF_4CC('T','Y','E','R'),
|
||||
ID3V2_FRAME_TXXX = GF_4CC('T','X','X','X'),
|
||||
ID3V2_FRAME_UFID = GF_4CC('U','F','I','D'),
|
||||
ID3V2_FRAME_USER = GF_4CC('U','S','E','R'),
|
||||
ID3V2_FRAME_USLT = GF_4CC('U','S','L','T'),
|
||||
ID3V2_FRAME_WCOM = GF_4CC('W','C','O','M'),
|
||||
ID3V2_FRAME_WCOP = GF_4CC('W','C','O','P'),
|
||||
ID3V2_FRAME_WOAF = GF_4CC('W','O','A','F'),
|
||||
ID3V2_FRAME_WOAR = GF_4CC('W','O','A','R'),
|
||||
ID3V2_FRAME_WOAS = GF_4CC('W','O','A','S'),
|
||||
ID3V2_FRAME_WORS = GF_4CC('W','O','R','S'),
|
||||
ID3V2_FRAME_WPAY = GF_4CC('W','P','A','Y'),
|
||||
ID3V2_FRAME_WPUB = GF_4CC('W','P','U','B'),
|
||||
ID3V2_FRAME_WXXX = GF_4CC('W','X','X','X')
|
||||
} GF_ID3v2FrameType;
|
||||
|
||||
|
||||
/* media types consts from media_import.c */
|
||||
enum {
|
||||
|
||||
GF_MEDIA_TYPE_AC3 = GF_4CC('A','C','3',' '),
|
||||
GF_MEDIA_TYPE_BIFS = GF_4CC('B','I','F','S'),
|
||||
GF_MEDIA_TYPE_CHAP = GF_4CC('C','H','A','P'),
|
||||
GF_MEDIA_TYPE_DAC3 = GF_4CC('D','A','C','3'),
|
||||
GF_MEDIA_TYPE_DEC3 = GF_4CC('D','E','C','3'),
|
||||
GF_MEDIA_TYPE_DTS = GF_4CC('D','T','S',' '),
|
||||
GF_MEDIA_TYPE_H264 = GF_4CC('H','2','6','4'),
|
||||
GF_MEDIA_TYPE_HEVC = GF_4CC('H','E','V','C'),
|
||||
GF_MEDIA_TYPE_ID3 = GF_4CC('I','D','3',' '),
|
||||
GF_MEDIA_TYPE_JPEG = GF_4CC('J','P','E','G'),
|
||||
GF_MEDIA_TYPE_LASR = GF_4CC('L','A','S','R'),
|
||||
GF_MEDIA_TYPE_LHVC = GF_4CC('L','H','V','C'),
|
||||
GF_MEDIA_TYPE_LPCM = GF_4CC('L','P','C','M'),
|
||||
GF_MEDIA_TYPE_M4SP = GF_4CC('M','4','S','P'),
|
||||
GF_MEDIA_TYPE_M4SS = GF_4CC('M','4','S','S'),
|
||||
GF_MEDIA_TYPE_MP1A = GF_4CC('M','P','1','A'),
|
||||
GF_MEDIA_TYPE_MP1V = GF_4CC('M','P','1','V'),
|
||||
GF_MEDIA_TYPE_MP2A = GF_4CC('M','P','2','A'),
|
||||
GF_MEDIA_TYPE_MP2V = GF_4CC('M','P','2','V'),
|
||||
GF_MEDIA_TYPE_MP4A = GF_4CC('M','P','4','A'),
|
||||
GF_MEDIA_TYPE_MP4V = GF_4CC('M','P','4','V'),
|
||||
GF_MEDIA_TYPE_MPG1 = GF_4CC('M','P','G','1'),
|
||||
GF_MEDIA_TYPE_MPG2 = GF_4CC('M','P','G','2'),
|
||||
GF_MEDIA_TYPE_MPGA = GF_4CC('M','P','G','A'),
|
||||
GF_MEDIA_TYPE_NHNL = GF_4CC('N','H','n','l'),
|
||||
GF_MEDIA_TYPE_NHNT = GF_4CC('N','H','n','t'),
|
||||
GF_MEDIA_TYPE_PNG = GF_4CC('P','N','G',' '),
|
||||
GF_MEDIA_TYPE_SVC = GF_4CC('S','V','C',' '),
|
||||
GF_MEDIA_TYPE_THEO = GF_4CC('t','h','e','o'),
|
||||
GF_MEDIA_TYPE_UNK = GF_4CC('U','N','K',' '),
|
||||
|
||||
/* from mpegts.c */
|
||||
GF_MEDIA_STREAM_AC3 = GF_4CC('A','C','-','3'),
|
||||
GF_MEDIA_STREAM_VC1 = GF_4CC('V','C','-','1'),
|
||||
|
||||
/* from m2ts_muc.c */
|
||||
GF_MEDIA_LANG_UND = GF_4CC('u','n','d',' '),
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* meta types from box_code_meta.c - fileimport.c */
|
||||
enum {
|
||||
|
||||
GF_META_ITEM_TYPE_MIME = GF_4CC('m', 'i', 'm', 'e'),
|
||||
GF_META_ITEM_TYPE_URI = GF_4CC('u', 'r', 'i', ' '),
|
||||
GF_META_ITEM_TYPE_PICT = GF_4CC('p', 'i', 'c', 't'),
|
||||
|
||||
GF_META_TYPE_SVG = GF_4CC('s','v','g',' '),
|
||||
GF_META_TYPE_SVGZ = GF_4CC('s','v','g','z'),
|
||||
GF_META_TYPE_SMIL = GF_4CC('s','m','i','l'),
|
||||
GF_META_TYPE_SMLZ = GF_4CC('s','m','l','z'),
|
||||
GF_META_TYPE_X3D = GF_4CC('x','3','d',' '),
|
||||
GF_META_TYPE_X3DZ = GF_4CC('x','3','d','z'),
|
||||
GF_META_TYPE_XMTA = GF_4CC('x','m','t','a'),
|
||||
GF_META_TYPE_XMTZ = GF_4CC('x','m','t','z'),
|
||||
|
||||
GF_META_TYPE_RVCI = GF_4CC('r','v','c','i'),
|
||||
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_GF_CONSTANTS_H_*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,245 +0,0 @@
|
||||
/*
|
||||
* GPAC - Multimedia Framework C SDK
|
||||
*
|
||||
* Authors: Jean Le Feuvre
|
||||
* Copyright (c) Telecom ParisTech 2000-2012
|
||||
* All rights reserved
|
||||
*
|
||||
* This file is part of GPAC / common tools sub-project
|
||||
*
|
||||
* GPAC is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GPAC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GF_LIST_H_
|
||||
#define _GF_LIST_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file <gpac/list.h>
|
||||
* \brief Generic list of objects.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \addtogroup list_grp List
|
||||
* \ingroup utils_grp
|
||||
* \brief List object
|
||||
*
|
||||
* This section documents the list object of the GPAC framework.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <gpac/tools.h>
|
||||
|
||||
typedef struct _tag_array GF_List;
|
||||
|
||||
/*!
|
||||
* \brief list constructor
|
||||
*
|
||||
* Constructs a new list object
|
||||
* \return new list object
|
||||
*/
|
||||
GF_List *gf_list_new();
|
||||
|
||||
/*!
|
||||
* \brief list destructor
|
||||
*
|
||||
* Destructs a list object
|
||||
* \param ptr list object to destruct
|
||||
* \note It is the caller responsability to destroy the content of the list if needed
|
||||
*/
|
||||
void gf_list_del(GF_List *ptr);
|
||||
|
||||
/*!
|
||||
* \brief get count
|
||||
*
|
||||
* Returns number of items in the list
|
||||
* \param ptr target list object
|
||||
* \return number of items in the list
|
||||
*/
|
||||
u32 gf_list_count(const GF_List *ptr);
|
||||
|
||||
/*!
|
||||
* \brief add item
|
||||
*
|
||||
* Adds an item at the end of the list
|
||||
* \param ptr target list object
|
||||
* \param item item to add
|
||||
*/
|
||||
GF_Err gf_list_add(GF_List *ptr, void* item);
|
||||
|
||||
/*!
|
||||
* \brief inserts item
|
||||
*
|
||||
* Insert an item in the list
|
||||
* \param ptr target list object
|
||||
* \param item item to add
|
||||
* \param position insertion position. It is expressed between 0 and gf_list_count-1, and any bigger value is equivalent to gf_list_add
|
||||
*/
|
||||
GF_Err gf_list_insert(GF_List *ptr, void *item, u32 position);
|
||||
|
||||
/*!
|
||||
* \brief removes item
|
||||
*
|
||||
* Removes an item from the list given its position
|
||||
* \param ptr target list object
|
||||
* \param position position of the item to remove. It is expressed between 0 and gf_list_count-1.
|
||||
* \note It is the caller responsability to destroy the content of the list if needed
|
||||
*/
|
||||
GF_Err gf_list_rem(GF_List *ptr, u32 position);
|
||||
|
||||
/*!
|
||||
* \brief gets item
|
||||
*
|
||||
* Gets an item from the list given its position
|
||||
* \param ptr target list object
|
||||
* \param position position of the item to get. It is expressed between 0 and gf_list_count-1.
|
||||
*/
|
||||
void *gf_list_get(GF_List *ptr, u32 position);
|
||||
|
||||
/*!
|
||||
* \brief finds item
|
||||
*
|
||||
* Finds an item in the list
|
||||
* \param ptr target list object.
|
||||
* \param item the item to find.
|
||||
* \return 0-based item position in the list, or -1 if the item could not be found.
|
||||
*/
|
||||
s32 gf_list_find(GF_List *ptr, void *item);
|
||||
|
||||
/*!
|
||||
* \brief deletes item
|
||||
*
|
||||
* Deletes an item from the list
|
||||
* \param ptr target list object.
|
||||
* \param item the item to find.
|
||||
* \return 0-based item position in the list before removal, or -1 if the item could not be found.
|
||||
*/
|
||||
s32 gf_list_del_item(GF_List *ptr, void *item);
|
||||
|
||||
/*!
|
||||
* \brief resets list
|
||||
*
|
||||
* Resets the content of the list
|
||||
* \param ptr target list object.
|
||||
* \note It is the caller responsability to destroy the content of the list if needed
|
||||
*/
|
||||
void gf_list_reset(GF_List *ptr);
|
||||
|
||||
/*!
|
||||
* \brief gets last item
|
||||
*
|
||||
* Gets last item o fthe list
|
||||
* \param ptr target list object
|
||||
*/
|
||||
void *gf_list_last(GF_List *ptr);
|
||||
|
||||
/*!
|
||||
* \brief reverses the order of the elements in the list container.
|
||||
*
|
||||
* reverses the order of the elements in the list container.
|
||||
* \param ptr target list object
|
||||
*/
|
||||
void gf_list_reverse(GF_List *ptr);
|
||||
|
||||
/*!
|
||||
* \brief removes last item
|
||||
*
|
||||
* Removes the last item of the list
|
||||
* \param ptr target list object
|
||||
* \note It is the caller responsability to destroy the content of the list if needed
|
||||
*/
|
||||
GF_Err gf_list_rem_last(GF_List *ptr);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief list enumerator
|
||||
*
|
||||
* Retrieves given list item and increment current position
|
||||
* \param ptr target list object
|
||||
* \param pos target item position. The position is automatically incremented regardless of the return value
|
||||
* \note A typical enumeration will start with a value of 0 until NULL is returned.
|
||||
*/
|
||||
void *gf_list_enum(GF_List *ptr, u32 *pos);
|
||||
|
||||
/*!
|
||||
* \brief list enumerator in reversed order
|
||||
*
|
||||
* Retrieves the given list item in reversed order and update current position
|
||||
* \param ptr target list object
|
||||
* \param pos target item position. The position is automatically decrelented regardless of the return value
|
||||
* \note A typical enumeration in reversed order will start with a value of 0 until NULL is returned.
|
||||
*/
|
||||
void *gf_list_rev_enum(GF_List *ptr, u32 *pos);
|
||||
|
||||
/*!
|
||||
* \brief list swap
|
||||
*
|
||||
* Swaps content of two lists
|
||||
* \param l1 first list object
|
||||
* \param l2 second list object
|
||||
*/
|
||||
GF_Err gf_list_swap(GF_List *l1, GF_List *l2);
|
||||
|
||||
/*!
|
||||
* \brief list transfer
|
||||
*
|
||||
* Transfer content between lists
|
||||
* \param l1 destination list object
|
||||
* \param l2 source list object
|
||||
*/
|
||||
GF_Err gf_list_transfer(GF_List *l1, GF_List *l2);
|
||||
|
||||
/*!
|
||||
* \brief clone list
|
||||
*
|
||||
* Returns a new list as an exact copy of the given list
|
||||
* \param ptr the list to clone
|
||||
* \return the cloned list
|
||||
*/
|
||||
GF_List* gf_list_clone(GF_List *ptr);
|
||||
|
||||
/*!
|
||||
* \brief Pop the first element in the list
|
||||
*
|
||||
* Removes the first element in the list container, effectively reducing its size by one
|
||||
* and returns the popped element.
|
||||
* \param ptr the list to pop
|
||||
* \return the popped element
|
||||
*/
|
||||
void* gf_list_pop_front(GF_List *ptr);
|
||||
|
||||
/*!
|
||||
* \brief Pop the last element in the list
|
||||
*
|
||||
* Removes the last element in the list container, effectively reducing the container size by one
|
||||
* and return the popped element.
|
||||
* \param ptr the list to pop
|
||||
* \return the popped element
|
||||
*/
|
||||
void* gf_list_pop_back(GF_List *ptr);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*_GF_LIST_H_*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,579 +0,0 @@
|
||||
/*
|
||||
* GPAC - Multimedia Framework C SDK
|
||||
*
|
||||
* Authors: Jean Le Feuvre
|
||||
* Copyright (c) Telecom ParisTech 2000-2012
|
||||
* All rights reserved
|
||||
*
|
||||
* This file is part of GPAC / common tools sub-project
|
||||
*
|
||||
* GPAC is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GPAC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GF_NET_H_
|
||||
#define _GF_NET_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file <gpac/network.h>
|
||||
* \brief Networking.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \addtogroup net_grp Network
|
||||
* \ingroup utils_grp
|
||||
* \brief Networking tools (URL resolution, TCP/UDP sockets)
|
||||
*
|
||||
*This section documents the IP network functions of the GPAC framework.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <gpac/tools.h>
|
||||
|
||||
|
||||
/*!
|
||||
*\brief URL local test
|
||||
*
|
||||
*Tests whether a URL describes a local file or not
|
||||
*\param url the url to analyze
|
||||
*\return 1 if the URL describes a local file, 0 otherwise
|
||||
*/
|
||||
Bool gf_url_is_local(const char *url);
|
||||
|
||||
/*!
|
||||
*\brief gets absolute file path
|
||||
*
|
||||
*Gets the absolute file path from a relative path and its parent absolute one. This can only be used with file paths.
|
||||
*\param pathName the relative path name of a file
|
||||
*\param parentPath the absolute parent path name
|
||||
*\return absolute path name of the file, or NULL if bad paths are provided.
|
||||
\note the returned string must be freed by user
|
||||
*/
|
||||
char *gf_url_get_absolute_path(const char *pathName, const char *parentPath);
|
||||
|
||||
/*concatenates URL and gets back full URL - returned string must be freed by user*/
|
||||
/*!
|
||||
*\brief URL concatenation
|
||||
*
|
||||
*Concatenates a relative URL with its parent URL
|
||||
*\param parentName URL of the parent service
|
||||
*\param pathName URL of the service
|
||||
*\return absolute path name of the service, or NULL if bad paths are provided or if the service path is already an absolute one.
|
||||
\note the returned string must be freed by user
|
||||
*/
|
||||
char *gf_url_concatenate(const char *parentName, const char *pathName);
|
||||
|
||||
/*!
|
||||
*\brief URL encodin
|
||||
*
|
||||
*Encodes URL by replacing special characters with their % encodings.
|
||||
*\param path URL of the service
|
||||
*\return encoded path name , or NULL if bad paths are provided.
|
||||
\note the returned string must be freed by user
|
||||
*/
|
||||
char *gf_url_percent_encode(const char *path);
|
||||
|
||||
/*!
|
||||
*\brief URL to file system
|
||||
*
|
||||
*Converts a local URL to a file system value. Removes all white spaces and similar
|
||||
*\param url url to convert
|
||||
*/
|
||||
void gf_url_to_fs_path(char *url);
|
||||
|
||||
|
||||
/*!
|
||||
*\brief Extract resource name from URL
|
||||
*
|
||||
* Extracts the resource name from the URL
|
||||
*\param url input url
|
||||
*\return resource name.
|
||||
*/
|
||||
const char *gf_url_get_resource_name(const char *url);
|
||||
|
||||
/*!
|
||||
*\brief Extract resource path from URL
|
||||
*
|
||||
*Extracts the reource path from the URL
|
||||
*\param url input url
|
||||
*\param res_path buffer for resulting path storage
|
||||
*\return 1 if path was extracted, 0 if url is a single file name.
|
||||
*/
|
||||
Bool gf_url_get_resource_path(const char *url, char *res_path);
|
||||
|
||||
/*!
|
||||
*\brief Remove last delimenter from URL
|
||||
*
|
||||
* Remove last delimenter from URL
|
||||
*\param sURL input url
|
||||
*\param res_path buffer for resulting path storage
|
||||
*\return GF_TRUE if delimiter was extracted, otherwise GF_FALSE.
|
||||
*/
|
||||
Bool gf_url_remove_last_delimiter(const char *sURL, char *res_path);
|
||||
|
||||
/*!
|
||||
*\brief Extract extension from a resource path in URL
|
||||
*
|
||||
* Extract a resource path of URL and analyze its extension
|
||||
*\param sURL input url
|
||||
*\return The corresponding extension if exists, otherwise NULL.
|
||||
*/
|
||||
const char* gf_url_get_ressource_extension(const char *sURL);
|
||||
|
||||
/*!
|
||||
*\brief Portable version of UNIX gettimeofday()
|
||||
*/
|
||||
struct timeval;
|
||||
s32 gf_gettimeofday(struct timeval *tp, void *tz);
|
||||
|
||||
/*!
|
||||
*\brief gets UTC time
|
||||
*
|
||||
*Gets UTC time since midnight Jan 1970
|
||||
*\param sec number of seconds
|
||||
*\param msec number of milliseconds
|
||||
*/
|
||||
void gf_utc_time_since_1970(u32 *sec, u32 *msec);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief NTP seconds from 1900 to 1970
|
||||
* \hideinitializer
|
||||
*
|
||||
* Macro giving the number of seconds from from 1900 to 1970
|
||||
*/
|
||||
#define GF_NTP_SEC_1900_TO_1970 2208988800ul
|
||||
|
||||
/*!
|
||||
*\brief gets NTP time
|
||||
*
|
||||
*Gets NTP (Network Time Protocol) in seconds and fractional side
|
||||
\param sec NTP time in seconds
|
||||
\param frac fractional NTP time expressed in 1 / (1<<32 - 1) seconds units
|
||||
*/
|
||||
void gf_net_get_ntp(u32 *sec, u32 *frac);
|
||||
|
||||
/*!
|
||||
*\brief offsets NTP time by a given amount of seconds
|
||||
*
|
||||
*Offsets NTP time of the system by a given amount of seconds in the future or the past (default value is 0).
|
||||
\param sec seconds to add or remove to the system NTP
|
||||
*/
|
||||
void gf_net_set_ntp_shift(s32 sec);
|
||||
|
||||
/*!
|
||||
*\brief gets NTP time
|
||||
*
|
||||
*Gets NTP (Network Time Protocol) timestamp (high 32 bit is seconds, low 32 bit is fraction)
|
||||
\return NTP timestamp
|
||||
*/
|
||||
u64 gf_net_get_ntp_ts();
|
||||
|
||||
/*!
|
||||
*
|
||||
*Gets diff in milliseconds between NTP time and current time
|
||||
\param ntp NTP timestamp
|
||||
\return diff in milliseconds with the current time
|
||||
*/
|
||||
s32 gf_net_get_ntp_diff_ms(u64 ntp);
|
||||
|
||||
/*!
|
||||
* Socket options
|
||||
* \hideinitializer
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*!Reuses port.*/
|
||||
GF_SOCK_REUSE_PORT = 1,
|
||||
/*!Forces IPV6 if available.*/
|
||||
GF_SOCK_FORCE_IPV6 = 1<<1
|
||||
};
|
||||
|
||||
/*!
|
||||
*\brief abstracted socket object
|
||||
*
|
||||
*The abstracted socket object allows you to build client and server applications very simply
|
||||
*with support for unicast and multicast
|
||||
*/
|
||||
typedef struct __tag_socket GF_Socket;
|
||||
|
||||
/*!
|
||||
*\brief abstracted socket group object
|
||||
*
|
||||
*The abstracted socket group object allows querying multiple sockets in a group
|
||||
*/
|
||||
typedef struct __tag_sock_group GF_SockGroup;
|
||||
|
||||
/*!Buffer size to pass for IP address retrieval*/
|
||||
#define GF_MAX_IP_NAME_LEN 516
|
||||
|
||||
/*!socket is a TCP socket*/
|
||||
#define GF_SOCK_TYPE_TCP 0x01
|
||||
/*!socket is a UDP socket*/
|
||||
#define GF_SOCK_TYPE_UDP 0x02
|
||||
|
||||
/*!
|
||||
*\brief socket constructor
|
||||
*
|
||||
*Constructs a socket object
|
||||
*\param SocketType the socket type to create, either UDP or TCP
|
||||
*\return the socket object or NULL if network initialization failure
|
||||
*/
|
||||
GF_Socket *gf_sk_new(u32 SocketType);
|
||||
/*!
|
||||
*\brief socket destructor
|
||||
*
|
||||
*Deletes a socket object
|
||||
*\param sock the socket object
|
||||
*/
|
||||
void gf_sk_del(GF_Socket *sock);
|
||||
|
||||
/*!
|
||||
*\brief reset internal buffer
|
||||
*
|
||||
*Forces the internal socket buffer to be reseted (discarded)
|
||||
*\param sock the socket object
|
||||
*/
|
||||
void gf_sk_reset(GF_Socket *sock);
|
||||
/*!
|
||||
*\brief socket buffer size control
|
||||
*
|
||||
*Sets the size of the internal buffer of the socket. The socket MUST be bound or connected before.
|
||||
*\param sock the socket object
|
||||
*\param send_buffer if 0, sets the size of the reception buffer, otherwise sets the size of the emission buffer
|
||||
*\param new_size new size of the buffer in bytes.
|
||||
*\warning This operation may fail depending on the provider, hardware...
|
||||
*/
|
||||
GF_Err gf_sk_set_buffer_size(GF_Socket *sock, Bool send_buffer, u32 new_size);
|
||||
|
||||
/*!
|
||||
*\brief blocking mode control
|
||||
*
|
||||
*Sets the blocking mode of a socket on or off. A blocking socket will wait for the net operation to be possible
|
||||
*while a non-blocking one would return an error. By default, sockets are created in blocking mode
|
||||
*\param sock the socket object
|
||||
*\param NonBlockingOn set to 1 to use on-blocking sockets, 0 otherwise
|
||||
*/
|
||||
GF_Err gf_sk_set_block_mode(GF_Socket *sock, Bool NonBlockingOn);
|
||||
/*!
|
||||
*\brief socket binding
|
||||
*
|
||||
*Binds the given socket to the specified port.
|
||||
*\param local_ip the local interface IP address if desired. If NULL, the default interface will be used.
|
||||
*\param sock the socket object
|
||||
*\param port port number to bind this socket to
|
||||
*\param peer_name the remote server address, if NULL, will use localhost
|
||||
*\param peer_port remote port number to connect the socket to
|
||||
*\param options list of option for the bind operation.
|
||||
*/
|
||||
GF_Err gf_sk_bind(GF_Socket *sock, const char *local_ip, u16 port, const char *peer_name, u16 peer_port, u32 options);
|
||||
/*!
|
||||
*\brief connects a socket
|
||||
*
|
||||
*Connects a socket to a remote peer on a given port
|
||||
*\param sock the socket object
|
||||
*\param peer_name the remote server address (IP or DNS)
|
||||
*\param port remote port number to connect the socket to
|
||||
*\param local_ip the local (client) address (IP or DNS) if any, NULL otherwise.
|
||||
*/
|
||||
GF_Err gf_sk_connect(GF_Socket *sock, const char *peer_name, u16 port, const char *local_ip);
|
||||
/*!
|
||||
*\brief data emission
|
||||
*
|
||||
*Sends a buffer on the socket. The socket must be in a bound or connected mode
|
||||
*\param sock the socket object
|
||||
*\param buffer the data buffer to send
|
||||
*\param length the data length to send
|
||||
*/
|
||||
GF_Err gf_sk_send(GF_Socket *sock, const char *buffer, u32 length);
|
||||
/*!
|
||||
*\brief data reception
|
||||
*
|
||||
*Fetches data on a socket. The socket must be in a bound or connected state
|
||||
*\param sock the socket object
|
||||
*\param buffer the reception buffer where data is written
|
||||
*\param length the allocated size of the reception buffer
|
||||
*\param start_from the offset in the reception buffer where to start writing
|
||||
*\param read the actual number of bytes received
|
||||
*\return error if any, GF_IP_NETWORK_EMPTY if nothing to read
|
||||
*/
|
||||
GF_Err gf_sk_receive(GF_Socket *sock, char *buffer, u32 length, u32 start_from, u32 *read);
|
||||
|
||||
/*!
|
||||
*\brief socket listening
|
||||
*
|
||||
*Sets the socket in a listening state. This socket must have been bound to a port before
|
||||
*\param sock the socket object
|
||||
*\param max_conn the maximum number of simultaneous connection this socket will accept
|
||||
*/
|
||||
GF_Err gf_sk_listen(GF_Socket *sock, u32 max_conn);
|
||||
/*!
|
||||
*\brief socket accept
|
||||
*
|
||||
*Accepts an incoming connection on a listening socket
|
||||
*\param sock the socket object
|
||||
*\param new_conn the resulting connection socket object
|
||||
*/
|
||||
GF_Err gf_sk_accept(GF_Socket *sock, GF_Socket **new_conn);
|
||||
|
||||
/*!
|
||||
*\brief server socket mode
|
||||
*
|
||||
*Disable the Nable algo (e.g. set TCP_NODELAY) and set the KEEPALIVE on
|
||||
*\param sock the socket object
|
||||
*\param server_on sets server mode on or off
|
||||
*/
|
||||
GF_Err gf_sk_server_mode(GF_Socket *sock, Bool server_on);
|
||||
|
||||
/*!
|
||||
*\brief get local host name
|
||||
*
|
||||
*Retrieves local host name.
|
||||
*\param buffer destination buffer for name. Buffer must be GF_MAX_IP_NAME_LEN long
|
||||
*/
|
||||
GF_Err gf_sk_get_host_name(char *buffer);
|
||||
|
||||
/*!
|
||||
*\brief get local IP
|
||||
*
|
||||
*Gets local IP address of a connected socket, typically used for server after an ACCEPT
|
||||
*\param sock the socket object
|
||||
*\param buffer destination buffer for IP address. Buffer must be GF_MAX_IP_NAME_LEN long
|
||||
*/
|
||||
GF_Err gf_sk_get_local_ip(GF_Socket *sock, char *buffer);
|
||||
/*!
|
||||
*\brief get local info
|
||||
*
|
||||
*Gets local socket info of a socket
|
||||
*\param sock the socket object
|
||||
*\param port local port number of the socket
|
||||
*\param sock_type socket type (UDP or TCP)
|
||||
*/
|
||||
GF_Err gf_sk_get_local_info(GF_Socket *sock, u16 *port, u32 *sock_type);
|
||||
|
||||
/*!
|
||||
*\brief get remote address
|
||||
*
|
||||
*Gets the remote address of a peer. The socket MUST be connected.
|
||||
*\param sock the socket object
|
||||
*\param buffer destination buffer for IP address. Buffer must be GF_MAX_IP_NAME_LEN long
|
||||
*/
|
||||
GF_Err gf_sk_get_remote_address(GF_Socket *sock, char *buffer);
|
||||
|
||||
/*!
|
||||
*\brief set remote address
|
||||
*
|
||||
*Sets the remote address of a socket. This is used by connectionless sockets using SendTo and ReceiveFrom
|
||||
*\param sock the socket object
|
||||
*\param address the remote peer address
|
||||
*\param port the remote peer port
|
||||
*/
|
||||
GF_Err gf_sk_set_remote(GF_Socket *sock, char *address, u16 port);
|
||||
|
||||
|
||||
/*!
|
||||
*\brief multicast setup
|
||||
*
|
||||
*Performs multicast setup (BIND and JOIN) for the socket object
|
||||
*\param sock the socket object
|
||||
*\param multi_ip_add the multicast IP address
|
||||
*\param multi_port the multicast port number
|
||||
*\param TTL the multicast TTL (Time-To-Live)
|
||||
*\param no_bind if sets, only join the multicast
|
||||
*\param local_interface_ip the local interface IP address if desired. If NULL, the default interface will be used.
|
||||
*/
|
||||
GF_Err gf_sk_setup_multicast(GF_Socket *sock, const char *multi_ip_add, u16 multi_port, u32 TTL, Bool no_bind, char *local_interface_ip);
|
||||
/*!
|
||||
*brief multicast address test
|
||||
*
|
||||
*tests whether an IP address is a multicast one or not
|
||||
*\param multi_ip_add the multicast IP address to test
|
||||
*\return 1 if the address is a multicast one, 0 otherwise
|
||||
*/
|
||||
u32 gf_sk_is_multicast_address(const char *multi_ip_add);
|
||||
|
||||
/*!
|
||||
*\brief send data with wait delay
|
||||
*
|
||||
*Sends data with a max wait delay. This is used for http / ftp sockets mainly. The socket must be connected.
|
||||
*\param sock the socket object
|
||||
*\param buffer the data buffer to send
|
||||
*\param length the data length to send
|
||||
*\param delay_sec the maximum delay in second to wait before aborting
|
||||
*\return If the operation timed out, the function will return a GF_IP_SOCK_WOULD_BLOCK error.
|
||||
*/
|
||||
GF_Err gf_sk_send_wait(GF_Socket *sock, const char *buffer, u32 length, u32 delay_sec);
|
||||
/* receive data with a max wait delay of Second - used for http / ftp sockets mainly*/
|
||||
/*!
|
||||
*\brief receive data with wait delay
|
||||
*
|
||||
*Fetches data with a max wait delay. This is used for http / ftp sockets mainly. The socket must be connected.
|
||||
*\param sock the socket object
|
||||
*\param buffer the reception buffer where data is written
|
||||
*\param length the allocated size of the reception buffer
|
||||
*\param start_from the offset in the reception buffer where to start writing
|
||||
*\param read the actual number of bytes received
|
||||
*\param delay_sec the maximum delay in second to wait before aborting
|
||||
*\return If the operation timed out, the function will return a GF_IP_SOCK_WOULD_BLOCK error.
|
||||
*/
|
||||
GF_Err gf_sk_receive_wait(GF_Socket *sock, char *buffer, u32 length, u32 start_from, u32 *read, u32 delay_sec);
|
||||
|
||||
/*!
|
||||
*\brief gets socket handle
|
||||
*
|
||||
*Gets the socket low-level handle as used by OpenSSL.
|
||||
*\param sock the socket object
|
||||
*\return the socket handle
|
||||
*/
|
||||
s32 gf_sk_get_handle(GF_Socket *sock);
|
||||
|
||||
/*!
|
||||
*Sets the socket wait time in microseconds. Default wait time is 500 microseconds. Any value >= 1000000 will reset to default.
|
||||
*\param sock the socket object
|
||||
*\param usec_wait wait time in microseconds
|
||||
*/
|
||||
void gf_sk_set_usec_wait(GF_Socket *sock, u32 usec_wait);
|
||||
|
||||
/*!
|
||||
*Creates a new socket group
|
||||
*\return socket group object
|
||||
*/
|
||||
GF_SockGroup *gf_sk_group_new();
|
||||
/*!
|
||||
*Deletes a socket group
|
||||
*\param sg socket group object
|
||||
*/
|
||||
void gf_sk_group_del(GF_SockGroup *sg);
|
||||
/*!
|
||||
*Registers a socket to a socket group
|
||||
*\param sg socket group object
|
||||
*\param sk socket object to register
|
||||
*/
|
||||
void gf_sk_group_register(GF_SockGroup *sg, GF_Socket *sk);
|
||||
/*!
|
||||
*Unregisters a socket from a socket group
|
||||
*\param sg socket group object
|
||||
*\param sk socket object to unregister
|
||||
*/
|
||||
void gf_sk_group_unregister(GF_SockGroup *sg, GF_Socket *sk);
|
||||
|
||||
/*!
|
||||
*Performs a select (wait) on the socket group
|
||||
*\param sg socket group object
|
||||
*\param wait_usec microseconds to wait (can be larger than one second)
|
||||
*\return error if any
|
||||
*/
|
||||
GF_Err gf_sk_group_select(GF_SockGroup *sg, u32 wait_usec);
|
||||
/*!
|
||||
*Checks if given socket is selected and can be read. This shall be called after gf_sk_group_select
|
||||
*\param sg socket group object
|
||||
*\param sk socket object to check
|
||||
*\return GF_TRUE if socket is ready to read, 0 otherwise
|
||||
*/
|
||||
Bool gf_sk_group_sock_is_set(GF_SockGroup *sg, GF_Socket *sk);
|
||||
|
||||
/*!
|
||||
*Fetches data on a socket without performing any select (wait), to be used with socket group on sockets that are set in the selected socket group
|
||||
*\param sock the socket object
|
||||
*\param buffer the reception buffer where data is written
|
||||
*\param length the allocated size of the reception buffer
|
||||
*\param start_from the offset in the reception buffer where to start writing
|
||||
*\param read the actual number of bytes received
|
||||
*\return error if any, GF_IP_NETWORK_EMPTY if nothing to read
|
||||
*/
|
||||
GF_Err gf_sk_receive_no_select(GF_Socket *sock, char *buffer, u32 length, u32 start_from, u32 *read);
|
||||
|
||||
|
||||
/*!
|
||||
*\brief gets ipv6 support
|
||||
*
|
||||
*Returns IPV6 support information.
|
||||
*\return 2 if the machine has IPV6 support, 1 if the library was compiled with IPV6 support, 0 otherwise
|
||||
*/
|
||||
u32 gf_net_has_ipv6();
|
||||
|
||||
|
||||
/*!
|
||||
*\brief checks address type
|
||||
*
|
||||
*Checks if an address is an IPV6 or IPV4 one.
|
||||
*\param address Adress to check
|
||||
*\return true 1 if address is IPV6 one, 0 otherwise
|
||||
*/
|
||||
Bool gf_net_is_ipv6(const char *address);
|
||||
|
||||
|
||||
/*!
|
||||
*host to network conversion of integer
|
||||
*
|
||||
*\param val integrer to convert
|
||||
*\return converted integer
|
||||
*/
|
||||
u32 gf_htonl(u32 val);
|
||||
/*!
|
||||
*network to host conversion of integer
|
||||
*
|
||||
*\param val integrer to convert
|
||||
*\return converted integer
|
||||
*/
|
||||
u32 gf_ntohl(u32 val);
|
||||
/*!
|
||||
*host to network conversion of short integer
|
||||
*
|
||||
*\param val short integrer to convert
|
||||
*\return converted integer
|
||||
*/
|
||||
u16 gf_htons(u16 val);
|
||||
/*!
|
||||
*network to host conversion of short integer
|
||||
*
|
||||
*\param val short integrer to convert
|
||||
*\return converted integer
|
||||
*/
|
||||
u16 gf_tohs(u16 val);
|
||||
|
||||
/*!
|
||||
* \brief MobileIP Callback
|
||||
*
|
||||
* The gf_net_mobileip_ctrl_cbk type is the type for the callback of the \ref gf_net_mobileip_set_callback function. By default no mobileip is used
|
||||
* \param cbck Opaque user data.
|
||||
* \param start boolean indicating wether the MobileIP subsystem should be started or stopped.
|
||||
* \return Error code if needed.
|
||||
*
|
||||
*/
|
||||
typedef GF_Err (*gf_net_mobileip_ctrl_cbk)(Bool start);
|
||||
|
||||
/*!
|
||||
*\brief Assigns MobileIP callback
|
||||
*
|
||||
*Assigns the MobileIP control callback.
|
||||
*\param _mobip_cbk MobileIP control callback
|
||||
*\param MobileIP MobileIP address
|
||||
*/
|
||||
void gf_net_mobileip_set_callback(gf_net_mobileip_ctrl_cbk _mobip_cbk, const char *MobileIP);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*_GF_NET_H_*/
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
#define GPAC_GIT_REVISION "457-g42cd567b3-master"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* GPAC - Multimedia Framework C SDK
|
||||
*
|
||||
* Authors: Jean Le Feuvre
|
||||
* Copyright (c) Telecom ParisTech 2000-2012
|
||||
* All rights reserved
|
||||
*
|
||||
* This file is part of GPAC / common tools sub-project
|
||||
*
|
||||
* GPAC is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GPAC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GF_UTF_H_
|
||||
#define _GF_UTF_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file <gpac/utf.h>
|
||||
* \brief UTF functions.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \addtogroup uni_grp
|
||||
* \ingroup utfuni_grp
|
||||
* \brief UTF encoding functions
|
||||
*
|
||||
*This section documents the UTF functions of the GPAC framework.\n
|
||||
*The wide characters in GPAC are unsignad shorts, in other words GPAC only supports UTF8 and UTF16 coding styles.
|
||||
*\note these functions are just ports of libutf8 library tools into GPAC.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <gpac/tools.h>
|
||||
|
||||
/*!
|
||||
*\brief wide-char to multibyte conversion
|
||||
*
|
||||
*Converts a wide-char string to a multibyte string
|
||||
*\param dst multibyte destination buffer
|
||||
*\param dst_len multibyte destination buffer size
|
||||
*\param srcp address of the wide-char string. This will be set to the next char to be converted in the input buffer if not enough space in the destination, or NULL if conversion was completed.
|
||||
*\return length (in byte) of the multibyte string or -1 if error.
|
||||
*/
|
||||
size_t gf_utf8_wcstombs(char* dst, size_t dst_len, const unsigned short** srcp);
|
||||
/*converts UTF8 string to wide char string - returns (-1) if error. set @srcp to next char to be
|
||||
converted if not enough space*/
|
||||
/*!
|
||||
*\brief multibyte to wide-char conversion
|
||||
*
|
||||
*Converts a multibyte string to a wide-char string
|
||||
*\param dst wide-char destination buffer
|
||||
*\param dst_len wide-char destination buffer size
|
||||
*\param srcp address of the multibyte character buffer. This will be set to the next char to be converted in the input buffer if not enough space in the destination, or NULL if conversion was completed.
|
||||
*\return length (in unsigned short) of the wide-char string or -1 if error.
|
||||
*/
|
||||
size_t gf_utf8_mbstowcs(unsigned short* dst, size_t dst_len, const char** srcp);
|
||||
/*!
|
||||
*\brief wide-char string length
|
||||
*
|
||||
*Returns the length in character of a wide-char string
|
||||
*\param s the wide-char string
|
||||
*\return the wide-char string length
|
||||
*/
|
||||
size_t gf_utf8_wcslen(const unsigned short *s);
|
||||
|
||||
/*!
|
||||
*\brief string bidi reordering
|
||||
*
|
||||
*Performs a simple reordering of words in the string based on each word direction, so that glyphs are sorted in display order.
|
||||
*\param utf_string the wide-char string
|
||||
*\param len the len of the wide-char string
|
||||
*\return 1 if the main direction is right-to-left, 0 otherwise
|
||||
*/
|
||||
Bool gf_utf8_reorder_bidi(u16 *utf_string, u32 len);
|
||||
|
||||
static const size_t UTF8_MAX_BYTES_PER_CHAR = 4;
|
||||
|
||||
/*! @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*_GF_UTF_H_*/
|
||||
|
||||
@@ -1,760 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gpac/isomedia.h>
|
||||
#include "lib_ccx.h"
|
||||
#include "utility.h"
|
||||
#include "ccx_encoders_common.h"
|
||||
#include "ccx_common_option.h"
|
||||
#include "ccx_mp4.h"
|
||||
#include "activity.h"
|
||||
#include "ccx_dtvcc.h"
|
||||
|
||||
#define MEDIA_TYPE(type, subtype) (((u64)(type)<<32)+(subtype))
|
||||
|
||||
static short bswap16(short v)
|
||||
{
|
||||
return ((v >> 8) & 0x00FF) | ((v << 8) & 0xFF00);
|
||||
}
|
||||
|
||||
static long bswap32(long v)
|
||||
{
|
||||
// For 0x12345678 returns 78563412
|
||||
long swapped=((v&0xFF)<<24) | ((v&0xFF00)<<8) | ((v&0xFF0000) >>8) | ((v&0xFF000000) >>24);
|
||||
return swapped;
|
||||
}
|
||||
static struct {
|
||||
unsigned total;
|
||||
unsigned type[32];
|
||||
}s_nalu_stats;
|
||||
|
||||
static int process_avc_sample(struct lib_ccx_ctx *ctx, u32 timescale, GF_AVCConfig* c, GF_ISOSample* s, struct cc_subtitle *sub)
|
||||
{
|
||||
int status = 0;
|
||||
u32 i;
|
||||
s32 signed_cts=(s32) s->CTS_Offset; // Convert from unsigned to signed. GPAC uses u32 but unsigned values are legal.
|
||||
struct lib_cc_decode *dec_ctx = NULL;
|
||||
|
||||
dec_ctx = update_decoder_list(ctx);
|
||||
|
||||
set_current_pts(dec_ctx->timing, (s->DTS + signed_cts)*MPEG_CLOCK_FREQ/timescale);
|
||||
set_fts(dec_ctx->timing);
|
||||
|
||||
for(i = 0; i < s->dataLength; )
|
||||
{
|
||||
u32 nal_length;
|
||||
|
||||
switch(c->nal_unit_size)
|
||||
{
|
||||
case 1:
|
||||
nal_length = s->data[i];
|
||||
break;
|
||||
case 2:
|
||||
nal_length = bswap16(*(short* )&s->data[i]);
|
||||
break;
|
||||
case 4:
|
||||
nal_length = bswap32(*(long* )&s->data[i]);
|
||||
break;
|
||||
}
|
||||
i += c->nal_unit_size;
|
||||
|
||||
s_nalu_stats.total += 1;
|
||||
s_nalu_stats.type[s->data[i] & 0x1F] += 1;
|
||||
|
||||
temp_debug=0;
|
||||
|
||||
if (nal_length>0)
|
||||
do_NAL (dec_ctx, (unsigned char *) &(s->data[i]) ,nal_length, sub);
|
||||
i += nal_length;
|
||||
} // outer for
|
||||
assert(i == s->dataLength);
|
||||
|
||||
return status;
|
||||
}
|
||||
static int process_xdvb_track(struct lib_ccx_ctx *ctx, const char* basename, GF_ISOFile* f, u32 track, struct cc_subtitle *sub)
|
||||
{
|
||||
u32 timescale, i, sample_count;
|
||||
int status;
|
||||
|
||||
struct lib_cc_decode *dec_ctx = NULL;
|
||||
|
||||
dec_ctx = update_decoder_list(ctx);
|
||||
if((sample_count = gf_isom_get_sample_count(f, track)) < 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
timescale = gf_isom_get_media_timescale(f, track);
|
||||
|
||||
status = 0;
|
||||
|
||||
for(i = 0; i < sample_count; i++)
|
||||
{
|
||||
u32 sdi;
|
||||
|
||||
GF_ISOSample* s = gf_isom_get_sample(f, track, i + 1, &sdi);
|
||||
if (s!=NULL)
|
||||
{
|
||||
s32 signed_cts=(s32) s->CTS_Offset; // Convert from unsigned to signed. GPAC uses u32 but unsigned values are legal.
|
||||
set_current_pts(dec_ctx->timing, (s->DTS + signed_cts)*MPEG_CLOCK_FREQ/timescale);
|
||||
set_fts(dec_ctx->timing);
|
||||
|
||||
process_m2v (dec_ctx, (unsigned char *) s->data,s->dataLength, sub);
|
||||
gf_isom_sample_del(&s);
|
||||
}
|
||||
|
||||
int progress = (int) ((i*100) / sample_count);
|
||||
if (ctx->last_reported_progress != progress)
|
||||
{
|
||||
int cur_sec = (int) (get_fts(dec_ctx->timing, dec_ctx->current_field) / 1000);
|
||||
activity_progress(progress, cur_sec/60, cur_sec%60);
|
||||
ctx->last_reported_progress = progress;
|
||||
}
|
||||
}
|
||||
int cur_sec = (int) (get_fts(dec_ctx->timing, dec_ctx->current_field) / 1000);
|
||||
activity_progress(100, cur_sec/60, cur_sec%60);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static int process_avc_track(struct lib_ccx_ctx *ctx, const char* basename, GF_ISOFile* f, u32 track, struct cc_subtitle *sub)
|
||||
{
|
||||
u32 timescale, i, sample_count, last_sdi = 0;
|
||||
int status;
|
||||
GF_AVCConfig* c = NULL;
|
||||
struct lib_cc_decode *dec_ctx = NULL;
|
||||
|
||||
dec_ctx = update_decoder_list(ctx);
|
||||
|
||||
if((sample_count = gf_isom_get_sample_count(f, track)) < 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
timescale = gf_isom_get_media_timescale(f, track);
|
||||
|
||||
status = 0;
|
||||
|
||||
for(i = 0; i < sample_count; i++)
|
||||
{
|
||||
u32 sdi;
|
||||
|
||||
GF_ISOSample* s = gf_isom_get_sample(f, track, i + 1, &sdi);
|
||||
|
||||
if(s != NULL)
|
||||
{
|
||||
if(sdi != last_sdi)
|
||||
{
|
||||
if(c != NULL)
|
||||
{
|
||||
gf_odf_avc_cfg_del(c);
|
||||
c = NULL;
|
||||
}
|
||||
|
||||
if((c = gf_isom_avc_config_get(f, track, sdi)) == NULL)
|
||||
{
|
||||
gf_isom_sample_del(&s);
|
||||
status = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
last_sdi = sdi;
|
||||
}
|
||||
|
||||
status = process_avc_sample(ctx, timescale, c, s, sub);
|
||||
|
||||
gf_isom_sample_del(&s);
|
||||
|
||||
if(status != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int progress = (int) ((i*100) / sample_count);
|
||||
if (ctx->last_reported_progress != progress)
|
||||
{
|
||||
int cur_sec = (int) (get_fts(dec_ctx->timing, dec_ctx->current_field) / 1000);
|
||||
activity_progress(progress, cur_sec/60, cur_sec%60);
|
||||
ctx->last_reported_progress = progress;
|
||||
}
|
||||
}
|
||||
int cur_sec = (int) (get_fts(dec_ctx->timing, dec_ctx->current_field) / 1000);
|
||||
activity_progress(100, cur_sec/60, cur_sec%60);
|
||||
|
||||
if(c != NULL)
|
||||
{
|
||||
gf_odf_avc_cfg_del(c);
|
||||
c = NULL;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static char *format_duration(u64 dur, u32 timescale, char *szDur)
|
||||
{
|
||||
u32 h, m, s, ms;
|
||||
if ((dur==(u64) -1) || (dur==(u32) -1)) {
|
||||
strcpy(szDur, "Unknown");
|
||||
return szDur;
|
||||
}
|
||||
dur = (u64) (( ((Double) (s64) dur)/timescale)*1000);
|
||||
h = (u32) (dur / 3600000);
|
||||
m = (u32) (dur/ 60000) - h*60;
|
||||
s = (u32) (dur/1000) - h*3600 - m*60;
|
||||
ms = (u32) (dur) - h*3600000 - m*60000 - s*1000;
|
||||
if (h<=24) {
|
||||
sprintf(szDur, "%02d:%02d:%02d.%03d", h, m, s, ms);
|
||||
} else {
|
||||
u32 d = (u32) (dur / 3600000 / 24);
|
||||
h = (u32) (dur/3600000)-24*d;
|
||||
if (d<=365) {
|
||||
sprintf(szDur, "%d Days, %02d:%02d:%02d.%03d", d, h, m, s, ms);
|
||||
} else {
|
||||
u32 y=0;
|
||||
while (d>365) {
|
||||
y++;
|
||||
d-=365;
|
||||
if (y%4) d--;
|
||||
}
|
||||
sprintf(szDur, "%d Years %d Days, %02d:%02d:%02d.%03d", y, d, h, m, s, ms);
|
||||
}
|
||||
|
||||
}
|
||||
return szDur;
|
||||
}
|
||||
|
||||
unsigned char * ccdp_find_data(unsigned char * ccdp_atom_content, unsigned int len, unsigned int *cc_count)
|
||||
{
|
||||
unsigned char *data = ccdp_atom_content;
|
||||
|
||||
if (len < 4)
|
||||
{
|
||||
dbg_print(CCX_DMT_PARSE, "mp4-708-cdp: unexpected size of cdp\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int cdp_id = (data[0] << 8) | data[1];
|
||||
if (cdp_id != 0x9669)
|
||||
{
|
||||
dbg_print(CCX_DMT_PARSE, "mp4-708-cdp: unexpected header %hhX %hhX\n", data[0], data[1]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data += 2;
|
||||
len -= 2;
|
||||
|
||||
unsigned int cdp_data_count = data[0];
|
||||
unsigned int cdp_frame_rate = data[1] >> 4; //frequency could be calculated
|
||||
if (cdp_data_count != len + 2)
|
||||
{
|
||||
dbg_print(CCX_DMT_PARSE, "mp4-708-cdp: unexpected data length %u %u\n", cdp_data_count, len + 2);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data += 2;
|
||||
len -= 2;
|
||||
|
||||
unsigned int cdp_flags = data[0];
|
||||
unsigned int cdp_counter = (data[1] << 8) | data[2];
|
||||
|
||||
data += 3;
|
||||
len -= 3;
|
||||
|
||||
unsigned int cdp_timecode_added = (cdp_flags & 0x80) >> 7;
|
||||
unsigned int cdp_data_added = (cdp_flags & 0x40) >> 6;
|
||||
|
||||
if (!cdp_data_added)
|
||||
{
|
||||
dbg_print(CCX_DMT_PARSE, "mp4-708-cdp: packet without data\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (cdp_timecode_added)
|
||||
{
|
||||
data += 4;
|
||||
len -= 4;
|
||||
}
|
||||
|
||||
if (data[0] != CDP_SECTION_DATA)
|
||||
{
|
||||
dbg_print(CCX_DMT_PARSE, "mp4-708-cdp: cdp_data_section byte not found\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*cc_count = (unsigned int) (data[1] & 0x1F);
|
||||
|
||||
if (*cc_count != 10 && *cc_count != 20 && *cc_count != 25 && *cc_count != 30)
|
||||
{
|
||||
dbg_print(CCX_DMT_PARSE, "mp4-708-cdp: unexpected cc_count %u\n", *cc_count);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data += 2;
|
||||
len -= 2;
|
||||
|
||||
if ((*cc_count) * 3 > len)
|
||||
{
|
||||
dbg_print(CCX_DMT_PARSE, "mp4-708-cdp: not enough bytes left (%u) to carry %u*3 bytes\n", len, *cc_count);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
(void)(cdp_counter);
|
||||
(void)(cdp_frame_rate);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
// Process clcp type atom
|
||||
// Return the length of the atom
|
||||
// Return -1 if unrecoverable error happened. In this case, the sample will be skipped.
|
||||
static int process_clcp(struct lib_ccx_ctx *ctx, struct encoder_ctx *enc_ctx,
|
||||
struct lib_cc_decode *dec_ctx, struct cc_subtitle *dec_sub, int *mp4_ret,
|
||||
u32 sub_type, char *data, size_t data_length)
|
||||
{
|
||||
unsigned int atom_length = RB32(data);
|
||||
if (atom_length < 8 || atom_length > data_length) {
|
||||
mprint("Invalid atom length. Atom length: %u, should be: %u\n", atom_length, data_length);
|
||||
return -1;
|
||||
}
|
||||
#ifdef MP4_DEBUG
|
||||
dump(256, (unsigned char *)data, atom_length - 8, 0, 1);
|
||||
#endif
|
||||
data += 4;
|
||||
int is_ccdp = !strncmp(data, "ccdp", 4);
|
||||
|
||||
if (!strncmp(data, "cdat", 4) || !strncmp(data, "cdt2", 4) || is_ccdp) {
|
||||
if (sub_type == GF_ISOM_SUBTYPE_C708) {
|
||||
if (!is_ccdp) {
|
||||
mprint("Your video file seems to be an interesting sample for us (%4.4s)\n", data);
|
||||
mprint("We haven't seen a c708 subtitle outside a ccdp atom before\n");
|
||||
mprint("Please, report\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
unsigned int cc_count;
|
||||
data += 4;
|
||||
unsigned char *cc_data = ccdp_find_data((unsigned char *)data, data_length - 8, &cc_count);
|
||||
|
||||
if (!cc_data) {
|
||||
dbg_print(CCX_DMT_PARSE, "mp4-708: no cc data found in ccdp\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ctx->dec_global_setting->settings_dtvcc->enabled = 1;
|
||||
unsigned char temp[4];
|
||||
for (int cc_i = 0; cc_i < cc_count; cc_i++, cc_data += 3) {
|
||||
unsigned char cc_info = cc_data[0];
|
||||
unsigned char cc_valid = (unsigned char)((cc_info & 4) >> 2);
|
||||
unsigned char cc_type = (unsigned char)(cc_info & 3);
|
||||
|
||||
if (cc_info == CDP_SECTION_SVC_INFO || cc_info == CDP_SECTION_FOOTER) {
|
||||
dbg_print(CCX_DMT_PARSE, "MP4-708: premature end of sample (0x73 or 0x74)\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if ((cc_info == 0xFA || cc_info == 0xFC || cc_info == 0xFD)
|
||||
&& (cc_data[1] & 0x7F) == 0 && (cc_data[2] & 0x7F) == 0) {
|
||||
dbg_print(CCX_DMT_PARSE, "MP4-708: skipped (zero cc data)\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
temp[0] = cc_valid;
|
||||
temp[1] = cc_type;
|
||||
temp[2] = cc_data[1];
|
||||
temp[3] = cc_data[2];
|
||||
|
||||
if (cc_type < 2) {
|
||||
dbg_print(CCX_DMT_PARSE, "MP4-708: atom skipped (cc_type < 2)\n");
|
||||
continue;
|
||||
}
|
||||
dec_ctx->dtvcc->encoder = (void *)enc_ctx; //WARN: otherwise cea-708 will not work
|
||||
//TODO is it really always 4-bytes long?
|
||||
ccx_dtvcc_process_data(dec_ctx, (unsigned char *)temp, 4);
|
||||
cb_708++;
|
||||
}
|
||||
}
|
||||
else //subtype == GF_ISOM_SUBTYPE_C608
|
||||
{
|
||||
if (is_ccdp) {
|
||||
mprint("Your video file seems to be an interesting sample for us\n");
|
||||
mprint("We haven't seen a c608 subtitle inside a ccdp atom before\n");
|
||||
mprint("Please, report\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
int len = atom_length - 8;
|
||||
data += 4;
|
||||
char *tdata = data;
|
||||
do {
|
||||
// Process each pair independently so we can adjust timing
|
||||
ret = process608((unsigned char *)tdata, len > 2 ? 2 : len, dec_ctx, dec_sub);
|
||||
len -= ret;
|
||||
tdata += ret;
|
||||
cb_field1++;
|
||||
if (dec_sub->got_output) {
|
||||
*mp4_ret = 1;
|
||||
encode_sub(enc_ctx, dec_sub);
|
||||
dec_sub->got_output = 0;
|
||||
}
|
||||
} while (len > 0);
|
||||
}
|
||||
}
|
||||
return atom_length;
|
||||
}
|
||||
|
||||
// Process tx3g type atom
|
||||
// Return the length of the atom
|
||||
// Return -1 if unrecoverable error happened or process of the atom is finished.
|
||||
// In this case, the sample will be skipped.
|
||||
// Argument `encode_last_only` is used to print the last subtitle
|
||||
static int process_tx3g(struct lib_ccx_ctx *ctx, struct encoder_ctx *enc_ctx,
|
||||
struct lib_cc_decode *dec_ctx, struct cc_subtitle *dec_sub, int *mp4_ret,
|
||||
char *data, size_t data_length, int encode_last_only) {
|
||||
// tx3g data format:
|
||||
// See https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html (Section Subtitle Sample Data)
|
||||
// See http://www.etsi.org/deliver/etsi_ts/126200_126299/126245/14.00.00_60/ts_126245v140000p.pdf (Section 5.17)
|
||||
// Basically it's 16-bit length + UTF-8/UTF-16 text + optional extension (ignored)
|
||||
// TODO: support extension & style
|
||||
|
||||
static struct cc_subtitle last_sub;
|
||||
static int has_previous_sub = 0;
|
||||
|
||||
// Always encode the previous subtitle, no matter the current one is valid or not
|
||||
if (has_previous_sub) {
|
||||
dec_sub->end_time = dec_ctx->timing->fts_now;
|
||||
encode_sub(enc_ctx, dec_sub); // encode the previous subtitle
|
||||
has_previous_sub = 0;
|
||||
}
|
||||
if (encode_last_only) return 0; // Caller in this case doesn't care about the value
|
||||
|
||||
unsigned int atom_length = RB16(data);
|
||||
data += 2;
|
||||
|
||||
if (atom_length > data_length) {
|
||||
mprint("Invalid atom length. Atom length: %u, should be: %u\n", atom_length, data_length);
|
||||
return -1;
|
||||
}
|
||||
if (atom_length == 0) {
|
||||
return -1;
|
||||
}
|
||||
#ifdef MP4_DEBUG
|
||||
dump(256, (unsigned char *)data, atom_length, 0, 1);
|
||||
#endif
|
||||
|
||||
// Start encode the current subtitle
|
||||
// But they won't be written to file until we get the next subtitle
|
||||
// So that we can know its end time
|
||||
dec_sub->type = CC_TEXT;
|
||||
dec_sub->start_time = dec_ctx->timing->fts_now;
|
||||
if (dec_sub->data != NULL) free(dec_sub->data);
|
||||
dec_sub->data = malloc(atom_length + 1);
|
||||
dec_sub->datatype = CC_DATATYPE_GENERIC;
|
||||
memcpy(dec_sub->data, data, atom_length);
|
||||
*((char*)dec_sub->data + atom_length) = '\0';
|
||||
|
||||
*mp4_ret = 1;
|
||||
has_previous_sub = 1;
|
||||
|
||||
return -1; // Assume there's only one subtitle in one atom.
|
||||
}
|
||||
|
||||
/*
|
||||
Here is application algorithm described in some C-like pseudo code:
|
||||
main(){
|
||||
media = open()
|
||||
for each track in media
|
||||
switch track
|
||||
AVC track:
|
||||
for each sample in track
|
||||
for each NALU in sample
|
||||
send to avc.c for processing
|
||||
CC track:
|
||||
for each sample in track
|
||||
deliver to corresponding process_xxx functions
|
||||
close(media)
|
||||
}
|
||||
|
||||
*/
|
||||
int processmp4 (struct lib_ccx_ctx *ctx, struct ccx_s_mp4Cfg *cfg, char *file)
|
||||
{
|
||||
int mp4_ret = 0;
|
||||
GF_ISOFile* f;
|
||||
u32 i, j, track_count, avc_track_count, cc_track_count;
|
||||
struct cc_subtitle dec_sub;
|
||||
struct lib_cc_decode *dec_ctx = NULL;
|
||||
struct encoder_ctx *enc_ctx = update_encoder_list(ctx);
|
||||
|
||||
dec_ctx = update_decoder_list(ctx);
|
||||
|
||||
if (enc_ctx)
|
||||
enc_ctx->timing = dec_ctx->timing;
|
||||
|
||||
memset(&dec_sub,0,sizeof(dec_sub));
|
||||
mprint("Opening \'%s\': ", file);
|
||||
#ifdef MP4_DEBUG
|
||||
gf_log_set_tool_level(GF_LOG_CONTAINER,GF_LOG_DEBUG);
|
||||
#endif
|
||||
|
||||
if((f = gf_isom_open(file, GF_ISOM_OPEN_READ, NULL)) == NULL)
|
||||
{
|
||||
mprint("Failed to open input file (gf_isom_open() returned error)\n");
|
||||
free(dec_ctx->xds_ctx);
|
||||
return -2;
|
||||
}
|
||||
|
||||
mprint("ok\n");
|
||||
|
||||
track_count = gf_isom_get_track_count(f);
|
||||
|
||||
avc_track_count = 0;
|
||||
cc_track_count = 0;
|
||||
|
||||
for(i = 0; i < track_count; i++)
|
||||
{
|
||||
const u32 type = gf_isom_get_media_type(f, i + 1);
|
||||
const u32 subtype = gf_isom_get_media_subtype(f, i + 1, 1);
|
||||
mprint ("Track %d, type=%c%c%c%c subtype=%c%c%c%c\n", i+1, (unsigned char) (type>>24%0x100),
|
||||
(unsigned char) ((type>>16)%0x100),(unsigned char) ((type>>8)%0x100),(unsigned char) (type%0x100),
|
||||
(unsigned char) (subtype>>24%0x100),
|
||||
(unsigned char) ((subtype>>16)%0x100),(unsigned char) ((subtype>>8)%0x100),(unsigned char) (subtype%0x100));
|
||||
if (type == GF_ISOM_MEDIA_CAPTIONS || type == GF_ISOM_MEDIA_SUBT || type == GF_ISOM_MEDIA_TEXT)
|
||||
cc_track_count++;
|
||||
if (type == GF_ISOM_MEDIA_VISUAL && subtype == GF_ISOM_SUBTYPE_AVC_H264)
|
||||
avc_track_count++;
|
||||
}
|
||||
|
||||
mprint("MP4: found %u tracks: %u avc and %u cc\n", track_count, avc_track_count, cc_track_count);
|
||||
|
||||
for (i = 0; i < track_count; i++) {
|
||||
const u32 type = gf_isom_get_media_type(f, i + 1);
|
||||
const u32 subtype = gf_isom_get_media_subtype(f, i + 1, 1);
|
||||
mprint("Processing track %d, type=%c%c%c%c subtype=%c%c%c%c\n", i + 1,
|
||||
(unsigned char)(type >> 24 % 0x100), (unsigned char)((type >> 16) % 0x100),
|
||||
(unsigned char)((type >> 8) % 0x100), (unsigned char)(type % 0x100),
|
||||
(unsigned char)(subtype >> 24 % 0x100), (unsigned char)((subtype >> 16) % 0x100),
|
||||
(unsigned char)((subtype >> 8) % 0x100), (unsigned char)(subtype % 0x100));
|
||||
|
||||
const u64 track_type = MEDIA_TYPE(type, subtype);
|
||||
|
||||
switch (track_type) {
|
||||
case MEDIA_TYPE(GF_ISOM_MEDIA_VISUAL, GF_ISOM_SUBTYPE_XDVB): //vide:xdvb
|
||||
if (cc_track_count && !cfg->mp4vidtrack)
|
||||
continue;
|
||||
// If there are multiple tracks, change fd for different tracks
|
||||
if (avc_track_count > 1) {
|
||||
switch_output_file(ctx, enc_ctx, i);
|
||||
}
|
||||
if (process_xdvb_track(ctx, file, f, i + 1, &dec_sub) != 0) {
|
||||
mprint("Error on process_xdvb_track()\n");
|
||||
free(dec_ctx->xds_ctx);
|
||||
return -3;
|
||||
}
|
||||
if (dec_sub.got_output) {
|
||||
mp4_ret = 1;
|
||||
encode_sub(enc_ctx, &dec_sub);
|
||||
dec_sub.got_output = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case MEDIA_TYPE(GF_ISOM_MEDIA_VISUAL, GF_ISOM_SUBTYPE_AVC_H264): // vide:avc1
|
||||
if (cc_track_count && !cfg->mp4vidtrack)
|
||||
continue;
|
||||
// If there are multiple tracks, change fd for different tracks
|
||||
if (avc_track_count > 1) {
|
||||
switch_output_file(ctx, enc_ctx, i);
|
||||
}
|
||||
GF_AVCConfig *cnf = gf_isom_avc_config_get(f, i + 1, 1);
|
||||
if (cnf != NULL) {
|
||||
for (j = 0; j < gf_list_count(cnf->sequenceParameterSets); j++) {
|
||||
GF_AVCConfigSlot* seqcnf = (GF_AVCConfigSlot*)gf_list_get(cnf->sequenceParameterSets, j);
|
||||
do_NAL(dec_ctx, (unsigned char *)seqcnf->data, seqcnf->size, &dec_sub);
|
||||
}
|
||||
}
|
||||
if (process_avc_track(ctx, file, f, i + 1, &dec_sub) != 0) {
|
||||
mprint("Error on process_avc_track()\n");
|
||||
free(dec_ctx->xds_ctx);
|
||||
return -3;
|
||||
}
|
||||
if (dec_sub.got_output) {
|
||||
mp4_ret = 1;
|
||||
encode_sub(enc_ctx, &dec_sub);
|
||||
dec_sub.got_output = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (type != GF_ISOM_MEDIA_CAPTIONS && type != GF_ISOM_MEDIA_SUBT && type != GF_ISOM_MEDIA_TEXT)
|
||||
break; // ignore non cc track
|
||||
|
||||
if (avc_track_count && cfg->mp4vidtrack)
|
||||
continue;
|
||||
// If there are multiple tracks, change fd for different tracks
|
||||
if (cc_track_count > 1) {
|
||||
switch_output_file(ctx, enc_ctx, i);
|
||||
}
|
||||
unsigned num_samples = gf_isom_get_sample_count(f, i + 1);
|
||||
|
||||
u32 ProcessingStreamDescriptionIndex = 0; // Current track we are processing, 0 = we don't know yet
|
||||
u32 timescale = gf_isom_get_media_timescale(f, i + 1);
|
||||
#ifdef MP4_DEBUG
|
||||
unsigned num_streams = gf_isom_get_sample_description_count(f, i + 1);
|
||||
u64 duration = gf_isom_get_media_duration(f, i + 1);
|
||||
mprint("%u streams\n", num_streams);
|
||||
mprint("%u sample counts\n", num_samples);
|
||||
mprint("%u timescale\n", (unsigned)timescale);
|
||||
mprint("%u duration\n", (unsigned)duration);
|
||||
#endif
|
||||
for (unsigned k = 0; k < num_samples; k++) {
|
||||
u32 StreamDescriptionIndex;
|
||||
GF_ISOSample *sample = gf_isom_get_sample(f, i + 1, k + 1, &StreamDescriptionIndex);
|
||||
if (ProcessingStreamDescriptionIndex && ProcessingStreamDescriptionIndex != StreamDescriptionIndex) {
|
||||
mprint("This sample seems to have more than one description. This isn't supported yet.\n");
|
||||
mprint("Submitting this video file will help add support to this case.\n");
|
||||
break;
|
||||
}
|
||||
if (!ProcessingStreamDescriptionIndex)
|
||||
ProcessingStreamDescriptionIndex = StreamDescriptionIndex;
|
||||
if (sample == NULL)
|
||||
continue;
|
||||
#ifdef MP4_DEBUG
|
||||
mprint("Data length: %lu\n", sample->dataLength);
|
||||
const LLONG timestamp = (LLONG)((sample->DTS + sample->CTS_Offset) * 1000) / timescale;
|
||||
#endif
|
||||
set_current_pts(dec_ctx->timing, (sample->DTS + sample->CTS_Offset)*MPEG_CLOCK_FREQ / timescale);
|
||||
set_fts(dec_ctx->timing);
|
||||
|
||||
int atomStart = 0;
|
||||
// Process Atom by Atom
|
||||
while (atomStart < sample->dataLength) {
|
||||
char *data = sample->data + atomStart;
|
||||
size_t atom_length = -1;
|
||||
switch (track_type) {
|
||||
case MEDIA_TYPE(GF_ISOM_MEDIA_TEXT, GF_ISOM_SUBTYPE_TX3G): // text:tx3g
|
||||
case MEDIA_TYPE(GF_ISOM_MEDIA_SUBT, GF_ISOM_SUBTYPE_TX3G): // sbtl:tx3g (they're the same)
|
||||
atom_length = process_tx3g(ctx, enc_ctx, dec_ctx,
|
||||
&dec_sub, &mp4_ret,
|
||||
data, sample->dataLength, 0);
|
||||
break;
|
||||
case MEDIA_TYPE(GF_ISOM_MEDIA_CAPTIONS, GF_ISOM_SUBTYPE_C608): // clcp:c608
|
||||
case MEDIA_TYPE(GF_ISOM_MEDIA_CAPTIONS, GF_ISOM_SUBTYPE_C708): // clcp:c708
|
||||
atom_length = process_clcp(ctx, enc_ctx, dec_ctx,
|
||||
&dec_sub, &mp4_ret, subtype,
|
||||
data, sample->dataLength);
|
||||
break;
|
||||
default:
|
||||
// See https://gpac.wp.imt.fr/2014/09/04/subtitling-with-gpac/ for more possible types
|
||||
mprint("\nUnsupported track type %c%c%c%c:%c%c%c%c! Please report.\n",
|
||||
(unsigned char)(type >> 24 % 0x100), (unsigned char)((type >> 16) % 0x100),
|
||||
(unsigned char)((type >> 8) % 0x100), (unsigned char)(type % 0x100),
|
||||
(unsigned char)(subtype >> 24 % 0x100), (unsigned char)((subtype >> 16) % 0x100),
|
||||
(unsigned char)((subtype >> 8) % 0x100), (unsigned char)(subtype % 0x100));
|
||||
}
|
||||
if (atom_length == -1) break; // error happened or process of the sample is finished
|
||||
atomStart += atom_length;
|
||||
}
|
||||
free(sample->data);
|
||||
free(sample);
|
||||
|
||||
// End of change
|
||||
int progress = (int)((k * 100) / num_samples);
|
||||
if (ctx->last_reported_progress != progress) {
|
||||
int cur_sec = (int)(get_fts(dec_ctx->timing, dec_ctx->current_field) / 1000);
|
||||
activity_progress(progress, cur_sec / 60, cur_sec % 60);
|
||||
ctx->last_reported_progress = progress;
|
||||
}
|
||||
}
|
||||
|
||||
// Encode the last subtitle
|
||||
if (subtype == GF_ISOM_SUBTYPE_TX3G) {
|
||||
process_tx3g(ctx, enc_ctx, dec_ctx,
|
||||
&dec_sub, &mp4_ret,
|
||||
NULL, 0, 1);
|
||||
}
|
||||
|
||||
int cur_sec = (int)(get_fts(dec_ctx->timing, dec_ctx->current_field) / 1000);
|
||||
activity_progress(100, cur_sec / 60, cur_sec % 60);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
free(dec_ctx->xds_ctx);
|
||||
|
||||
mprint("\nClosing media: ");
|
||||
gf_isom_close(f);
|
||||
f = NULL;
|
||||
mprint ("ok\n");
|
||||
|
||||
if(avc_track_count)
|
||||
mprint("Found %d AVC track(s). ", avc_track_count);
|
||||
else
|
||||
mprint("Found no AVC track(s). ");
|
||||
|
||||
if (cc_track_count)
|
||||
mprint ("Found %d CC track(s).\n", cc_track_count);
|
||||
else
|
||||
mprint ("Found no dedicated CC track(s).\n");
|
||||
|
||||
ctx->freport.mp4_cc_track_cnt = cc_track_count;
|
||||
|
||||
return mp4_ret;
|
||||
}
|
||||
|
||||
int dumpchapters (struct lib_ccx_ctx *ctx,struct ccx_s_mp4Cfg *cfg, char *file)
|
||||
{
|
||||
int mp4_ret = 0;
|
||||
GF_ISOFile* f;
|
||||
mprint("Opening \'%s\': ", file);
|
||||
#ifdef MP4_DEBUG
|
||||
gf_log_set_tool_level(GF_LOG_CONTAINER,GF_LOG_DEBUG);
|
||||
#endif
|
||||
|
||||
if((f = gf_isom_open(file, GF_ISOM_OPEN_READ, NULL)) == NULL)
|
||||
{
|
||||
mprint("failed to open\n");
|
||||
return 5;
|
||||
}
|
||||
|
||||
mprint("ok\n");
|
||||
|
||||
char szName[1024];
|
||||
FILE *t;
|
||||
u32 i, count;
|
||||
count = gf_isom_get_chapter_count(f, 0);
|
||||
if(count>0)
|
||||
{
|
||||
if (file)
|
||||
{
|
||||
strcpy(szName, get_basename(file));
|
||||
strcat(szName, ".txt");
|
||||
|
||||
t = gf_fopen(szName, "wt");
|
||||
if (!t) return 5;
|
||||
}
|
||||
else {
|
||||
t = stdout;
|
||||
}
|
||||
mp4_ret=1;
|
||||
printf("Writing chapters into %s\n",szName);
|
||||
}
|
||||
else
|
||||
{
|
||||
mprint("No chapters information found!\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
u64 chapter_time;
|
||||
const char *name;
|
||||
char szDur[20];
|
||||
gf_isom_get_chapter(f, 0, i+1, &chapter_time, &name);
|
||||
fprintf(t, "CHAPTER%02d=%s\n", i+1, format_duration(chapter_time, 1000, szDur));
|
||||
fprintf(t, "CHAPTER%02dNAME=%s\n", i+1, name);
|
||||
|
||||
}
|
||||
if (file) gf_fclose(t);
|
||||
return mp4_ret;
|
||||
}
|
||||
@@ -1,774 +0,0 @@
|
||||
/*
|
||||
* GPAC - Multimedia Framework C SDK
|
||||
*
|
||||
* Authors: Jean Le Feuvre
|
||||
* Copyright (c) Telecom ParisTech 2000-2012
|
||||
* All rights reserved
|
||||
*
|
||||
* This file is part of GPAC / common tools sub-project
|
||||
*
|
||||
* GPAC is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GPAC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GPAC_DISABLE_CORE_TOOLS
|
||||
|
||||
#include <gpac/config_file.h>
|
||||
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32_WCE)
|
||||
#include <windows.h> /*for GetModuleFileName*/
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#include <direct.h> /*for _mkdir*/
|
||||
#include <shlobj.h> /*for getting user-dir*/
|
||||
|
||||
#ifndef SHGFP_TYPE_CURRENT
|
||||
#define SHGFP_TYPE_CURRENT 0 /*needed for MinGW*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define CFG_FILE_NAME "GPAC.cfg"
|
||||
#define TEST_MODULE "gm_dummy_in.dll"
|
||||
|
||||
#elif (defined(__DARWIN__) || defined(__APPLE__) )
|
||||
#include <mach-o/dyld.h> /*for _NSGetExecutablePath */
|
||||
|
||||
#ifdef GPAC_IPHONE
|
||||
#define TEST_MODULE "osmo4ios"
|
||||
#else
|
||||
#define TEST_MODULE "gm_dummy_in.dylib"
|
||||
#endif
|
||||
#define CFG_FILE_NAME "GPAC.cfg"
|
||||
|
||||
#else
|
||||
#ifdef GPAC_CONFIG_LINUX
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef GPAC_ANDROID
|
||||
#define DEFAULT_ANDROID_PATH_APP "/data/data/com.gpac.Osmo4"
|
||||
#define DEFAULT_ANDROID_PATH_CFG "/sdcard/osmo"
|
||||
#endif
|
||||
#define CFG_FILE_NAME "GPAC.cfg"
|
||||
|
||||
#if defined(GPAC_CONFIG_WIN32)
|
||||
#define TEST_MODULE "gm_dummy_in.dll"
|
||||
#else
|
||||
#define TEST_MODULE "gm_dummy_in.so"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static Bool check_file_exists(char *name, char *path, char *outPath)
|
||||
{
|
||||
char szPath[GF_MAX_PATH];
|
||||
FILE *f;
|
||||
|
||||
#ifdef GPAC_STATIC_MODULES
|
||||
if (!strcmp(name, TEST_MODULE)) {
|
||||
if (! gf_dir_exists(path)) return 0;
|
||||
if (outPath != path) strcpy(outPath, path);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
sprintf(szPath, "%s%c%s", path, GF_PATH_SEPARATOR, name);
|
||||
//do not use gf_fopen here, we don't want to throw en error if failure
|
||||
f = fopen(szPath, "rb");
|
||||
if (!f) return GF_FALSE;
|
||||
fclose(f);
|
||||
if (outPath != path) strcpy(outPath, path);
|
||||
return GF_TRUE;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
GF_PATH_APP,
|
||||
GF_PATH_CFG,
|
||||
GF_PATH_GUI,
|
||||
GF_PATH_MODULES,
|
||||
};
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32_WCE)
|
||||
static Bool get_default_install_path(char *file_path, u32 path_type)
|
||||
{
|
||||
FILE *f;
|
||||
char *sep;
|
||||
char szPath[GF_MAX_PATH];
|
||||
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
TCHAR w_szPath[GF_MAX_PATH];
|
||||
GetModuleFileName(NULL, w_szPath, GF_MAX_PATH);
|
||||
CE_WideToChar((u16 *) w_szPath, file_path);
|
||||
#else
|
||||
GetModuleFileNameA(NULL, file_path, GF_MAX_PATH);
|
||||
#endif
|
||||
|
||||
/*remove exe name*/
|
||||
if (strstr(file_path, ".exe")) {
|
||||
sep = strrchr(file_path, '\\');
|
||||
if (sep) sep[0] = 0;
|
||||
}
|
||||
|
||||
strcpy(szPath, file_path);
|
||||
strlwr(szPath);
|
||||
|
||||
/*if this is run from a browser, we do not get our app path - fortunately on Windows, we always use 'GPAC' in the
|
||||
installation path*/
|
||||
if (!strstr(file_path, "gpac") && !strstr(file_path, "GPAC") ) {
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwSize = GF_MAX_PATH;
|
||||
|
||||
/*locate the key in current user, then in local machine*/
|
||||
#ifdef _WIN32_WCE
|
||||
DWORD dwType = REG_SZ;
|
||||
u16 w_path[1024];
|
||||
RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\GPAC"), 0, KEY_READ, &hKey);
|
||||
#ifdef _DEBUG
|
||||
if (RegQueryValueEx(hKey, TEXT("DebugDir"), 0, &dwType, (LPBYTE) w_path, &dwSize) != ERROR_SUCCESS)
|
||||
#endif
|
||||
RegQueryValueEx(hKey, TEXT("InstallDir"), 0, &dwType, (LPBYTE) w_path, &dwSize);
|
||||
CE_WideToChar(w_path, (char *)file_path);
|
||||
RegCloseKey(hKey);
|
||||
#else
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\GPAC", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
|
||||
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\GPAC", 0, KEY_READ, &hKey);
|
||||
|
||||
dwSize = GF_MAX_PATH;
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (RegQueryValueEx(hKey, "DebugDir", NULL, NULL,(unsigned char*) file_path, &dwSize) != ERROR_SUCCESS)
|
||||
#endif
|
||||
RegQueryValueEx(hKey, "InstallDir", NULL, NULL,(unsigned char*) file_path, &dwSize);
|
||||
|
||||
RegCloseKey(hKey);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (path_type==GF_PATH_APP) return GF_TRUE;
|
||||
|
||||
if (path_type==GF_PATH_GUI) {
|
||||
char *sep;
|
||||
strcat(file_path, "\\gui");
|
||||
if (check_file_exists("gui.bt", file_path, file_path)) return GF_TRUE;
|
||||
sep = strstr(file_path, "\\bin\\");
|
||||
if (sep) {
|
||||
sep[0] = 0;
|
||||
strcat(file_path, "\\gui");
|
||||
if (check_file_exists("gui.bt", file_path, file_path)) return GF_TRUE;
|
||||
}
|
||||
return GF_FALSE;
|
||||
}
|
||||
/*modules are stored in the GPAC directory (should be changed to GPAC/modules)*/
|
||||
if (path_type==GF_PATH_MODULES) return GF_TRUE;
|
||||
|
||||
/*we are looking for the config file path - make sure it is writable*/
|
||||
assert(path_type == GF_PATH_CFG);
|
||||
|
||||
strcpy(szPath, file_path);
|
||||
strcat(szPath, "\\gpaccfgtest.txt");
|
||||
//do not use gf_fopen here, we don't want to through any error if failure
|
||||
f = fopen(szPath, "wb");
|
||||
if (f != NULL) {
|
||||
fclose(f);
|
||||
gf_delete_file(szPath);
|
||||
return GF_TRUE;
|
||||
}
|
||||
#ifdef _WIN32_WCE
|
||||
return 0;
|
||||
#else
|
||||
/*no write access, get user home directory*/
|
||||
SHGetFolderPath(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, file_path);
|
||||
if (file_path[strlen(file_path)-1] != '\\') strcat(file_path, "\\");
|
||||
strcat(file_path, "GPAC");
|
||||
/*create GPAC dir*/
|
||||
_mkdir(file_path);
|
||||
strcpy(szPath, file_path);
|
||||
strcat(szPath, "\\gpaccfgtest.txt");
|
||||
f = fopen(szPath, "wb");
|
||||
/*COMPLETE FAILURE*/
|
||||
if (!f) return GF_FALSE;
|
||||
|
||||
fclose(f);
|
||||
gf_delete_file(szPath);
|
||||
return GF_TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*FIXME - the paths defined here MUST be coherent with the paths defined in applications/osmo4_android/src/com/gpac/Osmo4/GpacConfig.java'*/
|
||||
#elif defined(GPAC_ANDROID)
|
||||
|
||||
static Bool get_default_install_path(char *file_path, u32 path_type)
|
||||
{
|
||||
if (path_type==GF_PATH_APP) {
|
||||
strcpy(file_path, DEFAULT_ANDROID_PATH_APP);
|
||||
return 1;
|
||||
} else if (path_type==GF_PATH_CFG) {
|
||||
strcpy(file_path, DEFAULT_ANDROID_PATH_CFG);
|
||||
return 1;
|
||||
} else if (path_type==GF_PATH_GUI) {
|
||||
if (!get_default_install_path(file_path, GF_PATH_APP))
|
||||
return 0;
|
||||
strcat(file_path, "/gui");
|
||||
return 1;
|
||||
} else if (path_type==GF_PATH_MODULES) {
|
||||
if (!get_default_install_path(file_path, GF_PATH_APP))
|
||||
return 0;
|
||||
strcat(file_path, "/lib");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#elif defined(__SYMBIAN__)
|
||||
|
||||
#if defined(__SERIES60_3X__)
|
||||
#define SYMBIAN_GPAC_CFG_DIR "\\private\\F01F9075"
|
||||
#define SYMBIAN_GPAC_GUI_DIR "\\private\\F01F9075\\gui"
|
||||
#define SYMBIAN_GPAC_MODULES_DIR "\\sys\\bin"
|
||||
#else
|
||||
#define SYMBIAN_GPAC_CFG_DIR "\\system\\apps\\Osmo4"
|
||||
#define SYMBIAN_GPAC_GUI_DIR "\\system\\apps\\Osmo4\\gui"
|
||||
#define SYMBIAN_GPAC_MODULES_DIR GPAC_CFG_DIR
|
||||
#endif
|
||||
|
||||
static Bool get_default_install_path(char *file_path, u32 path_type)
|
||||
{
|
||||
if (path_type==GF_PATH_APP) strcpy(file_path, SYMBIAN_GPAC_MODULES_DIR);
|
||||
else if (path_type==GF_PATH_CFG) strcpy(file_path, SYMBIAN_GPAC_CFG_DIR);
|
||||
else if (path_type==GF_PATH_GUI) strcpy(file_path, SYMBIAN_GPAC_GUI_DIR);
|
||||
else if (path_type==GF_PATH_MODULES) strcpy(file_path, SYMBIAN_GPAC_MODULES_DIR);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*Linux, OSX, iOS*/
|
||||
#else
|
||||
|
||||
static Bool get_default_install_path(char *file_path, u32 path_type)
|
||||
{
|
||||
char app_path[GF_MAX_PATH];
|
||||
char *sep;
|
||||
u32 size = GF_MAX_PATH;
|
||||
|
||||
/*on OSX, Linux & co, user home is where we store the cfg file*/
|
||||
if (path_type==GF_PATH_CFG) {
|
||||
char *user_home = getenv("HOME");
|
||||
#ifdef GPAC_IPHONE
|
||||
char buf[PATH_MAX];
|
||||
char *res;
|
||||
#endif
|
||||
if (!user_home) {
|
||||
GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("Couldn't find HOME directory\n"));
|
||||
return 0;
|
||||
}
|
||||
#ifdef GPAC_IPHONE
|
||||
res = realpath(user_home, buf);
|
||||
if (res) {
|
||||
strcpy(file_path, buf);
|
||||
strcat(file_path, "/Documents");
|
||||
} else
|
||||
#endif
|
||||
strcpy(file_path, user_home);
|
||||
|
||||
if (file_path[strlen(file_path)-1] == '/') file_path[strlen(file_path)-1] = 0;
|
||||
|
||||
//cleanup of old install in .gpacrc
|
||||
if (check_file_exists(".gpacrc", file_path, file_path)) {
|
||||
strcpy(app_path, file_path);
|
||||
strcat(app_path, "/.gpacrc");
|
||||
gf_delete_file(app_path);
|
||||
}
|
||||
|
||||
strcat(file_path, "/.gpac");
|
||||
if (!gf_dir_exists(file_path)) {
|
||||
gf_mkdir(file_path);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (path_type==GF_PATH_APP) {
|
||||
#if (defined(__DARWIN__) || defined(__APPLE__) )
|
||||
if (_NSGetExecutablePath(app_path, &size) ==0) {
|
||||
realpath(app_path, file_path);
|
||||
char *sep = strrchr(file_path, '/');
|
||||
if (sep) sep[0] = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#elif defined(GPAC_CONFIG_LINUX)
|
||||
size = readlink("/proc/self/exe", file_path, GF_MAX_PATH);
|
||||
if (size>0) {
|
||||
char *sep = strrchr(file_path, '/');
|
||||
if (sep) sep[0] = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#elif defined(GPAC_CONFIG_WIN32)
|
||||
GetModuleFileNameA(NULL, file_path, GF_MAX_PATH);
|
||||
if (strstr(file_path, ".exe")) {
|
||||
sep = strrchr(file_path, '\\');
|
||||
if (sep) sep[0] = 0;
|
||||
if ((file_path[1]==':') && (file_path[2]=='\\')) {
|
||||
strcpy(file_path, &file_path[2]);
|
||||
}
|
||||
sep = file_path;
|
||||
while ( sep[0] ) {
|
||||
if (sep[0]=='\\') sep[0]='/';
|
||||
sep++;
|
||||
}
|
||||
//get rid of /mingw32 or /mingw64
|
||||
sep = strstr(file_path, "/usr/");
|
||||
if (sep) {
|
||||
strcpy(file_path, sep);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("Unknown arch, cannot find executable path\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*locate the app*/
|
||||
if (!get_default_install_path(app_path, GF_PATH_APP)) {
|
||||
GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("Couldn't find GPAC binaries install directory\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*installed or symlink on system, user user home directory*/
|
||||
if (!strnicmp(app_path, "/usr/", 5) || !strnicmp(app_path, "/opt/", 5)) {
|
||||
if (path_type==GF_PATH_GUI) {
|
||||
/*look in possible install dirs ...*/
|
||||
if (check_file_exists("gui.bt", "/usr/share/gpac/gui", file_path)) return 1;
|
||||
if (check_file_exists("gui.bt", "/usr/local/share/gpac/gui", file_path)) return 1;
|
||||
if (check_file_exists("gui.bt", "/opt/share/gpac/gui", file_path)) return 1;
|
||||
if (check_file_exists("gui.bt", "/opt/local/share/gpac/gui", file_path)) return 1;
|
||||
} else if (path_type==GF_PATH_MODULES) {
|
||||
/*look in possible install dirs ...*/
|
||||
if (check_file_exists(TEST_MODULE, "/usr/lib64/gpac", file_path)) return 1;
|
||||
if (check_file_exists(TEST_MODULE, "/usr/lib/gpac", file_path)) return 1;
|
||||
if (check_file_exists(TEST_MODULE, "/usr/local/lib/gpac", file_path)) return 1;
|
||||
if (check_file_exists(TEST_MODULE, "/opt/lib/gpac", file_path)) return 1;
|
||||
if (check_file_exists(TEST_MODULE, "/opt/local/lib/gpac", file_path)) return 1;
|
||||
if (check_file_exists(TEST_MODULE, "/usr/lib/x86_64-linux-gnu/gpac", file_path)) return 1;
|
||||
if (check_file_exists(TEST_MODULE, "/usr/lib/i386-linux-gnu/gpac", file_path)) return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (path_type==GF_PATH_GUI) {
|
||||
if (get_default_install_path(app_path, GF_PATH_CFG)) {
|
||||
/*GUI not found, look in ~/.gpac/gui/ */
|
||||
strcat(app_path, "/.gpac/gui");
|
||||
if (check_file_exists("gui.bt", app_path, file_path)) return 1;
|
||||
}
|
||||
|
||||
/*GUI not found, look in gpac distribution if any */
|
||||
if (get_default_install_path(app_path, GF_PATH_APP)) {
|
||||
char *sep = strstr(app_path, "/bin/");
|
||||
if (sep) {
|
||||
sep[0] = 0;
|
||||
strcat(app_path, "/gui");
|
||||
if (check_file_exists("gui.bt", app_path, file_path)) return 1;
|
||||
}
|
||||
sep = strstr(app_path, "/build/");
|
||||
if (sep) {
|
||||
sep[0] = 0;
|
||||
strcat(app_path, "/gui");
|
||||
if (check_file_exists("gui.bt", app_path, file_path)) return 1;
|
||||
}
|
||||
}
|
||||
/*GUI not found, look in .app for OSX case*/
|
||||
}
|
||||
|
||||
if (path_type==GF_PATH_MODULES) {
|
||||
/*look in gpac compilation tree (modules are output in the same folder as apps) */
|
||||
if (get_default_install_path(app_path, GF_PATH_APP)) {
|
||||
if (check_file_exists(TEST_MODULE, app_path, file_path)) return 1;
|
||||
/*on OSX check modules subdirectory */
|
||||
strcat(app_path, "/modules");
|
||||
if (check_file_exists(TEST_MODULE, app_path, file_path)) return 1;
|
||||
/*modules not found*/
|
||||
GF_LOG(GF_LOG_WARNING, GF_LOG_CORE, ("Couldn't find any modules in standard path (app path %s)\n", app_path));
|
||||
}
|
||||
/*modules not found, look in ~/.gpac/modules/ */
|
||||
if (get_default_install_path(app_path, GF_PATH_CFG)) {
|
||||
strcpy(app_path, file_path);
|
||||
strcat(app_path, "/.gpac/modules");
|
||||
if (check_file_exists(TEST_MODULE, app_path, file_path)) return 1;
|
||||
}
|
||||
/*modules not found, failure*/
|
||||
GF_LOG(GF_LOG_WARNING, GF_LOG_CORE, ("Couldn't find any modules in HOME path (app path %s)\n", app_path));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*OSX way vs iPhone*/
|
||||
sep = strstr(app_path, ".app/");
|
||||
if (sep) sep[4] = 0;
|
||||
|
||||
/*we are looking for .app install path, or GUI */
|
||||
if (path_type==GF_PATH_GUI) {
|
||||
#ifndef GPAC_IPHONE
|
||||
strcat(app_path, "/Contents/MacOS/gui");
|
||||
if (check_file_exists("gui.bt", app_path, file_path)) return 1;
|
||||
#else /*iOS: for now, everything is set flat within the package*/
|
||||
/*iOS app is distributed with embedded GUI*/
|
||||
get_default_install_path(app_path, GF_PATH_APP);
|
||||
strcat(app_path, "/gui");
|
||||
if (check_file_exists("gui.bt", app_path, file_path)) return 1;
|
||||
#endif
|
||||
}
|
||||
else { // (path_type==GF_PATH_MODULES)
|
||||
strcat(app_path, "/Contents/MacOS/modules");
|
||||
if (check_file_exists(TEST_MODULE, app_path, file_path)) return 1;
|
||||
}
|
||||
/*not found ...*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//get real path where the .gpac dir has been created, and use this as the default path
|
||||
//for cache (tmp/ dir of ios app) and last working fir
|
||||
#ifdef GPAC_IPHONE
|
||||
static void gf_ios_refresh_cache_directory( GF_Config *cfg, char *file_path)
|
||||
{
|
||||
char *cache_dir, *old_cache_dir;
|
||||
char buf[GF_MAX_PATH], *res, *sep;
|
||||
res = realpath(file_path, buf);
|
||||
if (!res) return;
|
||||
|
||||
sep = strstr(res, ".gpac");
|
||||
assert(sep);
|
||||
sep[0] = 0;
|
||||
gf_cfg_set_key(cfg, "General", "LastWorkingDir", res);
|
||||
gf_cfg_set_key(cfg, "General", "iOSDocumentsDir", res);
|
||||
|
||||
strcat(res, "cache/");
|
||||
cache_dir = res;
|
||||
old_cache_dir = (char*) gf_cfg_get_key(cfg, "General", "CacheDirectory");
|
||||
|
||||
if (!gf_dir_exists(cache_dir)) {
|
||||
if (old_cache_dir && strcmp(old_cache_dir, cache_dir)) {
|
||||
GF_LOG(GF_LOG_WARNING, GF_LOG_CORE, ("Cache dir changed: old %d -> new %s\n\n", old_cache_dir, cache_dir ));
|
||||
}
|
||||
gf_mkdir(cache_dir);
|
||||
}
|
||||
gf_cfg_set_key(cfg, "General", "CacheDirectory", cache_dir);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static GF_Config *create_default_config(char *file_path)
|
||||
{
|
||||
FILE *f;
|
||||
GF_Config *cfg;
|
||||
#if !defined(GPAC_IPHONE) && !defined(GPAC_ANDROID)
|
||||
char *cache_dir;
|
||||
#endif
|
||||
char szPath[GF_MAX_PATH];
|
||||
char gui_path[GF_MAX_PATH];
|
||||
|
||||
if (! get_default_install_path(file_path, GF_PATH_CFG)) {
|
||||
gf_delete_file(szPath);
|
||||
return NULL;
|
||||
}
|
||||
/*Create the config file*/
|
||||
sprintf(szPath, "%s%c%s", file_path, GF_PATH_SEPARATOR, CFG_FILE_NAME);
|
||||
GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("Trying to create config file: %s\n", szPath ));
|
||||
f = fopen(szPath, "wt");
|
||||
if (!f) return NULL;
|
||||
fclose(f);
|
||||
|
||||
#ifndef GPAC_IPHONE
|
||||
if (! get_default_install_path(szPath, GF_PATH_MODULES)) {
|
||||
gf_delete_file(szPath);
|
||||
GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] default modules not found\n"));
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
get_default_install_path(szPath, GF_PATH_APP);
|
||||
#endif
|
||||
|
||||
cfg = gf_cfg_new(file_path, CFG_FILE_NAME);
|
||||
if (!cfg) return NULL;
|
||||
|
||||
gf_cfg_set_key(cfg, "General", "ModulesDirectory", szPath);
|
||||
|
||||
#if defined(GPAC_IPHONE)
|
||||
gf_ios_refresh_cache_directory(cfg, file_path);
|
||||
#elif defined(GPAC_ANDROID)
|
||||
if (get_default_install_path(szPath, GF_PATH_APP)) {
|
||||
strcat(szPath, "/cache");
|
||||
gf_cfg_set_key(cfg, "General", "CacheDirectory", szPath);
|
||||
}
|
||||
#else
|
||||
/*get default temporary directoy */
|
||||
cache_dir = gf_get_default_cache_directory();
|
||||
|
||||
if (cache_dir) {
|
||||
gf_cfg_set_key(cfg, "General", "CacheDirectory", cache_dir);
|
||||
gf_free(cache_dir);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(GPAC_IPHONE)
|
||||
gf_cfg_set_key(cfg, "General", "DeviceType", "iOS");
|
||||
#elif defined(GPAC_ANDROID)
|
||||
gf_cfg_set_key(cfg, "General", "DeviceType", "Android");
|
||||
#else
|
||||
gf_cfg_set_key(cfg, "General", "DeviceType", "Desktop");
|
||||
#endif
|
||||
|
||||
gf_cfg_set_key(cfg, "Compositor", "Raster2D", "GPAC 2D Raster");
|
||||
gf_cfg_set_key(cfg, "Audio", "ForceConfig", "yes");
|
||||
gf_cfg_set_key(cfg, "Audio", "NumBuffers", "2");
|
||||
gf_cfg_set_key(cfg, "Audio", "TotalDuration", "120");
|
||||
gf_cfg_set_key(cfg, "Audio", "DisableNotification", "no");
|
||||
|
||||
/*Setup font engine to FreeType by default, and locate TrueType font directory on the system*/
|
||||
gf_cfg_set_key(cfg, "FontEngine", "FontReader", "FreeType Font Reader");
|
||||
gf_cfg_set_key(cfg, "FontEngine", "RescanFonts", "yes");
|
||||
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
/*FIXME - is this true on all WinCE systems??*/
|
||||
strcpy(szPath, "\\Windows");
|
||||
#elif defined(WIN32)
|
||||
GetWindowsDirectory((char*)szPath, MAX_PATH);
|
||||
if (szPath[strlen((char*)szPath)-1] != '\\') strcat((char*)szPath, "\\");
|
||||
strcat((char *)szPath, "Fonts");
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
#ifdef GPAC_IPHONE
|
||||
strcpy(szPath, "/System/Library/Fonts/Cache,/System/Library/Fonts/AppFonts,/System/Library/Fonts/Core,/System/Library/Fonts/Extra");
|
||||
#else
|
||||
strcpy(szPath, "/Library/Fonts");
|
||||
#endif
|
||||
|
||||
#elif defined(GPAC_ANDROID)
|
||||
strcpy(szPath, "/system/fonts/");
|
||||
#else
|
||||
strcpy(szPath, "/usr/share/fonts/truetype/");
|
||||
#endif
|
||||
gf_cfg_set_key(cfg, "FontEngine", "FontDirectory", szPath);
|
||||
|
||||
gf_cfg_set_key(cfg, "Downloader", "CleanCache", "200M");
|
||||
gf_cfg_set_key(cfg, "Compositor", "AntiAlias", "All");
|
||||
gf_cfg_set_key(cfg, "Compositor", "FrameRate", "30.0");
|
||||
/*use power-of-2 emulation in OpenGL if no rectangular texture extension*/
|
||||
gf_cfg_set_key(cfg, "Compositor", "EmulatePOW2", "yes");
|
||||
gf_cfg_set_key(cfg, "Compositor", "ScalableZoom", "yes");
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
gf_cfg_set_key(cfg, "Video", "DriverName", "GAPI Video Output");
|
||||
#elif defined(WIN32)
|
||||
gf_cfg_set_key(cfg, "Video", "DriverName", "DirectX Video Output");
|
||||
#elif defined(__DARWIN__) || defined(__APPLE__)
|
||||
gf_cfg_set_key(cfg, "Video", "DriverName", "SDL Video Output");
|
||||
#elif defined(GPAC_ANDROID)
|
||||
gf_cfg_set_key(cfg, "Video", "DriverName", "Android Video Output");
|
||||
gf_cfg_set_key(cfg, "Audio", "DriverName", "Android Audio Output");
|
||||
#else
|
||||
gf_cfg_set_key(cfg, "Video", "DriverName", "X11 Video Output");
|
||||
gf_cfg_set_key(cfg, "Audio", "DriverName", "SDL Audio Output");
|
||||
#endif
|
||||
#ifdef GPAC_IPHONE
|
||||
gf_cfg_set_key(cfg, "Compositor", "DisableGLUScale", "yes");
|
||||
#endif
|
||||
|
||||
gf_cfg_set_key(cfg, "Video", "SwitchResolution", "no");
|
||||
gf_cfg_set_key(cfg, "Video", "HardwareMemory", "Auto");
|
||||
gf_cfg_set_key(cfg, "Network", "AutoReconfigUDP", "yes");
|
||||
gf_cfg_set_key(cfg, "Network", "UDPTimeout", "10000");
|
||||
gf_cfg_set_key(cfg, "Network", "BufferLength", "3000");
|
||||
gf_cfg_set_key(cfg, "Network", "BufferMaxOccupancy", "10000");
|
||||
|
||||
|
||||
/*locate GUI*/
|
||||
if ( get_default_install_path(szPath, GF_PATH_GUI) ) {
|
||||
char *sep = strrchr(szPath, GF_PATH_SEPARATOR);
|
||||
if (!sep) sep = strrchr(szPath, GF_PATH_SEPARATOR);
|
||||
sprintf(gui_path, "%s%cgui.bt", szPath, GF_PATH_SEPARATOR);
|
||||
f = gf_fopen(gui_path, "rt");
|
||||
if (f) {
|
||||
gf_fclose(f);
|
||||
gf_cfg_set_key(cfg, "General", "StartupFile", gui_path);
|
||||
}
|
||||
|
||||
/*shaders are at the same location*/
|
||||
assert(sep);
|
||||
sep[0] = 0;
|
||||
sprintf(gui_path, "%s%cshaders%cvertex.glsl", szPath, GF_PATH_SEPARATOR, GF_PATH_SEPARATOR);
|
||||
gf_cfg_set_key(cfg, "Compositor", "VertexShader", gui_path);
|
||||
sprintf(gui_path, "%s%cshaders%cfragment.glsl", szPath, GF_PATH_SEPARATOR, GF_PATH_SEPARATOR);
|
||||
gf_cfg_set_key(cfg, "Compositor", "FragmentShader", gui_path);
|
||||
}
|
||||
|
||||
/*store and reload*/
|
||||
gf_cfg_del(cfg);
|
||||
return gf_cfg_new(file_path, CFG_FILE_NAME);
|
||||
}
|
||||
|
||||
/*check if modules directory has changed in the config file
|
||||
*/
|
||||
static void check_modules_dir(GF_Config *cfg)
|
||||
{
|
||||
char path[GF_MAX_PATH];
|
||||
|
||||
#ifdef GPAC_IPHONE
|
||||
char *cfg_path;
|
||||
if ( get_default_install_path(path, GF_PATH_GUI) ) {
|
||||
char *sep;
|
||||
char shader_path[GF_MAX_PATH];
|
||||
strcat(path, "/gui.bt");
|
||||
gf_cfg_set_key(cfg, "General", "StartupFile", path);
|
||||
//get rid of "/gui/gui.bt"
|
||||
sep = strrchr(path, '/');
|
||||
sep[0] = 0;
|
||||
sep = strrchr(path, '/');
|
||||
sep[0] = 0;
|
||||
|
||||
sprintf(shader_path, "%s%cshaders%cvertex.glsl", path, GF_PATH_SEPARATOR, GF_PATH_SEPARATOR);
|
||||
gf_cfg_set_key(cfg, "Compositor", "VertexShader", shader_path);
|
||||
sprintf(shader_path, "%s%cshaders%cfragment.glsl", path, GF_PATH_SEPARATOR, GF_PATH_SEPARATOR);
|
||||
gf_cfg_set_key(cfg, "Compositor", "FragmentShader", shader_path);
|
||||
}
|
||||
cfg_path = gf_cfg_get_filename(cfg);
|
||||
gf_ios_refresh_cache_directory(cfg, cfg_path);
|
||||
gf_free(cfg_path);
|
||||
|
||||
#else
|
||||
const char *opt;
|
||||
|
||||
if ( get_default_install_path(path, GF_PATH_MODULES) ) {
|
||||
opt = gf_cfg_get_key(cfg, "General", "ModulesDirectory");
|
||||
//for OSX, we can have an install in /usr/... and an install in /Applications/Osmo4.app - always change
|
||||
#if defined(__DARWIN__) || defined(__APPLE__)
|
||||
if (!opt || strcmp(opt, path))
|
||||
gf_cfg_set_key(cfg, "General", "ModulesDirectory", path);
|
||||
#else
|
||||
|
||||
//otherwise only check we didn't switch between a 64 bit version and a 32 bit version
|
||||
if (!opt) {
|
||||
gf_cfg_set_key(cfg, "General", "ModulesDirectory", path);
|
||||
} else {
|
||||
Bool erase_modules_dir = GF_FALSE;
|
||||
const char *opt64 = gf_cfg_get_key(cfg, "Systems", "64bits");
|
||||
if (!opt64) {
|
||||
//first run or old versions, erase
|
||||
erase_modules_dir = GF_TRUE;
|
||||
} else if (!strcmp(opt64, "yes") ) {
|
||||
#ifndef GPAC_64_BITS
|
||||
erase_modules_dir = GF_TRUE;
|
||||
#endif
|
||||
} else {
|
||||
#ifdef GPAC_64_BITS
|
||||
erase_modules_dir = GF_TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef GPAC_64_BITS
|
||||
opt64 = "yes";
|
||||
#else
|
||||
opt64 = "no";
|
||||
#endif
|
||||
gf_cfg_set_key(cfg, "Systems", "64bits", opt64);
|
||||
|
||||
if (erase_modules_dir) {
|
||||
gf_cfg_set_key(cfg, "General", "ModulesDirectory", path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*if startup file was disabled, do not attempt to correct it*/
|
||||
if (gf_cfg_get_key(cfg, "General", "StartupFile")==NULL) return;
|
||||
|
||||
if ( get_default_install_path(path, GF_PATH_GUI) ) {
|
||||
opt = gf_cfg_get_key(cfg, "General", "StartupFile");
|
||||
if (strstr(opt, "gui.bt") && strcmp(opt, path) && strstr(path, ".app") ) {
|
||||
#if defined(__DARWIN__) || defined(__APPLE__)
|
||||
strcat(path, "/gui.bt");
|
||||
gf_cfg_set_key(cfg, "General", "StartupFile", path);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
GF_EXPORT
|
||||
GF_Config *gf_cfg_init(const char *file, Bool *new_cfg)
|
||||
{
|
||||
GF_Config *cfg;
|
||||
char szPath[GF_MAX_PATH];
|
||||
|
||||
if (new_cfg) *new_cfg = GF_FALSE;
|
||||
|
||||
if (file) {
|
||||
cfg = gf_cfg_new(NULL, file);
|
||||
/*force creation of a new config*/
|
||||
if (!cfg) {
|
||||
FILE *fcfg = gf_fopen(file, "wt");
|
||||
if (fcfg) {
|
||||
gf_fclose(fcfg);
|
||||
cfg = gf_cfg_new(NULL, file);
|
||||
if (new_cfg) *new_cfg = GF_TRUE;
|
||||
}
|
||||
}
|
||||
if (cfg) {
|
||||
check_modules_dir(cfg);
|
||||
return cfg;
|
||||
}
|
||||
}
|
||||
|
||||
if (!get_default_install_path(szPath, GF_PATH_CFG)) {
|
||||
fprintf(stderr, "Fatal error: Cannot create a configuration file in application or user home directory - no write access\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cfg = gf_cfg_new(szPath, CFG_FILE_NAME);
|
||||
if (!cfg) {
|
||||
fprintf(stderr, "GPAC config file %s not found in %s - creating new file\n", CFG_FILE_NAME, szPath);
|
||||
cfg = create_default_config(szPath);
|
||||
}
|
||||
if (!cfg) {
|
||||
fprintf(stderr, "\nCannot create config file %s in %s directory\n", CFG_FILE_NAME, szPath);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef GPAC_IPHONE
|
||||
fprintf(stderr, "Using config file in %s directory\n", szPath);
|
||||
#endif
|
||||
|
||||
check_modules_dir(cfg);
|
||||
|
||||
if (!gf_cfg_get_key(cfg, "General", "StorageDirectory")) {
|
||||
get_default_install_path(szPath, GF_PATH_CFG);
|
||||
strcat(szPath, "/Storage");
|
||||
if (!gf_dir_exists(szPath)) gf_mkdir(szPath);
|
||||
gf_cfg_set_key(cfg, "General", "StorageDirectory", szPath);
|
||||
}
|
||||
|
||||
if (new_cfg) *new_cfg = GF_TRUE;
|
||||
return cfg;
|
||||
}
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user