Cleanup vs configs (#1539)

* Delete (probably) wrongly committed vs config file

* Remove Nuklear GUI

* Clean up SLN configs (Reduce to 64 bit full debug & release)

* Sync bat scripts, prepare to move

* Build rust in release when release

* Update changelog

* Delete rustx86.bat
This commit is contained in:
Willem
2023-05-29 20:34:15 +02:00
committed by GitHub
parent 3efb2b1a68
commit 5b7666965f
39 changed files with 15 additions and 65599 deletions

View File

@@ -21,92 +21,7 @@ on:
- "windows/**"
jobs:
build_non_ocr_release:
runs-on: windows-2019
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.3.1
- name: Install llvm and clang
run: choco install llvm
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Win 10 SDK
uses: ilammy/msvc-dev-cmd@v1
- name: Setup Vcpkg
id: vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
committish: "217194cea7e3491c14779c763beec50b6a4575d6"
cache-version: "1"
ignore-reserve-cache-error: true
- name: Install dependencies
run: cd vcpkg && vcpkg integrate install && vcpkg install libpng --triplet x64-windows-static
- name: build Release
env:
LIBCLANG_PATH: "C:\\Program Files\\LLVM\\lib"
LLVM_CONFIG_PATH: "C:\\Program Files\\LLVM\\bin\\llvm-config"
CARGO_TARGET_DIR: "..\\..\\windows"
BINDGEN_EXTRA_CLANG_ARGS: -fmsc-version=0
VCPKG_ROOT: ${{ github.workspace }}\vcpkg
run: msbuild ccextractor.sln /p:Configuration=Release /p:Platform=x64
working-directory: ./windows
- name: Display version information
run: ./ccextractorwin.exe --version
working-directory: ./windows/x64/Release
- uses: actions/upload-artifact@v3
with:
name: CCExtractor Windows Non-OCR Release build
path: |
./windows/x64/Release/ccextractorwin.exe
./windows/x64/Release/*.dll
build_non_ocr_debug:
runs-on: windows-2019
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.3.1
- name: Install llvm and clang
run: choco install llvm
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Win 10 SDK
uses: ilammy/msvc-dev-cmd@v1
- name: Setup Vcpkg
id: vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
committish: "217194cea7e3491c14779c763beec50b6a4575d6"
cache-version: "1"
ignore-reserve-cache-error: true
- name: Install dependencies
run: cd vcpkg && vcpkg integrate install && vcpkg install libpng --triplet x64-windows-static
- name: build Debug
env:
LIBCLANG_PATH: "C:\\Program Files\\LLVM\\lib"
LLVM_CONFIG_PATH: "C:\\Program Files\\LLVM\\bin\\llvm-config"
CARGO_TARGET_DIR: "..\\..\\windows"
BINDGEN_EXTRA_CLANG_ARGS: -fmsc-version=0
VCPKG_ROOT: ${{ github.workspace }}\vcpkg
run: msbuild ccextractor.sln /p:Configuration=Debug /p:Platform=x64
working-directory: ./windows
- name: Display version information
run: ./ccextractorwin.exe --version
working-directory: ./windows/x64/Debug
- uses: actions/upload-artifact@v3
with:
name: CCExtractor Windows Non-OCR Debug build
path: |
./windows/x64/Debug/ccextractorwin.exe
./windows/x64/Debug/ccextractorwin.pdb
./windows/x64/Debug/*.dll
build_ocr_hardsubx_release:
build_release:
runs-on: windows-2019
steps:
- name: Check out repository
@@ -144,11 +59,11 @@ jobs:
working-directory: ./windows/x64/Release-Full
- uses: actions/upload-artifact@v3
with:
name: CCExtractor Windows OCR and HardSubX Release build
name: CCExtractor Windows Release build
path: |
./windows/x64/Release-Full/ccextractorwinfull.exe
./windows/x64/Release-Full/*.dll
build_ocr_hardsubx_debug:
build_debug:
runs-on: windows-2019
steps:
- name: Check out repository
@@ -186,7 +101,7 @@ jobs:
working-directory: ./windows/x64/Debug-Full
- uses: actions/upload-artifact@v3
with:
name: CCExtractor Windows OCR and HardSubX Debug build
name: CCExtractor Windows Debug build
path: |
./windows/x64/Debug-Full/ccextractorwinfull.exe
./windows/x64/Debug-Full/ccextractorwinfull.pdb

View File

@@ -19,6 +19,8 @@
- Fix: McPoodle Broadcast Raw format for field 1
- Fix: Incorrect skipping of packets
- Fix: Repeated values for enums
- Cleanup: Remove the (unmaintained) Nuklear GUI code
- Cleanup: Reduce the amount of Windows build options in the project file
0.94 (2021-12-14)
-----------------

View File

@@ -218,7 +218,7 @@ Other dependencies are required through vcpkg, so you can follow below steps:
Note: Following screenshots and steps are based on Visual Studio 2017, but they should be more or less same for other versions.
1.Open `windows/` directory to locate `ccextractor.vcxproj`, `ccextractorGUI.vcxproj` (blue arrows) and `ccextractor.sln` (red arrow).
1.Open `windows/` directory to locate `ccextractor.vcxproj` and `ccextractor.sln` (red arrow).
![Project Files](img/projectFiles.png)

View File

@@ -1,821 +0,0 @@
# Documentation
## CCExtractor Graphical User Interface
### Code Structure:
```
src/GUI
├── activity.c -Activity window definitions
├── activity.h -Activity window declarations
├── ccextractorGUI.c -Contains main() and GUI code for 'Main' Tab + 'Menu'
├── ccextractorGUI.h -Function and structure declarations
├── ccx_cli_thread.c -All the functions (definitions) passed in threads
├── ccx_cli_thread.h -Function, variables & structs declaration used in thread
├── command_builder.c -Builds command to pass to CLI CCExtractor
├── command_builder.h -Function, variables & structs declaration used
├── file_browser.c -Function definition for File Browser
├── file_browser.h -Function, struct & variable declaration
├── nuklear_lib -Diretory contains Library Files
│ ├── nuklear_glfw_gl2.h -GLFW backend source header to interact with Nuklear
│ └── nuklear.h -Nuklear library source code
├── popups.c -Function definitions for all Popups used
├── popups.h -Function & network struct declaration for all Popups
├── preview.c -Preview window definitions
├── preview.h -Preview window definitions
├── save_load_data.c -Function definition to save last run state
├── save_load_data.h -Function declaration to save last run state
├── stb_image.h -Code to load images
├── tabs.c -Function definitions for all tabs except 'Main' tab
├── tabs.h -Function, variable and structure declarations
├── terminal.c -Code for terminal Window
└── win_dirent.h -Dirent API for Windows
```
### File by File functions:
activity.c
[nk_begin](#nk-begin)(ctx, "Activity", nk_rect(x, y, width, height), NK_WINDOW_TITLE|NK_WINDOW_BACKGROUND);
[nk_end](#nk-end)(ctx);
[nk_layout_row_dynamic](#nk-layout-row-dynamic)(ctx, 40, 1);
[nk_label_wrap](#nk-label-wrap)(ctx, [main_settings](#struct-main-tab)->activity_string[i]);
[nk_window_is_closed](#nk-window-is-closed)(ctx, "Activity");
activity.h
int [activity](#func-activity)(struct [nk_context](#nk-context) *ctx, int x, int y, int width, int height, struct [main_tab](#struct-main-tab) *main_settings);
ccextractorGUI.c
[nk_menubar_begin](#nk-menubar-begin)(ctx);
[nk_layout_row_begin](#nk-layout-row-begin)(ctx, NK_STATIC, 30, 3);
[nk_layout_row_push](#nk-layout-row-push)(ctx, 80);
[nk_menu_begin_label](#nk-menu-begin-label)(ctx, "Preferences", NK_TEXT_LEFT, [nk_vec2](#nk-vec2)(120, 200));
[nk_menu_end](#nk-menu-end)(ctx);
[nk_menubar_end](#nk-menubar-end)(ctx);
[nk_layout_space_begin](#nk-layout-space-begin)(ctx, NK_STATIC, 15, 1);
[nk_layout_space_end](#nk-layout-space-end)(ctx);
[nk_style_push_vec2](#nk-style-push-vec2)(ctx, &ctx->style.window.spacing, [nk_vec2(](#nk-vec2)0, 0));
[nk_style_push_float](#nk-style-push-float)(ctx, &ctx->style.button.rounding, 0);
[nk_button_label](#nk-label-button)(ctx, names[i]);
[nk_style_pop_float](#nk-style-pop-float)(ctx);
[nk_group_begin](#nk-group-begin)(ctx, "Advanced Tabs", NK_WINDOW_NO_SCROLLBAR);
[nk_group_end](#nk-group-end)(ctx);
[nk_layout_row](#nk-layout-row)(ctx, NK_DYNAMIC, 20, 3, ratio_adv_mode);
[nk_spacing](#nk-spacing)(ctx, 1);
[nk_checkbox_label](#nk-checkbox-label)(ctx, "Advanced Mode", &advanced_mode_check);
[nk_option_label](#nk-option-label)(ctx, "Extract from files below:", [main_settings](#struct-main-tab).port_or_files == FILES));
[nk_selectable_label](#nk-selectable-label)(ctx, [truncate_path_string](#func-truncate-path-string)([main_settings](#struct-main-tab).filenames[i]), NK_TEXT_LEFT, &[main_settings](#struct-main-tab).is_file_selected[i]);
[nk_combo](#nk-combo)(ctx, [main_settings](#struct-main-tab).port_type, 2, [main_settings](#struct-main-tab).port_select, 20, [nk_vec2](#nk-vec2)_(85,100));
[nk_label](#nk-label)(ctx, "Drag and Drop files for extraction.", NK_TEXT_CENTERED
[nk_progress](#nk-progress)(ctx, &[main_settings](#struct-main-tab).progress_cursor, 101, nk_true);
ccextractorGUI.h
void [setup_main_settings](#func-setup-main-settings)(struct main_tab *main_settings);
char* [truncate_path_string](#func-truncate-path-string)(char *filePath);
void [remove_path_entry](#func-remove-path-entry)(struct [main_tab](#struct-main-tab) *main_settings, int indexToRemove);
ccx_cli_thread.c || ccx_cli_thread.h
void* [read_activity_data](#func-read-activity-data)(void *read_args);
void* [read_data_from_thread](#func-read-data-from-thread)(void* read_args);
void* [extract_thread](#func-extract-thread)(void* extract_args);
void* [feed_files_for_extraction](#func-feed-files-for-extraction)(void* file_args);
void [setup_and_create_thread](#fun-setup-and-create-thread)(struct [main_tab](#struct-main-tab) *main_settings, struct [built_string](#struct-built-string) *command);
void&asst; [find_hd_homerun_devices](#func-hd-homerun-devices)(void *args);
void* [setup_hd_homerun_device](#func-setup-hd-homerun-device)(void *args);
command_builder.c || command_builder.h
void [command_builder](#func-command-builder)(struct [built_string](#struct-built-string) *command,
        struct [main_tab](#struct-main-tab) *main_settings,
        struct [network_popup](#struct-network-popup) *network_settings,
        struct [input_tab](#struct-input-tab) *input,
        struct [advanced_input_tab](#struct-advanced-input-tab) *advanced_input,
        struct [output_tab](#struct-output-tab) *output,
        struct [decoders_tab](#struct-output-tab) *decoders,
        struct [credits_tab](#struct-output-tab) *credits,
        struct [debug_tab](#struct-debug-tab) *debug,
        struct [burned_subs_tab](#struct-debug-tab) *burned_subs);
file_browser.c || file_browser.h
void [die](#func-die)(const char *fmt, ...);
char* [file_load](#func-file-load)(const char* path, size_t* siz);
char* [str_duplicate](#func-str-duplicate)(const char *src);
void [dir_free_list](#func-dir-free-list)(char **list, size_t size);
char** [dir_list](#func-dir-list)(const char *dir, int return_subdirs, size_t *count);
struct file_group [FILE_GROUP](#func-file-group)(enum file_groups group, const char *name, struct nk_image *icon);
struct file [FILE_DEF](#func-file-def)(enum file_types type, const char *suffix, enum file_groups group);
struct nk_image* [media_icon_for_file](#func-media-icon-for-file)(struct media *media, const char *file);
void [media_init](#func-media-init)(struct media *media);
void [file_browser_reload_directory_content](#func-file-browser-reload-directory-content)(struct file_browser *browser, const char *path);
void [get_drives](#func-get-drives)(struct file_browser *browser);
void [file_browser_init](#func-file-browser-init)(struct file_browser *browser, struct media *media);
void [file_browser_free](#func-file-browser-free)(struct file_browser *browser);
int [file_browser_run](#func-file-browser-run)(struct file_browser *browser, struct [nk_context](#nk-context) *ctx, struct [main_tab](#struct-main-tab) *main_settings, struct [output_tab](#struct-output-tab) *output, struct [debug_tab](#struct-debug-tab) *debug, struct [hd_homerun_tab](#struct-hd-homerun-tab) *hd_homerun);
popups.c || popups.h
void [draw_network_popup](#func-draw-network-popup)(struct [nk_context](#nk-context) *ctx, int *show_preferences_network, struct [network_popup](#struct-network-popup) *network_settings);
void [draw_getting_started_popup](#func-draw-getting-started-popup)(struct [nk_context](#nk-context) *ctx, int *show_getting_started);
void [draw_about_ccx_popup](#func-draw-about-ccx-popup)(struct [nk_context](#nk-context) *ctx, int *show_about_ccx, struct nk_user_font *droid_big, struct nk_user_font *droid_head);
void [draw_progress_details_popup](#func-draw-progress-details-popup)(struct [nk_context](#nk-context) *ctx, int *show_progress_details, struct [main_tab](#struct-main-tab) *main_settings);
void [draw_color_popup](#func-draw-color-popup)(struct [nk_context](#nk-context) *ctx, struct [output_tab](#struct-output-tab) *output);
void [draw_thread_popup](#fun-draw-thread-popup)(struct [nk_context](#nk-context) *ctx, int *show_thread_popup);
void [setup_network_settings](#func-setup-network-settings)(struct [network_popup](#struct-network-popup) *network_settings);
preview.c || preview.h
int [preview](#func-preview)(struct [nk_context](#nk-context) *ctx, int x, int y, int width, int height, struct [main_tab](#struct-main-tab) *main_settings);
save_load_data.c || save_load_data.h
void [load_data](#func-load-data)(FILE *file,
        struct [main_tab](#struct-main-tab) *main_settings,
        struct [input_tab](#struct-input-tab) *input,
        struct [advanced_input_tab](#struct-advanced-input-tab) *advanced_input,
        struct [output_tab](#struct-output-tab) *output,
        struct [decoders_tab](#struct-decoders-tab) *decoders,
        struct [credits_tab](#struct-credits-tab) *credits,
        struct [debug_tab](#struct-debug-tab) *debug,
        struct [hd_homerun_tab](#struct-hd-homerun-tab) *hd_homerun,
        struct [burned_subs_tab](#struct-burned-subs-tab) *burned_subs);
void [save_data](#func-save-data)(FILE *file,
        struct [main_tab](#struct-main-tab) *main_settings,
        struct [input_tab](#struct-input-tab) *input,
        struct [advanced_input_tab](#struct-advanced-input-tab) *advanced_input,
        struct [output_tab](#struct-output-tab) *output,
        struct [decoders_tab](#struct-decoders-tab) *decoders,
        struct [credits_tab](#struct-credits-tab) *credits,
        struct [debug_tab](#struct-debug-tab) *debug,
        struct [hd_homerun_tab](#struct-hd-homerun-tab) *hd_homerun,
        struct [burned_subs_tab](#struct-burned-subs-tab) *burned_subs);
void [write_credits](#func-write-credits)(FILE* file, struct [credits_tab](#struct-credits-tab) *credits);
void [read_credits](#func-read-credits)(FILE* file, struct [credits_tab](#struct-credits-tab) *credits);
terminal.c
int [terminal](#func-terminal)(struct [nk_context](#nk-context) *ctx, int x, int y, int width, int height, char *command);
### About CCExtractor specific functions
#### int <a id="func-activity">activity</a>(struct nk_context &ast;ctx, int x, int y, int width, int height, struct [main_tab](#struct-main-tab) &ast;main_settings);
##### Info:
--Contains the procedure to be carried out when Activity Window is toggled.
##### Parameters:
* &ast;ctx - pointer to `nk_context` structure.
* x - X co-ordinate to draw Activity Window
* y - Y co-ordinate to draw Activty Window.
* width - width of window to draw.
* height - height of window to draw.
* &ast;main_settings - pointer to [`main_tab`](#struct-main-tab) structure.
##### Return Type: int
* Returns non-zero value if window is not closed.
* Returns zero if window is closed.
#### void <a id="func-setup-main-settings">setup_main_settings</a>(struct [main_tab](#struct-main-tab) &ast;main_settings);
##### Info:
Setups the required defaults of variables in [`main_tab`](#struct-main-tab) structure.
##### Parameters:
* &ast;main_settings - pointer to [`main_tab`](#struct-main-tab) structure.
##### Return Type: void
#### char* <a id="func-truncate-path-string">truncate_path_string</a>(char &ast;filePath);
##### Info:
Truncated the Path String of file to visible area using `...`
##### Parameters:
* &ast;filePath - Pointer to string to be truncated.
##### Return Type: *char
* Returns pointer to truncated string.
#### void <a id="func-remove-path-entry">remove_path_entry</a>(struct [main_tab](#struct-main-tab) &ast;main_settings, int indexToRemove);
##### Info:
Removes the selected path in the extraction queue (Selected entry's index is passed).
##### Parameters:
* &ast;main_settings - pointer to [`main_tab`](#struct-main-tab) structure.
* indexToRemove - index of the string to be removed from dynamic array of many strings.
##### Return Type: void
#### void&ast; <a id="func-read-activity-data">read_activity_data</a>(void &ast;read_args);
##### Info:
Reads activity data related to CCExtractor on `stdout`. And outputs to activity window (Updates variables that code of activity window uses).
##### Parameters:
* &ast;read_args - Pointer to void, because thread functions don't allow any datatype as argument or return type. Therefore they are passed as void then typecasted later in the function.
##### Return type: void&ast;
#### void&ast; <a id="func-read-data-from-thread>read_data_from_thread</a>(void&ast; read_args);
##### Info:
Reads data from`--gui_mode_reports` redirected from `stderr` to a file. Reads the subtitles extracted in realtime and updates the variables for the same, updates the state of progress bar. Also, lanches [read_activity_data](#func-read-activity-data) in a new thread.
##### Parameters:
* &ast;read_args - Pointer to void, because thread functions don't allow any datatype as argument or return type. Therefore they are passed as void then typecasted later in the function.
##### Return type: void&ast;
#### void&ast; <a id="func-extract-thread">extract_thread</a>(void&ast; extract_args);
##### Info:
Passes command with all options from GUI to CLI CCExtractor.
##### Parameters:
* &ast;extract_args - Pointer to void, because thread functions don't allow any datatype as argument or return type. Therefore they are passed as void then typecasted later in the function.
##### Return type: void&ast;
#### void&ast; <a id="func-feed-files-for-extraction">feed_files_for_extraction</a>(void&ast; file_args);
##### Info:
Feeds file by file to a new thread and waits until its extraction is done. This is done until all the files in extraction queue are extracted.
##### Parameters:
* &ast;file_args - Pointer to void, because thread functions don't allow any datatype as argument or return type. Therefore they are passed as void then typecasted later in the function.
##### Return type: void&ast;
#### void <a id="func-setup-and-create-thread">setup_and_create_thread</a>(struct [main_tab](#struct-main-tab) &ast;main_settings, struct [built_string](#struct-built-string) &ast;command);
##### Info:
Initialises some values for the structure used in thread arguments and creates [feed_files_for_extraction](#feed-files-for-extraction).
##### Parameters:
* &ast;main_settings - Pointer to `main_tab` struct.
* &ast;command - Pointer to `built_string` struct.
##### Return type: void&ast;
#### void&ast; <a id="func-hind-hd-homerun-devices">find_hd_homerun_devices</a>(void &ast;args);
Finds devices connected to HD HomeRun Network.
#### Parameters:
* &ast;args - Pointer to void, because thread functions don't allow any datatype as argument or return type. Therefore they are passed as void then typecasted later in the function.
#### Return type: void&ast;
#### void&ast; <a id="func-setup-hd-homerun-device">setup_hd_homerun_device</a>(void &ast;args);
##### Info:
Sets up various parameters required to extract subtitle from incoming stream from a HD HomeRun Device.
##### Parameters:
* &ast;args - Pointer to void, because thread functions don't allow any datatype as argument or return type. Therefore they are passed as void then typecasted later in the function.
##### Return type: void&ast;
#### void [command_builder](#func-command-builder)(struct [built_string](#struct-built-string) &ast;command, struct [main_tab](#struct-main-tab) &ast;main_settings, struct [network_popup](#struct-network-popup) &ast;network_settings, struct [input_tab](#struct-input-tab) &ast;input, struct [advanced_input_tab](#struct-advanced-input-tab) &ast;advanced_input, struct [output_tab](#struct-output-tab) &ast;output, struct [decoders_tab](#struct-output-tab) &ast;decoders, struct [credits_tab](#struct-output-tab) &ast;credits, struct [debug_tab](#struct-debug-tab) &ast;debug, struct [burned_subs_tab](#struct-debug-tab) &ast;burned_subs);
##### Info:
Fetches the options from the whole GUI and adds the respective CLI commands to the `term_string` in `built_string` struct.
##### Parameters:
* &ast;command - Pointer to `built_string` command.
* &ast;main_settings - Pointer to `main_tab` struct.
* &ast;network_settings - Pointer to `network_popup` struct.
* &ast;input - Pointer to `input_tab` struct.
* &ast;advance_input - Pointer to `advanced_input` struct.
* &ast;output - Pointer to `output_tab` struct.
* &ast;decoders - Pointer to `decoders_tab` struct.
* &ast;credits - Pointer to `credits_tab` struct.
* &ast;debug - Pointer to `debug_tab` struct.
* &ast;burned_subs - Pointer to `burned_subs_tab` struct.
##### Return type: void
#### void <a id="func-die">die</a>(const char &ast;fmt, ...);
##### Info:
Custom function to generate error if something in File Browser goes wrong.
##### Parameters:
* &ast;fmt - Format of char string along with place holder for variables.
* ... - Variables in order of their specified place holder.
##### Return type: void
#### char&ast; <a id="func-file-load">file_load</a>(const char&ast; path, size_t&ast; siz);
##### Info:
Custom function to load file and read data from loaded file.
##### Parameters:
* &ast;path - Pointer to string literal (Path of the file).
* &ast;siz - Size of string literal provided (To allocate memory accordingly).
##### Return type: void
#### char&ast; <a id="func-str-duplicate">str_duplicate</a>(const char &ast;src);
##### Info:
Dynamically copies specified string to memory.
##### Parameters:
* &ast;src - The String to be copied.
##### Return type: char&ast;
* Pointer to the string in the memory.
#### void <a id="func-dir-free-list">dir_free_list</a>(char &ast;&ast;list, size_t size);
##### Info:
Frees the memory allocated to Files' and Directories' name and path.
##### Parameters:
* &ast;&ast;char - Pointer to list (array of strings) to be freed
##### Return type: void
#### char&ast;&ast; <a id="func-dir-list">dir_list</a>(const char &ast;dir, int return_subdirs, size_t &ast;count);
##### Info:
Opens the selected directory and adds its path to list and returns the same list.
#####Parameters:
* &ast;dir - Pointer to string (name of directory to be opened).
* return_subdirs - `nk_true` if subdirectories are to be returned then.
* &ast;count - Number of directories in opened directories.
#### Retrun type: char&ast;&ast;
* Pointer to List (Array of strings, name of directories and files) is returned.
#### struct file_group <a id="func-file-group">FILE_GROUP</a>(enum file_groups group, const char &ast;name, struct nk_image &ast;icon);
##### Info:
Initialises variables for `file_group` struct.
##### Parameters:
* group - specifies to which group does the file belong to. Selected from `file_groups` enum, like `FILE_GROUP_MUSIC`.
* &ast;name - Pointer to a string literal (to set `name` member in `file_group`.
* &ast;icon - Pointer to `nk_image` struct (Holds attributes for loaded image file) to set to `icon`member of `file_group`.
##### Returnt type: struct `file_group`
* Returns a `file_group` instance with set variables.
#### struct file <a id="func-file-def">FILE_DEF</a>(enum file_types type, const char &ast;suffix, enum file_groups group);
##### Info:
Initialises variables for `file` struct.
##### Parameters:
* type - specifies which type does the file belong to. Selected from `file_types` enum, like `FILE_TEXT`.
* &ast;suffix - Pointer to string( to set `suffix` member in `file`).
* group - specifies to which group does the file belong to. Selected from `file_groups` enum, like `FILE_GROUP_MUSIC`.
##### Return type: struct `file`
* Returns a `file` instance with set variables.
#### struct nk_image&ast; <a id="func-media-icon-for-file">media_icon_for_file</a>(struct media &ast;media, const char &ast;file);
##### Info:
Analyses the files and checks to which `file` or `file_group` they belong and assign appropriate icon to the file and returns the same.
##### Parameters:
* &ast;media - pointer to `media` struct.
* &ast;file - pointer to string literal (name of file with extension)
##### Return type: struct `nk_image`&ast;
* Returns appropriate `nk_image` corresponding to the file.
#### void <a id="func-media-init">media_init</a>(struct media &ast;media);
##### Info:
Assigns icons to `file` and `file_group` members from.
##### Parameters:
* &ast;media - pointer to `media` struct.
#### Return type: void
#### void <a is="func-file-browser-reload-directory-content">file_browser_reload_directory_content</a>(struct file_browser &ast;browser, const char &ast;path);
##### Info:
Updates various variables related to Files/Directories path and names when screen of File Browser reloads. (Due to clicking on a directory or any other button leading to different directory).
##### Parameters:
* &ast;browser - Pointer to `file_browser` struct.
* &ast;path - Path of the new directory whose contents are to be reloaded and showed on file browser.
##### Return type: void
#### void <a id="func-get-drives">get_drives</a>(struct file_browser &ast;browser);
##### Info:
NOTE: Windows Specific Function.
Detects the number of drives and their respective Drive Letters to show the same in File Browser.
#####Parameters:
* &ast;browser - pointer to `file_browser` struct.
##### Return type: void
#### void <a id="func-file-browser-init">file_browser_init</a>(struct file_browser &ast;browser, struct media &ast;media);
##### Info:
Initialised various variables/attributes required whenever the File Browser is run.
##### Parameters:
* &ast;browser - Pointer to `file_browser` struct.
* &ast;media - pointer to `media` struct.
##### Return type: void
#### void <a id="func-file-browser-free">file_browser_free</a>(struct file_browser &ast;browser);
##### Info:
Frees the memory allocated to various variables in [file_browser_init](#func-file-browser-init).
##### Parameters:
* &ast;browser - pointer to `file_browser` struct.
##### Return type: void
#### int <a id="func-file-browser-run">file_browser_run</a>(struct file_browser &ast;browser, struct [nk_context](#nk-context) &ast;ctx, struct [main_tab](#struct-main-tab) &ast;main_settings, struct [output_tab](#struct-output-tab) &ast;output, struct [debug_tab](#struct-debug-tab) &ast;debug, struct [hd_homerun_tab](#struct-hd-homerun-tab) &ast;hd_homerun);
##### Info:
Provides runtime of File Browser on GUI.
##### Parameters:
* &ast;browser - pointer to `file_browser` struct.
* &ast;ctx - pointer to `nk_context` struct.
* &ast;main_settings - pointer to `main_tab` struct.
* &ast;output - poiter to `output_tab` struct.
* &ast;debug - pointer to `debug_tab` struct.
* &ast;hd_homerun - pointer to `hd_homerun_tab` struct.
##### Return type: int
* Returns `1` if any File name/path is copied to current variable.
* Returns `0` otherwise.
#### void <a -d="func-draw-network-popup">draw_network_popup</a>(struct [nk_context](#nk-context) &ast;ctx, int &ast;show_preferences_network, struct [network_popup](#struct-network-popup) &ast;network_settings);
##### Info:
Draws popup with Network Settings on GUI.
##### Parameters:
* &ast;ctx - pointer to `nk_context` struct.
* &ast;show_preferences_network - pointer to variable status if which triggers the popup.
* &ast;network_settings - pointer to `network_popup` struct.
##### Return type: void
#### void <a id="func-draw-getting-started-popup">draw_getting_started_popup</a>(struct [nk_context](#nk-context) &ast;ctx, int &ast;show_getting_started);
##### Info:
Draws popup on screen which shows Getting Started Info.
##### Parameters:
* &ast;ctx - pointer to `nk_context` struct.
* &ast;show_getting_started - pointer to variable status if which triggers the popup.
##### Return type: void
#### void <a id="func-draw-about-ccx-popup">draw_about_ccx_popup</a>(struct [nk_context](#nk-context) &ast;ctx, int &ast;show_about_ccx, struct nk_user_font &ast;droid_big, struct nk_user_font &ast;droid_head);
##### Info:
Draws popup on screen containing information about CCExtractor.
##### Parameters:
* &ast;ctx - pointer to `nk_context` struct.
* &ast;show_about_ccx - pointer to variable status if which triggers the popup.
* &ast;droid_big - pointer to `nk_user_font` struct.
* &ast;droid_head - pointer to `nk_user_font` struct.
##### Return type: void
#### void <a id="func-draw-progress-details-popup">draw_progress_details_popup</a>(struct [nk_context](#nk-context) &ast;ctx, int &ast;show_progress_details, struct [main_tab](#struct-main-tab) &ast;main_settings);
##### Info:
Draws popup on screen which shows progress details.
##### Parameters:
* &ast;ctx - pointer to `nk_context` struct.
* &ast;show_pogress_details - pointer to variable status if which triggers the popup.
* &ast;main_settings - pointer to `main_tab` struct.
##### Return type: void
#### void <a id="func-draw-color-popup">draw_color_popup</a>(struct [nk_context](#nk-context) &ast;ctx, struct [output_tab](#struct-output-tab) &ast;output);
##### Info:
Draws popup on screen which shows color-picker.
##### Parameters:
* &ast;ctx - pointer to `nk_context` struct.
* &ast;output - pointer to `output_tab` struct.
##### Return type: void
#### void <a id="func-draw-thread-popup">draw_thread_popup</a>(struct [nk_context](#nk-context) &ast;ctx, int &ast;show_thread_popup);
##### Info:
This popup is shown if anyhow the GUI is unable to read file.
##### Parameters:
* &ast;ctx - pointer to `nk_context` struct.
* &ast;show_thread_popup - pointer to variable status if which triggers the popup.
##### Return type: void
#### void <a id="func-setup-network-settings">setup_network_settings</a>(struct [network_popup](#struct-network-popup) &ast;network_settings);
##### Info:
Sets up defaults for Network Settings.
##### Parameters:
* &ast;network_settings - pointer to `network_popup` struct.
##### Return type: void
#### int <a id="func-preview">preview</a>(struct [nk_context](#nk-context) &ast;ctx, int x, int y, int width, int height, struct [main_tab](#struct-main-tab) &ast;main_settings);
##### Info:
Draws `Preview` Nuklear window and shows preview strings (lines of subtitles extracted in realtime).
##### Parameters:
* &ast;ctx - pointer to `nk_context` struct.
* x - X co-ordinate from where to draw window.
* y - Y co-ordinate from where to draw window.
* width - width of window.
* height - height of window.
* &ast;main_settings - pointer to `main_tab ` struct.
##### Return type:
* Returns non-zero value if window is not closed.
* Returns zero if window is closed.
#### void <a id="func-load-data">load_data</a>(FILE *file, struct [main_tab](#struct-main-tab) &ast;main_settings, struct [input_tab](#struct-input-tab) &ast;input, struct [advanced_input_tab](#struct-advanced-input-tab) &ast;advanced_input, struct [output_tab](#struct-output-tab) &ast;output, struct [decoders_tab](#struct-decoders-tab) &ast;decoders, struct [credits_tab](#struct-credits-tab) &ast;credits, struct [debug_tab](#struct-debug-tab) &ast;debug, struct [hd_homerun_tab](#struct-hd-homerun-tab) &ast;hd_homerun, struct [burned_subs_tab](#struct-burned-subs-tab) &ast;burned_subs);
##### Info:
Loads values of all the variables stored in a file at last exit of GUI.
##### Parameters:
* &ast;file - pointer to `FILE`.
* &ast;main_settings - pointer to `main_tab` struct.
* &ast;intput - pointer to `input_tab` struct.
* &ast;advanced_input - pointer to `advanced_input_tab` struct.
* &ast;output - pointer to `output_tab` struct.
* &ast;decoders - pointer to `decoders_tab` struct.
* &ast;credits - poitner to `credits_tab` struct.
* &ast;debug - pointer to `debug_tab` struct.
* &ast;hd_homerun - pointer to `hd_homerun_tab` struct.
* &ast;burned_subs - pointer to `burned_subs_tab` struct.
##### Return type: void
#### void <a id="func-save-data">save_data</a>(FILE *file, struct [main_tab](#struct-main-tab) &ast;main_settings, struct [input_tab](#struct-input-tab) &ast;input, struct [advanced_input_tab](#struct-advanced-input-tab) &ast;advanced_input, struct [output_tab](#struct-output-tab) &ast;output, struct [decoders_tab](#struct-decoders-tab) &ast;decoders, struct [credits_tab](#struct-credits-tab) &ast;credits, struct [debug_tab](#struct-debug-tab) &ast;debug, struct [hd_homerun_tab](#struct-hd-homerun-tab) &ast;hd_homerun, struct [burned_subs_tab](#struct-burned-subs-tab) &ast;burned_subs);
##### info:
Saves values of all the variables as a "Current State" in a file on exit.
##### Parameters:
* &ast;file - pointer to `FILE`.
* &ast;main_settings - pointer to `main_tab` struct.
* &ast;intput - pointer to `input_tab` struct.
* &ast;advanced_input - pointer to `advanced_input_tab` struct.
* &ast;output - pointer to `output_tab` struct.
* &ast;decoders - pointer to `decoders_tab` struct.
* &ast;credits - poitner to `credits_tab` struct.
* &ast;debug - pointer to `debug_tab` struct.
* &ast;hd_homerun - pointer to `hd_homerun_tab` struct.
* &ast;burned_subs - pointer to `burned_subs_tab` struct.
##### Return type: void
#### void <a id="func-write-credits">write_credits</a>(FILE &ast;file, struct [credits_tab](#struct-credits-tab) &ast;credits);
##### Info:
Writes Credits to files after some operations, since extra`\n` character gives problems while reading file.
##### Parameters:
* &ast;file - pointer to `FILE`.
* &ast;credits - pointer to `credits_tab` struct.
##### Return type: void
#### void <a id="func-read-credits">read_credits</a>(FILE* file, struct [credits_tab](#struct-credits-tab) &ast;credits);
##### Info:
Reads credits from file in a specific format (as written by [write_credits](#func-write-credits)) from file.
##### Parameters:
* &ast;file - pointer to `FILE`.
* &ast;credits - pointer to `credits_tab` struct.
##### Return type: void
#### int <a id="func-terminal">terminal</a>(struct [nk_context](#nk-context) &ast;ctx, int x, int y, int width, int height, char &ast;command);
##### Info:
Writes the command string (that would be passed to CLI CCExtractor) in "Terminal" Nuklear Window.
##### Parameters:
* &ast;ctx - pointer to `nk_context` struct.
* x - X co-ordinate from where to draw the window.
* y - Y co-ordinate from where to draw the window.
* width - Width of the window.
* height - height of the window.
* &ast;command - String to write on window (the command to be passed).
##### Return type: int
* Returns non-zero value if window is not closed.
* Returns zero if window is closed.
### About CCExtractor specific Structures/Variables
#### <a id="struct-main-tab">main_tab</a>
##### Info:
Contains all the variables for `Main` tab.
##### Variables worth noting:
* `int is_file_browser_active`
* `nk_true` if File Browser is triggered by any event.
* `nk_false` otherwise.
* `int scaleWindowForFileBrowser`
* Sets to `nk_true` if `is_file_browser_active` is `nk_true` to scale the `glfwWindow` to required size to accommodate File Browser.
* Sets to `nk_false` otherwise.
#### <a id="struct-input-tab">input_tab</a>
##### Info:
Contains all variables to hold data of options selected/changed and view dynamically generated data to GUI in `Input` tab.
#### <a id="struct-advanced-input">advanced_input_tab</a>
Info:
Contains all variables to hold data of options selected/changed and view dynamically generated data to GUI in `Advanced Input` tab.
#### <a id="struct-output-tab">output_tab</a>
#####Info:
Contains all variables to hold data of options selected/changed and view dynamically generated data to GUI in `Advanced Input` tab.
#### <a id="struct-decoders-tab">decoders_tab</a>
##### Info:
Contains all variables to hold data of options selected/changed and view dynamically generated data to GUI in `Decoders` tab.
#### <a id="struct-credits-tab">credits_tab</a>
##### Info:
Contains all variables to hold data of options selected/changed and view dynamically generated data to GUI in `Credits` tab.
#### <a id="struct-debug-tab">debug_tab</a>
##### Info:
Contains all variables to hold data of options selected/changed and view dynamically generated data to GUI in `Debug` tab.
#### <a id="struct-hd-homerun-tab">hd_homerun_tab</a>
##### Info:
Contains all variables to hold data of options selected/changed and view dynamically generated data to GUI in `HDHomeRun` tab.
#### <a id="struct-burned-subs-tab">burned_subs</a>
##### Info:
Contains all variables to hold data of options selected/changed and view dynamically generated data to GUI in `HDHomeRun` tab.
#### <a id="struct-network-popup">networ_popup</a>
##### Info:
Contains all the variables to store all the Network related options or showing them in GUI dynamically.
### About Nuklear Specific functions
#### int <a id="nk-begin">nk_begin</a>(struct nk_context&ast;, const char &ast;title, struct nk_rect bounds, nk_flags flags);
##### Info:
Draws a basic(and blank) window(Nuklear Window inside main GLFW window) to hold other Nuklear widgets.
##### Parameters:
* nk_context&ast; - Pointer to `nk_context` structure.
* &ast;title - Title for the so drawn Nuklear Window.
* bounds - instance of `nk_rect` structure to hold co-ordinates, width and height of the Nuklear Window.
* flags - Which flags to pass( from those contained in `enum flags`) to change behaviour of the Nuklear Window.
##### Return Type: int
* Returns true if window creation is successful.
* Returns false if window creation fails.
#### void <a id="nk-end">nk_end</a>(struct nk_context *ctx)
##### Info:
Marks the end of the Nuklear Window.
##### Parameter:
* &ast;ctx - Pointer to `nk_context` structure.
##### Return type: void
#### void <a id="nk-layout-row-dynamic">nk_layout_row_dynamic</a>(struct nk_context&ast;, float height, int cols);
##### Info:
Used to define a dynamic row layout(to hold widgets), dynamic in the sense that the width is dynamically allocated to widgets.
##### Parameters:
* &ast;nk_context - Pointer to `nk_context` structure.
* height - height to set for widgets of that row.
* cols - Columns to set for layout (generally the number of widgets to place).
##### Return Type: void
#### void <a id="nk-label-wrap">nk_label_wrap</a>(struct nk_context&ast;, const char&ast;);
##### Info:
Writes a label ( A plain String) and wraps it to the next line if the border of Nuklear Window, Group or Popup is reached.
*Note*: If the text wraps to next line, height for a new line must be considered while defining a layout, else the wrapped text won't be visible (but it will be there).
##### Parameters:
* nk_context&ast; - Pointer to `nk_context` structure.
* char&ast; - Pointer to string literal (to view).
#### int <a id="nk-window-is-closed">nk_window_is_closed</a>(struct nk_context &ast;ctx, const char &ast;name);
##### Info:
Checks if the active Nuklear Window is closed (by any trigger).
##### Parameters:
* &ast;ctx - Pointer to `nk_context` structure.
* &ast;name - Pointer to String literal(Name of window to check).
##### Return type: int
* Returns true if window is closed (by any trigger).
* Returns false of window is not closed.
#### void <a id="nk-menubar-begin">nk_menubar_begin</a>(struct nk_context &ast;ctx);
##### Info:
Marks the end of Menu Bar definition(Menubar code).
##### Parameters:
* &ast;ctx - Pointer to `nk_context` structure.
##### Return type: void
#### void <a id="nk-layout-row-begin">nk_layout_row_begin</a>(struct nk_context *ctx, enum nk_layout_format fmt, float row_height, int cols);
##### Info:
Marks the beginning of custom layout. Which means, marking that layout has begun, now the widgets will be pushed row by row as per requirement using [nk_layout_row_push](#nk-layout-row-push).
##### Parameters:
* &ast;ctx - Pointer to `nk_context` structure.
* fmt - Layout format from provided formats (`enum nk_layout_format`), example - `NK_STATIC`, `NK_DYNAMIC`.
* row_height - height of row pushed.
* cols - Number of columns pushed in row.
##### Return type: void
#### void <a id="nk-layout-row-push">nk_layout_row_push</a>(struct nk_context&ast;, float value);
##### Info:
Pushes a row to hold widgets after defining the beginning of custom layout by [nk_layout_row_begin](#nk-layout-row-begin).
##### Parameters:
* nk_context&ast; - Pointer to `nk_context` structure.
* value - ratio or width of the widget to be pushed next.
##### Return Type: void
#### int <a id="nk-menu-begin-label">nk_menu_begin_label</a>(struct nk_context &ast;ctx, const char &ast;text, nk_flags align, struct [nk_vec2](#nk-vec2) size);
##### Info:
The label of the Menu Item to be pushed, for example - "Preferences" is marked by this function.
##### Parameters:
* &ast;ctx - pointer to `nk_context` structure.
* &ast;text - pointer to string literal (Title of the Menu, example - "Settings").
* align - alignment enumeration in `nk_flags`, example `NK_TEXT_LEFT`.
* size - Size of label (as `nk_vec2` struct)
##### Return type: int
* Returns true if label creation successful.
* Returns false if label creation fails.
#### void <a id="nk-menubar-end">nk_menubar_end</a>(struct nk_context&ast;);
##### Info:
Marks the end of the MenuBar definition.
##### Parameters:
* nk_context&ast; - Pointer to `nk_context` structure.
##### Return type: void
#### void <a id="nk-layout-space-begin">nk_layout_space_begin</a>(struct nk_context &ast;ctx, enum nk_layout_format fmt, float height, int widget_count);
##### Info:
Marks the beginning of an empty space (Custom space for proper placement of widgets).
##### Parameters:
* &ast;ctx - pointer to `nk_context` structure.
* fmt - Layout format as in `enu nk_layout_format`, example - `NK_STATIC`, `NK_DYNAMIC`.
* height = height of space to be added.
* widget_count - Number of spaces to add.
##### Return type: void
#### void <a id="nk-layout-space-end">nk_layout_space_end</a>(struct nk_context &ast;ctx);
##### Info:
Marks the end of custom space (empty) definition.
##### Parameters:
* &ast;ctx - pointer to `nk_context` structure.
##### Return type: void
#### int <a id="nk-style-push-vec2">nk_style_push_vec2</a>(struct nk_context&ast; struct nk_vec2&ast;, struct nk_vec2);
##### Info:
Comes under `Style Stack`. Used to temporarily modify length, width, spacing related attributes of Styles of Nuklear Context.
##### Parameters:
* nk_context&ast; - Pointer to `nk_context` structure.
* nk_vec2&ast; - Pointer to attribute to be modified.
* nk_vec2&ast; - New value in the form `nk_vec2(x, y)` as an instance of nk_vec2 structure.
##### Return type: int
* Returns true if successful.
* Returns false if unsuccessful.
#### int <a id="nk-style-push-float">nk_style_push_float</a>(struct nk_context&ast;, float&ast;, float);
##### Info:
Comes under `Style Stack`. Used to temporarily modify attributes requiring precision with floating point such as rounding value for buttons.
##### Parameters:
* nk_context&ast; - Pointer to `nk_context` structure.
* float&ast; - Pointer to variable whose value is to be changed.
* float - new value to set.
#### int <a id="nk-button-label">nk_button_label</a>(struct nk_context&ast;, const char &ast;title);
##### Info:
Draws a Button with provided label.
##### Parameters:
* nk_context&ast; - Pointer to `nk_context` struct.
* &ast;title - Pointer to string literal (Label to put on button).
##### Return type: int
* Returns true of Button is clicked.
* Returns false of Button is in 'unclicked' state.
#### int <a id="nk-style-pop-float">nk_style_pop_float</a>(struct nk_context&ast;);
##### Info:
Pops the float values modified off the `Style Stack`. Which means, returns them to original state as they were before being modified by [nk_style_push_float](#nk-style-push-float).
##### Paramaters:
* nk_context&ast; - Pointer to `nk_context` struct.
##### Return type: int
* Returns true if successful.
* Returns false if unsuccessful.
#### int <a id="nk-group-begin">nk_group_begin</a>(struct nk_context &ast;ctx, const char &ast;title, nk_flags flags);
##### Info:
Makes a group with given flags. Looks just like a window created by [nk_begin](#nk-begin) but can be created inside a window.
##### Parameters:
* &ast;ctx - pointer to `nk_context` struct.
* &ast;title - string literal (Title of the group).
* flags - All the required flags among available flags in `nk_flags`.
##### Return Type: int
* Returns false if creation unsuccessful.
* Returns true if creation successful.
#### void <a id="nk-group-end">nk_group_end</a>(struct nk_context &ast;ctx);
##### Info:
Marks the end of the group created by [nk_group_begin](#nk-group-begin).
##### Parameters:
* &ast;ctx - pointer to `nk_context` struct.
##### Return type: void
#### void <a id="nk-layout-row">nk_layout_row</a>(struct nk_context&ast;, enum nk_layout_format, float height, int cols, const float &ast;ratio);
##### Info:
Used to create custom row layout in which widget placement (including spacing) is done using ratios in floating point. Maximum ratio allowed is one. So, if there are two widgets (say buttons) need to placed in 50% available area each. Then `ratio` will be {0.5f, 0.5f}.
##### Parameters:
* nk_context&ast; - pointer to `nk_context` struct.
* nk_layout_format - format from available formats in `enum nk_layout_format` like `NK_STATIC` , `NK_DYNAMIC`.
* height - height of the layout.
* cols - Number of widgets(including spaces) to be used.
* &ast;ratio - Ratio for widget placement.
##### Return type: void
#### void <a id="nk-spacing">nk_spacing</a>(struct nk_context&ast;, int cols);
##### Info:
Used to create spacing (blank) of specified columns.
##### Parameters:
* nk_context&ast; - pointer to `nk_context` struct.
* cols - Number of columns for which spacing has to be true.
##### Return type: void
#### int <a id="nk-checkbox-label">nk_checkbox_label</a>(struct nk_context &ast;ctx, const char &ast;label, int &ast;active);
##### Info:
Creates a checkbox with specified label.
##### Parameters:
* &ast;ctx - Pointer to `nk_context` struct.
* &ast; - Pointer to string literal(Label of checkbox).
* &ast; - Pointer to variable to store the active value. `nk_false` if unchecked, `nk_true` if checked.
##### Return type: int
* Returns false if unable to draw widget or old value of `*active` = new value of `*active`.
* Returns true of old value of `*active` != new value of `*active`.
#### int <a id="nk-option-label">nk_option_label</a>(struct nk_context &ast;ctx, const char &ast;label, int active);
##### Info:
Draws radio button (among radio group) with specified label.
##### Parameters:
* &ast;ctx - pointer to `nk_context` struct.
* &ast;label - Pointer to string literal (label of radio button).
* active - Any check to specify if the radio button is active.
##### Return type: int
* Returns true if radio button is active.
* Returns false if radio button is inactive.
#### int <a id="nk-selectable-label">nk_selectable_label</a>(struct nk_context&ast;, const char&ast;, nk_flags align, int &ast;value);
##### Info:
Draws a selectable label. (Just like a regular [nk_label](#nk-label) but with a difference that it can be selected)
##### Parameters:
* nk_context&ast; - pointer to `nk_context` struct.
* char&ast; - Pointer to string literal (Label to display on GUI).
* align - required alignment flags from `nk_flags` like `NK_TEXT_LEFT`.
* &ast;value - Pointer to integer variable to store the value if the label is triggered or not.
* Sets to `nk_true` if label selected.
* Sets to `nk_false` if label is in unselected state.
##### Return type: int
* Returns false if unable to draw widget or old value of `*value` = new value of `*value`.
* Returns true of old value of `*value` != new value of `*value`.
#### int <a id="nk-combo">nk_combo</a>(struct nk_context&ast;, const char &ast;&ast;items, int count, int selected, int item_height, struct nk_vec2 size);
##### Info:
Draws combobox with given items as array of strings.
##### Parameters:
* nk_context&ast; - Pointer to `nk_context` structure.
* &ast;&ast;items - Array of strings of items to populate the list of combobox.
* count - Number of items in the combobox.
* selected - variable to store the index of selected item.
* item_height - Height to allocate to each item in combobox.
* size - size of combobox after expansion(when dropdown arrow is clicked). Given as [nk_vec2](#nk-vec2)(x, y).
##### Return type: int
* Returns the index of selected item.
#### void <a id="nk-label">nk_label</a>(struct nk_context &ast;ctx, const char &ast;str, nk_flags alignment);
##### Info:
Draws a plain text on Nuklear Window, Popup or group.
##### Parameters:
* &ast;ctx - pointer to `nk_context` structure.
* &ast;str - Pointer to string literal (Text to draw).
* alignment - required flags for text alignment from `nk_flags`, like `NK_TEXT_LEFT`.
##### Return type: void
#### int <a id="nk-progress">nk_progress</a>(struct nk_context &ast;ctx, nk_size &ast;cur, nk_size max, int is_modifyable);
##### Info:
Draws a progress bar.
##### Parameters:
* &ast;ctx - Poitner to `nk_context` struct.
* &ast;cur - Realtime value to update in progress bar.
* max - Maximum value `*cur` can achieve (usually 100, for 100% progress).
* is_modifyable -
* `nk_true` if progress bar can be modified with other events like mouse click and drag.
* `nk_false` if progress bar needs to be modified only by value of `*cur`
##### Return type: int
* Returns false if unable to draw widget or old value of `*cur` = new value of `*cur`.
* Returns true of old value of `*cur` != new value of `*cur`.
### About Nuklear Specific Structures/Variables
#### <a id="nk-context">nk_context</a>
##### Info:
Contains various Variables/attributes related to current Window.
#### <a id="nk-vec2">nk_vec2</a>
##### Info:
A simple structure containing 2 variables `x` and `y`. Used for various purposes where 2 variables are required for example.. using offset for position or size of any widget/window.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

@@ -1,18 +0,0 @@
#ifndef NK_IMPLEMENTATION
#include "nuklear_lib/nuklear.h"
#endif // !NK_IMPLEMENTATION
#include "activity.h"
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))
{
nk_layout_row_dynamic(ctx, 40, 1);
for (i = 0; i < main_settings->activity_string_count; i++)
nk_label_wrap(ctx, main_settings->activity_string[i]);
}
nk_end(ctx);
return !nk_window_is_closed(ctx, "Activity");
}

View File

@@ -1,8 +0,0 @@
#ifndef ACTIVITY_H
#define ACTIVITY_H
#include "ccextractorGUI.h"
int activity(struct nk_context *ctx, int x, int y, int width, int height, struct main_tab *main_settings);
#endif

View File

@@ -1,902 +0,0 @@
/* nuklear - v1.32.0 - public domain */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include <math.h>
#include <limits.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
#define NK_INCLUDE_FIXED_TYPES
#define NK_INCLUDE_STANDARD_IO
#define NK_INCLUDE_STANDARD_VARARGS
#define NK_INCLUDE_DEFAULT_ALLOCATOR
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
#define NK_INCLUDE_FONT_BAKING
#define NK_INCLUDE_DEFAULT_FONT
#define NK_IMPLEMENTATION
#define NK_GLFW_GL2_IMPLEMENTATION
#include "nuklear_lib/nuklear.h"
#include "nuklear_lib/nuklear_glfw_gl2.h"
#include "icon_data.c"
//#define WINDOW_WIDTH 1200
//#define WINDOW_HEIGHT 800
//#define true 1
//#define false 0
//#define UNUSED(a) (void)a
//#define MIN(a,b) ((a) < (b) ? (a) : (b))
//#define MAX(a,b) ((a) < (b) ? (b) : (a))
//#define LEN(a) (sizeof(a)/sizeof(a)[0])
#include "ccextractorGUI.h"
#include "tabs.h"
#include "activity.h"
#include "terminal.c"
#include "preview.h"
#include "popups.h"
#include "command_builder.h"
#include "ccx_cli_thread.h"
#include "file_browser.h"
#include "save_load_data.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
static struct main_tab main_settings;
/*Trigger command for CLI*/
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;
const GLint WIDTH_termANDPreviewPanel = 400, HEIGHT_termANDPreviewPanel = 650;
const GLint WIDTH_activityPanel = 400, HEIGHT_activityPanelSolo = 550, HEIGHT_activityPanelDuo = 650;
const GLint WIDTH_mainTermORPreviewWindow = 530, HEIGHT_mainORPreviewTermWindow = 650;
const GLint WIDTH_mainTermANDPreviewWindow = 930, HEIGHT_mainTermAndPreviewWindow = 650;
const GLint WIDTH_mainActivityWindow = 930, HEIGHT_mainActivityWindowSolo = 550, HEIGHT_mainActivityWindowDuo = 650;
/*Tab constants*/
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)
{
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 *));
else
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][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]);
main_settings.filename_count++;
}
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)
//{
// struct nk_command_buffer *canvas;
// struct nk_input *input = &ctx->input;
// canvas = nk_window_get_canvas(ctx);
//
// struct nk_rect space;
// enum nk_widget_layout_states state;
// state = nk_widget(&space, ctx);
// if (!state) return;
//
// /*if (state != NK_WIDGET_ROM)
// update_your_widget_by_user_input(...);*/
// nk_fill_rect(canvas, space, 5, nk_rgb(88, 81, 96));
// if (!strcmp(filePath[0], "\0")) {
// space.y = space.y + (space.h / 2) -10;
// space.x = space.x + 90;
// nk_draw_text(canvas, space, "Drag and Drop files here for Extraction.", 40, &font->handle, nk_rgb(88, 81, 96), nk_rgb(0, 0, 0));
// }
// else {
// for (int i = 0; i < fileCount; i++)
// {
// nk_draw_text(canvas, space, filePath[i], strlen(filePath[i]), &font->handle, nk_rgb(88, 81, 96), nk_rgb(0, 0, 0));
// space.y = space.y + 20;
// }
// }
//
// }
/*Rectangle to hold extraction info*/
// void draw_info_rectangle_widget(struct nk_context *ctx, struct nk_font *font)
//{
// struct nk_command_buffer *canvas;
// struct nk_input *input = &ctx->input;
// canvas = nk_window_get_canvas(ctx);
//
// struct nk_rect space;
// enum nk_widget_layout_states state;
// state = nk_widget(&space, ctx);
// if (!state) return;
//
// /*if (state != NK_WIDGET_ROM)
// update_your_widget_by_user_input(...);*/
// nk_fill_rect(canvas, space, 5, nk_rgb(88, 81, 96));
// space.x = space.x + 3;
// nk_draw_text(canvas, space, "Input Type: Auto", 16, &font->handle, nk_rgb(88, 81, 96), nk_rgb(0, 0, 0));
// space.y = space.y + 20;
// nk_draw_text(canvas, space, "Output Type: Default(.srt)", 26, &font->handle, nk_rgb(88, 81, 96), nk_rgb(0, 0, 0));
// space.y = space.y + 20;
// nk_draw_text(canvas, space, "Output Path: Default", 20, &font->handle, nk_rgb(88, 81, 96), nk_rgb(0, 0, 0));
// space.y = space.y + 20;
// nk_draw_text(canvas, space, "Hardsubs Extraction: Yes", 24, &font->handle, nk_rgb(88, 81, 96), nk_rgb(0, 0, 0));
// }
int main(void)
{
// Platform
static GLFWwindow *win;
struct nk_context *ctx;
int screenWidth, screenHeight;
// int winWidth, winHeight;
// GLFW
glfwSetErrorCallback(error_callback);
if (!glfwInit())
{
fprintf(stdout, "GLFW failed to initialise.\n");
}
win = glfwCreateWindow(WIDTH_mainPanelAndWindow, HEIGHT_mainPanelandWindow, "CCExtractor", NULL, NULL);
if (win == NULL)
printf("Window Could not be created!\n");
glfwMakeContextCurrent(win);
glfwSetWindowSizeLimits(win, WIDTH_mainPanelAndWindow, HEIGHT_mainPanelandWindow, WIDTH_mainPanelAndWindow, HEIGHT_mainPanelandWindow);
glfwSetWindowUserPointer(win, &ctx);
glfwSetDropCallback(win, drop_callback);
if (glewInit() != GLEW_OK)
{
fprintf(stderr, "Failed to setup GLEW\n");
exit(1);
}
// GUI
struct file_browser browser;
static const struct file_browser reset_browser;
struct media media;
ctx = nk_glfw3_init(win, NK_GLFW3_INSTALL_CALLBACKS);
struct nk_font_atlas *font_atlas;
nk_glfw3_font_stash_begin(&font_atlas);
struct nk_font *droid = nk_font_atlas_add_from_memory(font_atlas, roboto_regular_font, sizeof(roboto_regular_font), 16, 0);
struct nk_font *droid_big = nk_font_atlas_add_from_memory(font_atlas, roboto_regular_font, sizeof(roboto_regular_font), 25, 0);
struct nk_font *droid_head = nk_font_atlas_add_from_memory(font_atlas, roboto_regular_font, sizeof(roboto_regular_font), 20, 0);
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;
static int show_activity_check = nk_false;
static int advanced_mode_check = nk_false;
static int file_extension_check = nk_true;
/*Settings and tab options*/
setup_main_settings(&main_settings);
static struct network_popup network_settings;
setup_network_settings(&network_settings);
static struct output_tab output;
setup_output_tab(&output);
static struct decoders_tab decoders;
setup_decoders_tab(&decoders);
static struct credits_tab credits;
setup_credits_tab(&credits);
static struct input_tab input;
setup_input_tab(&input);
static struct advanced_input_tab advanced_input;
setup_advanced_input_tab(&advanced_input);
static struct debug_tab debug;
setup_debug_tab(&debug);
static struct hd_homerun_tab hd_homerun;
setup_hd_homerun_tab(&hd_homerun);
static struct burned_subs_tab burned_subs;
setup_burned_subs_tab(&burned_subs);
static struct built_string command;
/* icons */
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
media.icons.drives = icon_load(drive_icon_data, sizeof(drive_icon_data));
#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));
media.icons.music_file = icon_load(music_icon_data, sizeof(music_icon_data));
media.icons.font_file = icon_load(font_icon_data, sizeof(font_icon_data));
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);
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);
}
/*Main GUI loop*/
while (nk_true)
{
if (glfwWindowShouldClose(win))
{
FILE *saveFile;
saveFile = fopen("ccxGUI.ini", "w");
save_data(saveFile, &main_settings, &input, &advanced_input, &output, &decoders, &credits, &debug, &hd_homerun, &burned_subs, &network_settings);
fclose(saveFile);
break;
}
// Input
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))
{
// 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)))
{
nk_layout_row_dynamic(ctx, 30, 1);
if (nk_menu_item_label(ctx, "Reset Defaults", NK_TEXT_LEFT))
{
remove("ccxGUI.ini");
setup_main_settings(&main_settings);
setup_network_settings(&network_settings);
setup_output_tab(&output);
setup_decoders_tab(&decoders);
setup_credits_tab(&credits);
setup_input_tab(&input);
setup_advanced_input_tab(&advanced_input);
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)))
{
nk_layout_row_dynamic(ctx, 30, 1);
nk_checkbox_label(ctx, "Activity", &show_activity_check);
nk_checkbox_label(ctx, "Terminal", &show_terminal_check);
nk_checkbox_label(ctx, "Preview", &show_preview_check);
nk_menu_end(ctx);
}
nk_layout_row_push(ctx, 45);
if (nk_menu_begin_label(ctx, "Help", NK_TEXT_LEFT, nk_vec2(120, 200)))
{
nk_layout_row_dynamic(ctx, 30, 1);
if (nk_menu_item_label(ctx, "Getting Started", NK_TEXT_LEFT))
show_getting_started = nk_true;
if (nk_menu_item_label(ctx, "About CCExtractor", NK_TEXT_LEFT))
show_about_ccx = nk_true;
nk_menu_end(ctx);
}
// Network Settings
if (network_settings.show_network_settings)
draw_network_popup(ctx, &network_settings);
// About CCExtractor Popup
if (show_about_ccx)
draw_about_ccx_popup(ctx, &show_about_ccx, &droid_big->handle, &droid_head->handle);
// Getting Started
if (show_getting_started)
draw_getting_started_popup(ctx, &show_getting_started);
// Color Popup
if (output.color_popup)
draw_color_popup(ctx, &output);
// 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);
file_browser_run(&browser, ctx, &main_settings, &output, &debug, &hd_homerun);
}
// 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)
draw_thread_popup(ctx, &hd_homerun.threadPopup);
nk_layout_row_end(ctx);
nk_menubar_end(ctx);
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"};
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)
{
/*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)
{
/*Active tab gets highlighted*/
struct nk_style_item button_color = ctx->style.button.normal;
ctx->style.button.normal = ctx->style.button.active;
current_tab = nk_button_label(ctx, names[i]) ? i : current_tab;
ctx->style.button.normal = button_color;
}
else
current_tab = nk_button_label(ctx, names[i]) ? i : current_tab;
}
nk_style_pop_float(ctx);
/*Body*/
nk_layout_row_dynamic(ctx, tab_screen_height, 1);
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;
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 OUTPUT:
draw_output_tab(ctx, &tab_screen_height, &output, &main_settings);
break;
case DECODERS:
draw_decoders_tab(ctx, &tab_screen_height, &decoders);
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 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;
}
nk_group_end(ctx);
}
else
nk_style_pop_vec2(ctx);
}
// ADVANCED MODE FLAG
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};
// 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))
{
// op = FILES;
main_settings.port_or_files = FILES;
}
// CHECKBOX FOR FILE TYPES
static int add_remove_button = nk_false;
nk_layout_row(ctx, NK_DYNAMIC, 20, 5, check_extension_ratio);
nk_spacing(ctx, 1);
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"))
{
main_settings.is_file_browser_active = nk_true;
main_settings.scaleWindowForFileBrowser = nk_true;
}
for (int i = 0; i < main_settings.filename_count; i++)
{
if (main_settings.is_file_selected[i])
{
add_remove_button = nk_true;
break;
}
else
add_remove_button = nk_false;
}
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);
main_settings.is_file_selected[i] = nk_false;
}
}
}
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};
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 (main_settings.filename_count != 0)
{
int i = 0;
nk_layout_row_static(ctx, 18, 380, 1);
for (i = 0; i < main_settings.filename_count; ++i)
nk_selectable_label(ctx, truncate_path_string(main_settings.filenames[i]), NK_TEXT_LEFT, &main_settings.is_file_selected[i]);
}
else
{
nk_layout_row_dynamic(ctx, 1, 1);
nk_spacing(ctx, 1);
nk_layout_row_dynamic(ctx, 25, 1);
nk_label(ctx, "Drag and Drop files for extraction.", NK_TEXT_CENTERED);
nk_layout_row_dynamic(ctx, 25, 1);
nk_label(ctx, "OR", NK_TEXT_CENTERED);
nk_layout_row_dynamic(ctx, 25, 3);
nk_spacing(ctx, 1);
if (nk_button_label(ctx, "Browse Files"))
{
main_settings.is_file_browser_active = nk_true;
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};
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))
{
// 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));
nk_label(ctx, " stream, on port:", NK_TEXT_LEFT);
// RADDIO BUTTON 2, TEXTEDIT FOR ENTERING PORT NUMBER
static int len;
static char buffer[10];
nk_edit_string(ctx, NK_EDIT_SIMPLE, main_settings.port_num, &main_settings.port_num_len, 8, nk_filter_decimal);
nk_layout_space_begin(ctx, NK_STATIC, 10, 1);
nk_layout_space_end(ctx);
// Extraction Information
nk_layout_row_dynamic(ctx, 10, 1);
nk_text(ctx, "Extraction Info:", 16, NK_TEXT_CENTERED);
// RECTANGLE-INFO
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))
{
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_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};
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)
{
nk_layout_row_dynamic(ctx, 20, 3);
nk_spacing(ctx, 1);
if (nk_button_label(ctx, "Progress Details"))
{
show_progress_details = nk_true;
}
nk_spacing(ctx, 1);
}
// PROGRESS_DETAILS_POPUP
if (show_progress_details)
draw_progress_details_popup(ctx, &show_progress_details, &main_settings);
// 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)
{
if (screenWidth != 930 || screenHeight != 650)
{
glfwSetWindowSize(win, 930, 550);
glfwSetWindowSizeLimits(win, 930, 650, 930, 650);
}
preview(ctx, 530, 0, 400, 550, &main_settings);
terminal(ctx, 0, 550, 530, 100, &command.term_string);
activity(ctx, 530, 550, 400, 100, &main_settings);
}
if (show_activity_check && show_preview_check && !show_terminal_check)
{
if (screenWidth != 930 || screenHeight != 650)
{
glfwSetWindowSize(win, 930, 650);
glfwSetWindowSizeLimits(win, 930, 650, 930, 650);
}
preview(ctx, 530, 0, 400, 650, &main_settings);
activity(ctx, 0, 550, 530, 100, &main_settings);
}
if (show_activity_check && !show_preview_check && show_terminal_check)
{
if (screenWidth != 930 || screenHeight != 650)
{
glfwSetWindowSize(win, 930, 650);
glfwSetWindowSizeLimits(win, 930, 650, 930, 650);
}
activity(ctx, 530, 0, 400, 650, &main_settings);
terminal(ctx, 0, 550, 530, 100, &command.term_string);
}
if (show_terminal_check && show_preview_check && !show_activity_check)
{
if (screenWidth != 930 || screenHeight != 650)
{
glfwSetWindowSize(win, 930, 650);
glfwSetWindowSizeLimits(win, 930, 650, 930, 650);
}
terminal(ctx, 0, 550, 530, 100, &command.term_string);
preview(ctx, 530, 0, 400, 650, &main_settings);
}
if (show_activity_check && !show_preview_check && !show_terminal_check)
{
if (screenWidth != 930 || screenHeight == 650)
{
glfwSetWindowSize(win, 930, 550);
glfwSetWindowSizeLimits(win, 930, 550, 930, 550);
}
activity(ctx, 530, 0, 400, 550, &main_settings);
}
if (show_terminal_check && !show_activity_check && !show_preview_check)
{
if (screenHeight != 650 || screenWidth == 930)
{
glfwSetWindowSize(win, 530, 650);
glfwSetWindowSizeLimits(win, 530, 650, 530, 650);
}
terminal(ctx, 0, 550, 530, 100, &command.term_string);
}
if (show_preview_check && !show_terminal_check && !show_activity_check)
{
if (screenHeight != 650 || screenWidth == 930)
{
glfwSetWindowSize(win, 930, 550);
glfwSetWindowSizeLimits(win, 930, 550, 930, 550);
}
preview(ctx, 530, 0, 400, 550, &main_settings);
}
if (!show_preview_check && !show_terminal_check && !show_activity_check)
{
glfwSetWindowSize(win, WIDTH_mainPanelAndWindow, HEIGHT_mainPanelandWindow);
glfwSetWindowSizeLimits(win, WIDTH_mainPanelAndWindow, HEIGHT_mainPanelandWindow,
WIDTH_mainPanelAndWindow, HEIGHT_mainPanelandWindow);
}
}
else
{
glfwSetWindowSize(win, 930, 650);
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
* with blending, scissor, face culling and depth test and defaults everything
* back into a default state. Make sure to either save and restore or
* reset your own state after drawing rendering the UI. */
nk_glfw3_render(NK_ANTI_ALIASING_ON);
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);
#ifdef _WIN32
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);
file_browser_free(&browser);
// free(main_settings.filenames);
nk_glfw3_shutdown();
glfwTerminate();
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[0] = "UDP";
main_settings->port_type[1] = "TCP";
main_settings->port_select = 0;
main_settings->is_file_browser_active = nk_false;
main_settings->scaleWindowForFileBrowser = nk_false;
main_settings->preview_string_count = 0;
main_settings->activity_string_count = 0;
main_settings->threadPopup = nk_false;
}
char *truncate_path_string(char *filePath)
{
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)
{
#ifdef _WIN32
ptr_slash = strrchr(file_path, '\\');
#else
ptr_slash = strrchr(file_path, '/');
#endif
slash_length = strlen(ptr_slash);
if (slash_length >= NAME_LENGTH)
{
fileNameTruncated_index = NAME_LENGTH - 1;
for (z = 0; z < 6; z++)
{
fileNameTruncated[fileNameTruncated_index] = ptr_slash[slash_length];
fileNameTruncated_index--;
slash_length--;
}
for (z = 0; z < 4; z++)
{
fileNameTruncated[fileNameTruncated_index] = '.';
fileNameTruncated_index--;
}
strncpy(fileNameTruncated, ptr_slash, 47);
strncpy(file_name, file_path, 7);
file_name[7] = '.';
file_name[8] = '.';
file_name[9] = '.';
file_name[10] = '\0';
file_name[11] = '\0';
file_name[12] = '\0';
strcat(file_name, fileNameTruncated);
strcpy(file_path, file_name);
}
else
{
copycount = PATH_LENGTH - 1;
prefix_length = copycount - slash_length - 3;
strncpy(file_name, file_path, prefix_length);
while (slash_length >= 0)
{
file_name[copycount] = ptr_slash[slash_length];
copycount--;
slash_length--;
}
for (j = 0; j < 3; j++, copycount--)
file_name[copycount] = '.';
file_name[65] = '\0';
strcpy(file_path, file_name);
}
return file_path;
}
else
return filePath;
}
void remove_path_entry(struct main_tab *main_settings, int indexToRemove)
{
// printf("Beginning processing. Array is currently: ");
// for (int i = 0; i < arraySize; ++i)
// 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
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;
}
struct nk_image
icon_load(char icon_data[], int len)
{
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");
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);
}
char *concat(char *string1, char *string2)
{
static char prefix[300], suffix[300];
strcpy(prefix, string1);
strcpy(suffix, string2);
return strcat(prefix, suffix);
}

View File

@@ -1,35 +0,0 @@
#ifndef CCEXTRACTORGUI_H
#define CCEXTRACTORGUI_H
#ifndef NK_IMPLEMENTATION
#include "nuklear_lib/nuklear.h"
#endif // !NK_IMPLEMENTATION
struct main_tab
{
enum {PORT, FILES} port_or_files;
char port_num[8];
int port_num_len;
int is_check_common_extension;
char **port_type;
int port_select;
char **filenames;
int filename_count;
int is_file_selected[1000];
int is_file_browser_active;
int scaleWindowForFileBrowser;
nk_size progress_cursor;
char** activity_string;
int activity_string_count;
char** preview_string;
int preview_string_count;
int threadPopup;
};
void setup_main_settings(struct main_tab *main_settings);
char* truncate_path_string(char *filePath);
void remove_path_entry(struct main_tab *main_settings, int indexToRemove);
char* concat(char* string1, char *string2);
#endif //!CCEXTRACTORGUI_H

View File

@@ -1,374 +0,0 @@
#include "ccx_cli_thread.h"
#include "ccextractorGUI.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define MAX_WAIT 10
#define PROGRESS_COMPLETE 100
void *extract_thread(void *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, " ");
strcat(term_string, params->file_string);
strcat(term_string, " 1>>ccx.log 2>>gui_report.log");
printf("%s", term_string);
system(term_string);
pthread_exit(0);
}
void *read_activity_data(void *read_args)
{
puts("Inside activity thread!");
char line[500];
char buffer[500];
#if UNIX
struct timespec time;
time.tv_sec = 0;
time.tv_nsec = 10000000L;
#endif
int wait = 0;
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)
{
printf("Cannot open ccx.log, trying again.\n");
file = fopen("ccx.log", "r");
#if UNIX
nanosleep(&time, NULL);
#else
_sleep(10);
#endif
wait++;
if (wait == MAX_WAIT)
{
read_params->main_threadsettings->threadPopup = nk_true;
return 0;
}
}
while (!feof(file))
{
if (fgets(current_input, sizeof(current_input), file) == NULL)
continue;
if (concat_index == 0)
{
strcpy(line, current_input);
}
else
{
strcat(line, current_input);
}
concat_index++;
if (current_input[strlen(current_input) - 1] != '\n')
continue;
sscanf(line, "%[^\n]", buffer);
if (read_params->main_threadsettings->activity_string_count == 0)
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 *));
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)
{
pthread_t tid_activity;
pthread_attr_t attr_activity;
static char buffer[500];
char t_start[6], t_end[6], subtitle1[100], subtitle2[100];
#if UNIX
struct timespec time;
time.tv_sec = 0;
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;
FILE *file;
char prev_line[500];
char line[500];
char current_input[500];
int concat_index = 0;
char sub_line[500];
char prog_line[500];
int subs_success1, subs_success2, progress_success;
/*Setup activity thread*/
pthread_attr_init(&attr_activity);
int err = pthread_create(&tid_activity, &attr_activity, read_activity_data, read_params);
if (!err)
puts("Activity Thread created");
file = fopen("gui_report.log", "r");
while (file == NULL)
{
printf("Cannot open gui_report.log, trying again.\n");
file = fopen("gui_report.log", "r");
#if UNIX
nanosleep(&time, NULL);
#else
_sleep(10);
#endif
wait++;
if (wait >= MAX_WAIT)
{
read_params->main_threadsettings->threadPopup = nk_true;
return 0;
}
}
while (1)
{
if (fgets(current_input, sizeof(current_input), file) == NULL)
continue;
if (concat_index == 0)
{
strcpy(line, current_input);
}
else
{
strcat(line, current_input);
}
concat_index++;
if (current_input[strlen(current_input) - 1] != '\n')
continue;
progress_success = sscanf(line, "###PROGRESS#%d#%d#%d", &progress_count, &unknown1, &unknown2);
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)
{
sprintf(buffer, "%s-%s: %s", t_start, t_end, subtitle1);
if (read_params->main_threadsettings->preview_string_count == 0)
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 *));
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)
{
sprintf(buffer, " %s", subtitle2);
if (read_params->main_threadsettings->preview_string_count == 0)
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 *));
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)
break;
memset(line, 0, sizeof(line));
concat_index = 0;
}
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]);
pthread_exit(0);
}
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;
int count = extract_params->main_threadsettings->filename_count;
pthread_t tid_extract, tid_read;
pthread_attr_t attr_extract, attr_read;
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);
int err2 = pthread_create(&tid_read, &attr_read, read_data_from_thread, extract_params);
if (!err1)
printf("Extraction Thread Complete:%d\n", i);
if (!err2)
printf("Read Thread Complete:%d\n", i);
pthread_join(tid_extract, NULL);
printf("Extract thread joined\n");
pthread_join(tid_read, NULL);
printf("Read thread joined\n");
extract_params->main_threadsettings->is_file_selected[i] = nk_false;
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;
pthread_attr_init(&attr_launch);
int err = pthread_create(&tid_launch, &attr_launch, feed_files_for_extraction, &extract_args);
if (!err)
printf("Feeder created!\n");
}
/*THREAD FUNCTIONS FOR HD_HOMERUN*/
void *find_hd_homerun_devices(void *args)
{
char command[300];
extract_args.homerun_thread = (struct hd_homerun_tab *)args;
int wait = 0;
FILE *file;
char line[200];
int device_success;
char device[200];
#if UNIX
struct timespec time;
time.tv_sec = 0;
time.tv_nsec = 10000000L;
#endif
#if HD_HOMERUN
strcpy(command, "hdhomerun_config");
#else
strncpy(command, extract_args.homerun_thread->location, extract_args.homerun_thread->location_len);
#endif
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");
#if UNIX
nanosleep(&time, NULL);
#else
_sleep(10);
#endif
wait++;
if (wait >= MAX_WAIT)
{
extract_args.homerun_thread->threadPopup = nk_true;
return 0;
}
}
while (1)
{
fgets(line, sizeof(line), file);
device_success = sscanf(line, "hdhomerun device %[^\n]", device);
if (feof(file))
break;
if (device_success == 1)
{
if (extract_args.homerun_thread->device_num == 0)
{
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->devices[extract_args.homerun_thread->device_num] = strdup(device);
extract_args.homerun_thread->device_num++;
}
}
}
printf("Find device thread finished\n");
}
void *setup_hd_homerun_device(void *args)
{
char device[20];
extract_args.homerun_thread = (struct hd_homerun_tab *)args;
char channel_command[300];
char program_command[300];
char target_command[300];
sscanf(extract_args.homerun_thread->devices[extract_args.homerun_thread->selected], "%s", device);
#if HD_HOMERUN
strcpy(channel_command, "hdhomerun_config");
strcpy(program_command, "hdhomerun_config");
strcpy(target_command, "hdhomerun_config");
#else
strncpy(channel_command, extract_args.homerun_thread->location, extract_args.homerun_thread->location_len);
strncpy(program_command, extract_args.homerun_thread->location, extract_args.homerun_thread->location_len);
strncpy(target_command, extract_args.homerun_thread->location, extract_args.homerun_thread->location_len);
#endif
strcat(channel_command, " ");
strcat(program_command, " ");
strcat(target_command, " ");
strcat(channel_command, device);
strcat(program_command, device);
strcat(target_command, device);
strcat(channel_command, " set /tuner");
strcat(program_command, " set /tuner");
strcat(target_command, " set /tuner");
strncat(channel_command, extract_args.homerun_thread->tuner, extract_args.homerun_thread->tuner_len);
strncat(program_command, extract_args.homerun_thread->tuner, extract_args.homerun_thread->tuner_len);
strncat(target_command, extract_args.homerun_thread->tuner, extract_args.homerun_thread->tuner_len);
strcat(channel_command, "/channel ");
strcat(program_command, "/program ");
strcat(target_command, "/target ");
strncat(channel_command, extract_args.homerun_thread->channel, extract_args.homerun_thread->channel_len);
strncat(program_command, extract_args.homerun_thread->program, extract_args.homerun_thread->program_len);
strncat(target_command, extract_args.homerun_thread->ipv4_address, extract_args.homerun_thread->ipv4_address_len);
system(channel_command);
system(program_command);
system(target_command);
pthread_exit(0);
}

View File

@@ -1,40 +0,0 @@
#ifndef CCX_CLI_THREAD_H
#define CCX_CLI_THREAD_H
#define HAVE_STRUCT_TIMESPEC
#include "ccextractorGUI.h"
#include "popups.h"
#include "tabs.h"
#include "command_builder.h"
#include "pthread.h"
struct args_extract {
struct main_tab *main_threadsettings;
struct built_string *threadcommand;
struct hd_homerun_tab *homerun_thread;
char *file_string;
char *command_string;
};
static struct args_extract extract_args;
//FOR EXTRACT BUTTON TRIGGER ---- MAIN_TAB
pthread_t tid_launch;
pthread_attr_t attr_launch;
//FOR FIND DEVICES BUTTON TRIGGER ----- HD_HOMERUN_TAB
pthread_t tid_find;
pthread_attr_t attr_find;
//FOR SETUP DEVICE BUTTON TRIGGER ------ HD_HOMERUN_TAB
pthread_t tid_setup;
pthread_attr_t attr_setup;
void* read_activity_data(void *read_args);
void* read_data_from_thread(void* read_args);
void* extract_thread(void* extract_args);
void* feed_files_for_extraction(void* file_args);
void setup_and_create_thread(struct main_tab *main_settings, struct built_string *command);
void* find_hd_homerun_devices(void *args);
void* setup_hd_homerun_device(void *args);
#endif //!CCX_CLI_THREAD_H

View File

@@ -1,504 +0,0 @@
#ifndef NK_IMPLEMENTATION
#include "nuklear_lib/nuklear.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#endif //! NK_IMPLEMENTATION
#include "ccextractorGUI.h"
#include "tabs.h"
#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)
{
static char buffer[1000];
#ifdef _WIN32
strcpy(buffer, "ccextractorwin --gui_mode_reports");
#else
strcpy(buffer, "./ccextractor --gui_mode_reports");
#endif
/*INPUT COMMANDS*/
if (main_settings->port_or_files == FILES)
{
if (input->type_select != 0)
{
strcat(buffer, " -in=");
strcat(buffer, input->type[input->type_select]);
}
if (input->is_split)
strcat(buffer, " --videoedited");
if (input->is_process_from)
{
strcat(buffer, " -startat ");
strcat(buffer, input->from_time_buffer);
}
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);
}
if (input->is_assume_mpeg)
{
strcat(buffer, " -streamtype ");
strncat(buffer, input->mpeg_type, input->mpeg_type_len);
}
if (decoders->teletext_dvb == TELETEXT)
{
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)
{
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->clock_input)
{
case AUTO:
break;
case GOP:
strcat(buffer, " --goptime");
break;
case PTS:
strcat(buffer, " --nogoptime");
break;
}
}
/*Main tab and network settings*/
if (main_settings->port_or_files == PORT)
{
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;
}
if (input->is_live_stream)
{
strcat(buffer, " -s ");
strncat(buffer, input->wait_data_sec, input->wait_data_sec_len);
}
if (input->is_process_from)
{
strcat(buffer, " -startat ");
strcat(buffer, input->from_time_buffer);
}
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);
}
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");
}
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->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)
{
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;
}
}
switch (advanced_input->set_myth)
{
case AUTO_MYTH:
break;
case FORCE_MYTH:
strcat(buffer, " -myth");
break;
case DISABLE_MYTH:
strcat(buffer, " -nomyth");
break;
}
if (advanced_input->is_mpeg_90090)
strcat(buffer, " -90090");
if (advanced_input->is_padding_0000)
strcat(buffer, " -fp");
if (advanced_input->is_order_ccinfo)
strcat(buffer, " -poc");
if (advanced_input->is_win_bug)
strcat(buffer, " -wtvconvertfix");
if (advanced_input->is_hauppage_file)
strcat(buffer, " -haup");
if (advanced_input->is_process_mp4)
strcat(buffer, " -mp4vidtrack");
if (advanced_input->is_ignore_broadcast)
strcat(buffer, " -noautotimeref");
/*DECODERS TAB*/
if (decoders->is_field2)
strcat(buffer, " -12");
switch (decoders->channel)
{
case CHANNEL_1:
break;
case CHANNEL_2:
strcat(buffer, " -cc2");
break;
}
if (decoders->is_708)
{
strcat(buffer, " -svc ");
strncat(buffer, decoders->services, decoders->services_len);
}
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 DVB:
strcat(buffer, " -codec dvdsub");
break;
}
/*CREDITS TAB*/
if (credits->is_start_text)
{
strcat(buffer, " --startcreditstext \"");
strncat(buffer, credits->start_text, credits->start_text_len);
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)
{
strcat(buffer, " --startcreditsnotbefore ");
strcat(buffer, credits->before_time_buffer);
}
if (credits->is_after)
{
strcat(buffer, " --startcreditsnotafter ");
strcat(buffer, credits->after_time_buffer);
}
}
if (credits->is_end_text)
{
strcat(buffer, " --endcreditstext \"");
strncat(buffer, credits->end_text, credits->end_text_len);
strcat(buffer, "\" --endcreditsforatleast ");
strncat(buffer, credits->end_atleast_sec, credits->end_atleast_sec_len);
strcat(buffer, " --endcreditsforatmost ");
strncat(buffer, credits->end_atmost_sec, credits->end_atmost_sec_len);
}
/*DEBUG TAB*/
if (debug->is_elementary_stream)
{
strcat(buffer, " -cf ");
strncat(buffer, debug->elementary_stream, debug->elementary_stream_len);
}
if (debug->is_dump_packets)
strcat(buffer, " -debug");
if (debug->is_debug_608)
strcat(buffer, " -608");
if (debug->is_debug_708)
strcat(buffer, " -708");
if (debug->is_stamp_output)
strcat(buffer, " -goppts");
if (debug->is_debug_analysed_vid)
strcat(buffer, " -vides");
if (debug->is_raw_608_708)
strcat(buffer, " -cbraw");
if (debug->is_debug_parsed)
strcat(buffer, " -parsedebug");
if (!strcmp(output->type[output->type_select], "bin"))
{
if (debug->is_disable_sync)
strcat(buffer, " -nosync");
if (debug->is_no_padding)
strcat(buffer, " -fullbin");
}
if (debug->is_debug_xds)
strcat(buffer, " -xdsdebug");
if (debug->is_output_pat)
strcat(buffer, " -parsePAT");
if (debug->is_output_pmt)
strcat(buffer, " -parsePMT");
if (debug->is_scan_ccdata)
strcat(buffer, " -investigate_packets");
if (debug->is_output_levenshtein)
strcat(buffer, " -deblev");
/*HARD_BURNED SUBS SETTINGS*/
if (burned_subs->is_burned_subs)
{
strcat(buffer, " -hardsubx -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;
}
strcat(buffer, " -min_sub_duration ");
strcat(buffer, burned_subs->min_duration);
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)
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, "\"");
}
if (output->is_delay)
{
strcat(buffer, " -delay ");
strcat(buffer, output->delay_sec_buffer);
}
if (output->is_export_xds)
strcat(buffer, " -xds");
switch (output->encoding)
{
case LATIN:
strcat(buffer, " -latin1");
break;
case UNIC:
strcat(buffer, " -unicode");
break;
case UTF:
strcat(buffer, " -utf8");
break;
}
if (output->is_bom)
strcat(buffer, " -bom");
else
strcat(buffer, " -nobom");
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, "\"");
}
switch (output->line_ending)
{
case CRLF:
break;
case LF:
strcat(buffer, " -lf");
break;
}
if (output->is_center)
strcat(buffer, " -trim");
if (output->is_dash)
strcat(buffer, " -autodash");
if (output->no_typesetting)
strcat(buffer, " --notypesetting");
switch (output->font_color)
{
case NO_COLOR:
strcat(buffer, " --nofontcolor");
break;
case DEFAULT_COLOR:
strcat(buffer, " --defaultcolor #");
strcat(buffer, output->color_hex);
break;
}
switch (output->onetime_or_realtime)
{
case ONETIME:
strcat(buffer, " --norollup");
break;
case REALTIME:
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;
}
}
}
memset(command->term_string, 0, sizeof(command->term_string));
strncpy(command->term_string, buffer, strlen(buffer));
}

View File

@@ -1,24 +0,0 @@
#ifndef COMMAND_BUILDER_H
#define COMMAND_BUILDER_H
#include "ccextractorGUI.h"
#include "tabs.h"
#include "popups.h"
struct built_string
{
char term_string[1000];
};
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);
#endif //!COMMAND_BUILDER_H

View File

@@ -1,598 +0,0 @@
#include "file_browser.h"
#ifdef _WIN32
#include "win_dirent.h"
#else
#include <dirent.h>
#endif
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <stdarg.h>
#ifndef STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#endif
#if UNIX
#include <unistd.h>
#endif
#include <GL/glew.h>
#include <string.h>
#ifndef NK_IMPLEMENTATION
#include "nuklear_lib/nuklear.h"
#endif
#include "ccextractorGUI.h"
#include "tabs.h"
void die(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
fputs("\n", stderr);
exit(EXIT_FAILURE);
}
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);
fseek(fd, 0, SEEK_END);
*siz = (size_t)ftell(fd);
fseek(fd, 0, SEEK_SET);
buf = (char *)calloc(*siz, 1);
fread(buf, *siz, 1, fd);
fclose(fd);
return buf;
}
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;
memcpy(ret, src, len);
ret[len] = '\0';
return ret;
}
void dir_free_list(char **list, size_t size)
{
size_t i;
for (i = 0; i < size; ++i)
free(list[i]);
free(list);
}
char **
dir_list(const char *dir, int return_subdirs, size_t *count)
{
size_t n = 0;
char buffer[MAX_PATH_LEN];
char **results = NULL;
const DIR *none = NULL;
size_t capacity = 32;
size_t size;
DIR *z;
assert(dir);
assert(count);
strncpy(buffer, dir, MAX_PATH_LEN);
n = strlen(buffer);
#ifdef _WIN32
if (n > 0 && (buffer[n - 1] != '\\'))
buffer[n++] = '\\';
#else
if (n > 0 && (buffer[n - 1] != '/'))
buffer[n++] = '/';
#endif
size = 0;
z = opendir(dir);
if (z != none)
{
int nonempty = 1;
struct dirent *data = readdir(z);
nonempty = (data != NULL);
if (!nonempty)
return NULL;
do
{
DIR *y;
char *p;
int is_subdir;
if (data->d_name[0] == '.')
continue;
strncpy(buffer + n, data->d_name, MAX_PATH_LEN - n);
y = opendir(buffer);
is_subdir = (y != NULL);
if (y != NULL)
closedir(y);
if ((return_subdirs && is_subdir) || (!is_subdir && !return_subdirs))
{
if (!size)
{
results = (char **)calloc(sizeof(char *), capacity);
}
else if (size >= capacity)
{
void *old = results;
capacity = capacity * 2;
results = (char **)realloc(results, capacity * sizeof(char *));
assert(results);
if (!results)
free(old);
}
p = str_duplicate(data->d_name);
results[size++] = p;
}
} while ((data = readdir(z)) != NULL);
}
if (z)
closedir(z);
*count = size;
return results;
}
struct file_group
FILE_GROUP(enum file_groups group, const char *name, struct nk_image *icon)
{
struct file_group fg;
fg.group = group;
fg.name = name;
fg.icon = icon;
return fg;
}
struct file
FILE_DEF(enum file_types type, const char *suffix, enum file_groups group)
{
struct file fd;
fd.type = type;
fd.suffix = suffix;
fd.group = group;
return fd;
}
struct nk_image *
media_icon_for_file(struct media *media, const char *file)
{
int i = 0;
const char *s = file;
char suffix[4];
int found = 0;
memset(suffix, 0, sizeof(suffix));
/* extract suffix .xxx from file */
while (*s++ != '\0')
{
if (found && i < 3)
suffix[i++] = *s;
if (*s == '.')
{
if (found)
{
found = 0;
break;
}
found = 1;
}
}
/* check for all file definition of all groups for fitting suffix*/
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++;
}
/* found correct file definition so */
if (f && *s == '\0' && *f == '\0')
return media->group[d->group].icon;
}
}
return &media->icons.default_file;
}
void media_init(struct media *media)
{
/* file groups */
struct icons *icons = &media->icons;
media->group[FILE_GROUP_DEFAULT] = FILE_GROUP(FILE_GROUP_DEFAULT, "default", &icons->default_file);
media->group[FILE_GROUP_TEXT] = FILE_GROUP(FILE_GROUP_TEXT, "textual", &icons->text_file);
media->group[FILE_GROUP_MUSIC] = FILE_GROUP(FILE_GROUP_MUSIC, "music", &icons->music_file);
media->group[FILE_GROUP_FONT] = FILE_GROUP(FILE_GROUP_FONT, "font", &icons->font_file);
media->group[FILE_GROUP_IMAGE] = FILE_GROUP(FILE_GROUP_IMAGE, "image", &icons->img_file);
media->group[FILE_GROUP_MOVIE] = FILE_GROUP(FILE_GROUP_MOVIE, "movie", &icons->movie_file);
/* files */
media->files[FILE_DEFAULT] = FILE_DEF(FILE_DEFAULT, NULL, FILE_GROUP_DEFAULT);
media->files[FILE_TEXT] = FILE_DEF(FILE_TEXT, "txt", FILE_GROUP_TEXT);
media->files[FILE_C_SOURCE] = FILE_DEF(FILE_C_SOURCE, "c", FILE_GROUP_TEXT);
media->files[FILE_CPP_SOURCE] = FILE_DEF(FILE_CPP_SOURCE, "cpp", FILE_GROUP_TEXT);
media->files[FILE_HEADER] = FILE_DEF(FILE_HEADER, "h", FILE_GROUP_TEXT);
media->files[FILE_CPP_HEADER] = FILE_DEF(FILE_HEADER, "hpp", FILE_GROUP_TEXT);
media->files[FILE_MP3] = FILE_DEF(FILE_MP3, "mp3", FILE_GROUP_MUSIC);
media->files[FILE_WAV] = FILE_DEF(FILE_WAV, "wav", FILE_GROUP_MUSIC);
media->files[FILE_OGG] = FILE_DEF(FILE_OGG, "ogg", FILE_GROUP_MUSIC);
media->files[FILE_TTF] = FILE_DEF(FILE_TTF, "ttf", FILE_GROUP_FONT);
media->files[FILE_BMP] = FILE_DEF(FILE_BMP, "bmp", FILE_GROUP_IMAGE);
media->files[FILE_PNG] = FILE_DEF(FILE_PNG, "png", FILE_GROUP_IMAGE);
media->files[FILE_JPEG] = FILE_DEF(FILE_JPEG, "jpg", FILE_GROUP_IMAGE);
media->files[FILE_PCX] = FILE_DEF(FILE_PCX, "pcx", FILE_GROUP_IMAGE);
media->files[FILE_TGA] = FILE_DEF(FILE_TGA, "tga", FILE_GROUP_IMAGE);
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)
{
strncpy(browser->directory, path, MAX_PATH_LEN);
dir_free_list(browser->files, browser->file_count);
dir_free_list(browser->directories, browser->dir_count);
browser->files = dir_list(path, 0, &browser->file_count);
browser->directories = dir_list(path, 1, &browser->dir_count);
}
#ifdef _WIN32
void get_drives(struct file_browser *browser)
{
static int drive_num;
static char drive_list[50][4];
int c, prev_char;
system("wmic logicaldisk get name 1> drive.txt");
FILE *file;
file = fopen("drive.txt", "r");
if (file == NULL)
{
printf("cannot find any drives! try again with different settings/permissions");
}
else
{
puts("File opened");
while ((c = getc(file)) != EOF)
{
if (c == ':')
{
sprintf(drive_list[drive_num], "%c", prev_char);
drive_num++;
continue;
}
if (c < 65 || c > 90)
continue;
prev_char = c;
}
}
printf("drive nums:%d\n", drive_num);
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 *));
for (int i = 0; i < drive_num; i++)
{
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++)
puts(browser->drives[i]);
fclose(file);
remove("drive.txt");
}
#endif
void file_browser_init(struct file_browser *browser, struct media *media)
{
memset(browser, 0, sizeof(*browser));
browser->media = media;
#ifdef _WIN32
get_drives(browser);
#endif
{
/* load files and sub-directory list */
const char *home = getenv("HOME");
#ifdef _WIN32
if (!home)
home = getenv("USERPROFILE");
#else
if (!home)
home = getpwuid(getuid());
#endif
{
size_t l;
strncpy(browser->home, home, MAX_PATH_LEN);
l = strlen(browser->home);
#ifdef _WIN32
strcpy(browser->home + l, "\\");
#else
strcpy(browser->home + l, "/");
#endif
strcpy(browser->directory, browser->home);
}
{
size_t l;
strcpy(browser->desktop, browser->home);
l = strlen(browser->desktop);
#ifdef _WIN32
strcpy(browser->desktop + l, "Desktop\\");
#else
strcpy(browser->desktop + l, "Desktop/");
#endif
}
browser->files = dir_list(browser->directory, 0, &browser->file_count);
browser->directories = dir_list(browser->directory, 1, &browser->dir_count);
}
}
void file_browser_free(struct file_browser *browser)
{
if (browser->files)
dir_free_list(browser->files, browser->file_count);
if (browser->directories)
dir_free_list(browser->directories, browser->dir_count);
browser->files = NULL;
browser->directories = NULL;
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)
{
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)))
{
static float ratio[] = {0.25f, NK_UNDEFINED};
float spacing_x = ctx->style.window.spacing.x;
/* output path directory selector in the menubar */
ctx->style.window.spacing.x = 0;
nk_menubar_begin(ctx);
{
char *d = browser->directory;
char *begin = d + 1;
nk_layout_row_dynamic(ctx, 25, 6);
while (*d++)
{
#ifdef _WIN32
if (*d == '\\')
#else
if (*d == '/')
#endif
{
*d = '\0';
if (nk_button_label(ctx, begin))
{
#ifdef _WIN32
*d++ = '\\';
#else
*d++ = '/';
#endif
*d = '\0';
file_browser_reload_directory_content(browser, browser->directory);
break;
}
#ifdef _WIN32
*d = '\\';
#else
*d = '/';
#endif
begin = d + 1;
}
}
}
nk_menubar_end(ctx);
ctx->style.window.spacing.x = spacing_x;
/* window layout */
total_space = nk_window_get_content_region(ctx);
nk_layout_row(ctx, NK_DYNAMIC, total_space.h, 2, ratio);
nk_group_begin(ctx, "Special", NK_WINDOW_NO_SCROLLBAR);
{
struct nk_image home = media->icons.home;
struct nk_image desktop = media->icons.desktop;
struct nk_image computer = media->icons.computer;
#ifdef _WIN32
struct nk_image drive = media->icons.drives;
#endif
nk_layout_row_dynamic(ctx, 40, 1);
if (nk_button_image_label(ctx, home, "Home", NK_TEXT_CENTERED))
file_browser_reload_directory_content(browser, browser->home);
if (nk_button_image_label(ctx, desktop, "Desktop", NK_TEXT_CENTERED))
file_browser_reload_directory_content(browser, browser->desktop);
#ifdef _WIN32
for (int drive_counter = 0; drive_counter < browser->drives_num; drive_counter++)
{
if (nk_button_image_label(ctx, drive, browser->drives[drive_counter], NK_TEXT_CENTERED))
file_browser_reload_directory_content(browser, browser->drives[drive_counter]);
}
#else
if (nk_button_image_label(ctx, computer, "Computer", NK_TEXT_CENTERED))
file_browser_reload_directory_content(browser, "/");
#endif
nk_group_end(ctx);
}
/* output directory content window */
nk_group_begin(ctx, "Content", 0);
{
int index = -1;
size_t i = 0, j = 0, k = 0;
size_t rows = 0, cols = 0;
size_t count = browser->dir_count + browser->file_count;
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;
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 *));
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);
}
else
{
size_t t = k - browser->dir_count;
nk_label(ctx, browser->files[t], NK_TEXT_CENTERED);
}
}
}
}
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)
{
#ifdef _WIN32
browser->directory[n] = '\\';
#else
browser->directory[n] = '/';
#endif
browser->directory[n + 1] = '\0';
}
file_browser_reload_directory_content(browser, browser->directory);
}
nk_group_end(ctx);
}
if (isFileAdded)
{
isFileAdded = nk_false;
main_settings->scaleWindowForFileBrowser = nk_false;
nk_popup_close(ctx);
}
nk_popup_end(ctx);
return ret;
}
else
{
main_settings->scaleWindowForFileBrowser = nk_false;
return 0;
}
}

View File

@@ -1,159 +0,0 @@
#ifndef FILE_BROWSER_H
#define FILE_BROWSER_H
#include "ccextractorGUI.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#ifndef STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#endif
#include "tabs.h"
/* ===============================================================
*
* GUI
*
* ===============================================================*/
struct icons {
struct nk_image desktop;
#ifdef _WIN32
struct nk_image drives;
#endif
struct nk_image home;
struct nk_image computer;
struct nk_image directory;
struct nk_image default_file;
struct nk_image text_file;
struct nk_image music_file;
struct nk_image font_file;
struct nk_image img_file;
struct nk_image movie_file;
};
enum file_groups {
FILE_GROUP_DEFAULT,
FILE_GROUP_TEXT,
FILE_GROUP_MUSIC,
FILE_GROUP_FONT,
FILE_GROUP_IMAGE,
FILE_GROUP_MOVIE,
FILE_GROUP_MAX
};
enum file_types {
FILE_DEFAULT,
FILE_TEXT,
FILE_C_SOURCE,
FILE_CPP_SOURCE,
FILE_HEADER,
FILE_CPP_HEADER,
FILE_MP3,
FILE_WAV,
FILE_OGG,
FILE_TTF,
FILE_BMP,
FILE_PNG,
FILE_JPEG,
FILE_PCX,
FILE_TGA,
FILE_GIF,
FILE_MAX
};
struct file_group {
enum file_groups group;
const char *name;
struct nk_image *icon;
};
struct file {
enum file_types type;
const char *suffix;
enum file_groups group;
};
struct media {
int font;
int icon_sheet;
struct icons icons;
struct file_group group[FILE_GROUP_MAX];
struct file files[FILE_MAX];
};
#define MAX_PATH_LEN 512
struct file_browser {
/* path */
char file[MAX_PATH_LEN];
char home[MAX_PATH_LEN];
char desktop[MAX_PATH_LEN];
char directory[MAX_PATH_LEN];
#ifdef _WIN32
char **drives;
int drives_num;
#endif
/* directory content */
char **files;
char **directories;
size_t file_count;
size_t dir_count;
struct media *media;
};
void
die(const char *fmt, ...);
char*
file_load(const char* path, size_t* siz);
char*
str_duplicate(const char *src);
void
dir_free_list(char **list, size_t size);
char**
dir_list(const char *dir, int return_subdirs, size_t *count);
struct file_group
FILE_GROUP(enum file_groups group, const char *name, struct nk_image *icon);
struct file
FILE_DEF(enum file_types type, const char *suffix, enum file_groups group);
struct nk_image*
media_icon_for_file(struct media *media, const char *file);
void
media_init(struct media *media);
void
file_browser_reload_directory_content(struct file_browser *browser, const char *path);
#if _WIN32
void
get_drives(struct file_browser *browser);
#endif
void
file_browser_init(struct file_browser *browser, struct media *media);
void
file_browser_free(struct file_browser *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);
struct nk_image
icon_load(char icon_data[], int len);
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,352 +0,0 @@
/*
* Nuklear - v1.32.0 - public domain
* no warrenty implied; use at your own risk.
* authored from 2015-2017 by Micha Mettke
*/
/*
* ==============================================================
*
* API
*
* ===============================================================
*/
#ifndef NK_GLFW_GL2_H_
#define NK_GLFW_GL2_H_
#include <GLFW/glfw3.h>
enum nk_glfw_init_state{
NK_GLFW3_DEFAULT = 0,
NK_GLFW3_INSTALL_CALLBACKS
};
NK_API struct nk_context* nk_glfw3_init(GLFWwindow *win, enum nk_glfw_init_state);
NK_API void nk_glfw3_font_stash_begin(struct nk_font_atlas **atlas);
NK_API void nk_glfw3_font_stash_end(void);
NK_API void nk_glfw3_new_frame(void);
NK_API void nk_glfw3_render(enum nk_anti_aliasing);
NK_API void nk_glfw3_shutdown(void);
NK_API void nk_glfw3_char_callback(GLFWwindow *win, unsigned int codepoint);
NK_API void nk_gflw3_scroll_callback(GLFWwindow *win, double xoff, double yoff);
#endif
/*
* ==============================================================
*
* IMPLEMENTATION
*
* ===============================================================
*/
#ifdef NK_GLFW_GL2_IMPLEMENTATION
#ifndef NK_GLFW_TEXT_MAX
#define NK_GLFW_TEXT_MAX 256
#endif
struct nk_glfw_device {
struct nk_buffer cmds;
struct nk_draw_null_texture null;
GLuint font_tex;
GLint uniform_tex;
GLint uniform_proj;
};
struct nk_glfw_vertex {
float position[2];
float uv[2];
nk_byte col[4];
};
static struct nk_glfw {
GLFWwindow *win;
int width, height;
int display_width, display_height;
struct nk_glfw_device ogl;
struct nk_context ctx;
struct nk_font_atlas atlas;
struct nk_vec2 fb_scale;
unsigned int text[NK_GLFW_TEXT_MAX];
int text_len;
float scroll;
} glfw;
NK_INTERN void
nk_glfw3_device_upload_atlas(const void *image, int width, int height)
{
struct nk_glfw_device *dev = &glfw.ogl;
glGenTextures(1, &dev->font_tex);
glBindTexture(GL_TEXTURE_2D, dev->font_tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)width, (GLsizei)height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image);
}
NK_API void
nk_glfw3_render(enum nk_anti_aliasing AA)
{
/* setup global state */
struct nk_glfw_device *dev = &glfw.ogl;
glPushAttrib(GL_ENABLE_BIT|GL_COLOR_BUFFER_BIT|GL_TRANSFORM_BIT);
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
glEnable(GL_SCISSOR_TEST);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* setup viewport/project */
glViewport(0,0,(GLsizei)glfw.display_width,(GLsizei)glfw.display_height);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0f, glfw.width, glfw.height, 0.0f, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
{
GLsizei vs = sizeof(struct nk_glfw_vertex);
size_t vp = offsetof(struct nk_glfw_vertex, position);
size_t vt = offsetof(struct nk_glfw_vertex, uv);
size_t vc = offsetof(struct nk_glfw_vertex, col);
/* convert from command queue into draw list and draw to screen */
const struct nk_draw_command *cmd;
const nk_draw_index *offset = NULL;
struct nk_buffer vbuf, ebuf;
/* fill convert configuration */
struct nk_convert_config config;
static const struct nk_draw_vertex_layout_element vertex_layout[] = {
{NK_VERTEX_POSITION, NK_FORMAT_FLOAT, NK_OFFSETOF(struct nk_glfw_vertex, position)},
{NK_VERTEX_TEXCOORD, NK_FORMAT_FLOAT, NK_OFFSETOF(struct nk_glfw_vertex, uv)},
{NK_VERTEX_COLOR, NK_FORMAT_R8G8B8A8, NK_OFFSETOF(struct nk_glfw_vertex, col)},
{NK_VERTEX_LAYOUT_END}
};
NK_MEMSET(&config, 0, sizeof(config));
config.vertex_layout = vertex_layout;
config.vertex_size = sizeof(struct nk_glfw_vertex);
config.vertex_alignment = NK_ALIGNOF(struct nk_glfw_vertex);
config.null = dev->null;
config.circle_segment_count = 22;
config.curve_segment_count = 22;
config.arc_segment_count = 22;
config.global_alpha = 1.0f;
config.shape_AA = AA;
config.line_AA = AA;
/* convert shapes into vertexes */
nk_buffer_init_default(&vbuf);
nk_buffer_init_default(&ebuf);
nk_convert(&glfw.ctx, &dev->cmds, &vbuf, &ebuf, &config);
/* setup vertex buffer pointer */
{const void *vertices = nk_buffer_memory_const(&vbuf);
glVertexPointer(2, GL_FLOAT, vs, (const void*)((const nk_byte*)vertices + vp));
glTexCoordPointer(2, GL_FLOAT, vs, (const void*)((const nk_byte*)vertices + vt));
glColorPointer(4, GL_UNSIGNED_BYTE, vs, (const void*)((const nk_byte*)vertices + vc));}
/* iterate over and execute each draw command */
offset = (const nk_draw_index*)nk_buffer_memory_const(&ebuf);
nk_draw_foreach(cmd, &glfw.ctx, &dev->cmds)
{
if (!cmd->elem_count) continue;
glBindTexture(GL_TEXTURE_2D, (GLuint)cmd->texture.id);
glScissor(
(GLint)(cmd->clip_rect.x * glfw.fb_scale.x),
(GLint)((glfw.height - (GLint)(cmd->clip_rect.y + cmd->clip_rect.h)) * glfw.fb_scale.y),
(GLint)(cmd->clip_rect.w * glfw.fb_scale.x),
(GLint)(cmd->clip_rect.h * glfw.fb_scale.y));
glDrawElements(GL_TRIANGLES, (GLsizei)cmd->elem_count, GL_UNSIGNED_SHORT, offset);
offset += cmd->elem_count;
}
nk_clear(&glfw.ctx);
nk_buffer_free(&vbuf);
nk_buffer_free(&ebuf);
}
/* default OpenGL state */
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glPopAttrib();
}
NK_API void
nk_glfw3_char_callback(GLFWwindow *win, unsigned int codepoint)
{
(void)win;
if (glfw.text_len < NK_GLFW_TEXT_MAX)
glfw.text[glfw.text_len++] = codepoint;
}
NK_API void
nk_gflw3_scroll_callback(GLFWwindow *win, double xoff, double yoff)
{
(void)win; (void)xoff;
glfw.scroll += (float)yoff;
}
NK_INTERN void
nk_glfw3_clipbard_paste(nk_handle usr, struct nk_text_edit *edit)
{
const char *text = glfwGetClipboardString(glfw.win);
if (text) nk_textedit_paste(edit, text, nk_strlen(text));
(void)usr;
}
NK_INTERN void
nk_glfw3_clipbard_copy(nk_handle usr, const char *text, int len)
{
char *str = 0;
(void)usr;
if (!len) return;
str = (char*)malloc((size_t)len+1);
if (!str) return;
memcpy(str, text, (size_t)len);
str[len] = '\0';
glfwSetClipboardString(glfw.win, str);
free(str);
}
NK_API struct nk_context*
nk_glfw3_init(GLFWwindow *win, enum nk_glfw_init_state init_state)
{
glfw.win = win;
if (init_state == NK_GLFW3_INSTALL_CALLBACKS) {
glfwSetScrollCallback(win, nk_gflw3_scroll_callback);
glfwSetCharCallback(win, nk_glfw3_char_callback);
}
nk_init_default(&glfw.ctx, 0);
glfw.ctx.clip.copy = nk_glfw3_clipbard_copy;
glfw.ctx.clip.paste = nk_glfw3_clipbard_paste;
glfw.ctx.clip.userdata = nk_handle_ptr(0);
nk_buffer_init_default(&glfw.ogl.cmds);
return &glfw.ctx;
}
NK_API void
nk_glfw3_font_stash_begin(struct nk_font_atlas **atlas)
{
nk_font_atlas_init_default(&glfw.atlas);
nk_font_atlas_begin(&glfw.atlas);
*atlas = &glfw.atlas;
}
NK_API void
nk_glfw3_font_stash_end(void)
{
const void *image; int w, h;
image = nk_font_atlas_bake(&glfw.atlas, &w, &h, NK_FONT_ATLAS_RGBA32);
nk_glfw3_device_upload_atlas(image, w, h);
nk_font_atlas_end(&glfw.atlas, nk_handle_id((int)glfw.ogl.font_tex), &glfw.ogl.null);
if (glfw.atlas.default_font)
nk_style_set_font(&glfw.ctx, &glfw.atlas.default_font->handle);
}
NK_API void
nk_glfw3_new_frame(void)
{
int i;
double x, y;
struct nk_context *ctx = &glfw.ctx;
struct GLFWwindow *win = glfw.win;
glfwGetWindowSize(win, &glfw.width, &glfw.height);
glfwGetFramebufferSize(win, &glfw.display_width, &glfw.display_height);
glfw.fb_scale.x = (float)glfw.display_width/(float)glfw.width;
glfw.fb_scale.y = (float)glfw.display_height/(float)glfw.height;
nk_input_begin(ctx);
for (i = 0; i < glfw.text_len; ++i)
nk_input_unicode(ctx, glfw.text[i]);
/* optional grabbing behavior */
if (ctx->input.mouse.grab)
glfwSetInputMode(glfw.win, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
else if (ctx->input.mouse.ungrab)
glfwSetInputMode(glfw.win, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
nk_input_key(ctx, NK_KEY_DEL, glfwGetKey(win, GLFW_KEY_DELETE) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_ENTER, glfwGetKey(win, GLFW_KEY_ENTER) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TAB, glfwGetKey(win, GLFW_KEY_TAB) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_BACKSPACE, glfwGetKey(win, GLFW_KEY_BACKSPACE) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_UP, glfwGetKey(win, GLFW_KEY_UP) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_DOWN, glfwGetKey(win, GLFW_KEY_DOWN) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_START, glfwGetKey(win, GLFW_KEY_HOME) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_END, glfwGetKey(win, GLFW_KEY_END) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_SCROLL_START, glfwGetKey(win, GLFW_KEY_HOME) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_SCROLL_END, glfwGetKey(win, GLFW_KEY_END) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_SCROLL_DOWN, glfwGetKey(win, GLFW_KEY_PAGE_DOWN) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_SCROLL_UP, glfwGetKey(win, GLFW_KEY_PAGE_UP) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_SHIFT, glfwGetKey(win, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS||
glfwGetKey(win, GLFW_KEY_RIGHT_SHIFT) == GLFW_PRESS);
if (glfwGetKey(win, GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS ||
glfwGetKey(win, GLFW_KEY_RIGHT_CONTROL) == GLFW_PRESS) {
nk_input_key(ctx, NK_KEY_COPY, glfwGetKey(win, GLFW_KEY_C) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_PASTE, glfwGetKey(win, GLFW_KEY_V) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_CUT, glfwGetKey(win, GLFW_KEY_X) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_UNDO, glfwGetKey(win, GLFW_KEY_Z) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_REDO, glfwGetKey(win, GLFW_KEY_R) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_WORD_LEFT, glfwGetKey(win, GLFW_KEY_LEFT) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_WORD_RIGHT, glfwGetKey(win, GLFW_KEY_RIGHT) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_LINE_START, glfwGetKey(win, GLFW_KEY_B) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_LINE_END, glfwGetKey(win, GLFW_KEY_E) == GLFW_PRESS);
} else {
nk_input_key(ctx, NK_KEY_LEFT, glfwGetKey(win, GLFW_KEY_LEFT) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_RIGHT, glfwGetKey(win, GLFW_KEY_RIGHT) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_COPY, 0);
nk_input_key(ctx, NK_KEY_PASTE, 0);
nk_input_key(ctx, NK_KEY_CUT, 0);
nk_input_key(ctx, NK_KEY_SHIFT, 0);
}
glfwGetCursorPos(win, &x, &y);
nk_input_motion(ctx, (int)x, (int)y);
if (ctx->input.mouse.grabbed) {
glfwSetCursorPos(glfw.win, ctx->input.mouse.prev.x, ctx->input.mouse.prev.y);
ctx->input.mouse.pos.x = ctx->input.mouse.prev.x;
ctx->input.mouse.pos.y = ctx->input.mouse.prev.y;
}
nk_input_button(ctx, NK_BUTTON_LEFT, (int)x, (int)y, glfwGetMouseButton(win, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS);
nk_input_button(ctx, NK_BUTTON_MIDDLE, (int)x, (int)y, glfwGetMouseButton(win, GLFW_MOUSE_BUTTON_MIDDLE) == GLFW_PRESS);
nk_input_button(ctx, NK_BUTTON_RIGHT, (int)x, (int)y, glfwGetMouseButton(win, GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS);
nk_input_scroll(ctx, glfw.scroll);
nk_input_end(&glfw.ctx);
glfw.text_len = 0;
glfw.scroll = 0;
}
NK_API
void nk_glfw3_shutdown(void)
{
struct nk_glfw_device *dev = &glfw.ogl;
nk_font_atlas_clear(&glfw.atlas);
nk_free(&glfw.ctx);
glDeleteTextures(1, &dev->font_tex);
nk_buffer_free(&dev->cmds);
memset(&glfw, 0, sizeof(glfw));
}
#endif

View File

@@ -1,313 +0,0 @@
#ifndef NK_IMPLEMENTATION
#include "nuklear_lib/nuklear.h"
#include <stdio.h>
#include <string.h>
#endif // !NK_IMPLEMENTATION
#include "tabs.h"
#include "popups.h"
void setup_network_settings(struct network_popup *network_settings)
{
network_settings->show_network_settings = nk_false;
network_settings->save_network_settings = nk_false;
strcpy(network_settings->udp_ipv4, "None");
network_settings->udp_ipv4_len = strlen(network_settings->udp_ipv4);
strcpy(network_settings->tcp_pass, "None");
network_settings->tcp_pass_len = strlen(network_settings->tcp_pass);
strcpy(network_settings->tcp_desc, "None");
network_settings->tcp_desc_len = strlen(network_settings->tcp_desc);
strcpy(network_settings->send_port, "None");
network_settings->send_port_len = strlen(network_settings->send_port);
strcpy(network_settings->send_host, "None");
network_settings->send_host_len = strlen(network_settings->send_host);
}
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};
static char udp_ipv4_buffer[30];
static int udp_ipv4_len[30];
static char tcp_pass_buf[30];
static int tcp_pass_len[30];
static char tcp_desc_buf[30];
static int tcp_desc_len[30];
static char send_port_buf[30];
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))
{
nk_layout_row_dynamic(ctx, 220, 1);
if (nk_group_begin(ctx, "Receive", NK_WINDOW_TITLE))
{
nk_layout_row(ctx, NK_DYNAMIC, 21, 3, udp_tcp_ratio);
nk_spacing(ctx, 1);
nk_label(ctx, "UDP:", NK_TEXT_CENTERED);
nk_layout_row_static(ctx, 20, 200, 2);
nk_label(ctx, "Hostname/IPv4 Address:", NK_TEXT_LEFT);
nk_edit_string(ctx, NK_EDIT_SIMPLE, network_settings->udp_ipv4, &network_settings->udp_ipv4_len, 50, nk_filter_default);
nk_layout_row(ctx, NK_DYNAMIC, 21, 3, udp_tcp_ratio);
nk_spacing(ctx, 1);
nk_label(ctx, "TCP:", NK_TEXT_CENTERED);
nk_layout_row_static(ctx, 20, 200, 2);
nk_label(ctx, "Password:", NK_TEXT_LEFT);
nk_edit_string(ctx, NK_EDIT_SIMPLE, network_settings->tcp_pass, &network_settings->tcp_pass_len, 25, nk_filter_default);
nk_layout_row_static(ctx, 20, 200, 2);
nk_label(ctx, "Description:", NK_TEXT_LEFT);
nk_edit_string(ctx, NK_EDIT_SIMPLE, network_settings->tcp_desc, &network_settings->tcp_desc_len, 25, nk_filter_default);
nk_group_end(ctx);
}
nk_layout_row_dynamic(ctx, 200, 1);
if (nk_group_begin(ctx, "Send", NK_WINDOW_TITLE))
{
nk_layout_row(ctx, NK_DYNAMIC, 21, 3, udp_tcp_ratio);
nk_spacing(ctx, 1);
nk_label(ctx, "Send to:", NK_TEXT_CENTERED);
nk_layout_row_static(ctx, 20, 200, 2);
nk_label(ctx, "Port:", NK_TEXT_LEFT);
nk_edit_string(ctx, NK_EDIT_SIMPLE, network_settings->send_port, &network_settings->send_port_len, 25, nk_filter_default);
nk_layout_row_static(ctx, 20, 200, 2);
nk_label(ctx, "Host:", NK_TEXT_LEFT);
nk_edit_string(ctx, NK_EDIT_SIMPLE, network_settings->send_host, &network_settings->send_host_len, 25, nk_filter_default);
nk_group_end(ctx);
}
/*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"))
{
network_settings->save_network_settings = nk_true;
network_settings->show_network_settings = nk_false;
nk_popup_close(ctx);
}
if (nk_button_label(ctx, "OK"))
{
network_settings->save_network_settings = nk_false;
network_settings->show_network_settings = nk_false;
nk_popup_close(ctx);
}
nk_popup_end(ctx);
}
else
network_settings->show_network_settings = nk_false;
}
void draw_getting_started_popup(struct nk_context *ctx, int *show_getting_started)
{
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);
nk_label_wrap(ctx, "Getting Started information about CCX will come here! This popup will be populated at the end.");
nk_popup_end(ctx);
}
else
*show_getting_started = nk_false;
}
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))
{
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_style_pop_font(ctx);
nk_layout_row_dynamic(ctx, 390, 1);
if (nk_group_begin(ctx, "About CCExtractor", NK_WINDOW_BACKGROUND))
{
nk_style_push_font(ctx, droid_head);
nk_layout_row_dynamic(ctx, 23, 1);
nk_label_wrap(ctx, "What's CCExtractor?");
nk_style_pop_font(ctx);
nk_layout_row_dynamic(ctx, 65, 1);
nk_label_wrap(ctx, "A tool that analyzes video files and produces independent subtitle files from the closed captions data. CCExtractor is portable, small, and very fast. It works in Linux, Windows, and OSX.");
nk_style_push_font(ctx, droid_head);
nk_layout_row_dynamic(ctx, 23, 1);
nk_label_wrap(ctx, "What kind of closed captions does CCExtractor support?");
nk_style_pop_font(ctx);
nk_layout_row_dynamic(ctx, 47, 1);
nk_label_wrap(ctx, "American TV captions (CEA-608 is well supported, and CEA-708 is starting to look good) and Teletext based European subtitles.");
nk_style_push_font(ctx, droid_head);
nk_layout_row_dynamic(ctx, 23, 1);
nk_label_wrap(ctx, "How easy is it to use CCExtractor?");
nk_style_pop_font(ctx);
nk_layout_row_dynamic(ctx, 30, 1);
nk_label_wrap(ctx, "Very. Just tell it what file to process and it does everything for you.");
nk_style_push_font(ctx, droid_head);
nk_layout_row_dynamic(ctx, 23, 1);
nk_label_wrap(ctx, "CCExtractor integration with other tools");
nk_style_pop_font(ctx);
nk_layout_row_dynamic(ctx, 147, 1);
nk_label_wrap(ctx, "It is possible to integrate CCExtractor in a larger process. A couple of tools already call CCExtractor as part their video process - this way they get subtitle support for free. Starting in 0.52, CCExtractor is very front - end friendly.Front - ends can easily get real - time status information.The GUI source code is provided and can be used for reference. Any tool, commercial or not, is specifically allowed to use CCExtractor for any use the authors seem fit. So if your favourite video tools still lacks captioning tool, feel free to send the authors here.");
nk_style_push_font(ctx, droid_head);
nk_layout_row_dynamic(ctx, 50, 1);
nk_label_wrap(ctx, "What's the point of generating separate files for subtitles, if they are already in the source file?");
nk_style_pop_font(ctx);
nk_layout_row_dynamic(ctx, 367, 1);
nk_label_wrap(ctx, "There are several reasons to have subtitles separated from the video file, including: - Closed captions never survive MPEG processing. If you take a MPEG file and encode it to any format (such as divx), your result file will not have closed captions. This means that if you want to keep the subtitles, you need to keep the original file. This is hardly practical if you are archiving HDTV shows for example. - Subtitles files are small - so small (around 250 Kb for a movie) that you can quickly download them, or email them, etc, in case you have a recording without subtitles. - Subtitles files are indexable: You can have a database with all your subtitles if you want (there are many available), so you can search the dialogs. - Subtitles files are a de-facto standard: Almost every player can use them. In fact, many setbox players accept subtitles files in .srt format - so you can have subtitles in your divx movies and not just in your original DVDs. - Closed captions are stored in many different formats by capture cards. Upgrading to a new card, if it comes with a new player, may mean that you can't use your previously recorded closed captions, even if the audio/video are fine. - Closed captions require a closed caption decoder. All US TV have one (it's a legal requirement), but no European TV does, since there are not closed captions in Europe (teletext is used instead). Basically this means that if you buy a DVD in the US which has closed captions but no DVD subtitles, you are out of luck. This is a problem with many (most) old TV shows DVDs, which only come with closed captions. DVD producers don't bother doing DVD subs, since it's another way to segment the market, same as with DVD regions. ");
nk_style_push_font(ctx, droid_head);
nk_layout_row_dynamic(ctx, 23, 1);
nk_label_wrap(ctx, "How I do use subtitles once they are in a separate file?");
nk_style_pop_font(ctx);
nk_layout_row_dynamic(ctx, 80, 1);
nk_label_wrap(ctx, "CCExtractor generates files in the two most common formats: .srt (SubRip) and .smi (which is a Microsoft standard). Most players support at least .srt natively. You just need to name the .srt file as the file you want to play it with, for example sample.avi and sample.srt.");
nk_style_push_font(ctx, droid_head);
nk_layout_row_dynamic(ctx, 23, 1);
nk_label_wrap(ctx, "What kind of files can I extract closed captions from?");
nk_style_pop_font(ctx);
nk_layout_row_dynamic(ctx, 20, 1);
nk_label_wrap(ctx, "CCExtractor currently handles:");
nk_layout_row_dynamic(ctx, 20, 1);
nk_label_wrap(ctx, "- DVDs.");
nk_layout_row_dynamic(ctx, 20, 1);
nk_label_wrap(ctx, "- Most HDTV captures(where you save the Transport Stream).");
nk_layout_row_dynamic(ctx, 52, 1);
nk_label_wrap(ctx, "- Captures where captions are recorded in bttv format.The number of cards that use this card is huge.My test samples came from a Hauppage PVR - 250. You can check the complete list here:");
nk_layout_row_dynamic(ctx, 40, 1);
nk_label_colored_wrap(ctx, "http://linuxtv.org/hg/v4l-dvb/file/tip/linux/Documentation/video4linux/CARDLIST.bttv", nk_rgb(61, 117, 206));
nk_layout_row_dynamic(ctx, 20, 1);
nk_label_wrap(ctx, "- DVR - MS(microsoft digital video recording).");
nk_layout_row_dynamic(ctx, 20, 1);
nk_label_wrap(ctx, "- Tivo files");
nk_layout_row_dynamic(ctx, 20, 1);
nk_label_wrap(ctx, "- ReplayTV files");
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_style_push_font(ctx, droid_head);
nk_layout_row_dynamic(ctx, 23, 1);
nk_label_wrap(ctx, "Can I edit the subtitles? ");
nk_style_pop_font(ctx);
nk_layout_row_dynamic(ctx, 43, 1);
nk_label_wrap(ctx, ".srt files are just text files, with time information (when subtitles are supposed to be shown and for how long) and some basic formatting (use italics, bold, etc). So you can edit them with any text editor. If you need to do serious editing (such as adjusting timing), you can use subtitle editing tools - there are many available.");
nk_style_push_font(ctx, droid_head);
nk_layout_row_dynamic(ctx, 23, 1);
nk_label_wrap(ctx, "Can CCExtractor generate other subtitles formats?");
nk_style_pop_font(ctx);
nk_layout_row_dynamic(ctx, 23, 1);
nk_label_wrap(ctx, "At this time, CCExtractor can generate .srt, .smi and raw and bin files.");
nk_style_push_font(ctx, droid_head);
nk_layout_row_dynamic(ctx, 23, 1);
nk_label_wrap(ctx, "How I can contact the author?");
nk_style_pop_font(ctx);
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"))
{
*show_about_ccx = nk_false;
nk_popup_close(ctx);
}
nk_popup_end(ctx);
}
else
*show_about_ccx = nk_false;
}
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};
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++)
nk_label_wrap(ctx, main_settings->activity_string[i]);
nk_popup_end(ctx);
}
else
*show_progress_details = nk_false;
}
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))
{
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"))
{
show_color_from_picker = nk_true;
output->color_popup = nk_false;
nk_popup_close(ctx);
}
nk_spacing(ctx, 1);
nk_popup_end(ctx);
}
else
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};
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "File Read Error",
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"))
{
*show_thread_popup = nk_false;
nk_popup_close(ctx);
}
nk_popup_end(ctx);
}
else
*show_thread_popup = nk_false;
}

View File

@@ -1,31 +0,0 @@
#ifndef POPUPS_H
#define POPUPS_H
#include "tabs.h"
struct network_popup
{
int show_network_settings;
int save_network_settings;
char udp_ipv4[30];
int udp_ipv4_len;
char tcp_pass[30];
int tcp_pass_len;
char tcp_desc[30];
int tcp_desc_len;
char send_port[30];
int send_port_len;
char send_host[30];
int send_host_len;
};
void draw_network_popup(struct nk_context *ctx, struct network_popup *network_settings);
void draw_getting_started_popup(struct nk_context *ctx, int *show_getting_started);
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);
void draw_progress_details_popup(struct nk_context *ctx, int *show_progress_details, struct main_tab *main_settings);
void draw_color_popup(struct nk_context *ctx, struct output_tab *output);
void draw_thread_popup(struct nk_context *ctx, int *show_thread_popup);
void setup_network_settings(struct network_popup *network_settings);
#endif //!POPUPS_H

View File

@@ -1,19 +0,0 @@
#ifndef NK_IMPLEMENTATION
#include "nuklear_lib/nuklear.h"
#endif // !NK_IMPLEMENTATION
#include <stdio.h>
#include "preview.h"
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))
{
nk_layout_row_dynamic(ctx, 20, 1);
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");
}

View File

@@ -1,8 +0,0 @@
#ifndef PREVIEW_H
#define PREVIEW_H
#include "ccextractorGUI.h"
int preview(struct nk_context *ctx, int x, int y, int width, int height, struct main_tab *main_settings);
#endif //!PREVIEW_H

View File

@@ -1,561 +0,0 @@
#include "save_load_data.h"
#include "ccextractorGUI.h"
#include "tabs.h"
#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)
{
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)
fscanf(file, "port_num:%[^\n]\n", main_settings->port_num);
else
fscanf(file, "%[^\n]\n", null_char);
fscanf(file, "is_check_common_extension:%d\n", &main_settings->is_check_common_extension);
fscanf(file, "port_select:%d\n", &main_settings->port_select);
// Read input_tab data
fscanf(file, "type_select:%d\n", &input->type_select);
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)
fscanf(file, "wait_data_sec:%[^\n]\n", input->wait_data_sec);
else
fscanf(file, "%[^\n]\n", null_char);
fscanf(file, "is_process_from:%d\n", &input->is_process_from);
fscanf(file, "is_process_until:%d\n", &input->is_process_until);
fscanf(file, "from_time_buffer:%[^\n]\n", input->from_time_buffer);
fscanf(file, "until_time_buffer:%[^\n]\n", input->until_time_buffer);
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)
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)
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)
fscanf(file, "mpeg_type:%[^\n]\n", input->mpeg_type);
else
fscanf(file, "%[^\n]\n", null_char);
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)
fscanf(file, "teletext_page_number:%[^\n]\n", input->teletext_page_number);
else
fscanf(file, "%[^\n]\n", null_char);
fscanf(file, "is_limit:%d\n", &input->is_limit);
fscanf(file, "screenful_limit_buffer:%[^\n]\n", input->screenful_limit_buffer);
fscanf(file, "clock_input:%d\n", &input->clock_input);
// Read advanced_input_tab data
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)
fscanf(file, "prog_number:%[^\n]\n", advanced_input->prog_number);
else
fscanf(file, "%[^\n]\n", null_char);
fscanf(file, "set_myth:%d\n", &advanced_input->set_myth);
fscanf(file, "is_mpeg_90090:%d\n", &advanced_input->is_mpeg_90090);
fscanf(file, "is_padding_0000:%d\n", &advanced_input->is_padding_0000);
fscanf(file, "is_order_ccinfo:%d\n", &advanced_input->is_order_ccinfo);
fscanf(file, "is_win_bug:%d\n", &advanced_input->is_win_bug);
fscanf(file, "is_hauppage_file:%d\n", &advanced_input->is_hauppage_file);
fscanf(file, "is_process_mp4:%d\n", &advanced_input->is_process_mp4);
fscanf(file, "is_ignore_broadcast:%d\n", &advanced_input->is_ignore_broadcast);
// Read output_tab data
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)
fscanf(file, "filename:%[^\n]\n", output->filename);
else
fscanf(file, "%[^\n]\n", null_char);
fscanf(file, "is_delay:%d\n", &output->is_delay);
fscanf(file, "delay_sec_buffer:%[^\n]\n", output->delay_sec_buffer);
fscanf(file, "is_export_xds:%d\n", &output->is_export_xds);
fscanf(file, "encoding:%d\n", &output->encoding);
fscanf(file, "is_bom:%d\n", &output->is_bom);
fscanf(file, "is_cap_standard:%d\n", &output->is_cap_standard);
fscanf(file, "is_cap_file:%d\n", &output->is_cap_file);
fscanf(file, "cap_dictionary_len:%d\n", &output->cap_dictionary_len);
if (output->cap_dictionary_len > 0)
fscanf(file, "cap_dictionary:%[^\n]\n", output->cap_dictionary);
else
fscanf(file, "%[^\n]\n", null_char);
fscanf(file, "line_ending:%d\n", &output->line_ending);
fscanf(file, "is_center:%d\n", &output->is_center);
fscanf(file, "is_dash:%d\n", &output->is_dash);
fscanf(file, "no_typesetting:%d\n", &output->no_typesetting);
fscanf(file, "font_color:%d\n", &output->font_color);
fscanf(file, "color_hex:%[^\n]\n", output->color_hex);
fscanf(file, "color_rgb_r:%d\n", &r);
fscanf(file, "color_rgb_g:%d\n", &g);
fscanf(file, "color_rgb_b:%d\n", &b);
output->color_rgb.r = (nk_byte)r;
output->color_rgb.g = (nk_byte)g;
output->color_rgb.b = (nk_byte)b;
fscanf(file, "onetime_or_realtime:%d\n", &output->onetime_or_realtime);
fscanf(file, "roll_limit_select:%d\n", &output->roll_limit_select);
// Read decoders_tab data
fscanf(file, "is_field1:%d\n", &decoders->is_field1);
fscanf(file, "is_field2:%d\n", &decoders->is_field2);
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)
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)
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)
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);
fscanf(file, "is_before:%d\n", &credits->is_before);
fscanf(file, "is_after:%d\n", &credits->is_after);
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)
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)
fscanf(file, "start_atleast_sec:%[^\n]\n", credits->start_atleast_sec);
else
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)
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)
fscanf(file, "end_atleast_sec:%[^\n]\n", credits->end_atleast_sec);
else
fscanf(file, "%[^\n]\n", null_char);
fscanf(file, "start_text_len:%d\n", &credits->start_text_len);
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)
fscanf(file, "elementary_stream:%[^\n]\n", debug->elementary_stream);
else
fscanf(file, "%[^\n]\n", null_char);
fscanf(file, "is_dump_packets:%d\n", &debug->is_dump_packets);
fscanf(file, "is_debug_608:%d\n", &debug->is_debug_608);
fscanf(file, "is_debug_708:%d\n", &debug->is_debug_708);
fscanf(file, "is_stamp_output:%d\n", &debug->is_stamp_output);
fscanf(file, "is_debug_analysed_vid:%d\n", &debug->is_debug_analysed_vid);
fscanf(file, "is_raw_608_708:%d\n", &debug->is_raw_608_708);
fscanf(file, "is_debug_parsed:%d\n", &debug->is_debug_parsed);
fscanf(file, "is_disable_sync:%d\n", &debug->is_disable_sync);
fscanf(file, "is_no_padding:%d\n", &debug->is_no_padding);
fscanf(file, "is_debug_xds:%d\n", &debug->is_debug_xds);
fscanf(file, "is_output_pat:%d\n", &debug->is_output_pat);
fscanf(file, "is_output_pmt:%d\n", &debug->is_output_pmt);
fscanf(file, "is_scan_ccdata:%d\n", &debug->is_scan_ccdata);
fscanf(file, "is_output_levenshtein:%d\n", &debug->is_output_levenshtein);
// Read HD Homerun Tab data
fscanf(file, "location_len:%d\n", &hd_homerun->location_len);
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)
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)
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)
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)
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)
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)
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)
fscanf(file, "min_duration:%[^\n]\n", burned_subs->min_duration);
else
fscanf(file, "%[^\n]\n", null_char);
fscanf(file, "luminance_threshold:%d\n", &burned_subs->luminance_threshold);
fscanf(file, "confidence_threshold:%d\n", &burned_subs->confidence_threshold);
fscanf(file, "is_italic:%d\n", &burned_subs->is_italic);
// Read Network Settings data
fscanf(file, "udp_ipv4_len:%d\n", &network_settings->udp_ipv4_len);
if (network_settings->udp_ipv4_len > 0)
fscanf(file, "udp_ipv4:%[^\n]\n", network_settings->udp_ipv4);
else
fscanf(file, "udp_ipv4:%[^\n]\n", null_char);
fscanf(file, "tcp_pass_len:%d\n", &network_settings->tcp_pass_len);
if (network_settings->tcp_pass_len > 0)
fscanf(file, "tcp_pass:%[^\n]\n", network_settings->tcp_pass);
else
fscanf(file, "tcp_pass:%[^\n]\n", null_char);
fscanf(file, "tcp_desc_len:%d\n", &network_settings->tcp_desc_len);
if (network_settings->tcp_desc_len > 0)
fscanf(file, "tcp_desc:%[^\n]\n", network_settings->tcp_desc);
else
fscanf(file, "tcp_desc:%[^\n]\n", null_char);
fscanf(file, "send_port_len:%d\n", &network_settings->send_port_len);
if (network_settings->send_port_len > 0)
fscanf(file, "send_port:%[^\n]\n", network_settings->send_port);
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)
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)
{
// Write main_tab data
fprintf(file, "port_or_files:%d\n", main_settings->port_or_files);
fprintf(file, "port_num_len:%d\n", main_settings->port_num_len);
fprintf(file, "port_num:%s\n", main_settings->port_num);
fprintf(file, "is_check_common_extension:%d\n", main_settings->is_check_common_extension);
fprintf(file, "port_select:%d\n", main_settings->port_select);
// Write input_tab data
fprintf(file, "type_select:%d\n", input->type_select);
fprintf(file, "is_split:%d\n", input->is_split);
fprintf(file, "is_live_stream:%d\n", input->is_live_stream);
fprintf(file, "wait_data_sec_len:%d\n", input->wait_data_sec_len);
fprintf(file, "wait_data_sec:%s\n", input->wait_data_sec);
fprintf(file, "is_process_from:%d\n", input->is_process_from);
fprintf(file, "is_process_until:%d\n", input->is_process_until);
fprintf(file, "from_time_buffer:%s\n", input->from_time_buffer);
fprintf(file, "until_time_buffer:%s\n", input->until_time_buffer);
fprintf(file, "elementary_stream:%d\n", input->elementary_stream);
fprintf(file, "is_assume_mpeg:%d\n", input->is_assume_mpeg);
fprintf(file, "stream_type_len:%d\n", input->stream_type_len);
fprintf(file, "stream_type:%s\n", input->stream_type);
fprintf(file, "stream_pid_len:%d\n", input->stream_pid_len);
fprintf(file, "stream_pid:%s\n", input->stream_pid);
fprintf(file, "mpeg_type_len:%d\n", input->mpeg_type_len);
fprintf(file, "mpeg_type:%s\n", input->mpeg_type);
fprintf(file, "teletext_decoder:%d\n", input->teletext_decoder);
fprintf(file, "is_process_teletext_page:%d\n", input->is_process_teletext_page);
fprintf(file, "teletext_page_number_len:%d\n", input->teletext_page_numer_len);
fprintf(file, "teletext_page_number:%s\n", input->teletext_page_number);
fprintf(file, "is_limit:%d\n", input->is_limit);
fprintf(file, "screenful_limit_buffer:%s\n", input->screenful_limit_buffer);
fprintf(file, "clock_input:%d\n", input->clock_input);
// Write advanced_input_tab data
fprintf(file, "is_multiple_program:%d\n", advanced_input->is_multiple_program);
fprintf(file, "multiple_program:%d\n", advanced_input->multiple_program);
fprintf(file, "prog_number_len:%d\n", advanced_input->prog_number_len);
fprintf(file, "prog_number:%s\n", advanced_input->prog_number);
fprintf(file, "set_myth:%d\n", advanced_input->set_myth);
fprintf(file, "is_mpeg_90090:%d\n", advanced_input->is_mpeg_90090);
fprintf(file, "is_padding_0000:%d\n", advanced_input->is_padding_0000);
fprintf(file, "is_order_ccinfo:%d\n", advanced_input->is_order_ccinfo);
fprintf(file, "is_win_bug:%d\n", advanced_input->is_win_bug);
fprintf(file, "is_hauppage_file:%d\n", advanced_input->is_hauppage_file);
fprintf(file, "is_process_mp4:%d\n", advanced_input->is_process_mp4);
fprintf(file, "is_ignore_broadcast:%d\n", advanced_input->is_ignore_broadcast);
// Write output_tab data
fprintf(file, "type_select:%d\n", output->type_select);
fprintf(file, "is_filename:%d\n", output->is_filename);
fprintf(file, "filename_len:%d\n", output->filename_len);
fprintf(file, "filename:%s\n", output->filename);
fprintf(file, "is_delay:%d\n", output->is_delay);
fprintf(file, "delay_sec_buffer:%s\n", output->delay_sec_buffer);
fprintf(file, "is_export_xds:%d\n", output->is_export_xds);
fprintf(file, "encoding:%d\n", output->encoding);
fprintf(file, "is_bom:%d\n", output->is_bom);
fprintf(file, "is_cap_standard:%d\n", output->is_cap_standard);
fprintf(file, "is_cap_file:%d\n", output->is_cap_file);
fprintf(file, "cap_dictionary_len:%d\n", output->cap_dictionary_len);
fprintf(file, "cap_dictionary:%s\n", output->cap_dictionary);
fprintf(file, "line_ending:%d\n", output->line_ending);
fprintf(file, "is_center:%d\n", output->is_center);
fprintf(file, "is_dash:%d\n", output->is_dash);
fprintf(file, "no_typesetting:%d\n", output->no_typesetting);
fprintf(file, "font_color:%d\n", output->font_color);
fprintf(file, "color_hex:%s\n", output->color_hex);
fprintf(file, "color_rgb_r:%d\n", output->color_rgb.r);
fprintf(file, "color_rgb_g:%d\n", output->color_rgb.g);
fprintf(file, "color_rgb_b:%d\n", output->color_rgb.b);
fprintf(file, "onetime_or_realtime:%d\n", output->onetime_or_realtime);
fprintf(file, "roll_limit_select:%d\n", output->roll_limit_select);
// Write decoders_tab data
fprintf(file, "is_field1:%d\n", decoders->is_field1);
fprintf(file, "is_field2:%d\n", decoders->is_field2);
fprintf(file, "channel:%d\n", decoders->channel);
fprintf(file, "is_708:%d\n", decoders->is_708);
fprintf(file, "services_len:%d\n", decoders->services_len);
fprintf(file, "services:%s\n", decoders->services);
fprintf(file, "teletext_dvb:%d\n", decoders->teletext_dvb);
fprintf(file, "min_distance_len:%d\n", decoders->min_distance_len);
fprintf(file, "min_distance:%s\n", decoders->min_distance);
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);
fprintf(file, "is_before:%d\n", credits->is_before);
fprintf(file, "is_after:%d\n", credits->is_after);
fprintf(file, "before_time_buffer:%s\n", credits->before_time_buffer);
fprintf(file, "after_time_buffer:%s\n", credits->after_time_buffer);
fprintf(file, "start_atmost_sec_len:%d\n", credits->start_atmost_sec_len);
fprintf(file, "start_atmost_sec:%s\n", credits->start_atmost_sec);
fprintf(file, "start_atleast_sec_len:%d\n", credits->start_atleast_sec_len);
fprintf(file, "start_atleast_sec:%s\n", credits->start_atleast_sec);
fprintf(file, "is_end_text:%d\n", credits->is_end_text);
fprintf(file, "end_atmost_sec_len:%d\n", credits->end_atmost_sec_len);
fprintf(file, "end_atmost_sec:%s\n", credits->end_atmost_sec);
fprintf(file, "end_atleast_sec_len:%d\n", credits->end_atleast_sec_len);
fprintf(file, "end_atleast_sec:%s\n", credits->end_atleast_sec);
fprintf(file, "start_text_len:%d\n", credits->start_text_len);
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);
fprintf(file, "elementary_stream:%s\n", debug->elementary_stream);
fprintf(file, "is_dump_packets:%d\n", debug->is_dump_packets);
fprintf(file, "is_debug_608:%d\n", debug->is_debug_608);
fprintf(file, "is_debug_708:%d\n", debug->is_debug_708);
fprintf(file, "is_stamp_output:%d\n", debug->is_stamp_output);
fprintf(file, "is_debug_analysed_vid:%d\n", debug->is_debug_analysed_vid);
fprintf(file, "is_raw_608_708:%d\n", debug->is_raw_608_708);
fprintf(file, "is_debug_parsed:%d\n", debug->is_debug_parsed);
fprintf(file, "is_disable_sync:%d\n", debug->is_disable_sync);
fprintf(file, "is_no_padding:%d\n", debug->is_no_padding);
fprintf(file, "is_debug_xds:%d\n", debug->is_debug_xds);
fprintf(file, "is_output_pat:%d\n", debug->is_output_pat);
fprintf(file, "is_output_pmt:%d\n", debug->is_output_pmt);
fprintf(file, "is_scan_ccdata:%d\n", debug->is_scan_ccdata);
fprintf(file, "is_output_levenshtein:%d\n", debug->is_output_levenshtein);
// Write HD Homerun Tab data
fprintf(file, "location_len:%d\n", hd_homerun->location_len);
fprintf(file, "location:%s\n", hd_homerun->location);
fprintf(file, "tuner_len:%d\n", hd_homerun->tuner_len);
fprintf(file, "tuner:%s\n", hd_homerun->tuner);
fprintf(file, "channel_len:%d\n", hd_homerun->channel_len);
fprintf(file, "channel:%s\n", hd_homerun->channel);
fprintf(file, "program_len:%d\n", hd_homerun->program_len);
fprintf(file, "program:%s\n", hd_homerun->program);
fprintf(file, "ipv4_address_len:%d\n", hd_homerun->ipv4_address_len);
fprintf(file, "ipv4_address:%s\n", hd_homerun->ipv4_address);
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);
fprintf(file, "sub_color_select:%d\n", burned_subs->subs_color_select);
fprintf(file, "custom_hue_len:%d\n", burned_subs->custom_hue_len);
fprintf(file, "custom_hue:%s\n", burned_subs->custom_hue);
fprintf(file, "ocr_mode:%d\n", burned_subs->ocr_mode);
fprintf(file, "min_duration_len:%d\n", burned_subs->min_duration_len);
fprintf(file, "min_duration:%s\n", burned_subs->min_duration);
fprintf(file, "luminance_threshold:%d\n", burned_subs->luminance_threshold);
fprintf(file, "confidence_threshold:%d\n", burned_subs->confidence_threshold);
fprintf(file, "is_italic:%d\n", burned_subs->is_italic);
// Write Network Settings popup data
if (network_settings->save_network_settings)
{
fprintf(file, "udp_ipv4_len:%d\n", network_settings->udp_ipv4_len);
fprintf(file, "udp_ipv4:%s\n", network_settings->udp_ipv4);
fprintf(file, "tcp_pass_len:%d\n", network_settings->tcp_pass_len);
fprintf(file, "tcp_pass:%s\n", network_settings->tcp_pass);
fprintf(file, "tcp_desc_len:%d\n", network_settings->tcp_desc_len);
fprintf(file, "tcp_desc:%s\n", network_settings->tcp_desc);
fprintf(file, "send_port_len:%d\n", network_settings->send_port_len);
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)
{
// 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++)
{
if (credits->start_text[i] == newline_char)
newlines_start++;
}
for (int i = 0; i < credits->end_text_len; i++)
{
if (credits->end_text[i] == newline_char)
newlines_end++;
}
fprintf(file, "start_text:%d\n", newlines_start);
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)
fprintf(file, "%s\n", credits->end_text);
}
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)
fscanf(file, "%[^\n]\n", null_char);
else
{
fscanf(file, "start_text:%d\n", &newlines_start);
for (int i = 0; i != newlines_start + 1; i++)
{
static char line[200];
fscanf(file, "%[^\n]\n", line);
if (!(i == newlines_start))
strcat(line, "\n");
if (strlen(buffer) > 0)
strcat(buffer, line);
else
strcpy(buffer, line);
}
memset(credits->start_text, 0, sizeof(credits->start_text));
strcpy(credits->start_text, buffer);
memset(buffer, 0, sizeof(buffer));
}
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++)
{
static char line[200];
fscanf(file, "%[^\n]\n", line);
if (!(i == newlines_end))
strcat(line, "\n");
if (strlen(buffer) > 0)
strcat(buffer, line);
else
strcpy(buffer, line);
}
memset(credits->end_text, 0, sizeof(credits->end_text));
strcpy(credits->end_text, buffer);
}
}

View File

@@ -1,40 +0,0 @@
#ifndef SAVE_LOAD_DATA_H
#define SAVE_LOAD_DATA_H
#include "ccextractorGUI.h"
#include "tabs.h"
#include "popups.h"
#include <stdio.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);
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);
void write_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;
#endif //!SAVE_LOAD_DATA_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,241 +0,0 @@
#ifndef TABS_H
#define TABS_H
#include "ccextractorGUI.h"
/*Global variable for output tab*/
int show_color_from_picker;
/*Data containers for other functions*/
struct output_tab
{
//General
char **type;
int type_select;
int is_filename;
char filename[260];
int filename_len;
int is_output_browser_active;
int is_delay;
char delay_sec_buffer[4];
int is_export_xds;
//Encoding
enum { LATIN, UNIC, UTF } encoding;
int is_bom;
//Capitalization
int is_cap_browser_active;
int is_cap_standard;
int is_cap_file;
char cap_dictionary[260];
int cap_dictionary_len;
//Line Endings
enum { CRLF, LF } line_ending;
//Colors and Styles
int is_center;
int is_dash;
int no_typesetting;
enum { NO_COLOR, DEFAULT_COLOR } font_color;
int color_popup;
char color_hex[7];
struct nk_color color_rgb;
//Roll-up Captions
enum {ONETIME, REALTIME} onetime_or_realtime;
char **roll_limit;
int roll_limit_select;
};
struct time {
int hours, minutes, seconds;
};
struct input_tab {
//General
char **type;
int type_select;
int is_split;
int is_live_stream;
char wait_data_sec[4];
int wait_data_sec_len;
//Timing
int is_process_from;
int is_process_until;
char from_time_buffer[10];
char until_time_buffer[10];
//Elementary Stream
enum {AUTO_DETECT,STREAM_TYPE,STREAM_PID} elementary_stream;
int is_assume_mpeg;
char stream_type[10];
int stream_type_len;
char stream_pid[10];
int stream_pid_len;
char mpeg_type[10];
int mpeg_type_len;
//Teletext
enum { AUTO_DECODE, FORCE, DISABLE } teletext_decoder;
int is_process_teletext_page;
char teletext_page_number[6];
int teletext_page_numer_len;
//Screenfuls limit
enum { NO_LIMIT, LIMITED } is_limit;
char screenful_limit_buffer[4];
//Clock
enum { AUTO, GOP, PTS } clock_input;
};
struct advanced_input_tab{
//Multiple Programs
int is_multiple_program;
enum { FIRST_PROG, PROG_NUM } multiple_program;
char prog_number[6];
int prog_number_len;
//Myth TV
enum { AUTO_MYTH, FORCE_MYTH, DISABLE_MYTH } set_myth;
//Miscellaneous
int is_mpeg_90090;
int is_padding_0000;
int is_order_ccinfo;
int is_win_bug;
int is_hauppage_file;
int is_process_mp4;
int is_ignore_broadcast;
};
struct debug_tab{
int is_elementary_stream;
char elementary_stream[260];
int elementary_stream_len;
int is_dump_packets;
int is_debug_608;
int is_debug_708;
int is_stamp_output;
int is_debug_analysed_vid;
int is_raw_608_708;
int is_debug_parsed;
int is_disable_sync;
int is_no_padding;
int is_debug_xds;
int is_output_pat;
int is_output_pmt;
int is_scan_ccdata;
int is_output_levenshtein;
//File browser trigger
int is_debug_browser_active;
};
struct burned_subs_tab{
int is_burned_subs;
enum {PRESET, CUSTOM} color_type;
char** subs_color;
int subs_color_select;
char custom_hue[4];
int custom_hue_len;
enum {FRAME_WISE, WORD_WISE, LETTER_WISE} ocr_mode;
char min_duration[4];
int min_duration_len;
int luminance_threshold;
int confidence_threshold;
int is_italic;
};
struct decoders_tab{
//608 DECODER
int is_field1;
int is_field2;
enum { CHANNEL_1, CHANNEL_2 } channel;
//708 DECODER
int is_708;
char services[15];
int services_len;
//Teletext or DVB
enum { TELETEXT, DVB } teletext_dvb;
//Teletext line Duplication
char min_distance[4];
int min_distance_len;
char max_distance[4];
int max_distance_len;
};
struct credits_tab{
//START CREDITS
int is_start_text;
char start_text[1000];
int start_text_len;
int is_before;
int is_after;
char before_time_buffer[10];
char after_time_buffer[10];
char start_atmost_sec[4];
int start_atmost_sec_len;
char start_atleast_sec[4];
int start_atleast_sec_len;
//END CREDITS
int is_end_text;
char end_text[1000];
int end_text_len;
char end_atmost_sec[4];
int end_atmost_sec_len;
char end_atleast_sec[4];
int end_atleast_sec_len;
};
struct hd_homerun_tab{
char location[260];
int location_len;
int device_select[50];
int device_num;
char **devices;
int is_homerun_browser_active;
char tuner[2];
int tuner_len;
char channel[5];
int channel_len;
char program[10];
int program_len;
char ipv4_address[16];
int ipv4_address_len;
char port_number[8];
int port_number_len;
int selected;
int threadPopup;
};
/*Tab Functions*/
void setup_output_tab(struct output_tab *output);
void setup_decoders_tab(struct decoders_tab *decoders);
void setup_credits_tab(struct credits_tab *credits);
void setup_input_tab(struct input_tab *input);
void setup_advanced_input_tab(struct advanced_input_tab *advaned_input);
void setup_debug_tab(struct debug_tab *debug);
void setup_hd_homerun_tab(struct hd_homerun_tab *hd_homerun);
void setup_burned_subs_tab(struct burned_subs_tab *burned_subs);
void draw_input_tab(struct nk_context *ctx, int *tab_screen_height, struct input_tab *input,
struct decoders_tab *decoders);
void draw_advanced_input_tab(struct nk_context *ctx, int *tab_screen_height,
struct advanced_input_tab *advaned_input);
void draw_output_tab(struct nk_context *ctx, int *tab_screen_height, struct output_tab *output,
struct main_tab *main_settings);
void draw_decoders_tab(struct nk_context *ctx, int *tab_screen_height, struct decoders_tab *decoders);
void draw_credits_tab(struct nk_context *ctx, int *tab_screen_height, struct credits_tab *credits);
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);
void draw_hd_homerun_tab(struct nk_context *ctx, int *tab_screen_height,
struct hd_homerun_tab *hd_homerun,
struct main_tab *main_settings);
void draw_burned_subs_tab(struct nk_context *ctx, int *tab_screen_height, struct burned_subs_tab *burned_subs);
#endif //!TABS_H

View File

@@ -1,16 +0,0 @@
#ifndef NK_IMPLEMENTATION
#include "nuklear_lib/nuklear.h"
#endif // !NK_IMPLEMENTATION
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_layout_row_dynamic(ctx, 60, 1);
nk_label_wrap(ctx, command);
}
nk_end(ctx);
return !nk_window_is_closed(ctx, "Terminal");
}

View File

@@ -1,951 +0,0 @@
/*
* Dirent interface for Microsoft Visual Studio
* Version 1.21
*
* Copyright (C) 2006-2012 Toni Ronkko
* This file is part of dirent. Dirent may be freely distributed
* under the MIT license. For all details and documentation, see
* https://github.com/tronkko/dirent
*/
#ifndef DIRENT_H
#define DIRENT_H
/*
* Include windows.h without Windows Sockets 1.1 to prevent conflicts with
* Windows Sockets 2.0.
*/
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <stdio.h>
#include <stdarg.h>
#include <wchar.h>
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
/* Indicates that d_type field is available in dirent structure */
#define _DIRENT_HAVE_D_TYPE
/* Indicates that d_namlen field is available in dirent structure */
#define _DIRENT_HAVE_D_NAMLEN
/* Entries missing from MSVC 6.0 */
#if !defined(FILE_ATTRIBUTE_DEVICE)
# define FILE_ATTRIBUTE_DEVICE 0x40
#endif
/* File type and permission flags for stat(), general mask */
#if !defined(S_IFMT)
# define S_IFMT _S_IFMT
#endif
/* Directory bit */
#if !defined(S_IFDIR)
# define S_IFDIR _S_IFDIR
#endif
/* Character device bit */
#if !defined(S_IFCHR)
# define S_IFCHR _S_IFCHR
#endif
/* Pipe bit */
#if !defined(S_IFFIFO)
# define S_IFFIFO _S_IFFIFO
#endif
/* Regular file bit */
#if !defined(S_IFREG)
# define S_IFREG _S_IFREG
#endif
/* Read permission */
#if !defined(S_IREAD)
# define S_IREAD _S_IREAD
#endif
/* Write permission */
#if !defined(S_IWRITE)
# define S_IWRITE _S_IWRITE
#endif
/* Execute permission */
#if !defined(S_IEXEC)
# define S_IEXEC _S_IEXEC
#endif
/* Pipe */
#if !defined(S_IFIFO)
# define S_IFIFO _S_IFIFO
#endif
/* Block device */
#if !defined(S_IFBLK)
# define S_IFBLK 0
#endif
/* Link */
#if !defined(S_IFLNK)
# define S_IFLNK 0
#endif
/* Socket */
#if !defined(S_IFSOCK)
# define S_IFSOCK 0
#endif
/* Read user permission */
#if !defined(S_IRUSR)
# define S_IRUSR S_IREAD
#endif
/* Write user permission */
#if !defined(S_IWUSR)
# define S_IWUSR S_IWRITE
#endif
/* Execute user permission */
#if !defined(S_IXUSR)
# define S_IXUSR 0
#endif
/* Read group permission */
#if !defined(S_IRGRP)
# define S_IRGRP 0
#endif
/* Write group permission */
#if !defined(S_IWGRP)
# define S_IWGRP 0
#endif
/* Execute group permission */
#if !defined(S_IXGRP)
# define S_IXGRP 0
#endif
/* Read others permission */
#if !defined(S_IROTH)
# define S_IROTH 0
#endif
/* Write others permission */
#if !defined(S_IWOTH)
# define S_IWOTH 0
#endif
/* Execute others permission */
#if !defined(S_IXOTH)
# define S_IXOTH 0
#endif
/* Maximum length of file name */
#if !defined(PATH_MAX)
# define PATH_MAX MAX_PATH
#endif
#if !defined(FILENAME_MAX)
# define FILENAME_MAX MAX_PATH
#endif
#if !defined(NAME_MAX)
# define NAME_MAX FILENAME_MAX
#endif
/* File type flags for d_type */
#define DT_UNKNOWN 0
#define DT_REG S_IFREG
#define DT_DIR S_IFDIR
#define DT_FIFO S_IFIFO
#define DT_SOCK S_IFSOCK
#define DT_CHR S_IFCHR
#define DT_BLK S_IFBLK
#define DT_LNK S_IFLNK
/* Macros for converting between st_mode and d_type */
#define IFTODT(mode) ((mode) & S_IFMT)
#define DTTOIF(type) (type)
/*
* File type macros. Note that block devices, sockets and links cannot be
* distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are
* only defined for compatibility. These macros should always return false
* on Windows.
*/
#if !defined(S_ISFIFO)
# define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
#endif
#if !defined(S_ISDIR)
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif
#if !defined(S_ISREG)
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#endif
#if !defined(S_ISLNK)
# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
#endif
#if !defined(S_ISSOCK)
# define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
#endif
#if !defined(S_ISCHR)
# define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
#endif
#if !defined(S_ISBLK)
# define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
#endif
/* Return the exact length of d_namlen without zero terminator */
#define _D_EXACT_NAMLEN(p) ((p)->d_namlen)
/* Return number of bytes needed to store d_namlen */
#define _D_ALLOC_NAMLEN(p) (PATH_MAX)
#ifdef __cplusplus
extern "C" {
#endif
/* Wide-character version */
struct _wdirent {
/* Always zero */
long d_ino;
/* Structure size */
unsigned short d_reclen;
/* Length of name without \0 */
size_t d_namlen;
/* File type */
int d_type;
/* File name */
wchar_t d_name[PATH_MAX];
};
typedef struct _wdirent _wdirent;
struct _WDIR {
/* Current directory entry */
struct _wdirent ent;
/* Private file data */
WIN32_FIND_DATAW data;
/* True if data is valid */
int cached;
/* Win32 search handle */
HANDLE handle;
/* Initial directory name */
wchar_t *patt;
};
typedef struct _WDIR _WDIR;
static _WDIR *_wopendir(const wchar_t *dirname);
static struct _wdirent *_wreaddir(_WDIR *dirp);
static int _wclosedir(_WDIR *dirp);
static void _wrewinddir(_WDIR* dirp);
/* For compatibility with Symbian */
#define wdirent _wdirent
#define WDIR _WDIR
#define wopendir _wopendir
#define wreaddir _wreaddir
#define wclosedir _wclosedir
#define wrewinddir _wrewinddir
/* Multi-byte character versions */
struct dirent {
/* Always zero */
long d_ino;
/* Structure size */
unsigned short d_reclen;
/* Length of name without \0 */
size_t d_namlen;
/* File type */
int d_type;
/* File name */
char d_name[PATH_MAX];
};
typedef struct dirent dirent;
struct DIR {
struct dirent ent;
struct _WDIR *wdirp;
};
typedef struct DIR DIR;
static DIR *opendir(const char *dirname);
static struct dirent *readdir(DIR *dirp);
static int closedir(DIR *dirp);
static void rewinddir(DIR* dirp);
/* Internal utility functions */
static WIN32_FIND_DATAW *dirent_first(_WDIR *dirp);
static WIN32_FIND_DATAW *dirent_next(_WDIR *dirp);
static int dirent_mbstowcs_s(
size_t *pReturnValue,
wchar_t *wcstr,
size_t sizeInWords,
const char *mbstr,
size_t count);
static int dirent_wcstombs_s(
size_t *pReturnValue,
char *mbstr,
size_t sizeInBytes,
const wchar_t *wcstr,
size_t count);
static void dirent_set_errno(int error);
/*
* Open directory stream DIRNAME for read and return a pointer to the
* internal working area that is used to retrieve individual directory
* entries.
*/
static _WDIR*
_wopendir(
const wchar_t *dirname)
{
_WDIR *dirp = NULL;
int error;
/* Must have directory name */
if (dirname == NULL || dirname[0] == '\0') {
dirent_set_errno(ENOENT);
return NULL;
}
/* Allocate new _WDIR structure */
dirp = (_WDIR*)malloc(sizeof(struct _WDIR));
if (dirp != NULL) {
DWORD n;
/* Reset _WDIR structure */
dirp->handle = INVALID_HANDLE_VALUE;
dirp->patt = NULL;
dirp->cached = 0;
/* Compute the length of full path plus zero terminator
*
* Note that on WinRT there's no way to convert relative paths
* into absolute paths, so just assume its an absolute path.
*/
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
n = wcslen(dirname);
# else
n = GetFullPathNameW(dirname, 0, NULL, NULL);
# endif
/* Allocate room for absolute directory name and search pattern */
dirp->patt = (wchar_t*)malloc(sizeof(wchar_t) * n + 16);
if (dirp->patt) {
/*
* Convert relative directory name to an absolute one. This
* allows rewinddir() to function correctly even when current
* working directory is changed between opendir() and rewinddir().
*
* Note that on WinRT there's no way to convert relative paths
* into absolute paths, so just assume its an absolute path.
*/
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
wcsncpy_s(dirp->patt, n + 1, dirname, n);
# else
n = GetFullPathNameW(dirname, n, dirp->patt, NULL);
# endif
if (n > 0) {
wchar_t *p;
/* Append search pattern \* to the directory name */
p = dirp->patt + n;
if (dirp->patt < p) {
switch (p[-1]) {
case '\\':
case '/':
case ':':
/* Directory ends in path separator, e.g. c:\temp\ */
/*NOP*/;
break;
default:
/* Directory name doesn't end in path separator */
*p++ = '\\';
}
}
*p++ = '*';
*p = '\0';
/* Open directory stream and retrieve the first entry */
if (dirent_first(dirp)) {
/* Directory stream opened successfully */
error = 0;
}
else {
/* Cannot retrieve first entry */
error = 1;
dirent_set_errno(ENOENT);
}
}
else {
/* Cannot retrieve full path name */
dirent_set_errno(ENOENT);
error = 1;
}
}
else {
/* Cannot allocate memory for search pattern */
error = 1;
}
}
else {
/* Cannot allocate _WDIR structure */
error = 1;
}
/* Clean up in case of error */
if (error && dirp) {
_wclosedir(dirp);
dirp = NULL;
}
return dirp;
}
/*
* Read next directory entry. The directory entry is returned in dirent
* structure in the d_name field. Individual directory entries returned by
* this function include regular files, sub-directories, pseudo-directories
* "." and ".." as well as volume labels, hidden files and system files.
*/
static struct _wdirent*
_wreaddir(
_WDIR *dirp)
{
WIN32_FIND_DATAW *datap;
struct _wdirent *entp;
/* Read next directory entry */
datap = dirent_next(dirp);
if (datap) {
size_t n;
DWORD attr;
/* Pointer to directory entry to return */
entp = &dirp->ent;
/*
* Copy file name as wide-character string. If the file name is too
* long to fit in to the destination buffer, then truncate file name
* to PATH_MAX characters and zero-terminate the buffer.
*/
n = 0;
while (n + 1 < PATH_MAX && datap->cFileName[n] != 0) {
entp->d_name[n] = datap->cFileName[n];
n++;
}
dirp->ent.d_name[n] = 0;
/* Length of file name excluding zero terminator */
entp->d_namlen = n;
/* File type */
attr = datap->dwFileAttributes;
if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
entp->d_type = DT_CHR;
}
else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
entp->d_type = DT_DIR;
}
else {
entp->d_type = DT_REG;
}
/* Reset dummy fields */
entp->d_ino = 0;
entp->d_reclen = sizeof(struct _wdirent);
}
else {
/* Last directory entry read */
entp = NULL;
}
return entp;
}
/*
* Close directory stream opened by opendir() function. This invalidates the
* DIR structure as well as any directory entry read previously by
* _wreaddir().
*/
static int
_wclosedir(
_WDIR *dirp)
{
int ok;
if (dirp) {
/* Release search handle */
if (dirp->handle != INVALID_HANDLE_VALUE) {
FindClose(dirp->handle);
dirp->handle = INVALID_HANDLE_VALUE;
}
/* Release search pattern */
if (dirp->patt) {
free(dirp->patt);
dirp->patt = NULL;
}
/* Release directory structure */
free(dirp);
ok = /*success*/0;
}
else {
/* Invalid directory stream */
dirent_set_errno(EBADF);
ok = /*failure*/-1;
}
return ok;
}
/*
* Rewind directory stream such that _wreaddir() returns the very first
* file name again.
*/
static void
_wrewinddir(
_WDIR* dirp)
{
if (dirp) {
/* Release existing search handle */
if (dirp->handle != INVALID_HANDLE_VALUE) {
FindClose(dirp->handle);
}
/* Open new search handle */
dirent_first(dirp);
}
}
/* Get first directory entry (internal) */
static WIN32_FIND_DATAW*
dirent_first(
_WDIR *dirp)
{
WIN32_FIND_DATAW *datap;
/* Open directory and retrieve the first entry */
dirp->handle = FindFirstFileExW(
dirp->patt, FindExInfoStandard, &dirp->data,
FindExSearchNameMatch, NULL, 0);
if (dirp->handle != INVALID_HANDLE_VALUE) {
/* a directory entry is now waiting in memory */
datap = &dirp->data;
dirp->cached = 1;
}
else {
/* Failed to re-open directory: no directory entry in memory */
dirp->cached = 0;
datap = NULL;
}
return datap;
}
/* Get next directory entry (internal) */
static WIN32_FIND_DATAW*
dirent_next(
_WDIR *dirp)
{
WIN32_FIND_DATAW *p;
/* Get next directory entry */
if (dirp->cached != 0) {
/* A valid directory entry already in memory */
p = &dirp->data;
dirp->cached = 0;
}
else if (dirp->handle != INVALID_HANDLE_VALUE) {
/* Get the next directory entry from stream */
if (FindNextFileW(dirp->handle, &dirp->data) != FALSE) {
/* Got a file */
p = &dirp->data;
}
else {
/* The very last entry has been processed or an error occurred */
FindClose(dirp->handle);
dirp->handle = INVALID_HANDLE_VALUE;
p = NULL;
}
}
else {
/* End of directory stream reached */
p = NULL;
}
return p;
}
/*
* Open directory stream using plain old C-string.
*/
static DIR*
opendir(
const char *dirname)
{
struct DIR *dirp;
int error;
/* Must have directory name */
if (dirname == NULL || dirname[0] == '\0') {
dirent_set_errno(ENOENT);
return NULL;
}
/* Allocate memory for DIR structure */
dirp = (DIR*)malloc(sizeof(struct DIR));
if (dirp) {
wchar_t wname[PATH_MAX];
size_t n;
/* Convert directory name to wide-character string */
error = dirent_mbstowcs_s(&n, wname, PATH_MAX, dirname, PATH_MAX);
if (!error) {
/* Open directory stream using wide-character name */
dirp->wdirp = _wopendir(wname);
if (dirp->wdirp) {
/* Directory stream opened */
error = 0;
}
else {
/* Failed to open directory stream */
error = 1;
}
}
else {
/*
* Cannot convert file name to wide-character string. This
* occurs if the string contains invalid multi-byte sequences or
* the output buffer is too small to contain the resulting
* string.
*/
error = 1;
}
}
else {
/* Cannot allocate DIR structure */
error = 1;
}
/* Clean up in case of error */
if (error && dirp) {
free(dirp);
dirp = NULL;
}
return dirp;
}
/*
* Read next directory entry.
*
* When working with text consoles, please note that file names returned by
* readdir() are represented in the default ANSI code page while any output to
* console is typically formatted on another code page. Thus, non-ASCII
* characters in file names will not usually display correctly on console. The
* problem can be fixed in two ways: (1) change the character set of console
* to 1252 using chcp utility and use Lucida Console font, or (2) use
* _cprintf function when writing to console. The _cprinf() will re-encode
* ANSI strings to the console code page so many non-ASCII characters will
* display correctly.
*/
static struct dirent*
readdir(
DIR *dirp)
{
WIN32_FIND_DATAW *datap;
struct dirent *entp;
/* Read next directory entry */
datap = dirent_next(dirp->wdirp);
if (datap) {
size_t n;
int error;
/* Attempt to convert file name to multi-byte string */
error = dirent_wcstombs_s(
&n, dirp->ent.d_name, PATH_MAX, datap->cFileName, PATH_MAX);
/*
* If the file name cannot be represented by a multi-byte string,
* then attempt to use old 8+3 file name. This allows traditional
* Unix-code to access some file names despite of unicode
* characters, although file names may seem unfamiliar to the user.
*
* Be ware that the code below cannot come up with a short file
* name unless the file system provides one. At least
* VirtualBox shared folders fail to do this.
*/
if (error && datap->cAlternateFileName[0] != '\0') {
error = dirent_wcstombs_s(
&n, dirp->ent.d_name, PATH_MAX,
datap->cAlternateFileName, PATH_MAX);
}
if (!error) {
DWORD attr;
/* Initialize directory entry for return */
entp = &dirp->ent;
/* Length of file name excluding zero terminator */
entp->d_namlen = n - 1;
/* File attributes */
attr = datap->dwFileAttributes;
if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
entp->d_type = DT_CHR;
}
else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
entp->d_type = DT_DIR;
}
else {
entp->d_type = DT_REG;
}
/* Reset dummy fields */
entp->d_ino = 0;
entp->d_reclen = sizeof(struct dirent);
}
else {
/*
* Cannot convert file name to multi-byte string so construct
* an errornous directory entry and return that. Note that
* we cannot return NULL as that would stop the processing
* of directory entries completely.
*/
entp = &dirp->ent;
entp->d_name[0] = '?';
entp->d_name[1] = '\0';
entp->d_namlen = 1;
entp->d_type = DT_UNKNOWN;
entp->d_ino = 0;
entp->d_reclen = 0;
}
}
else {
/* No more directory entries */
entp = NULL;
}
return entp;
}
/*
* Close directory stream.
*/
static int
closedir(
DIR *dirp)
{
int ok;
if (dirp) {
/* Close wide-character directory stream */
ok = _wclosedir(dirp->wdirp);
dirp->wdirp = NULL;
/* Release multi-byte character version */
free(dirp);
}
else {
/* Invalid directory stream */
dirent_set_errno(EBADF);
ok = /*failure*/-1;
}
return ok;
}
/*
* Rewind directory stream to beginning.
*/
static void
rewinddir(
DIR* dirp)
{
/* Rewind wide-character string directory stream */
_wrewinddir(dirp->wdirp);
}
/* Convert multi-byte string to wide character string */
static int
dirent_mbstowcs_s(
size_t *pReturnValue,
wchar_t *wcstr,
size_t sizeInWords,
const char *mbstr,
size_t count)
{
int error;
#if defined(_MSC_VER) && _MSC_VER >= 1400
/* Microsoft Visual Studio 2005 or later */
error = mbstowcs_s(pReturnValue, wcstr, sizeInWords, mbstr, count);
#else
/* Older Visual Studio or non-Microsoft compiler */
size_t n;
/* Convert to wide-character string (or count characters) */
n = mbstowcs(wcstr, mbstr, sizeInWords);
if (!wcstr || n < count) {
/* Zero-terminate output buffer */
if (wcstr && sizeInWords) {
if (n >= sizeInWords) {
n = sizeInWords - 1;
}
wcstr[n] = 0;
}
/* Length of resulting multi-byte string WITH zero terminator */
if (pReturnValue) {
*pReturnValue = n + 1;
}
/* Success */
error = 0;
}
else {
/* Could not convert string */
error = 1;
}
#endif
return error;
}
/* Convert wide-character string to multi-byte string */
static int
dirent_wcstombs_s(
size_t *pReturnValue,
char *mbstr,
size_t sizeInBytes, /* max size of mbstr */
const wchar_t *wcstr,
size_t count)
{
int error;
#if defined(_MSC_VER) && _MSC_VER >= 1400
/* Microsoft Visual Studio 2005 or later */
error = wcstombs_s(pReturnValue, mbstr, sizeInBytes, wcstr, count);
#else
/* Older Visual Studio or non-Microsoft compiler */
size_t n;
/* Convert to multi-byte string (or count the number of bytes needed) */
n = wcstombs(mbstr, wcstr, sizeInBytes);
if (!mbstr || n < count) {
/* Zero-terminate output buffer */
if (mbstr && sizeInBytes) {
if (n >= sizeInBytes) {
n = sizeInBytes - 1;
}
mbstr[n] = '\0';
}
/* Length of resulting multi-bytes string WITH zero-terminator */
if (pReturnValue) {
*pReturnValue = n + 1;
}
/* Success */
error = 0;
}
else {
/* Cannot convert string */
error = 1;
}
#endif
return error;
}
/* Set errno variable */
static void
dirent_set_errno(
int error)
{
#if defined(_MSC_VER) && _MSC_VER >= 1400
/* Microsoft Visual Studio 2005 and later */
_set_errno(error);
#else
/* Non-Microsoft compiler or older Microsoft compiler */
errno = error;
#endif
}
#ifdef __cplusplus
}
#endif
#endif /*DIRENT_H*/

View File

@@ -1,66 +0,0 @@
#include <stdio.h>
#include <assert.h>
#include <dirent.h>
#include <string.h>
#define MAX_FILE_PATH 500
/*
CCExtractor Binary to C Array Converter
First Compile the C program to an executable (say icons2c)
Usage: icons2c DIRECTORY [ > OUTPUTFILE]
icons2c creates C arrays from binary files.
Use this tool to generate the C arrays for icons and other GUI resources to be used in src/GUI/ccextractorGUI.c
C arrays generated by this tool should be placed in src/GUI/icon_data.c
Copy the code from the output file obtained by running this tool and paste (or replace) in the above mentioned file
Check the following example to know how to generate C array for new resource(s).
Example:
icons2c ../icon > temp.c # Creates 'temp.c' from the contents of files in ../icon directory
*/
int main(int argc, char** argv) {
assert(argc == 2);
char* directory = argv[1];
DIR *d;
FILE *f;
struct dirent *dir;
printf("//Scanning directory \"%s\" for resources.\n\n", directory);
d = opendir(directory);
if (d)
{
int count = 0;
while ((dir = readdir(d)) != NULL)
{
char* fn = dir->d_name;
if (dir->d_type == DT_REG)
{
char file[MAX_FILE_PATH];
count++;
printf("//Converting file: %s\n", fn);
strcpy(file, directory);
strcat(file, "/");
strcat(file, fn);
f = fopen(file, "rb");
char *name = strtok(fn, ".");
printf("char %s_icon_data[] = {\n", name);
unsigned long n = 0;
while(!feof(f)) {
unsigned char c;
if(fread(&c, 1, 1, f) == 0) break;
printf("0x%.2X,", (int)c);
++n;
if(n % 10 == 0) printf("\n");
}
fclose(f);
printf("};\n\n");
}
}
closedir(d);
printf("//Total %d icons converted successfully.\n",count);
}
else
{
printf("//Sorry, Given directory couldn\'t be opened\n");
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -7,48 +7,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ccextractor", "ccextractor.
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Debug-Full|Win32 = Debug-Full|Win32
Debug-Full|x64 = Debug-Full|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
Release-Full|Win32 = Release-Full|Win32
Release-Full|x64 = Release-Full|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Debug|Win32.ActiveCfg = Debug|Win32
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Debug|Win32.Build.0 = Debug|Win32
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Debug|x64.ActiveCfg = Debug|x64
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Debug|x64.Build.0 = Debug|x64
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Debug-Full|Win32.ActiveCfg = Debug-Full|Win32
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Debug-Full|Win32.Build.0 = Debug-Full|Win32
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Debug-Full|x64.ActiveCfg = Debug-Full|x64
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Debug-Full|x64.Build.0 = Debug-Full|x64
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Release|Win32.ActiveCfg = Release|Win32
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Release|Win32.Build.0 = Release|Win32
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Release|x64.ActiveCfg = Release|x64
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Release|x64.Build.0 = Release|x64
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Release-Full|Win32.ActiveCfg = Release-Full|Win32
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Release-Full|Win32.Build.0 = Release-Full|Win32
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Release-Full|x64.ActiveCfg = Release-Full|x64
{0F0063C4-BCBC-4379-A6D5-84A5669C940A}.Release-Full|x64.Build.0 = Release-Full|x64
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Debug|Win32.ActiveCfg = Debug|Win32
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Debug|Win32.Build.0 = Debug|Win32
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Debug|x64.ActiveCfg = Debug|x64
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Debug|x64.Build.0 = Debug|x64
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Debug-Full|Win32.ActiveCfg = Debug|Win32
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Debug-Full|Win32.Build.0 = Debug|Win32
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Debug-Full|x64.ActiveCfg = Debug|x64
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Debug-Full|x64.Build.0 = Debug|x64
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Release|Win32.ActiveCfg = Release|Win32
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Release|Win32.Build.0 = Release|Win32
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Release|x64.ActiveCfg = Release|x64
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Release|x64.Build.0 = Release|x64
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Release-Full|Win32.ActiveCfg = Release|Win32
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Release-Full|Win32.Build.0 = Release|Win32
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Release-Full|x64.ActiveCfg = Release|x64
{74290DA6-174D-4F4B-A48E-F30B824B7925}.Release-Full|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -2,38 +2,14 @@
<Project DefaultTargets="Build" ToolsVersion="14.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug-Full|Win32">
<Configuration>Debug-Full</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug-Full|x64">
<Configuration>Debug-Full</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release-Full|Win32">
<Configuration>Release-Full</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release-Full|x64">
<Configuration>Release-Full</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\ccextractor.h" />
@@ -302,36 +278,10 @@
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project=" $(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Full|Win32'"
Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Full|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Full|Win32'"
Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Full|x64'"
Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
@@ -340,42 +290,11 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Full|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Full|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-Full|Win32'"
Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-Full|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
@@ -385,29 +304,6 @@
<PropertyGroup>
<_ProjectFileVersion>12.0.21005.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>Debug\</OutDir>
<IntDir>Debug\</IntDir>
<LinkIncremental>true</LinkIncremental>
<TargetName>ccextractorwin</TargetName>
<IncludePath>
$(ProjectDir)\libs\include;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include\libpng16;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<TargetName>ccextractorwin</TargetName>
<IncludePath>
$(ProjectDir)\libs\include;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include\libpng16;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Full|Win32'">
<OutDir>Debug-Full\</OutDir>
<IntDir>Debug-Full\</IntDir>
<LinkIncremental>true</LinkIncremental>
<TargetName>ccextractorwinfull</TargetName>
<IncludePath>
$(ProjectDir)\libs\include;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include\zlib;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include\libpng16;$(IncludePath)</IncludePath>
<LibraryPath>$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Full|x64'">
<LinkIncremental>true</LinkIncremental>
<TargetName>ccextractorwinfull</TargetName>
@@ -416,14 +312,6 @@
<LibraryPath>
$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Full|Win32'">
<OutDir>Release-Full\</OutDir>
<IntDir>Release-Full\</IntDir>
<LinkIncremental>false</LinkIncremental>
<TargetName>ccextractorwinfull</TargetName>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Full|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>ccextractorwinfull</TargetName>
@@ -432,142 +320,6 @@
<LibraryPath>
$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>Release\</OutDir>
<IntDir>Release\</IntDir>
<IncludePath>
$(ProjectDir)\libs\include;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include\libpng16;$(IncludePath)</IncludePath>
<LinkIncremental>false</LinkIncremental>
<TargetName>ccextractorwin</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>ccextractorwin</TargetName>
<IncludePath>
$(ProjectDir)\libs\include;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include\libpng16;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>
..\src\thirdparty\freetype\include;..\src;..\src\thirdparty\win_spec_incld;..\src\lib_ccx;..\src\thirdparty\lib_hash;..\src\lib_ccx\zvbi;..\src\thirdparty\protobuf-c;..\src\thirdparty\gpacmp4;..\src\thirdparty\win_iconv;..\src\thirdparty\zlib;..\src\thirdparty;..\src;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include\libpng16;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>
WIN32;FT2_BUILD_LIBRARY;GPAC_DISABLE_VTT;GPAC_DISABLE_OD_DUMP;_DEBUG;_CONSOLE;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_WARNINGS;GPAC_DISABLE_REMOTERY;GPAC_DISABLE_ZLIB;GPAC_HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<AdditionalDependencies>
ccx_rust.lib;UserEnv.lib;Crypt32.lib;WS2_32.Lib;Bcrypt.lib;libpng16.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>
$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PreBuildEvent>
<Command>call pre-build.bat
call rust.bat </Command>
</PreBuildEvent>
<!-- <PostBuildEvent>
<Command>xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\avcodec-59.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\avformat-59.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\avutil-57.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\swresample-4.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\swscale-6.dll"
"$(ProjectDir)$(OutDir)"</Command>
</PostBuildEvent> -->
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>
..\src\thirdparty\freetype\include;..\src;../src/thirdparty/protobuf-c;../src/thirdparty/win_spec_incld;../src/thirdparty/gpacmp4;../src;../src/lib_ccx;../src/lib_ccx/zvbi;../src/thirdparty;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include\libpng16;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>
WIN32;FT2_BUILD_LIBRARY;GPAC_DISABLE_VTT;GPAC_DISABLE_OD_DUMP;_DEBUG;_CONSOLE;_FILE_OFFSET_BITS=64;GPAC_DISABLE_REMOTERY;GPAC_DISABLE_ZLIB;GPAC_HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>
ccx_rust.lib;UserEnv.lib;Crypt32.lib;WS2_32.Lib;Bcrypt.lib;libpng16.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>
$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PreBuildEvent>
<Command>call pre-build.bat
call rust.bat</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Full|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>
..\src\thirdparty\freetype\include;..\src;..\src\thirdparty\win_spec_incld;..\src\lib_ccx;..\src\thirdparty\lib_hash;..\src\lib_ccx\zvbi;..\src\thirdparty\protobuf-c;..\src\thirdparty\gpacmp4;..\src\thirdparty\win_iconv;..\src\thirdparty\;..\src;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>
SEGMENT_BY_FILE_TIME;ENABLE_HARDSUBX;FT2_BUILD_LIBRARY;GPAC_DISABLE_VTT;GPAC_DISABLE_OD_DUMP;ENABLE_OCR;WIN32;_DEBUG;_CONSOLE;_FILE_OFFSET_BITS=64;GPAC_DISABLE_REMOTERY;GPAC_DISABLE_ZLIB;GPAC_HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<CompileAs>CompileAsC</CompileAs>
<DisableSpecificWarnings>4005;4996</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>
ccx_rust.lib;UserEnv.lib;Crypt32.lib;Ws2_32.lib;Bcrypt.lib;Mfplat.lib;Mfuuid.lib;Secur32.lib;Strmiids.lib;Ole32.lib;User32.lib;libcrypto.lib;libcurl.lib;avcodec.lib;avformat.lib;avutil.lib;avfilter.lib;swscale.lib;swresample.lib;leptonica-1.83.1.lib;tesseract53.lib;gif.lib;archive.lib;avdevice.lib;bz2.lib;charset.lib;iconv.lib;jpeg.lib;libpng16.lib;libsharpyuv.lib;libssl.lib;libwebp.lib;libwebpdecoder.lib;libwebpdemux.lib;libwebpmux.lib;libxml2.lib;lz4.lib;lzma.lib;openjp2.lib;tiff.lib;turbojpeg.lib;zlib.lib;zstd.lib;tiff.lib;jpeg.lib;openjp2.lib;lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalOptions>/SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>
$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PreBuildEvent>
<Command>call pre-build.bat
call rustx86.bat</Command>
</PreBuildEvent>
<!-- <PostBuildEvent>
<Command>xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\avcodec-59.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\avformat-59.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\avutil-57.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\swresample-4.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\swscale-6.dll"
"$(ProjectDir)$(OutDir)"</Command>
</PostBuildEvent> -->
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Full|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
@@ -593,61 +345,13 @@
</Link>
<PreBuildEvent>
<Command>call pre-build.bat
call rustx86.bat</Command>
call rust.bat</Command>
</PreBuildEvent>
<!-- <PostBuildEvent>
<Command>xcopy /y "$(ProjectDir)libs\lib\liblept172.dll" "$(ProjectDir)$(OutDir)"
xcopy /y "$(ProjectDir)libs\lib\libtesseract304d.dll" "$(ProjectDir)$(OutDir)"</Command>
</PostBuildEvent> -->
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Full|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>
..\src\thirdparty\freetype\include;..\src;..\src\thirdparty\win_spec_incld;..\src\lib_ccx;..\src\thirdparty\lib_hash;..\src\lib_ccx\zvbi;..\src\thirdparty\protobuf-c;..\src\thirdparty\gpacmp4;..\src\thirdparty\win_iconv;..\src\thirdparty\;..\src;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>
ENABLE_HARDSUBX;FT2_BUILD_LIBRARY;GPAC_DISABLE_VTT;GPAC_DISABLE_OD_DUMP;VERSION_FILE_PRESENT;ENABLE_OCR;WIN32;NDEBUG;_CONSOLE;_FILE_OFFSET_BITS=64;GPAC_DISABLE_REMOTERY;GPAC_DISABLE_ZLIB;GPAC_HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<DisableSpecificWarnings>4005;4996</DisableSpecificWarnings>
<AdditionalLibraryDirectories>
$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>
ccx_rust.lib;UserEnv.lib;Crypt32.lib;Ws2_32.lib;Bcrypt.lib;Mfplat.lib;Mfuuid.lib;Secur32.lib;Strmiids.lib;Ole32.lib;User32.lib;libcrypto.lib;libcurl.lib;avcodec.lib;avformat.lib;avutil.lib;avfilter.lib;swscale.lib;swresample.lib;leptonica-1.83.1.lib;tesseract53.lib;gif.lib;archive.lib;avdevice.lib;bz2.lib;charset.lib;iconv.lib;jpeg.lib;libpng16.lib;libsharpyuv.lib;libssl.lib;libwebp.lib;libwebpdecoder.lib;libwebpdemux.lib;libwebpmux.lib;libxml2.lib;lz4.lib;lzma.lib;openjp2.lib;tiff.lib;turbojpeg.lib;zlib.lib;zstd.lib;tiff.lib;jpeg.lib;openjp2.lib;lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<!-- <PostBuildEvent>
<Command>xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\avcodec-59.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\avformat-59.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\avutil-57.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\swresample-4.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\swscale-6.dll"
"$(ProjectDir)$(OutDir)"</Command>
</PostBuildEvent> -->
<PreBuildEvent>
<Command>call pre-build.bat
call rustx86.bat</Command>
</PreBuildEvent>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Full|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
@@ -673,82 +377,13 @@
</Link>
<PreBuildEvent>
<Command>call pre-build.bat
call rustx86.bat</Command>
call rust.bat -r</Command>
</PreBuildEvent>
<!-- <PostBuildEvent>
<Command>xcopy /y "$(ProjectDir)libs\lib\liblept172.dll" "$(ProjectDir)$(OutDir)"
xcopy /y "$(ProjectDir)libs\lib\libtesseract304d.dll" "$(ProjectDir)$(OutDir)"</Command>
</PostBuildEvent> -->
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>
..\src\thirdparty\freetype\include;..\src;..\src\thirdparty\win_spec_incld;..\src\lib_ccx;..\src\thirdparty\lib_hash;..\src\lib_ccx\zvbi;..\src\thirdparty\protobuf-c;..\src\thirdparty\gpacmp4;..\src\thirdparty\win_iconv;..\src\thirdparty\zlib;..\src\thirdparty;..\src;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include\libpng16;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>
VERSION_FILE_PRESENT;FT2_BUILD_LIBRARY;GPAC_DISABLE_VTT;GPAC_DISABLE_OD_DUMP;WIN32;NDEBUG;_CONSOLE;_FILE_OFFSET_BITS=64;GPAC_DISABLE_REMOTERY;GPAC_DISABLE_ZLIB;GPAC_HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
</ClCompile>
<Link>
<AdditionalDependencies>
ccx_rust.lib;UserEnv.lib;Crypt32.lib;WS2_32.Lib;Bcrypt.lib;libpng16.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>
$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<PreBuildEvent>
<Command>call pre-build.bat
call rust.bat </Command>
</PreBuildEvent>
<!-- <PostBuildEvent>
<Command>xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\avcodec-59.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\avformat-59.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\avutil-57.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\swresample-4.dll"
"$(ProjectDir)$(OutDir)"
xcopy /y "$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib\swscale-6.dll"
"$(ProjectDir)$(OutDir)"</Command>
</PostBuildEvent> -->
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>
..\src\thirdparty\freetype\include;..\src;../src/thirdparty/protobuf-c;../src/thirdparty/win_spec_incld;../src/lib_ccx;../src/thirdparty/lib_hash;../src/thirdparty/gpacmp4;../src/lib_ccx/zvbi;../src/thirdparty;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include\libpng16;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>
VERSION_FILE_PRESENT;FT2_BUILD_LIBRARY;GPAC_DISABLE_VTT;GPAC_DISABLE_OD_DUMP;WIN32;NDEBUG;_CONSOLE;_FILE_OFFSET_BITS=64;GPAC_DISABLE_REMOTERY;GPAC_DISABLE_ZLIB;GPAC_HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>
ccx_rust.lib;UserEnv.lib;Crypt32.lib;WS2_32.Lib;Bcrypt.lib;libpng16.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<AdditionalLibraryDirectories>
$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PreBuildEvent>
<Command>call pre-build.bat
call rust.bat </Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@@ -1,192 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{74290DA6-174D-4F4B-A48E-F30B824B7925}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>ccextractorGUI</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>Debug\</OutDir>
<IntDir>Debug\</IntDir>
<TargetName>ccextractorgui</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>Release\</OutDir>
<IntDir>Release\</IntDir>
<TargetName>ccextractorgui</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;GLEW_STATIC;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>libs\include;..\src\GUI</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>libs\lib;libs\lib\glfw-lib;libs\lib\glew-lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>glfw3.lib;msvcrtd.lib;glew32s.lib;opengl32.lib;pthreadVSE2.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>post-build.bat Debug</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;GLEW_STATIC;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>libs\include;..\src\GUI</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>libs\lib;libs\lib\glfw-lib;libs\lib\glew-lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>glfw3.lib;msvcrt.lib;glew32s.lib;opengl32.lib;pthreadVSE2.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>post-build.bat Release</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\src\GUI\activity.h" />
<ClInclude Include="..\src\GUI\ccextractorGUI.h" />
<ClInclude Include="..\src\GUI\ccx_cli_thread.h" />
<ClInclude Include="..\src\GUI\command_builder.h" />
<ClInclude Include="..\src\GUI\file_browser.h" />
<ClInclude Include="..\src\GUI\popups.h" />
<ClInclude Include="..\src\GUI\preview.h" />
<ClInclude Include="..\src\GUI\save_load_data.h" />
<ClInclude Include="..\src\GUI\stb_image.h" />
<ClInclude Include="..\src\GUI\tabs.h" />
<ClInclude Include="..\src\GUI\win_dirent.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\GUI\activity.c" />
<ClCompile Include="..\src\GUI\ccextractorGUI.c" />
<ClCompile Include="..\src\GUI\ccx_cli_thread.c" />
<ClCompile Include="..\src\GUI\command_builder.c" />
<ClCompile Include="..\src\GUI\file_browser.c" />
<ClCompile Include="..\src\GUI\popups.c" />
<ClCompile Include="..\src\GUI\preview.c" />
<ClCompile Include="..\src\GUI\save_load_data.c" />
<ClCompile Include="..\src\GUI\tabs.c" />
<ClCompile Include="..\src\GUI\terminal.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,84 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\GUI\activity.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\GUI\ccextractorGUI.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\GUI\ccx_cli_thread.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\GUI\command_builder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\GUI\file_browser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\GUI\popups.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\GUI\preview.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\GUI\save_load_data.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\GUI\stb_image.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\GUI\tabs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\GUI\win_dirent.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\GUI\activity.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\GUI\ccextractorGUI.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\GUI\ccx_cli_thread.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\GUI\command_builder.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\GUI\file_browser.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\GUI\popups.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\GUI\preview.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\GUI\save_load_data.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\GUI\tabs.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\GUI\terminal.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -1,2 +0,0 @@
@echo OFF
xcopy libs\lib\pthreadVSE2.dll %1

View File

@@ -1,6 +1,10 @@
for /f "delims=" %%i in ('cd') do set output=%%i
set CARGO_TARGET_DIR=%output%
cd ..\src\rust
cargo build
cargo build %1 --features "hardsubx_ocr" --target x86_64-pc-windows-msvc
cd ..\..\windows
copy debug\ccx_rust.lib .\ccx_rust.lib
IF "%~1"=="-r" (
copy x86_64-pc-windows-msvc\release\ccx_rust.lib .\ccx_rust.lib
) ELSE (
copy x86_64-pc-windows-msvc\debug\ccx_rust.lib .\ccx_rust.lib
)

View File

@@ -1,6 +0,0 @@
for /f "delims=" %%i in ('cd') do set output=%%i
set CARGO_TARGET_DIR=%output%
cd ..\src\rust
cargo build --features "hardsubx_ocr" --target x86_64-pc-windows-msvc
cd ..\..\windows
copy x86_64-pc-windows-msvc\debug\ccx_rust.lib .\ccx_rust.lib