Read subtitles from media files, fix bug in text_buffer

This commit is contained in:
simon987 2021-03-26 19:48:16 -04:00
parent bc884e137c
commit 50771bd1dc
4 changed files with 7 additions and 2 deletions

View File

@ -46,6 +46,7 @@ Scan options
--fast Only index file names & mime type
--treemap-threshold=<str> Relative size threshold for treemap (see USAGE.md). DEFAULT: 0.0005
--mem-buffer=<int> Maximum memory buffer size per thread in MB for files inside archives (see USAGE.md). DEFAULT: 2000
--read-subtitles Read subtitles from media files
Index options
-t, --threads=<int> Number of threads. DEFAULT=1
@ -91,7 +92,7 @@ Made by simon987 <me@simon987.net>. Released under GPL-3.0
Specify an existing index. Information about files in this index that were not modified (based on *mtime* attribute)
will be copied to the new index and will not be parsed again.
* `-o, --output` Output directory.
* `--rewrite-url` Set the `rewrite_url` option for the web module (See [rewrite_url](#rewrite_url))
* `--rewrite-url` Set the `rewrite_url` option for the web module (See [rewrite_url](#rewrite_url))
* `--name` Set the `name` option for the web module
* `--depth` Maximum scan dept. Set to 0 only scan files directly in the root directory, set to -1 for infinite depth
* `--archive` Archive file mode.
@ -123,6 +124,7 @@ Made by simon987 <me@simon987.net>. Released under GPL-3.0
larger than this number will be read sequentially and no *seek* operations will be supported.
To check if a media file can be parsed without *seek*, execute `cat file.mp4 | ffprobe -`
* `--read-subtitles` When enabled, will attempt to read the subtitles stream from media files.
### Scan examples

View File

@ -25,6 +25,7 @@ typedef struct scan_args {
const char* treemap_threshold_str;
double treemap_threshold;
int max_memory_buffer;
int read_subtitles;
} scan_args_t;
scan_args_t *scan_args_create();

View File

@ -132,6 +132,7 @@ void initialize_scan_context(scan_args_t *args) {
ScanCtx.media_ctx.logf = _logf;
ScanCtx.media_ctx.store = _store;
ScanCtx.media_ctx.max_media_buffer = (long) args->max_memory_buffer * 1024 * 1024;
ScanCtx.media_ctx.read_subtitles = args->read_subtitles;
init_media();
// OOXML
@ -448,6 +449,7 @@ int main(int argc, const char *argv[]) {
OPT_INTEGER(0, "mem-buffer", &scan_args->max_memory_buffer,
"Maximum memory buffer size per thread in MB for files inside archives "
"(see USAGE.md). DEFAULT: 2000"),
OPT_BOOLEAN(0, "read-subtitles", &scan_args->read_subtitles, "Read subtitles from media files."),
OPT_GROUP("Index options"),
OPT_INTEGER('t', "threads", &common_threads, "Number of threads. DEFAULT=1"),

@ -1 +1 @@
Subproject commit 3f4e3594a6891b942d5a711781d5425111aa13bf
Subproject commit ffd9c23427d0cb105e27f27f0cf97b463b6a8bf8