Add explanatory comments to the #endif part of multiple inclusion guards.
[mplayer/greg.git] / libmpdemux / extension.c
blob87cc07cc25a354b5b0ea95414d4847735066b58f
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 USE_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 { "mac", DEMUXER_TYPE_LAVF },
66 // At least the following are hacks against broken autodetection
67 // that should not be there
71 int demuxer_type_by_filename(char* filename){
72 int i;
73 char* extension=strrchr(filename,'.');
74 mp_msg(MSGT_OPEN, MSGL_V, "Searching demuxer type for filename %s ext: %s\n",filename,extension);
75 if(extension) {
76 ++extension;
77 // mp_msg(MSGT_CPLAYER,MSGL_DBG2,"Extension: %s\n", extension );
78 // Look for the extension in the extensions table
79 for( i=0 ; i<(sizeof(extensions_table)/sizeof(extensions_table[0])) ; i++ ) {
80 if( !strcasecmp(extension, extensions_table[i].extension) ) {
81 mp_msg(MSGT_OPEN, MSGL_V, "Trying demuxer %d based on filename extension\n",extensions_table[i].demuxer_type);
82 return extensions_table[i].demuxer_type;
86 return DEMUXER_TYPE_UNKNOWN;