summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2013-02-18 19:44:28 +0100
committerJohns <johns98@gmx.net>2013-02-18 19:44:28 +0100
commit9cdabbee2109239ec70c11bacc4ea46d66e9ff98 (patch)
treed1ecac41376a737c3055785b913d3b473668e9cc
parent2b9a9d70b79d11b1d759da4b72070e8f787b8cec (diff)
downloadvdr-plugin-play-9cdabbee2109239ec70c11bacc4ea46d66e9ff98.tar.gz
vdr-plugin-play-9cdabbee2109239ec70c11bacc4ea46d66e9ff98.tar.bz2
Handle iso dvd images.
-rw-r--r--play.cpp60
-rw-r--r--player.c2
2 files changed, 60 insertions, 2 deletions
diff --git a/play.cpp b/play.cpp
index 5d089d1..37620d6 100644
--- a/play.cpp
+++ b/play.cpp
@@ -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;
}
diff --git a/player.c b/player.c
index ea52d97..a79e331 100644
--- a/player.c
+++ b/player.c
@@ -756,7 +756,7 @@ void PlayerStop(void)
}
}
PlayerPid = 0;
- PlayerClosesPipe();
+ PlayerClosePipes();
if (ConfigOsdOverlay) {
DisableDummyDevice();