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