Mercurial > mplayer.hg
annotate stream/stream_livedotcom.c @ 26609:d2d9e6b2732f
cosmetics: Fix indentation after last commits.
author | diego |
---|---|
date | Thu, 01 May 2008 17:43:12 +0000 |
parents | c1d17bd6683c |
children |
rev | line source |
---|---|
15585 | 1 |
2 #include "config.h" | |
3 | |
4 #include <unistd.h> | |
5 #include <stdlib.h> | |
6 #include <stdio.h> | |
7 #include <string.h> | |
8 | |
9 #include "stream.h" | |
10 #include "network.h" | |
19312
ab8d6b6deb63
proper inclusion of demuxer.h (including libmpdemux in Makefile only was to make previous split easier)
ben
parents:
19271
diff
changeset
|
11 #include "libmpdemux/demuxer.h" |
15585 | 12 #include "help_mp.h" |
13 | |
14 extern int network_bandwidth; | |
15 | |
16 static int _rtsp_streaming_seek(int fd, off_t pos, streaming_ctrl_t* streaming_ctrl) { | |
17 return -1; // For now, we don't handle RTSP stream seeking | |
18 } | |
19 | |
20 static int rtsp_streaming_start(stream_t* stream) { | |
21 stream->streaming_ctrl->streaming_seek = _rtsp_streaming_seek; | |
22 return 0; | |
23 } | |
24 | |
25 | |
26 static int open_live_rtsp_sip(stream_t *stream,int mode, void* opts, int* file_format) { | |
27 URL_t *url; | |
28 | |
29 stream->streaming_ctrl = streaming_ctrl_new(); | |
30 if( stream->streaming_ctrl==NULL ) { | |
31 return STREAM_ERROR; | |
32 } | |
33 stream->streaming_ctrl->bandwidth = network_bandwidth; | |
34 url = url_new(stream->url); | |
35 stream->streaming_ctrl->url = check4proxies(url); | |
36 //url_free(url); | |
37 | |
16572
56a5f69e9b35
"LIVE.COM Streaming Media" is now called "LIVE555 Streaming Media".
rsf
parents:
15777
diff
changeset
|
38 mp_msg(MSGT_OPEN, MSGL_INFO, "STREAM_LIVE555, URL: %s\n", stream->url); |
15585 | 39 |
40 if(rtsp_streaming_start(stream) < 0) { | |
41 mp_msg(MSGT_NETWORK,MSGL_ERR,"rtsp_streaming_start failed\n"); | |
42 goto fail; | |
43 } | |
44 | |
45 *file_format = DEMUXER_TYPE_RTP; | |
46 stream->type = STREAMTYPE_STREAM; | |
47 return STREAM_OK; | |
48 | |
49 fail: | |
50 streaming_ctrl_free( stream->streaming_ctrl ); | |
51 stream->streaming_ctrl = NULL; | |
52 return STREAM_ERROR; | |
53 } | |
54 | |
55 static int open_live_sdp(stream_t *stream,int mode, void* opts, int* file_format) { | |
17089 | 56 int f; |
15585 | 57 char *filename = stream->url; |
58 off_t len; | |
59 char* sdpDescription; | |
60 ssize_t numBytesRead; | |
61 | |
62 if(strncmp("sdp://",filename,6) == 0) { | |
63 filename += 6; | |
64 #if defined(__CYGWIN__) || defined(__MINGW32__) | |
65 f = open(filename,O_RDONLY|O_BINARY); | |
66 #else | |
67 f = open(filename,O_RDONLY); | |
68 #endif | |
69 if(f < 0) { | |
70 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_FileNotFound,filename); | |
71 return STREAM_ERROR; | |
72 } | |
73 | |
74 len=lseek(f,0,SEEK_END); | |
75 lseek(f,0,SEEK_SET); | |
76 if(len == -1) | |
77 return STREAM_ERROR; | |
18558
4928dd61f136
Fix potential integer overflows in memory allocation.
rtogni
parents:
17089
diff
changeset
|
78 if(len > SIZE_MAX - 1) |
4928dd61f136
Fix potential integer overflows in memory allocation.
rtogni
parents:
17089
diff
changeset
|
79 return STREAM_ERROR; |
15585 | 80 |
19062
83c3afeab35d
drops casts from void * on malloc/calloc from libmpdemux code
reynaldo
parents:
18922
diff
changeset
|
81 sdpDescription = malloc(len+1); |
15585 | 82 if(sdpDescription == NULL) return STREAM_ERROR; |
83 numBytesRead = read(f, sdpDescription, len); | |
84 if(numBytesRead != len) { | |
85 free(sdpDescription); | |
86 return STREAM_ERROR; | |
87 } | |
88 sdpDescription[len] = '\0'; // to be safe | |
89 stream->priv = sdpDescription; | |
90 | |
91 stream->type = STREAMTYPE_SDP; | |
92 *file_format = DEMUXER_TYPE_RTP; | |
93 return STREAM_OK; | |
94 } | |
24257 | 95 return STREAM_UNSUPPORTED; |
15585 | 96 } |
97 | |
98 | |
25211 | 99 const stream_info_t stream_info_rtsp_sip = { |
15777 | 100 "standard RTSP and SIP", |
101 "RTSP and SIP", | |
15585 | 102 "Ross Finlayson", |
16572
56a5f69e9b35
"LIVE.COM Streaming Media" is now called "LIVE555 Streaming Media".
rsf
parents:
15777
diff
changeset
|
103 "Uses LIVE555 Streaming Media library.", |
15585 | 104 open_live_rtsp_sip, |
105 {"rtsp", "sip", NULL }, | |
106 NULL, | |
107 0 // Urls are an option string | |
108 }; | |
109 | |
25211 | 110 const stream_info_t stream_info_sdp = { |
15777 | 111 "SDP stream descriptor", |
112 "SDP", | |
15585 | 113 "Ross Finlayson", |
16572
56a5f69e9b35
"LIVE.COM Streaming Media" is now called "LIVE555 Streaming Media".
rsf
parents:
15777
diff
changeset
|
114 "Uses LIVE555 Streaming Media library.", |
15585 | 115 open_live_sdp, |
116 {"sdp", NULL }, | |
117 NULL, | |
118 0 // Urls are an option string | |
119 }; |