summaryrefslogtreecommitdiffstats
path: root/apps/plugins/mpegplayer/mpegplayer.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2010-12-18 21:20:53 +0000
committerMichael Sevakis <jethead71@rockbox.org>2010-12-18 21:20:53 +0000
commit6032ff1730513296a80989b6e430e8399d2cda89 (patch)
treebfa19f0a894f172b14128a87e6cfbdde38ac40f8 /apps/plugins/mpegplayer/mpegplayer.c
parent8d849723f7237f1861fb1c3541f29b780e37198e (diff)
downloadrockbox-6032ff1730513296a80989b6e430e8399d2cda89.tar.gz
rockbox-6032ff1730513296a80989b6e430e8399d2cda89.tar.bz2
rockbox-6032ff1730513296a80989b6e430e8399d2cda89.zip
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
Diffstat (limited to 'apps/plugins/mpegplayer/mpegplayer.c')
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c22
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)
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.