Mercurial > pt1.oyama
comparison src/mime.c @ 125:e413158cae13
Add ushare project files.
author | naoyan@johnstown.minaminoshima.org |
---|---|
date | Sun, 03 Oct 2010 11:35:19 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
124:9c7bc6c0327e | 125:e413158cae13 |
---|---|
1 /* | |
2 * mime.c : GeeXboX uShare media file MIME-type association. | |
3 * Originally developped for the GeeXboX project. | |
4 * Ref : http://freedesktop.org/wiki/Standards_2fshared_2dmime_2dinfo_2dspec | |
5 * Copyright (C) 2005-2007 Benjamin Zores <ben@geexbox.org> | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU Library General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License along | |
18 * with this program; if not, write to the Free Software Foundation, | |
19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 */ | |
21 | |
22 #include <stdlib.h> | |
23 #include <string.h> | |
24 | |
25 #include "mime.h" | |
26 #include "ushare.h" | |
27 | |
28 #define UPNP_VIDEO "object.item.videoItem" | |
29 #define UPNP_AUDIO "object.item.audioItem.musicTrack" | |
30 #define UPNP_PHOTO "object.item.imageItem.photo" | |
31 #define UPNP_PLAYLIST "object.item.playlistItem" | |
32 #define UPNP_TEXT "object.item.textItem" | |
33 | |
34 const struct mime_type_t MIME_Type_List[] = { | |
35 /* Video files */ | |
36 { "asf", UPNP_VIDEO, "http-get:*:video/x-ms-asf:"}, | |
37 { "avc", UPNP_VIDEO, "http-get:*:video/avi:"}, | |
38 { "avi", UPNP_VIDEO, "http-get:*:video/avi:"}, | |
39 { "dv", UPNP_VIDEO, "http-get:*:video/x-dv:"}, | |
40 { "divx", UPNP_VIDEO, "http-get:*:video/avi:"}, | |
41 { "wmv", UPNP_VIDEO, "http-get:*:video/x-ms-wmv:"}, | |
42 { "mjpg", UPNP_VIDEO, "http-get:*:video/x-motion-jpeg:"}, | |
43 { "mjpeg", UPNP_VIDEO, "http-get:*:video/x-motion-jpeg:"}, | |
44 { "mpeg", UPNP_VIDEO, "http-get:*:video/mpeg:"}, | |
45 { "mpg", UPNP_VIDEO, "http-get:*:video/mpeg:"}, | |
46 { "mpe", UPNP_VIDEO, "http-get:*:video/mpeg:"}, | |
47 { "mp2p", UPNP_VIDEO, "http-get:*:video/mp2p:"}, | |
48 { "vob", UPNP_VIDEO, "http-get:*:video/mp2p:"}, | |
49 { "mp2t", UPNP_VIDEO, "http-get:*:video/mp2t:"}, | |
50 { "m1v", UPNP_VIDEO, "http-get:*:video/mpeg:"}, | |
51 { "m2v", UPNP_VIDEO, "http-get:*:video/mpeg2:"}, | |
52 { "mpg2", UPNP_VIDEO, "http-get:*:video/mpeg2:"}, | |
53 { "mpeg2", UPNP_VIDEO, "http-get:*:video/mpeg2:"}, | |
54 { "m4v", UPNP_VIDEO, "http-get:*:video/mp4:"}, | |
55 { "m4p", UPNP_VIDEO, "http-get:*:video/mp4:"}, | |
56 { "mp4ps", UPNP_VIDEO, "http-get:*:video/x-nerodigital-ps:"}, | |
57 { "ts", UPNP_VIDEO, "http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_TS_HD_60_L2_ISO;"}, | |
58 { "ogm", UPNP_VIDEO, "http-get:*:video/mpeg:"}, | |
59 { "mkv", UPNP_VIDEO, "http-get:*:video/mpeg:"}, | |
60 { "rmvb", UPNP_VIDEO, "http-get:*:video/mpeg:"}, | |
61 { "mov", UPNP_VIDEO, "http-get:*:video/quicktime:"}, | |
62 { "hdmov", UPNP_VIDEO, "http-get:*:video/quicktime:"}, | |
63 { "qt", UPNP_VIDEO, "http-get:*:video/quicktime:"}, | |
64 { "bin", UPNP_VIDEO, "http-get:*:video/mpeg2:"}, | |
65 { "iso", UPNP_VIDEO, "http-get:*:video/mpeg2:"}, | |
66 | |
67 /* Audio files */ | |
68 { "3gp", UPNP_AUDIO, "http-get:*:audio/3gpp:"}, | |
69 { "aac", UPNP_AUDIO, "http-get:*:audio/x-aac:"}, | |
70 { "ac3", UPNP_AUDIO, "http-get:*:audio/x-ac3:"}, | |
71 { "aif", UPNP_AUDIO, "http-get:*:audio/aiff:"}, | |
72 { "aiff", UPNP_AUDIO, "http-get:*:audio/aiff:"}, | |
73 { "at3p", UPNP_AUDIO, "http-get:*:audio/x-atrac3:"}, | |
74 { "au", UPNP_AUDIO, "http-get:*:audio/basic:"}, | |
75 { "snd", UPNP_AUDIO, "http-get:*:audio/basic:"}, | |
76 { "dts", UPNP_AUDIO, "http-get:*:audio/x-dts:"}, | |
77 { "rmi", UPNP_AUDIO, "http-get:*:audio/midi:"}, | |
78 { "mid", UPNP_AUDIO, "http-get:*:audio/midi:"}, | |
79 { "mp1", UPNP_AUDIO, "http-get:*:audio/mp1:"}, | |
80 { "mp2", UPNP_AUDIO, "http-get:*:audio/mp2:"}, | |
81 { "mp3", UPNP_AUDIO, "http-get:*:audio/mpeg:"}, | |
82 { "mp4", UPNP_AUDIO, "http-get:*:audio/mp4:"}, | |
83 { "m4a", UPNP_AUDIO, "http-get:*:audio/mp4:"}, | |
84 { "ogg", UPNP_AUDIO, "http-get:*:audio/x-ogg:"}, | |
85 { "wav", UPNP_AUDIO, "http-get:*:audio/wav:"}, | |
86 { "pcm", UPNP_AUDIO, "http-get:*:audio/l16:"}, | |
87 { "lpcm", UPNP_AUDIO, "http-get:*:audio/l16:"}, | |
88 { "l16", UPNP_AUDIO, "http-get:*:audio/l16:"}, | |
89 { "wma", UPNP_AUDIO, "http-get:*:audio/x-ms-wma:"}, | |
90 { "mka", UPNP_AUDIO, "http-get:*:audio/mpeg:"}, | |
91 { "ra", UPNP_AUDIO, "http-get:*:audio/x-pn-realaudio:"}, | |
92 { "rm", UPNP_AUDIO, "http-get:*:audio/x-pn-realaudio:"}, | |
93 { "ram", UPNP_AUDIO, "http-get:*:audio/x-pn-realaudio:"}, | |
94 { "flac", UPNP_AUDIO, "http-get:*:audio/x-flac:"}, | |
95 | |
96 /* Images files */ | |
97 { "bmp", UPNP_PHOTO, "http-get:*:image/bmp:"}, | |
98 { "ico", UPNP_PHOTO, "http-get:*:image/x-icon:"}, | |
99 { "gif", UPNP_PHOTO, "http-get:*:image/gif:"}, | |
100 { "jpeg", UPNP_PHOTO, "http-get:*:image/jpeg:"}, | |
101 { "jpg", UPNP_PHOTO, "http-get:*:image/jpeg:"}, | |
102 { "jpe", UPNP_PHOTO, "http-get:*:image/jpeg:"}, | |
103 { "pcd", UPNP_PHOTO, "http-get:*:image/x-ms-bmp:"}, | |
104 { "png", UPNP_PHOTO, "http-get:*:image/png:"}, | |
105 { "pnm", UPNP_PHOTO, "http-get:*:image/x-portable-anymap:"}, | |
106 { "ppm", UPNP_PHOTO, "http-get:*:image/x-portable-pixmap:"}, | |
107 { "qti", UPNP_PHOTO, "http-get:*:image/x-quicktime:"}, | |
108 { "qtf", UPNP_PHOTO, "http-get:*:image/x-quicktime:"}, | |
109 { "qtif", UPNP_PHOTO, "http-get:*:image/x-quicktime:"}, | |
110 { "tif", UPNP_PHOTO, "http-get:*:image/tiff:"}, | |
111 { "tiff", UPNP_PHOTO, "http-get:*:image/tiff:"}, | |
112 | |
113 /* Playlist files */ | |
114 { "pls", UPNP_PLAYLIST, "http-get:*:audio/x-scpls:"}, | |
115 { "m3u", UPNP_PLAYLIST, "http-get:*:audio/mpegurl:"}, | |
116 { "asx", UPNP_PLAYLIST, "http-get:*:video/x-ms-asf:"}, | |
117 | |
118 /* Subtitle Text files */ | |
119 { "srt", UPNP_TEXT, "http-get:*:text/srt:"}, /* SubRip */ | |
120 { "ssa", UPNP_TEXT, "http-get:*:text/ssa:"}, /* SubStation Alpha */ | |
121 { "stl", UPNP_TEXT, "http-get:*:text/srt:"}, /* Spruce */ | |
122 { "psb", UPNP_TEXT, "http-get:*:text/psb:"}, /* PowerDivX */ | |
123 { "pjs", UPNP_TEXT, "http-get:*:text/pjs:"}, /* Phoenix Japanim */ | |
124 { "sub", UPNP_TEXT, "http-get:*:text/sub:"}, /* MicroDVD */ | |
125 { "idx", UPNP_TEXT, "http-get:*:text/idx:"}, /* VOBsub */ | |
126 { "dks", UPNP_TEXT, "http-get:*:text/dks:"}, /* DKS */ | |
127 { "scr", UPNP_TEXT, "http-get:*:text/scr:"}, /* MACsub */ | |
128 { "tts", UPNP_TEXT, "http-get:*:text/tts:"}, /* TurboTitler */ | |
129 { "vsf", UPNP_TEXT, "http-get:*:text/vsf:"}, /* ViPlay */ | |
130 { "zeg", UPNP_TEXT, "http-get:*:text/zeg:"}, /* ZeroG */ | |
131 { "mpl", UPNP_TEXT, "http-get:*:text/mpl:"}, /* MPL */ | |
132 | |
133 /* Miscellaneous text files */ | |
134 { "bup", UPNP_TEXT, "http-get:*:text/bup:"}, /* DVD backup */ | |
135 { "ifo", UPNP_TEXT, "http-get:*:text/ifo:"}, /* DVD information */ | |
136 | |
137 { NULL, NULL, NULL} | |
138 }; | |
139 | |
140 char *mime_get_protocol (struct mime_type_t *mime) | |
141 { | |
142 char protocol[512]; | |
143 | |
144 if (!mime) | |
145 return NULL; | |
146 | |
147 sprintf (protocol, mime->mime_protocol); | |
148 //strcat (protocol, "*"); | |
149 return strdup (protocol); | |
150 } |