annotate stream/open.c @ 35410:1c991ec0e6da

Change declaration to use proper type to avoid a ridiculous number of casts.
author reimar
date Wed, 28 Nov 2012 19:43:03 +0000
parents ade40c1d69b8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30426
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
1 /*
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
2 * This file is part of MPlayer.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
3 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
5 * it under the terms of the GNU General Public License as published by
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
7 * (at your option) any later version.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
8 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
12 * GNU General Public License for more details.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
13 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
14 * You should have received a copy of the GNU General Public License along
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
17 */
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
18
4343
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
19 #include <ctype.h>
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
20 #include <stdio.h>
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
21 #include <stdlib.h>
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
22 #include <string.h>
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
23 #include <unistd.h>
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
24 #include <fcntl.h>
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
25 #include <string.h>
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
26
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
27 #include "config.h"
1567
5c7760aa4f94 printf->mp_msg/mp_dbg
arpi
parents: 1482
diff changeset
28 #include "mp_msg.h"
1584
e49b3927c793 more messages for translator :)
arpi
parents: 1567
diff changeset
29 #include "help_mp.h"
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
30
1468
fbed9c34069c freebsd fix
arpi
parents: 1467
diff changeset
31 #ifdef __FreeBSD__
fbed9c34069c freebsd fix
arpi
parents: 1467
diff changeset
32 #include <sys/cdrio.h>
fbed9c34069c freebsd fix
arpi
parents: 1467
diff changeset
33 #endif
fbed9c34069c freebsd fix
arpi
parents: 1467
diff changeset
34
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 15585
diff changeset
35 #include "m_option.h"
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
36 #include "stream.h"
19312
ab8d6b6deb63 proper inclusion of demuxer.h (including libmpdemux in Makefile only was to make previous split easier)
ben
parents: 19271
diff changeset
37 #include "libmpdemux/demuxer.h"
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
38
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
39
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
40 /// We keep these 2 for the gui atm, but they will be removed.
4222
de7eddb3fd70 Change to use cdrom-device and dvd-device options needed for DVD/TV/VCD
albeu
parents: 4146
diff changeset
41 char* cdrom_device=NULL;
17191
6ac0b5f0d1ed fix compilation when dvdkit and dvdread are not available
nicodvb
parents: 17012
diff changeset
42 int dvd_chapter=1;
6ac0b5f0d1ed fix compilation when dvdkit and dvdread are not available
nicodvb
parents: 17012
diff changeset
43 int dvd_last_chapter=0;
6ac0b5f0d1ed fix compilation when dvdkit and dvdread are not available
nicodvb
parents: 17012
diff changeset
44 char* dvd_device=NULL;
32326
4189a8951568 Use bluray_device variable also for bd:// instead of dvd_device
reimar
parents: 31871
diff changeset
45 char *bluray_device=NULL;
5380
8a01cde9cf39 DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents: 4729
diff changeset
46
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
47 // Open a new stream (stdin/file/vcd/url)
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
48
30697
9a49143918aa Mark stream open filename parameter as const, the filename string is not
reimar
parents: 30633
diff changeset
49 stream_t* open_stream(const char* filename,char** options, int* file_format){
31871
c3775dbb8509 Simplify code: allow file_format argument to open_stream to be NULL.
reimar
parents: 30697
diff changeset
50 int dummy = DEMUXER_TYPE_UNKNOWN;
c3775dbb8509 Simplify code: allow file_format argument to open_stream to be NULL.
reimar
parents: 30697
diff changeset
51 if (!file_format) file_format = &dummy;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 19312
diff changeset
52 // Check if playlist or unknown
12223
e7c8200ffdc5 Respect -playlist for asx streams
rtognimp
parents: 10807
diff changeset
53 if (*file_format != DEMUXER_TYPE_PLAYLIST){
e7c8200ffdc5 Respect -playlist for asx streams
rtognimp
parents: 10807
diff changeset
54 *file_format=DEMUXER_TYPE_UNKNOWN;
e7c8200ffdc5 Respect -playlist for asx streams
rtognimp
parents: 10807
diff changeset
55 }
e7c8200ffdc5 Respect -playlist for asx streams
rtognimp
parents: 10807
diff changeset
56
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
57 if(!filename) {
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
58 mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n");
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
59 return NULL;
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
60 }
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
61
6320
12136df07dbd common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents: 5932
diff changeset
62 //============ Open STDIN or plain FILE ============
6910
1a747aee653b applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents: 6853
diff changeset
63
9795
20f8944a6e0c Remove -sdp
albeu
parents: 9773
diff changeset
64 return open_stream_full(filename,STREAM_READ,options,file_format);
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
65 }