2009-05-08 21:51:13 +00:00
|
|
|
/*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2003-01-19 00:21:54 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2007-03-15 18:36:36 +00:00
|
|
|
#include "stream/stream.h"
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "demux.h"
|
2003-01-19 00:21:54 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* An autodetection based on the extension is not a good idea, but we don't care ;-)
|
2009-12-25 08:48:57 +00:00
|
|
|
*
|
2009-12-25 09:03:02 +00:00
|
|
|
* You should not add anything here where autodetection can be easily fixed except in
|
2009-12-25 08:48:57 +00:00
|
|
|
* order to speed up auto-detection, in particular for formats that are often streamed.
|
|
|
|
* In particular you should not normally add any DEMUXER_TYPE_LAVF, adding the
|
2012-11-09 00:06:43 +00:00
|
|
|
* format to preferred_list in demux/demuxer_lavf.c will usually achieve
|
2009-12-25 08:48:57 +00:00
|
|
|
* the same effect in a much more reliable way.
|
2003-01-19 00:21:54 +00:00
|
|
|
*/
|
|
|
|
static struct {
|
2006-07-16 01:40:24 +00:00
|
|
|
const char *extension;
|
2003-01-19 00:21:54 +00:00
|
|
|
int demuxer_type;
|
|
|
|
} extensions_table[] = {
|
2003-01-19 00:40:48 +00:00
|
|
|
{ "vob", DEMUXER_TYPE_MPEG_PS },
|
|
|
|
{ "m2v", DEMUXER_TYPE_MPEG_PS },
|
2003-01-19 00:21:54 +00:00
|
|
|
{ "avi", DEMUXER_TYPE_AVI },
|
|
|
|
{ "asx", DEMUXER_TYPE_ASF },
|
|
|
|
{ "asf", DEMUXER_TYPE_ASF },
|
|
|
|
{ "wmv", DEMUXER_TYPE_ASF },
|
|
|
|
{ "wma", DEMUXER_TYPE_ASF },
|
2012-08-18 09:13:58 +00:00
|
|
|
{ "rm", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "rmvb", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "ra", DEMUXER_TYPE_LAVF },
|
2003-01-19 00:21:54 +00:00
|
|
|
{ "y4m", DEMUXER_TYPE_Y4M },
|
2012-08-18 09:13:58 +00:00
|
|
|
{ "mp3", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "wav", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "flac", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "fla", DEMUXER_TYPE_LAVF },
|
2012-07-30 16:40:46 +00:00
|
|
|
{ "ogg", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "ogm", DEMUXER_TYPE_LAVF },
|
2003-01-28 01:18:43 +00:00
|
|
|
// { "pls", DEMUXER_TYPE_PLAYLIST },
|
|
|
|
// { "m3u", DEMUXER_TYPE_PLAYLIST },
|
2012-07-30 16:40:46 +00:00
|
|
|
{ "xm", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "mod", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "s3m", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "it", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "mid", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "midi", DEMUXER_TYPE_LAVF },
|
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 },
|
2008-07-30 12:01:30 +00:00
|
|
|
#ifdef CONFIG_WIN32DLL
|
2005-02-13 13:39:19 +00:00
|
|
|
{ "avs", DEMUXER_TYPE_AVS },
|
|
|
|
#endif
|
2005-09-02 19:31:29 +00:00
|
|
|
{ "302", DEMUXER_TYPE_LAVF },
|
2012-07-30 16:40:46 +00:00
|
|
|
{ "264", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "26l", DEMUXER_TYPE_LAVF },
|
2006-10-08 12:19:08 +00:00
|
|
|
{ "ac3", DEMUXER_TYPE_LAVF },
|
2007-09-13 17:06:36 +00:00
|
|
|
{ "ape", DEMUXER_TYPE_LAVF },
|
|
|
|
{ "apl", DEMUXER_TYPE_LAVF },
|
2008-09-01 22:37:50 +00:00
|
|
|
{ "eac3",DEMUXER_TYPE_LAVF },
|
2007-09-13 17:06:36 +00:00
|
|
|
{ "mac", DEMUXER_TYPE_LAVF },
|
2008-06-24 12:15:31 +00:00
|
|
|
{ "str", DEMUXER_TYPE_LAVF },
|
2009-12-24 18:20:03 +00:00
|
|
|
{ "cdg", DEMUXER_TYPE_LAVF },
|
2007-04-07 17:41:17 +00:00
|
|
|
|
|
|
|
// At least the following are hacks against broken autodetection
|
|
|
|
// that should not be there
|
|
|
|
|
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;
|
|
|
|
}
|