summaryrefslogtreecommitdiff
path: root/responsebase.c
diff options
context:
space:
mode:
authorthlo <smarttv640@gmail.com>2013-09-02 18:53:27 +0200
committerthlo <smarttv640@gmail.com>2013-09-02 18:53:27 +0200
commit9010746b5691cbab96fc9558751177b9287166f6 (patch)
tree411474a073c2d0b9b73928dcb2b270f4f1a761d9 /responsebase.c
parent417202343b64947e80dbe14b4ab456cc6442e88c (diff)
downloadvdr-plugin-smarttvweb-9010746b5691cbab96fc9558751177b9287166f6.tar.gz
vdr-plugin-smarttvweb-9010746b5691cbab96fc9558751177b9287166f6.tar.bz2
Provide correct MIME types for media.xml
Diffstat (limited to 'responsebase.c')
-rw-r--r--responsebase.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/responsebase.c b/responsebase.c
index 633b922..5297700 100644
--- a/responsebase.c
+++ b/responsebase.c
@@ -125,6 +125,33 @@ void cResponseBase::sendHeaders(int status, const char *title, const char *extra
strcpy(mBlkData, hdr.c_str());
}
+const char *cResponseBase::getMimeType(const char *name) {
+ char *ext = strrchr((char*)name, '.');
+ if (!ext)
+ return "application/octet-stream";
+
+ if (strcmp(ext, ".html") == 0 || strcmp(ext, ".htm") == 0) return "text/html";
+ if (strcmp(ext, ".jpg") == 0 || strcmp(ext, ".jpeg") == 0) return "image/jpeg";
+ if (strcmp(ext, ".gif") == 0) return "image/gif";
+ if (strcmp(ext, ".png") == 0) return "image/png";
+ if (strcmp(ext, ".xml") == 0) return "application/xml";
+ if (strcmp(ext, ".css") == 0) return "text/css";
+ if (strcmp(ext, ".js") == 0) return "text/javascript";
+ if (strcmp(ext, ".au") == 0) return "audio/basic";
+ if (strcmp(ext, ".wav") == 0) return "audio/wav";
+ if (strcmp(ext, ".avi") == 0) return "video/x-msvideo";
+ if (strcmp(ext, ".mp4") == 0) return "video/mp4";
+ if (strcmp(ext, ".3gp") == 0) return "video/3gp";
+ if (strcmp(ext, ".vdr") == 0) return "video/mpeg";
+ if (strcmp(ext, ".ts") == 0) return "video/mpeg";
+ if (strcmp(ext, ".mpeg") == 0 || strcmp(ext, ".mpg") == 0) return "video/mpeg";
+ if (strcmp(ext, ".mp3") == 0) return "audio/mpeg";
+ if (strcmp(ext, ".mpd") == 0) return "application/dash+xml";
+ if (strcmp(ext, ".m3u8") == 0) return "application/x-mpegURL";
+
+ return "application/octet-stream";
+}
+
int cResponseBase::fillDataBlk() {