Merge svn changes up to r30475
[mplayer/glamo.git] / stream / open.c
blob77157aff5a6f6b86847ec1af4a65e6eb83a696a1
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include <ctype.h>
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 #include <unistd.h>
24 #include <fcntl.h>
25 #include <string.h>
27 #include "config.h"
28 #include "mp_msg.h"
29 #include "help_mp.h"
31 #ifdef __FreeBSD__
32 #include <sys/cdrio.h>
33 #endif
35 #include "m_option.h"
36 #include "stream.h"
37 #include "libmpdemux/demuxer.h"
40 /// We keep these 2 for the gui atm, but they will be removed.
41 int vcd_track=0;
42 char* cdrom_device=NULL;
43 int dvd_chapter=1;
44 int dvd_last_chapter=0;
45 char* dvd_device=NULL;
46 int dvd_title=0;
48 // Open a new stream (stdin/file/vcd/url)
50 stream_t* open_stream(char* filename, struct MPOpts *options, int* file_format)
52 // Check if playlist or unknown
53 if (*file_format != DEMUXER_TYPE_PLAYLIST){
54 *file_format=DEMUXER_TYPE_UNKNOWN;
57 if(!filename) {
58 mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n");
59 return NULL;
62 //============ Open STDIN or plain FILE ============
64 return open_stream_full(filename,STREAM_READ,options,file_format);