codec: avcodec: remove leftoff cc code
[vlc.git] / src / misc / mime.c
blob3b16934c86b3bae22c0e6c2a6c8fd848138e2965
1 /*****************************************************************************
2 * mime.c
3 *****************************************************************************
4 * Copyright © 2004-2012 VLC authors and VideoLAN
5 * Copyright © 2004-2007 Rémi Denis-Courmont
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * Rémi Denis-Courmont <rem # videolan.org>
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #ifdef HAVE_CONFIG_H
26 # include "config.h"
27 #endif
29 #include <vlc_common.h>
30 #include <vlc_mime.h>
32 #include <string.h>
34 static const struct
36 const char psz_ext[8];
37 const char *psz_mime;
38 } ext_mime[] =
40 { ".htm", "text/html" },
41 { ".html", "text/html" },
42 { ".txt", "text/plain" },
43 { ".xml", "text/xml" },
44 { ".dtd", "text/dtd" },
46 { ".css", "text/css" },
48 /* image mime */
49 { ".gif", "image/gif" },
50 { ".jpe", "image/jpeg" },
51 { ".jpg", "image/jpeg" },
52 { ".jpeg", "image/jpeg" },
53 { ".png", "image/png" },
54 { ".pct", "image/x-pict" },
55 /* same as modules/mux/mpjpeg.c here: */
56 { ".mpjpeg","multipart/x-mixed-replace; boundary=7b3cc56e5f51db803f790dad720ed50a" },
58 /* media mime */
59 { ".avi", "video/avi" },
60 { ".asf", "video/x-ms-asf" },
61 { ".m1a", "audio/mpeg" },
62 { ".m2a", "audio/mpeg" },
63 { ".m1v", "video/mpeg" },
64 { ".m2v", "video/mpeg" },
65 { ".mp2", "audio/mpeg" },
66 { ".mp3", "audio/mpeg" },
67 { ".mpa", "audio/mpeg" },
68 { ".mpg", "video/mpeg" },
69 { ".mpeg", "video/mpeg" },
70 { ".mpe", "video/mpeg" },
71 { ".mov", "video/quicktime" },
72 { ".moov", "video/quicktime" },
73 { ".oga", "audio/ogg" },
74 { ".ogg", "application/ogg" },
75 { ".ogm", "application/ogg" },
76 { ".ogv", "video/ogg" },
77 { ".ogx", "application/ogg" },
78 { ".opus", "audio/ogg; codecs=opus" },
79 { ".spx", "audio/ogg" },
80 { ".wav", "audio/wav" },
81 { ".wma", "audio/x-ms-wma" },
82 { ".wmv", "video/x-ms-wmv" },
83 { ".webm", "video/webm" },
85 /* end */
86 { "", "" }
89 const char *vlc_mime_Ext2Mime( const char *psz_url )
92 char *psz_ext;
94 psz_ext = strrchr( psz_url, '.' );
95 if( psz_ext )
97 int i;
99 for( i = 0; ext_mime[i].psz_ext[0] ; i++ )
101 if( !strcasecmp( ext_mime[i].psz_ext, psz_ext ) )
103 return ext_mime[i].psz_mime;
107 return "application/octet-stream";