Unified · Split
| @@ -1,4 +1,4 @@ | |||
| 1 | add `--autocreate-playlist` | 1 | add `--autocreate-playlist` |
| 2 | add `--directory-video-exts` | 2 | add `--video-exts` |
| 3 | add `--directory-audio-exts` | 3 | add `--audio-exts` |
| 4 | add `--directory-image-exts` | 4 | add `--image-exts` |
| @@ -2277,10 +2277,12 @@ Audio · 2276 unmodified lines | |||
| 2277 | :all: Load all audio files in the current and ``--audio-file-paths`` | 2277 | :all: Load all audio files in the current and ``--audio-file-paths`` |
| 2278 | directories. | 2278 | directories. |
| 2279 | 2279 | ||
| 2280 | ``--audio-file-auto-exts=ext1,ext2,...`` | 2280 | ``--audio-exts=ext1,ext2,...`` |
| 2281 | Audio file extentions to try and match when using ``audio-file-auto``. | 2281 | Audio file extentions to try to match when using ``--audio-file-auto``, |
| 2282 | ``--autocreate-playlist`` or ``--directory-filter-types``. | ||
| 2282 | 2283 | ||
| 2283 | This is a string list option. See `List Options`_ for details. | 2284 | This is a string list option. See `List Options`_ for details. |
| 2285 | Use ``--help=audio-exts`` to see default extensions. | ||
| 2284 | 2286 | ||
| 2285 | ``--audio-file-paths=<path1:path2:...>`` | 2287 | ``--audio-file-paths=<path1:path2:...>`` |
| 2286 | Equivalent to ``--sub-file-paths`` option, but for auto-loaded audio files. | 2288 | Equivalent to ``--sub-file-paths`` option, but for auto-loaded audio files. |
| @@ -4152,26 +4154,14 @@ Demuxer · 1865 unmodified lines | |||
| 4152 | :no: Load a single file (default). | 4154 | :no: Load a single file (default). |
| 4153 | :any: Create a playlist from the parent directory with any file type. | 4155 | :any: Create a playlist from the parent directory with any file type. |
| 4154 | :filter: Create a playlist from the parent directory with files matching | 4156 | :filter: Create a playlist from the parent directory with files matching |
| 4155 | extensions from any list ``directory-*-exts``. | 4157 | extensions from any list ``*-exts``. |
| 4156 | :same: Create a playlist from the parent directory with files matching the | 4158 | :same: Create a playlist from the parent directory with files matching the |
| 4157 | same category as the currently loaded file. One of the | 4159 | same category as the currently loaded file. One of the |
| 4158 | ``directory-*-exts`` is selected based on the input file | 4160 | ``*-exts`` is selected based on the input file |
| 4159 | and only files with matching extensions are added to the playlist. | 4161 | and only files with matching extensions are added to the playlist. |
| 4160 | If the input file itself is not matched to any extension list, | 4162 | If the input file itself is not matched to any extension list, |
| 4161 | the playlist is not autogenerated. | 4163 | the playlist is not autogenerated. |
| 4162 | 4164 | ||
| 4163 | ``--directory-video-exts=<ext1,ext2,...>`` | ||
| 4164 | Video file extension list that is used to match files when using | ||
| 4165 | ``--autocreate-playlist=<exts|same>``. | ||
| 4166 | |||
| 4167 | ``--directory-audio-exts=<ext1,ext2,...>`` | ||
| 4168 | Audio file extension list that is used to match files when using | ||
| 4169 | ``--autocreate-playlist=<exts|same>``. | ||
| 4170 | |||
| 4171 | ``--directory-image-exts=<ext1,ext2,...>`` | ||
| 4172 | Image file extension list that is used to match files when using | ||
| 4173 | ``--autocreate-playlist=<exts|same>``. | ||
| 4174 | |||
| 4175 | Input | 4165 | Input |
| 4176 | ----- | 4166 | ----- |
| 4177 | 4167 | ||
| @@ -7540,20 +7530,29 @@ Miscellaneous · 3362 unmodified lines | |||
| 7540 | See ``--audio-display`` how to control display of cover art (this can be | 7530 | See ``--audio-display`` how to control display of cover art (this can be |
| 7541 | used to disable cover art that is part of the file). | 7531 | used to disable cover art that is part of the file). |
| 7542 | 7532 | ||
| 7543 | ``--cover-art-auto-exts=ext1,ext2,...`` | 7533 | ``--image-exts=ext1,ext2,...`` |
| 7544 | Cover art extentions to try and match when using ``cover-art-auto``. | 7534 | Image file extentions to try to match when using ``--cover-art-auto``, |
| 7535 | ``--autocreate-playlist`` or ``--directory-filter-types``. | ||
| 7545 | 7536 | ||
| 7546 | This is a string list option. See `List Options`_ for details. | 7537 | This is a string list option. See `List Options`_ for details. |
| 7538 | Use ``--help=image-exts`` to see default extensions. | ||
| 7547 | 7539 | ||
| 7548 | ``--cover-art-whitelist=filename1,filename2,...`` | 7540 | ``--cover-art-whitelist=filename1,filename2,...`` |
| 7549 | Filenames to load as cover art, sorted by descending priority. They are | 7541 | Filenames to load as cover art, sorted by descending priority. They are |
| 7550 | combined with the extensions in ``--cover-art-auto-exts``. This has no | 7542 | combined with the extensions in ``--image-exts``. This has no |
| 7551 | effect if ``cover-art-auto`` is ``no``. | 7543 | effect if ``cover-art-auto`` is ``no``. |
| 7552 | 7544 | ||
| 7553 | Default: ``AlbumArt,Album,cover,front,AlbumArtSmall,Folder,.folder,thumb`` | 7545 | Default: ``AlbumArt,Album,cover,front,AlbumArtSmall,Folder,.folder,thumb`` |
| 7554 | 7546 | ||
| 7555 | This is a string list option. See `List Options`_ for details. | 7547 | This is a string list option. See `List Options`_ for details. |
| 7556 | 7548 | ||
| 7549 | ``--video-exts=ext1,ext2,...`` | ||
| 7550 | Video file extentions to try to match when using ``--autocreate-playlist`` or | ||
| 7551 | ``--directory-filter-types``. | ||
| 7552 | |||
| 7553 | This is a string list option. See `List Options`_ for details. | ||
| 7554 | Use ``--help=video-exts`` to see default extensions. | ||
| 7555 | |||
| 7557 | ``--autoload-files=<yes|no>`` | 7556 | ``--autoload-files=<yes|no>`` |
| 7558 | Automatically load/select external files (default: yes). | 7557 | Automatically load/select external files (default: yes). |
| 7559 | 7558 | ||
| @@ -54,9 +54,6 @@ enum autocreate_mode { · 53 unmodified lines | |||
| 54 | struct demux_playlist_opts { | 54 | struct demux_playlist_opts { |
| 55 | int dir_mode; | 55 | int dir_mode; |
| 56 | char **directory_filter; | 56 | char **directory_filter; |
| 57 | char **directory_vid_exts; | ||
| 58 | char **directory_aud_exts; | ||
| 59 | char **directory_img_exts; | ||
| 60 | }; | 57 | }; |
| 61 | 58 | ||
| 62 | struct m_sub_options demux_playlist_conf = { | 59 | struct m_sub_options demux_playlist_conf = { |
| @@ -68,12 +65,6 @@ struct m_sub_options demux_playlist_conf = { · 5 unmodified lines | |||
| 68 | {"ignore", DIR_IGNORE})}, | 65 | {"ignore", DIR_IGNORE})}, |
| 69 | {"directory-filter-types", | 66 | {"directory-filter-types", |
| 70 | OPT_STRINGLIST(directory_filter)}, | 67 | OPT_STRINGLIST(directory_filter)}, |
| 71 | {"directory-video-exts", | ||
| 72 | OPT_STRINGLIST(directory_vid_exts)}, | ||
| 73 | {"directory-audio-exts", | ||
| 74 | OPT_STRINGLIST(directory_aud_exts)}, | ||
| 75 | {"directory-image-exts", | ||
| 76 | OPT_STRINGLIST(directory_img_exts)}, | ||
| 77 | {0} | 68 | {0} |
| 78 | }, | 69 | }, |
| 79 | .size = sizeof(struct demux_playlist_opts), | 70 | .size = sizeof(struct demux_playlist_opts), |
| @@ -82,18 +73,6 @@ struct m_sub_options demux_playlist_conf = { · 2 unmodified lines | |||
| 82 | .directory_filter = (char *[]){ | 73 | .directory_filter = (char *[]){ |
| 83 | NULL | 74 | NULL |
| 84 | }, | 75 | }, |
| 85 | .directory_vid_exts = (char *[]){ | ||
| 86 | "3g2", "3gp", "avi", "flv", "m2ts", "m4v", "mj2", "mkv", "mov", | ||
| 87 | "mp4", "mpeg", "mpg", "ogv", "rmvb", "webm", "wmv", "y4m", NULL | ||
| 88 | }, | ||
| 89 | .directory_aud_exts = (char *[]){ | ||
| 90 | "aiff", "ape", "au", "flac", "m4a", "mka", "mp3", "oga", "ogg", | ||
| 91 | "ogm", "opus", "wav", "wma", NULL | ||
| 92 | }, | ||
| 93 | .directory_img_exts = (char *[]){ | ||
| 94 | "avif", "bmp", "gif", "j2k", "jp2", "jpeg", "jpg", "jxl", "png", | ||
| 95 | "svg", "tga", "tif", "tiff", "webp", NULL | ||
| 96 | }, | ||
| 97 | }, | 76 | }, |
| 98 | }; | 77 | }; |
| 99 | 78 | ||
| @@ -126,6 +105,7 @@ struct pl_parser { · 26 unmodified lines | |||
| 126 | char *format; | 105 | char *format; |
| 127 | char *codepage; | 106 | char *codepage; |
| 128 | struct demux_playlist_opts *opts; | 107 | struct demux_playlist_opts *opts; |
| 108 | struct MPOpts *mp_opts; | ||
| 129 | }; | 109 | }; |
| 130 | 110 | ||
| 131 | 111 | ||
| @@ -447,11 +427,11 @@ static bool test_path(struct pl_parser *p, char *path, int autocreate) · 315 unmodified lines | |||
| 447 | return true; | 427 | return true; |
| 448 | 428 | ||
| 449 | bstr ext = bstr_get_ext(bstr0(path)); | 429 | bstr ext = bstr_get_ext(bstr0(path)); |
| 450 | if (autocreate & AUTO_VIDEO && has_str(ext, p->opts->directory_vid_exts)) | 430 | if (autocreate & AUTO_VIDEO && has_str(ext, p->mp_opts->video_exts)) |
| 451 | return true; | 431 | return true; |
| 452 | if (autocreate & AUTO_AUDIO && has_str(ext, p->opts->directory_aud_exts)) | 432 | if (autocreate & AUTO_AUDIO && has_str(ext, p->mp_opts->audio_exts)) |
| 453 | return true; | 433 | return true; |
| 454 | if (autocreate & AUTO_IMAGE && has_str(ext, p->opts->directory_img_exts)) | 434 | if (autocreate & AUTO_IMAGE && has_str(ext, p->mp_opts->image_exts)) |
| 455 | return true; | 435 | return true; |
| 456 | 436 | ||
| 457 | return false; | 437 | return false; |
| @@ -541,11 +521,11 @@ static int parse_dir(struct pl_parser *p) · 83 unmodified lines | |||
| 541 | autocreate = AUTO_VIDEO | AUTO_AUDIO | AUTO_IMAGE; | 521 | autocreate = AUTO_VIDEO | AUTO_AUDIO | AUTO_IMAGE; |
| 542 | break; | 522 | break; |
| 543 | case 3: // same | 523 | case 3: // same |
| 544 | if (has_str(ext, p->opts->directory_vid_exts)) { | 524 | if (has_str(ext, p->mp_opts->video_exts)) { |
| 545 | autocreate = AUTO_VIDEO; | 525 | autocreate = AUTO_VIDEO; |
| 546 | } else if (has_str(ext, p->opts->directory_aud_exts)) { | 526 | } else if (has_str(ext, p->mp_opts->audio_exts)) { |
| 547 | autocreate = AUTO_AUDIO; | 527 | autocreate = AUTO_AUDIO; |
| 548 | } else if (has_str(ext, p->opts->directory_img_exts)) { | 528 | } else if (has_str(ext, p->mp_opts->image_exts)) { |
| 549 | autocreate = AUTO_IMAGE; | 529 | autocreate = AUTO_IMAGE; |
| 550 | } | 530 | } |
| 551 | break; | 531 | break; |
| @@ -561,7 +541,7 @@ static int parse_dir(struct pl_parser *p) · 9 unmodified lines | |||
| 561 | } | 541 | } |
| 562 | } else { | 542 | } else { |
| 563 | autocreate = AUTO_NONE; | 543 | autocreate = AUTO_NONE; |
| 564 | if (!p->opts->directory_filter[0]) | 544 | if (!p->opts->directory_filter || !p->opts->directory_filter[0]) |
| 565 | autocreate = AUTO_ANY; | 545 | autocreate = AUTO_ANY; |
| 566 | if (has_str(bstr0("video"), p->opts->directory_filter)) | 546 | if (has_str(bstr0("video"), p->opts->directory_filter)) |
| 567 | autocreate |= AUTO_VIDEO; | 547 | autocreate |= AUTO_VIDEO; |
| @@ -675,6 +655,7 @@ static int open_file(struct demuxer *demuxer, enum demux_check check) · 107 unmodified lines | |||
| 675 | p->check_level = check; | 655 | p->check_level = check; |
| 676 | p->probing = true; | 656 | p->probing = true; |
| 677 | p->autocreate_playlist = demuxer->params->allow_playlist_create ? opts->autocreate_playlist : 0; | 657 | p->autocreate_playlist = demuxer->params->allow_playlist_create ? opts->autocreate_playlist : 0; |
| 658 | p->mp_opts = mp_get_config_group(demuxer, demuxer->global, &mp_opt_root); | ||
| 678 | p->opts = mp_get_config_group(demuxer, demuxer->global, &demux_playlist_conf); | 659 | p->opts = mp_get_config_group(demuxer, demuxer->global, &demux_playlist_conf); |
| 679 | 660 | ||
| 680 | const struct pl_format *fmts = playlist_formats; | 661 | const struct pl_format *fmts = playlist_formats; |
| @@ -720,11 +720,14 @@ static const m_option_t mp_opts[] = { · 719 unmodified lines | |||
| 720 | {"sub-auto-exts", OPT_STRINGLIST(sub_auto_exts), .flags = UPDATE_SUB_EXTS}, | 720 | {"sub-auto-exts", OPT_STRINGLIST(sub_auto_exts), .flags = UPDATE_SUB_EXTS}, |
| 721 | {"audio-file-auto", OPT_CHOICE(audiofile_auto, | 721 | {"audio-file-auto", OPT_CHOICE(audiofile_auto, |
| 722 | {"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})}, | 722 | {"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})}, |
| 723 | {"audio-file-auto-exts", OPT_STRINGLIST(audiofile_auto_exts)}, | 723 | {"audio-exts", OPT_STRINGLIST(audio_exts)}, |
| 724 | {"audio-file-auto-exts", OPT_ALIAS("audio-exts")}, | ||
| 724 | {"cover-art-auto", OPT_CHOICE(coverart_auto, | 725 | {"cover-art-auto", OPT_CHOICE(coverart_auto, |
| 725 | {"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})}, | 726 | {"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})}, |
| 726 | {"cover-art-auto-exts", OPT_STRINGLIST(coverart_auto_exts)}, | 727 | {"image-exts", OPT_STRINGLIST(image_exts)}, |
| 728 | {"cover-art-auto-exts", OPT_ALIAS("image-exts")}, | ||
| 727 | {"cover-art-whitelist", OPT_STRINGLIST(coverart_whitelist)}, | 729 | {"cover-art-whitelist", OPT_STRINGLIST(coverart_whitelist)}, |
| 730 | {"video-exts", OPT_STRINGLIST(video_exts)}, | ||
| 728 | 731 | ||
| 729 | {"", OPT_SUBSTRUCT(subs_rend, mp_subtitle_sub_opts)}, | 732 | {"", OPT_SUBSTRUCT(subs_rend, mp_subtitle_sub_opts)}, |
| 730 | {"", OPT_SUBSTRUCT(subs_shared, mp_subtitle_shared_sub_opts)}, | 733 | {"", OPT_SUBSTRUCT(subs_shared, mp_subtitle_shared_sub_opts)}, |
| @@ -1044,36 +1047,17 @@ static const struct MPOpts mp_default_opts = { · 313 unmodified lines | |||
| 1044 | .screenshot_template = "mpv-shot%n", | 1047 | .screenshot_template = "mpv-shot%n", |
| 1045 | .play_dir = 1, | 1048 | .play_dir = 1, |
| 1046 | .media_controls = 1, | 1049 | .media_controls = 1, |
| 1047 | 1050 | .video_exts = (char *[]){ | |
| 1048 | .audiofile_auto_exts = (char *[]){ | 1051 | "3g2", "3gp", "avi", "flv", "m2ts", "m4v", "mj2", "mkv", "mov", "mp4", |
| 1049 | "aac", | 1052 | "mpeg", "mpg", "ogv", "rmvb", "ts", "webm", "wmv", "y4m", NULL |
| 1050 | "ac3", | ||
| 1051 | "dts", | ||
| 1052 | "eac3", | ||
| 1053 | "flac", | ||
| 1054 | "m4a", | ||
| 1055 | "mka", | ||
| 1056 | "mp3", | ||
| 1057 | "ogg", | ||
| 1058 | "opus", | ||
| 1059 | "thd", | ||
| 1060 | "wav", | ||
| 1061 | "wv", | ||
| 1062 | NULL | ||
| 1063 | }, | 1053 | }, |
| 1064 | 1054 | .audio_exts = (char *[]){ | |
| 1065 | .coverart_auto_exts = (char *[]){ | 1055 | "aac", "ac3", "aiff", "ape", "au", "dts", "eac3", "flac", "m4a", "mka", |
| 1066 | "avif", | 1056 | "mp3", "oga", "ogg", "ogm", "opus", "thd", "wav", "wav", "wma", "wv", NULL |
| 1067 | "bmp", | 1057 | }, |
| 1068 | "gif", | 1058 | .image_exts = (char *[]){ |
| 1069 | "jpeg", | 1059 | "avif", "bmp", "gif", "j2k", "jp2", "jpeg", "jpg", "jxl", "png", |
| 1070 | "jpg", | 1060 | "svg", "tga", "tif", "tiff", "webp", NULL |
| 1071 | "jxl", | ||
| 1072 | "png", | ||
| 1073 | "tif", | ||
| 1074 | "tiff", | ||
| 1075 | "webp", | ||
| 1076 | NULL | ||
| 1077 | }, | 1061 | }, |
| 1078 | 1062 | ||
| 1079 | .sub_auto_exts = (char *[]){ | 1063 | .sub_auto_exts = (char *[]){ |
| @@ -338,10 +338,11 @@ typedef struct MPOpts { · 337 unmodified lines | |||
| 338 | int sub_auto; | 338 | int sub_auto; |
| 339 | char **sub_auto_exts; | 339 | char **sub_auto_exts; |
| 340 | int audiofile_auto; | 340 | int audiofile_auto; |
| 341 | char **audiofile_auto_exts; | 341 | char **audio_exts; |
| 342 | int coverart_auto; | 342 | int coverart_auto; |
| 343 | char **coverart_auto_exts; | 343 | char **image_exts; |
| 344 | char **coverart_whitelist; | 344 | char **coverart_whitelist; |
| 345 | char **video_exts; | ||
| 345 | bool osd_bar_visible; | 346 | bool osd_bar_visible; |
| 346 | 347 | ||
| 347 | int w32_priority; | 348 | int w32_priority; |
| @@ -49,9 +49,9 @@ static int test_ext(MPOpts *opts, bstr ext) · 48 unmodified lines | |||
| 49 | { | 49 | { |
| 50 | if (test_ext_list(ext, opts->sub_auto_exts)) | 50 | if (test_ext_list(ext, opts->sub_auto_exts)) |
| 51 | return STREAM_SUB; | 51 | return STREAM_SUB; |
| 52 | if (test_ext_list(ext, opts->audiofile_auto_exts)) | 52 | if (test_ext_list(ext, opts->audio_exts)) |
| 53 | return STREAM_AUDIO; | 53 | return STREAM_AUDIO; |
| 54 | if (test_ext_list(ext, opts->coverart_auto_exts)) | 54 | if (test_ext_list(ext, opts->image_exts)) |
| 55 | return STREAM_VIDEO; | 55 | return STREAM_VIDEO; |
| 56 | return -1; | 56 | return -1; |
| 57 | } | 57 | } |