Increase probe buffer size to 32kB, this makes ac3 auto-detection far more reliable.
[mplayer/glamo.git] / libmpdemux / extension.c
blob88cc17f3a7517ee4f389f4cc7a95a45612b92504
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
6 #include "config.h"
8 #include "stream/stream.h"
9 #include "demuxer.h"
12 * An autodetection based on the extension is not a good idea, but we don't care ;-)
14 static struct {
15 const char *extension;
16 int demuxer_type;
17 } extensions_table[] = {
18 // { "mpeg", DEMUXER_TYPE_MPEG_PS },
19 // { "mpg", DEMUXER_TYPE_MPEG_PS },
20 // { "mpe", DEMUXER_TYPE_MPEG_PS },
21 { "vob", DEMUXER_TYPE_MPEG_PS },
22 { "m2v", DEMUXER_TYPE_MPEG_PS },
23 { "avi", DEMUXER_TYPE_AVI },
24 { "mp4", DEMUXER_TYPE_MOV },
25 { "mov", DEMUXER_TYPE_MOV },
26 { "qt", DEMUXER_TYPE_MOV },
27 { "asx", DEMUXER_TYPE_ASF },
28 { "asf", DEMUXER_TYPE_ASF },
29 { "wmv", DEMUXER_TYPE_ASF },
30 { "wma", DEMUXER_TYPE_ASF },
31 { "viv", DEMUXER_TYPE_VIVO },
32 { "vivo", DEMUXER_TYPE_VIVO },
33 { "rm", DEMUXER_TYPE_REAL },
34 { "rmvb", DEMUXER_TYPE_REAL },
35 { "ra", DEMUXER_TYPE_REAL },
36 { "y4m", DEMUXER_TYPE_Y4M },
37 { "mp3", DEMUXER_TYPE_AUDIO },
38 { "wav", DEMUXER_TYPE_AUDIO },
39 { "flac", DEMUXER_TYPE_AUDIO },
40 { "fla", DEMUXER_TYPE_AUDIO },
41 { "ogg", DEMUXER_TYPE_OGG },
42 { "ogm", DEMUXER_TYPE_OGG },
43 // { "pls", DEMUXER_TYPE_PLAYLIST },
44 // { "m3u", DEMUXER_TYPE_PLAYLIST },
45 { "xm", DEMUXER_TYPE_XMMS },
46 { "mod", DEMUXER_TYPE_XMMS },
47 { "s3m", DEMUXER_TYPE_XMMS },
48 { "it", DEMUXER_TYPE_XMMS },
49 { "mid", DEMUXER_TYPE_XMMS },
50 { "midi", DEMUXER_TYPE_XMMS },
51 { "vqf", DEMUXER_TYPE_XMMS },
52 { "nsv", DEMUXER_TYPE_NSV },
53 { "nsa", DEMUXER_TYPE_NSV },
54 { "mpc", DEMUXER_TYPE_MPC },
55 #ifdef CONFIG_WIN32DLL
56 { "avs", DEMUXER_TYPE_AVS },
57 #endif
58 { "302", DEMUXER_TYPE_LAVF },
59 { "264", DEMUXER_TYPE_H264_ES },
60 { "26l", DEMUXER_TYPE_H264_ES },
61 { "ac3", DEMUXER_TYPE_LAVF },
62 { "ape", DEMUXER_TYPE_LAVF },
63 { "apl", DEMUXER_TYPE_LAVF },
64 { "eac3",DEMUXER_TYPE_LAVF },
65 { "mac", DEMUXER_TYPE_LAVF },
66 { "str", DEMUXER_TYPE_LAVF },
68 // At least the following are hacks against broken autodetection
69 // that should not be there
73 int demuxer_type_by_filename(char* filename){
74 int i;
75 char* extension=strrchr(filename,'.');
76 mp_msg(MSGT_OPEN, MSGL_V, "Searching demuxer type for filename %s ext: %s\n",filename,extension);
77 if(extension) {
78 ++extension;
79 // mp_msg(MSGT_CPLAYER,MSGL_DBG2,"Extension: %s\n", extension );
80 // Look for the extension in the extensions table
81 for( i=0 ; i<(sizeof(extensions_table)/sizeof(extensions_table[0])) ; i++ ) {
82 if( !strcasecmp(extension, extensions_table[i].extension) ) {
83 mp_msg(MSGT_OPEN, MSGL_V, "Trying demuxer %d based on filename extension\n",extensions_table[i].demuxer_type);
84 return extensions_table[i].demuxer_type;
88 return DEMUXER_TYPE_UNKNOWN;