diff options
author | Johns <johns98@gmx.net> | 2013-02-18 19:44:28 +0100 |
---|---|---|
committer | Johns <johns98@gmx.net> | 2013-02-18 19:44:28 +0100 |
commit | 9cdabbee2109239ec70c11bacc4ea46d66e9ff98 (patch) | |
tree | d1ecac41376a737c3055785b913d3b473668e9cc | |
parent | 2b9a9d70b79d11b1d759da4b72070e8f787b8cec (diff) | |
download | vdr-plugin-play-9cdabbee2109239ec70c11bacc4ea46d66e9ff98.tar.gz vdr-plugin-play-9cdabbee2109239ec70c11bacc4ea46d66e9ff98.tar.bz2 |
Handle iso dvd images.
-rw-r--r-- | play.cpp | 60 | ||||
-rw-r--r-- | player.c | 2 |
2 files changed, 60 insertions, 2 deletions
@@ -627,6 +627,64 @@ static void PlayFile(const char *filename) cControl::Launch(new cMyControl(filename)); } +/** +** Check if filename is an iso dvd image. +** +** @param filename path and file name +** +** @retval true archive +** @retval false no archive +*/ +static int IsIsoImage(const char *filename) +{ + + /** + ** Table of supported iso image suffixes. + */ + static const NameFilter IsoFilters[] = { +#define FILTER(x) { sizeof(x) - 1, x } + FILTER(".bin"), + FILTER(".dvd"), + FILTER(".img"), + FILTER(".iso"), + FILTER(".mdf"), + FILTER(".nrg"), +#undef FILTER + {0, NULL} + }; + int i; + int len; + + len = strlen(filename); + for (i = 0; IsoFilters[i].String; ++i) { + if (len >= IsoFilters[i].Length + && !strcasecmp(filename + len - IsoFilters[i].Length, + IsoFilters[i].String)) { + return 1; + } + } + return 0; +} + +/** +** Play a file, with type detection. +** +** @param filename path and file name +*/ +static void PlayFileHandleType(const char *filename) +{ + if (IsIsoImage(filename)) { // handle dvd iso images + char *tmp; + + tmp = (char *)malloc(sizeof("dvdnav:///") + strlen(filename)); + stpcpy(stpcpy(tmp, "dvdnav:///"), filename); + PlayFile(tmp); + free(tmp); + return; + } + PlayFile(filename); +} + ////////////////////////////////////////////////////////////////////////////// // cOsdMenu ////////////////////////////////////////////////////////////////////////////// @@ -888,7 +946,7 @@ eOSState cBrowser::Selected(void) // FIXME: if dir fails use keep old! return osContinue; } - PlayFile(filename); + PlayFileHandleType(filename); free(filename); return osEnd; } @@ -756,7 +756,7 @@ void PlayerStop(void) } } PlayerPid = 0; - PlayerClosesPipe(); + PlayerClosePipes(); if (ConfigOsdOverlay) { DisableDummyDevice(); |