Mercurial > mplayer.hg
annotate libmpdemux/open.c @ 15553:43af13780751
Speedup asf descrambling (avoid one memcpy and use our fastmemcpy).
author | reimar |
---|---|
date | Mon, 23 May 2005 16:20:46 +0000 |
parents | 2c5186ed83b9 |
children | 281d155fb37f |
rev | line source |
---|---|
1467 | 1 |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
2 #include <ctype.h> |
1467 | 3 #include <stdio.h> |
4 #include <stdlib.h> | |
5 #include <string.h> | |
6 #include <unistd.h> | |
7 #include <fcntl.h> | |
9746 | 8 #include <string.h> |
1467 | 9 |
10 #include "config.h" | |
1567 | 11 #include "mp_msg.h" |
1584 | 12 #include "help_mp.h" |
1467 | 13 |
1468 | 14 #ifdef __FreeBSD__ |
15 #include <sys/cdrio.h> | |
16 #endif | |
17 | |
10594
57bdcdb061d7
Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents:
10560
diff
changeset
|
18 #include "../m_option.h" |
1467 | 19 #include "stream.h" |
1482 | 20 #include "demuxer.h" |
4551 | 21 #include "mf.h" |
1467 | 22 |
10121
d42177a0da2a
Changed the STREAMING defines to MPLAYER_NETWORK to avoid name definition clash.
bertrand
parents:
10067
diff
changeset
|
23 #ifdef MPLAYER_NETWORK |
1467 | 24 #include "url.h" |
25 #include "network.h" | |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7854
diff
changeset
|
26 extern int streaming_start( stream_t *stream, int *demuxer_type, URL_t *url); |
6910
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
6853
diff
changeset
|
27 #ifdef STREAMING_LIVE_DOT_COM |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
6853
diff
changeset
|
28 #include "demux_rtp.h" |
1a747aee653b
applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents:
6853
diff
changeset
|
29 #endif |
1467 | 30 static URL_t* url; |
31 #endif | |
32 | |
9746 | 33 /// We keep these 2 for the gui atm, but they will be removed. |
15484 | 34 int vcd_track=0; |
4222
de7eddb3fd70
Change to use cdrom-device and dvd-device options needed for DVD/TV/VCD
albeu
parents:
4146
diff
changeset
|
35 char* cdrom_device=NULL; |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
36 |
1467 | 37 // Open a new stream (stdin/file/vcd/url) |
38 | |
9795 | 39 stream_t* open_stream(char* filename,char** options, int* file_format){ |
1467 | 40 stream_t* stream=NULL; |
41 int f=-1; | |
42 off_t len; | |
12223 | 43 |
44 // Check if playlist or unknown | |
45 if (*file_format != DEMUXER_TYPE_PLAYLIST){ | |
46 *file_format=DEMUXER_TYPE_UNKNOWN; | |
47 } | |
48 | |
9746 | 49 if(!filename) { |
50 mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n"); | |
51 return NULL; | |
52 } | |
1467 | 53 |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
8712
diff
changeset
|
54 |
10121
d42177a0da2a
Changed the STREAMING defines to MPLAYER_NETWORK to avoid name definition clash.
bertrand
parents:
10067
diff
changeset
|
55 #ifdef MPLAYER_NETWORK |
9878
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
56 #ifdef STREAMING_LIVE_DOT_COM |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
57 // Check for a SDP file: |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
58 if (strncmp("sdp://",filename,6) == 0) { |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
59 filename += 6; |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
60 #if defined(__CYGWIN__) || defined(__MINGW32__) |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
61 f=open(filename,O_RDONLY|O_BINARY); |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
62 #else |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
63 f=open(filename,O_RDONLY); |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
64 #endif |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
65 if(f<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_FileNotFound,filename);return NULL; } |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
66 |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
67 len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET); |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
68 if (len == -1) |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
69 return NULL; |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
70 |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
71 #ifdef _LARGEFILE_SOURCE |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
72 mp_msg(MSGT_OPEN,MSGL_V,"File size is %lld bytes\n", (long long)len); |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
73 #else |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
74 mp_msg(MSGT_OPEN,MSGL_V,"File size is %u bytes\n", (unsigned int)len); |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
75 #endif |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
76 return stream_open_sdp(f, len, file_format); |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
77 } |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
78 #endif |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
79 |
10697
f0cddd635519
added a workaround to get rid of 'Unable to open URL: mf://*.jpg' and such nonsense (tv,mf,vcd)
alex
parents:
10601
diff
changeset
|
80 // FIXME: to avoid nonsense error messages... |
f0cddd635519
added a workaround to get rid of 'Unable to open URL: mf://*.jpg' and such nonsense (tv,mf,vcd)
alex
parents:
10601
diff
changeset
|
81 if (strncmp("tv://", filename, 5) && strncmp("mf://", filename, 5) && |
10735
8a10d5d0ce86
serious bugs - 1l absinth (changed to absinth against cola inflation)
alex
parents:
10697
diff
changeset
|
82 strncmp("vcd://", filename, 6) && strncmp("dvb://", filename, 6) && |
10807
fb66c426cd91
cdda && cddb aren't uris too (hopefully all the pseudo urls are catched before url_new())
alex
parents:
10735
diff
changeset
|
83 strncmp("cdda://", filename, 7) && strncmp("cddb://", filename, 7) && |
14836
8b9738526dd7
added a stream module for the vstream client library
joey
parents:
14092
diff
changeset
|
84 strncmp("mpst://", filename, 7) && strncmp("tivo://", filename, 7) && |
15476
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
15452
diff
changeset
|
85 strncmp("file://", filename, 7) && strncmp("cue://", filename, 6) && |
15520 | 86 strncmp("ftp://", filename, 6) && strncmp("smb://", filename, 6) && |
15518 | 87 strncmp("dvd://", filename, 6) && strncmp("dvdnav://", filename, 9) && |
12270 | 88 strstr(filename, "://")) { |
12391 | 89 url = url_new(filename); |
12270 | 90 } |
1467 | 91 if(url) { |
4251
05affdf4bdcd
Moved network related code from open.c to network.c
bertrand
parents:
4222
diff
changeset
|
92 stream=new_stream(f,STREAMTYPE_STREAM); |
4729
f51bd827ed1c
fixed MP3 ICY detection, return detected file format for open_stream
alex
parents:
4551
diff
changeset
|
93 if( streaming_start( stream, file_format, url )<0){ |
4251
05affdf4bdcd
Moved network related code from open.c to network.c
bertrand
parents:
4222
diff
changeset
|
94 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_UnableOpenURL, filename); |
12269 | 95 url_free(url); |
12571 | 96 url = NULL; |
12269 | 97 return NULL; |
9795 | 98 } else { |
1584 | 99 mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_ConnToServer, url->hostname ); |
3045
6c14fd789ba5
Changed the order of processing the network opening.
bertrand
parents:
2935
diff
changeset
|
100 url_free(url); |
12571 | 101 url = NULL; |
2315 | 102 return stream; |
12412 | 103 } |
1467 | 104 } |
9878
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
105 #endif |
1467 | 106 |
6320
12136df07dbd
common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents:
5932
diff
changeset
|
107 //============ 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
|
108 |
9795 | 109 return open_stream_full(filename,STREAM_READ,options,file_format); |
1467 | 110 } |
1596 | 111 |