diff options
Diffstat (limited to 'apps/plugins/mpegplayer/mpegplayer.c')
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index b324133940..f130760ff2 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -1512,14 +1512,28 @@ static void osd_seek(int btn) | |||
1512 | stream_seek(time, SEEK_SET); | 1512 | stream_seek(time, SEEK_SET); |
1513 | } | 1513 | } |
1514 | 1514 | ||
1515 | /* has this file the extension .mpg ? */ | 1515 | /* Has this file one of the supported extensions? */ |
1516 | static bool is_videofile(const char* file) | 1516 | static bool is_videofile(const char* file) |
1517 | { | 1517 | { |
1518 | static const char * const extensions[] = | ||
1519 | { | ||
1520 | /* Should match apps/plugins/viewers.config */ | ||
1521 | "mpg", "mpeg", "mpv", "m2v" | ||
1522 | }; | ||
1523 | |||
1518 | const char* ext = rb->strrchr(file, '.'); | 1524 | const char* ext = rb->strrchr(file, '.'); |
1519 | if (ext && !rb->strcasecmp(ext, ".mpg")) | 1525 | int i; |
1520 | return true; | ||
1521 | 1526 | ||
1522 | return false; | 1527 | if (!ext) |
1528 | return false; | ||
1529 | |||
1530 | for (i = ARRAYLEN(extensions) - 1; i >= 0; i--) | ||
1531 | { | ||
1532 | if (!rb->strcasecmp(ext + 1, extensions[i])) | ||
1533 | break; | ||
1534 | } | ||
1535 | |||
1536 | return i >= 0; | ||
1523 | } | 1537 | } |
1524 | 1538 | ||
1525 | /* deliver the next/previous video file in the current directory. | 1539 | /* deliver the next/previous video file in the current directory. |