2010-01-30 22:26:47 +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.
|
|
|
|
*/
|
2001-08-09 01:17:24 +00:00
|
|
|
|
2002-01-24 23:02:59 +00:00
|
|
|
#include <ctype.h>
|
2001-08-09 01:17:24 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
2003-03-30 17:07:31 +00:00
|
|
|
#include <string.h>
|
2001-08-09 01:17:24 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
2001-08-17 00:40:25 +00:00
|
|
|
#include "mp_msg.h"
|
2001-08-09 01:17:24 +00:00
|
|
|
|
2001-08-09 15:47:40 +00:00
|
|
|
#ifdef __FreeBSD__
|
|
|
|
#include <sys/cdrio.h>
|
|
|
|
#endif
|
|
|
|
|
2005-11-18 14:39:25 +00:00
|
|
|
#include "m_option.h"
|
2001-08-09 01:17:24 +00:00
|
|
|
#include "stream.h"
|
2006-08-04 17:01:29 +00:00
|
|
|
#include "libmpdemux/demuxer.h"
|
2001-08-09 01:17:24 +00:00
|
|
|
|
|
|
|
|
2003-03-30 17:07:31 +00:00
|
|
|
/// We keep these 2 for the gui atm, but they will be removed.
|
2005-05-15 20:52:06 +00:00
|
|
|
int vcd_track=0;
|
2002-01-17 20:40:07 +00:00
|
|
|
char* cdrom_device=NULL;
|
2005-12-14 21:52:41 +00:00
|
|
|
char* dvd_device=NULL;
|
|
|
|
int dvd_title=0;
|
2002-03-28 20:40:21 +00:00
|
|
|
|
2001-08-09 01:17:24 +00:00
|
|
|
// Open a new stream (stdin/file/vcd/url)
|
|
|
|
|
2010-03-09 23:46:46 +00:00
|
|
|
stream_t* open_stream(const char *filename, struct MPOpts *options,
|
|
|
|
int *file_format)
|
2008-04-23 03:35:36 +00:00
|
|
|
{
|
2010-08-10 13:23:04 +00:00
|
|
|
if (!file_format)
|
|
|
|
file_format = &(int){DEMUXER_TYPE_UNKNOWN};
|
2009-07-06 23:26:13 +00:00
|
|
|
// Check if playlist or unknown
|
2004-04-17 16:46:41 +00:00
|
|
|
if (*file_format != DEMUXER_TYPE_PLAYLIST){
|
|
|
|
*file_format=DEMUXER_TYPE_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2003-03-30 17:07:31 +00:00
|
|
|
if(!filename) {
|
|
|
|
mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
2001-08-09 01:17:24 +00:00
|
|
|
|
2003-04-08 05:14:43 +00:00
|
|
|
//============ Open STDIN or plain FILE ============
|
2002-08-05 00:39:07 +00:00
|
|
|
|
2003-04-02 16:26:58 +00:00
|
|
|
return open_stream_full(filename,STREAM_READ,options,file_format);
|
2001-08-09 01:17:24 +00:00
|
|
|
}
|