Mercurial > mplayer.hg
annotate libmpdemux/extension.c @ 18106:3a34a728fa1b
always cast stream IDs to unsigned before comparing to MAX_STREAMS.
just defining them as unsigned might be a better fix though...
author | reimar |
---|---|
date | Sat, 15 Apr 2006 21:09:29 +0000 |
parents | 65530e552f6f |
children | da91dc728556 |
rev | line source |
---|---|
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
1 |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
2 #include <stdio.h> |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
3 #include <stdlib.h> |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
4 #include <string.h> |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
5 |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
6 #include "config.h" |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
7 |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
8 #include "stream.h" |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
9 #include "demuxer.h" |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
10 |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
11 /* |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
12 * An autodetection based on the extension is not a good idea, but we don't care ;-) |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
13 */ |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
14 static struct { |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
15 char *extension; |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
16 int demuxer_type; |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
17 } extensions_table[] = { |
9134
f033fdd54da3
- mpeg extensions removed, it causes misdetction of renamed avi/asf files
arpi
parents:
9079
diff
changeset
|
18 // { "mpeg", DEMUXER_TYPE_MPEG_PS }, |
f033fdd54da3
- mpeg extensions removed, it causes misdetction of renamed avi/asf files
arpi
parents:
9079
diff
changeset
|
19 // { "mpg", DEMUXER_TYPE_MPEG_PS }, |
f033fdd54da3
- mpeg extensions removed, it causes misdetction of renamed avi/asf files
arpi
parents:
9079
diff
changeset
|
20 // { "mpe", DEMUXER_TYPE_MPEG_PS }, |
9008 | 21 { "vob", DEMUXER_TYPE_MPEG_PS }, |
22 { "m2v", DEMUXER_TYPE_MPEG_PS }, | |
16310
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
15061
diff
changeset
|
23 { "gxf", DEMUXER_TYPE_MPEG_GXF }, |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
24 { "avi", DEMUXER_TYPE_AVI }, |
9134
f033fdd54da3
- mpeg extensions removed, it causes misdetction of renamed avi/asf files
arpi
parents:
9079
diff
changeset
|
25 { "mp4", DEMUXER_TYPE_MOV }, |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
26 { "mov", DEMUXER_TYPE_MOV }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
27 { "qt", DEMUXER_TYPE_MOV }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
28 { "asx", DEMUXER_TYPE_ASF }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
29 { "asf", DEMUXER_TYPE_ASF }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
30 { "wmv", DEMUXER_TYPE_ASF }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
31 { "wma", DEMUXER_TYPE_ASF }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
32 { "viv", DEMUXER_TYPE_VIVO }, |
9008 | 33 { "vivo", DEMUXER_TYPE_VIVO }, |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
34 { "rm", DEMUXER_TYPE_REAL }, |
9008 | 35 { "rmvb", DEMUXER_TYPE_REAL }, |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
36 { "ra", DEMUXER_TYPE_REAL }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
37 { "y4m", DEMUXER_TYPE_Y4M }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
38 { "mp3", DEMUXER_TYPE_AUDIO }, |
9008 | 39 { "wav", DEMUXER_TYPE_AUDIO }, |
11004 | 40 { "flac", DEMUXER_TYPE_AUDIO }, |
41 { "fla", DEMUXER_TYPE_AUDIO }, | |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
42 { "ogg", DEMUXER_TYPE_OGG }, |
9008 | 43 { "ogm", DEMUXER_TYPE_OGG }, |
9134
f033fdd54da3
- mpeg extensions removed, it causes misdetction of renamed avi/asf files
arpi
parents:
9079
diff
changeset
|
44 // { "pls", DEMUXER_TYPE_PLAYLIST }, |
f033fdd54da3
- mpeg extensions removed, it causes misdetction of renamed avi/asf files
arpi
parents:
9079
diff
changeset
|
45 // { "m3u", DEMUXER_TYPE_PLAYLIST }, |
9008 | 46 { "xm", DEMUXER_TYPE_XMMS }, |
47 { "mod", DEMUXER_TYPE_XMMS }, | |
48 { "s3m", DEMUXER_TYPE_XMMS }, | |
49 { "it", DEMUXER_TYPE_XMMS }, | |
50 { "mid", DEMUXER_TYPE_XMMS }, | |
51 { "midi", DEMUXER_TYPE_XMMS }, | |
12175 | 52 { "vqf", DEMUXER_TYPE_XMMS }, |
12477
1550ef7117c4
Add detection of nsa streamed by aol ultravox server
rtognimp
parents:
12175
diff
changeset
|
53 { "nsv", DEMUXER_TYPE_NSV }, |
13072 | 54 { "nsa", DEMUXER_TYPE_NSV }, |
17580 | 55 { "mpc", DEMUXER_TYPE_MPC }, |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
13072
diff
changeset
|
56 #ifdef USE_WIN32DLL |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
13072
diff
changeset
|
57 { "avs", DEMUXER_TYPE_AVS }, |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
13072
diff
changeset
|
58 #endif |
14751 | 59 { "nut", DEMUXER_TYPE_LAVF }, |
60 { "swf", DEMUXER_TYPE_LAVF }, | |
15035 | 61 { "flv", DEMUXER_TYPE_LAVF }, |
16363 | 62 { "302", DEMUXER_TYPE_LAVF }, |
15035 | 63 { "264", DEMUXER_TYPE_H264_ES }, |
15061 | 64 { "26l", DEMUXER_TYPE_H264_ES }, |
65 { "ac3", DEMUXER_TYPE_LAVF } | |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
66 }; |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
67 |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
68 int demuxer_type_by_filename(char* filename){ |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
69 int i; |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
70 char* extension=strrchr(filename,'.'); |
9079
b1ea14b9694b
cosmetic for 0.90, printf->mp_msg (hm..probably arpi will piss of me?:)
alex
parents:
9008
diff
changeset
|
71 mp_msg(MSGT_OPEN, MSGL_V, "Searching demuxer type for filename %s ext: %s\n",filename,extension); |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
72 if(extension) { |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
73 ++extension; |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
74 // mp_msg(MSGT_CPLAYER,MSGL_DBG2,"Extension: %s\n", extension ); |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
75 // Look for the extension in the extensions table |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
76 for( i=0 ; i<(sizeof(extensions_table)/sizeof(extensions_table[0])) ; i++ ) { |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
77 if( !strcasecmp(extension, extensions_table[i].extension) ) { |
9079
b1ea14b9694b
cosmetic for 0.90, printf->mp_msg (hm..probably arpi will piss of me?:)
alex
parents:
9008
diff
changeset
|
78 mp_msg(MSGT_OPEN, MSGL_V, "Trying demuxer %d based on filename extension\n",extensions_table[i].demuxer_type); |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
79 return extensions_table[i].demuxer_type; |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
80 } |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
81 } |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
82 } |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
83 return DEMUXER_TYPE_UNKNOWN; |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
84 } |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
85 |