From 6032ff1730513296a80989b6e430e8399d2cda89 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sat, 18 Dec 2010 21:20:53 +0000 Subject: MPEGPlayer playlist should as well support all viewer-handled file extensions...indeed. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28850 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/mpegplayer/mpegplayer.c | 22 ++++++++++++++++++---- 1 file 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) stream_seek(time, SEEK_SET); } -/* has this file the extension .mpg ? */ +/* Has this file one of the supported extensions? */ static bool is_videofile(const char* file) { + static const char * const extensions[] = + { + /* Should match apps/plugins/viewers.config */ + "mpg", "mpeg", "mpv", "m2v" + }; + const char* ext = rb->strrchr(file, '.'); - if (ext && !rb->strcasecmp(ext, ".mpg")) - return true; + int i; - return false; + if (!ext) + return false; + + for (i = ARRAYLEN(extensions) - 1; i >= 0; i--) + { + if (!rb->strcasecmp(ext + 1, extensions[i])) + break; + } + + return i >= 0; } /* deliver the next/previous video file in the current directory. -- cgit v1.2.3