| @@ -28,6 +28,7 @@ · 27 unmodified lines |
| 28 | 28 | #include "misc/charset_conv.h" |
| 29 | 29 | #include "misc/thread_tools.h" |
| 30 | 30 | #include "options/path.h" |
| 31 | +#include "player/core.h" |
| 31 | 32 | #include "stream/stream.h" |
| 32 | 33 | #include "osdep/io.h" |
| 33 | 34 | #include "misc/natural_sort.h" |
| @@ -410,28 +411,17 @@ static int cmp_dir_entry(const void *a, const void *b) · 376 unmodified lines |
| 410 | 411 | } |
| 411 | 412 | } |
| 412 | 413 | |
| 413 | | −static bool has_str(bstr ext, char **list) |
| 414 | | −{ |
| 415 | | − if (!list) |
| 416 | | − return false; |
| 417 | | − while (*list) { |
| 418 | | − if (!bstrcasecmp0(ext, *list++)) |
| 419 | | − return true; |
| 420 | | − } |
| 421 | | − return false; |
| 422 | | −} |
| 423 | | − |
| 424 | 414 | static bool test_path(struct pl_parser *p, char *path, int autocreate) |
| 425 | 415 | { |
| 426 | 416 | if (autocreate & AUTO_ANY) |
| 427 | 417 | return true; |
| 428 | 418 | |
| 429 | 419 | bstr ext = bstr_get_ext(bstr0(path)); |
| 430 | | − if (autocreate & AUTO_VIDEO && has_str(ext, p->mp_opts->video_exts)) |
| 420 | + if (autocreate & AUTO_VIDEO && str_in_list(ext, p->mp_opts->video_exts)) |
| 431 | 421 | return true; |
| 432 | | − if (autocreate & AUTO_AUDIO && has_str(ext, p->mp_opts->audio_exts)) |
| 422 | + if (autocreate & AUTO_AUDIO && str_in_list(ext, p->mp_opts->audio_exts)) |
| 433 | 423 | return true; |
| 434 | | − if (autocreate & AUTO_IMAGE && has_str(ext, p->mp_opts->image_exts)) |
| 424 | + if (autocreate & AUTO_IMAGE && str_in_list(ext, p->mp_opts->image_exts)) |
| 435 | 425 | return true; |
| 436 | 426 | |
| 437 | 427 | return false; |
| @@ -521,11 +511,11 @@ static int parse_dir(struct pl_parser *p) · 83 unmodified lines |
| 521 | 511 | autocreate = AUTO_VIDEO | AUTO_AUDIO | AUTO_IMAGE; |
| 522 | 512 | break; |
| 523 | 513 | case 3: // same |
| 524 | | − if (has_str(ext, p->mp_opts->video_exts)) { |
| 514 | + if (str_in_list(ext, p->mp_opts->video_exts)) { |
| 525 | 515 | autocreate = AUTO_VIDEO; |
| 526 | | − } else if (has_str(ext, p->mp_opts->audio_exts)) { |
| 516 | + } else if (str_in_list(ext, p->mp_opts->audio_exts)) { |
| 527 | 517 | autocreate = AUTO_AUDIO; |
| 528 | | − } else if (has_str(ext, p->mp_opts->image_exts)) { |
| 518 | + } else if (str_in_list(ext, p->mp_opts->image_exts)) { |
| 529 | 519 | autocreate = AUTO_IMAGE; |
| 530 | 520 | } |
| 531 | 521 | break; |
| @@ -543,11 +533,11 @@ static int parse_dir(struct pl_parser *p) · 11 unmodified lines |
| 543 | 533 | autocreate = AUTO_NONE; |
| 544 | 534 | if (!p->opts->directory_filter || !p->opts->directory_filter[0]) |
| 545 | 535 | autocreate = AUTO_ANY; |
| 546 | | − if (has_str(bstr0("video"), p->opts->directory_filter)) |
| 536 | + if (str_in_list(bstr0("video"), p->opts->directory_filter)) |
| 547 | 537 | autocreate |= AUTO_VIDEO; |
| 548 | | − if (has_str(bstr0("audio"), p->opts->directory_filter)) |
| 538 | + if (str_in_list(bstr0("audio"), p->opts->directory_filter)) |
| 549 | 539 | autocreate |= AUTO_AUDIO; |
| 550 | | − if (has_str(bstr0("image"), p->opts->directory_filter)) |
| 540 | + if (str_in_list(bstr0("image"), p->opts->directory_filter)) |
| 551 | 541 | autocreate |= AUTO_IMAGE; |
| 552 | 542 | } |
| 553 | 543 | if (!stream->is_directory) |