Mercurial > mplayer.hg
annotate libmpdemux/extension.c @ 35418:cedb0ba2b5c6
Move the code to set guiInfo's Track, Chapter and Angle start values.
Set them before checking whether there is any media opened, because
with no media opened we clear the counters.
author | ib |
---|---|
date | Thu, 29 Nov 2012 14:11:03 +0000 |
parents | ef73eb8a2c43 |
children | 389d43c448b3 |
rev | line source |
---|---|
29238
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
1 /* |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
2 * This file is part of MPlayer. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
3 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
7 * (at your option) any later version. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
8 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
12 * GNU General Public License for more details. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
13 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
29141
diff
changeset
|
17 */ |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
18 |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
19 #include <stdio.h> |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
20 #include <stdlib.h> |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
21 #include <string.h> |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
22 |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
23 #include "config.h" |
34174
a93891202051
Add missing mp_msg.h #includes, remove some unnecessary ones.
diego
parents:
30633
diff
changeset
|
24 #include "mp_msg.h" |
22605
4d81dbdf46b9
Add explicit location for headers from the stream/ directory.
diego
parents:
20103
diff
changeset
|
25 #include "stream/stream.h" |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
26 #include "demuxer.h" |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
27 |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
28 /* |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
29 * An autodetection based on the extension is not a good idea, but we don't care ;-) |
30068
124057c64264
Add a (unfortunately rather long) explanation on how and when to use it
reimar
parents:
30067
diff
changeset
|
30 * |
30070 | 31 * You should not add anything here where autodetection can be easily fixed except in |
30068
124057c64264
Add a (unfortunately rather long) explanation on how and when to use it
reimar
parents:
30067
diff
changeset
|
32 * order to speed up auto-detection, in particular for formats that are often streamed. |
124057c64264
Add a (unfortunately rather long) explanation on how and when to use it
reimar
parents:
30067
diff
changeset
|
33 * In particular you should not normally add any DEMUXER_TYPE_LAVF, adding the |
124057c64264
Add a (unfortunately rather long) explanation on how and when to use it
reimar
parents:
30067
diff
changeset
|
34 * format to preferred_list in libmpdemux/demuxer_lavf.c will usually achieve |
124057c64264
Add a (unfortunately rather long) explanation on how and when to use it
reimar
parents:
30067
diff
changeset
|
35 * the same effect in a much more reliable way. |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
36 */ |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
37 static struct { |
19110
08888397444e
marks several strings inside structs as const when they hold just
reynaldo
parents:
18931
diff
changeset
|
38 const char *extension; |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
39 int demuxer_type; |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
40 } extensions_table[] = { |
9134
f033fdd54da3
- mpeg extensions removed, it causes misdetction of renamed avi/asf files
arpi
parents:
9079
diff
changeset
|
41 // { "mpeg", DEMUXER_TYPE_MPEG_PS }, |
f033fdd54da3
- mpeg extensions removed, it causes misdetction of renamed avi/asf files
arpi
parents:
9079
diff
changeset
|
42 // { "mpg", DEMUXER_TYPE_MPEG_PS }, |
f033fdd54da3
- mpeg extensions removed, it causes misdetction of renamed avi/asf files
arpi
parents:
9079
diff
changeset
|
43 // { "mpe", DEMUXER_TYPE_MPEG_PS }, |
9008 | 44 { "vob", DEMUXER_TYPE_MPEG_PS }, |
45 { "m2v", DEMUXER_TYPE_MPEG_PS }, | |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
46 { "avi", DEMUXER_TYPE_AVI }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
47 { "asx", DEMUXER_TYPE_ASF }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
48 { "asf", DEMUXER_TYPE_ASF }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
49 { "wmv", DEMUXER_TYPE_ASF }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
50 { "wma", DEMUXER_TYPE_ASF }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
51 { "viv", DEMUXER_TYPE_VIVO }, |
9008 | 52 { "vivo", DEMUXER_TYPE_VIVO }, |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
53 { "rm", DEMUXER_TYPE_REAL }, |
9008 | 54 { "rmvb", DEMUXER_TYPE_REAL }, |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
55 { "ra", DEMUXER_TYPE_REAL }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
56 { "y4m", DEMUXER_TYPE_Y4M }, |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
57 { "mp3", DEMUXER_TYPE_AUDIO }, |
9008 | 58 { "wav", DEMUXER_TYPE_AUDIO }, |
11004 | 59 { "flac", DEMUXER_TYPE_AUDIO }, |
60 { "fla", DEMUXER_TYPE_AUDIO }, | |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
61 { "ogg", DEMUXER_TYPE_OGG }, |
9008 | 62 { "ogm", DEMUXER_TYPE_OGG }, |
9134
f033fdd54da3
- mpeg extensions removed, it causes misdetction of renamed avi/asf files
arpi
parents:
9079
diff
changeset
|
63 // { "pls", DEMUXER_TYPE_PLAYLIST }, |
f033fdd54da3
- mpeg extensions removed, it causes misdetction of renamed avi/asf files
arpi
parents:
9079
diff
changeset
|
64 // { "m3u", DEMUXER_TYPE_PLAYLIST }, |
9008 | 65 { "xm", DEMUXER_TYPE_XMMS }, |
66 { "mod", DEMUXER_TYPE_XMMS }, | |
67 { "s3m", DEMUXER_TYPE_XMMS }, | |
68 { "it", DEMUXER_TYPE_XMMS }, | |
69 { "mid", DEMUXER_TYPE_XMMS }, | |
70 { "midi", DEMUXER_TYPE_XMMS }, | |
12477
1550ef7117c4
Add detection of nsa streamed by aol ultravox server
rtognimp
parents:
12175
diff
changeset
|
71 { "nsv", DEMUXER_TYPE_NSV }, |
13072 | 72 { "nsa", DEMUXER_TYPE_NSV }, |
17580 | 73 { "mpc", DEMUXER_TYPE_MPC }, |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27101
diff
changeset
|
74 #ifdef CONFIG_WIN32DLL |
14693
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
13072
diff
changeset
|
75 { "avs", DEMUXER_TYPE_AVS }, |
37116118ab6a
avisynth demuxer patch by Gianluigi Tiesi <mplayer at netfarm.it>
faust3
parents:
13072
diff
changeset
|
76 #endif |
16363 | 77 { "302", DEMUXER_TYPE_LAVF }, |
15035 | 78 { "264", DEMUXER_TYPE_H264_ES }, |
15061 | 79 { "26l", DEMUXER_TYPE_H264_ES }, |
20103
9c7de33d0e17
WavPack files contain a complete, valid RIFF tag, so use extension (.wv)
reimar
parents:
19924
diff
changeset
|
80 { "ac3", DEMUXER_TYPE_LAVF }, |
24429
73bcf011f744
added monkey audio file extensions to extension table
ben
parents:
22972
diff
changeset
|
81 { "ape", DEMUXER_TYPE_LAVF }, |
73bcf011f744
added monkey audio file extensions to extension table
ben
parents:
22972
diff
changeset
|
82 { "apl", DEMUXER_TYPE_LAVF }, |
27482 | 83 { "eac3",DEMUXER_TYPE_LAVF }, |
24429
73bcf011f744
added monkey audio file extensions to extension table
ben
parents:
22972
diff
changeset
|
84 { "mac", DEMUXER_TYPE_LAVF }, |
27101 | 85 { "str", DEMUXER_TYPE_LAVF }, |
30067
1957c654b56d
force cdg to lavf demuxer in extensions.c, misdetected as mpeg otherwise
compn
parents:
29613
diff
changeset
|
86 { "cdg", DEMUXER_TYPE_LAVF }, |
35141 | 87 { "tak", DEMUXER_TYPE_LAVF }, |
22920
320d9b360a3b
Start to separate bad-autodetection hacks from other stuff in extension-based
reimar
parents:
22919
diff
changeset
|
88 |
320d9b360a3b
Start to separate bad-autodetection hacks from other stuff in extension-based
reimar
parents:
22919
diff
changeset
|
89 // At least the following are hacks against broken autodetection |
320d9b360a3b
Start to separate bad-autodetection hacks from other stuff in extension-based
reimar
parents:
22919
diff
changeset
|
90 // that should not be there |
320d9b360a3b
Start to separate bad-autodetection hacks from other stuff in extension-based
reimar
parents:
22919
diff
changeset
|
91 |
9006
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
92 }; |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
93 |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
94 int demuxer_type_by_filename(char* filename){ |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
95 int i; |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
96 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
|
97 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
|
98 if(extension) { |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
99 ++extension; |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
100 // 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
|
101 // Look for the extension in the extensions table |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
102 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
|
103 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
|
104 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
|
105 return extensions_table[i].demuxer_type; |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
106 } |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
107 } |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
108 } |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
109 return DEMUXER_TYPE_UNKNOWN; |
d00997f12257
extension-based filetype detection for headerless files (mp3 vs mpeg, etc)
arpi
parents:
diff
changeset
|
110 } |