2003-01-19 00:21:54 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "stream.h"
|
|
|
|
#include "demuxer.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* An autodetection based on the extension is not a good idea, but we don't care ;-)
|
|
|
|
*/
|
|
|
|
static struct {
|
|
|
|
char *extension;
|
|
|
|
int demuxer_type;
|
|
|
|
} extensions_table[] = {
|
2003-01-28 01:18:43 +00:00
|
|
|
// { "mpeg", DEMUXER_TYPE_MPEG_PS },
|
|
|
|
// { "mpg", DEMUXER_TYPE_MPEG_PS },
|
|
|
|
// { "mpe", DEMUXER_TYPE_MPEG_PS },
|
2003-01-19 00:40:48 +00:00
|
|
|
{ "vob", DEMUXER_TYPE_MPEG_PS },
|
|
|
|
{ "m2v", DEMUXER_TYPE_MPEG_PS },
|
2005-08-26 17:40:02 +00:00
|
|
|
{ "gxf", DEMUXER_TYPE_MPEG_GXF },
|
2003-01-19 00:21:54 +00:00
|
|
|
{ "avi", DEMUXER_TYPE_AVI },
|
2003-01-28 01:18:43 +00:00
|
|
|
{ "mp4", DEMUXER_TYPE_MOV },
|
2003-01-19 00:21:54 +00:00
|
|
|
{ "mov", DEMUXER_TYPE_MOV },
|
|
|
|
{ "qt", DEMUXER_TYPE_MOV },
|
|
|
|
{ "asx", DEMUXER_TYPE_ASF },
|
|
|
|
{ "asf", DEMUXER_TYPE_ASF },
|
|
|
|
{ "wmv", DEMUXER_TYPE_ASF },
|
|
|
|
{ "wma", DEMUXER_TYPE_ASF },
|
|
|
|
{ "viv", DEMUXER_TYPE_VIVO },
|
2003-01-19 00:40:48 +00:00
|
|
|
{ "vivo", DEMUXER_TYPE_VIVO },
|
2003-01-19 00:21:54 +00:00
|
|
|
{ "rm", DEMUXER_TYPE_REAL },
|
2003-01-19 00:40:48 +00:00
|
|
|
{ "rmvb", DEMUXER_TYPE_REAL },
|
2003-01-19 00:21:54 +00:00
|
|
|
{ "ra", DEMUXER_TYPE_REAL },
|
|
|
|
{ "y4m", DEMUXER_TYPE_Y4M },
|
|
|
|
{ "mp3", DEMUXER_TYPE_AUDIO },
|
|
|
|
{ "wav", DEMUXER_TYPE_AUDIO },
|
2003-10-04 22:00:25 +00:00
|
|
|
{ "flac", DEMUXER_TYPE_AUDIO },
|
|
|
|
{ "fla", DEMUXER_TYPE_AUDIO },
|
2003-01-19 00:40:48 +00:00
|
|
|
{ "ogg", DEMUXER_TYPE_OGG },
|
|
|
|
{ "ogm", DEMUXER_TYPE_OGG },
|
2003-01-28 01:18:43 +00:00
|
|
|
// { "pls", DEMUXER_TYPE_PLAYLIST },
|
|
|
|
// { "m3u", DEMUXER_TYPE_PLAYLIST },
|
2003-01-19 00:40:48 +00:00
|
|
|
{ "xm", DEMUXER_TYPE_XMMS },
|
|
|
|
{ "mod", DEMUXER_TYPE_XMMS },
|
|
|
|
{ "s3m", DEMUXER_TYPE_XMMS },
|
|
|
|
{ "it", DEMUXER_TYPE_XMMS },
|
|
|
|
{ "mid", DEMUXER_TYPE_XMMS },
|
|
|
|
{ "midi", DEMUXER_TYPE_XMMS },
|
2004-04-12 14:19:12 +00:00
|
|
|
{ "vqf", DEMUXER_TYPE_XMMS },
|
2004-05-14 23:10:43 +00:00
|
|
|
{ "nsv", DEMUXER_TYPE_NSV },
|
2004-08-21 19:17:17 +00:00
|
|
|
{ "nsa", DEMUXER_TYPE_NSV },
|
2006-02-10 18:18:24 +00:00
|
|
|
{ "mpc", DEMUXER_TYPE_MPC },
|
2005-02-13 13:39:19 +00:00
|
|
|
#ifdef USE_WIN32DLL
|
|
|
|
{ "avs", DEMUXER_TYPE_AVS },
|
|
|
|
#endif
|
2005-02-21 17:36:42 +00:00
|
|
|
{ "nut", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "swf", DEMUXER_TYPE_LAVF },
|
2005-04-01 05:45:55 +00:00
|
|
|
{ "flv", DEMUXER_TYPE_LAVF },
|
2005-09-02 19:31:29 +00:00
|
|
|
{ "302", DEMUXER_TYPE_LAVF },
|
2005-04-01 05:45:55 +00:00
|
|
|
{ "264", DEMUXER_TYPE_H264_ES },
|
2005-04-07 18:59:15 +00:00
|
|
|
{ "26l", DEMUXER_TYPE_H264_ES },
|
|
|
|
{ "ac3", DEMUXER_TYPE_LAVF }
|
2003-01-19 00:21:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int demuxer_type_by_filename(char* filename){
|
|
|
|
int i;
|
|
|
|
char* extension=strrchr(filename,'.');
|
2003-01-24 18:38:54 +00:00
|
|
|
mp_msg(MSGT_OPEN, MSGL_V, "Searching demuxer type for filename %s ext: %s\n",filename,extension);
|
2003-01-19 00:21:54 +00:00
|
|
|
if(extension) {
|
|
|
|
++extension;
|
|
|
|
// mp_msg(MSGT_CPLAYER,MSGL_DBG2,"Extension: %s\n", extension );
|
|
|
|
// Look for the extension in the extensions table
|
|
|
|
for( i=0 ; i<(sizeof(extensions_table)/sizeof(extensions_table[0])) ; i++ ) {
|
|
|
|
if( !strcasecmp(extension, extensions_table[i].extension) ) {
|
2003-01-24 18:38:54 +00:00
|
|
|
mp_msg(MSGT_OPEN, MSGL_V, "Trying demuxer %d based on filename extension\n",extensions_table[i].demuxer_type);
|
2003-01-19 00:21:54 +00:00
|
|
|
return extensions_table[i].demuxer_type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return DEMUXER_TYPE_UNKNOWN;
|
|
|
|
}
|
|
|
|
|