Mercurial > mplayer.hg
annotate stream/stream_live555.c @ 33634:9326f80e0fa3
Italian manual page update
patch by skizzhg, skizzhg gmx com
author | diego |
---|---|
date | Sat, 25 Jun 2011 00:36:52 +0000 |
parents | 9494acd724a9 |
children | a93891202051 |
rev | line source |
---|---|
30426
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29889
diff
changeset
|
1 /* |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29889
diff
changeset
|
2 * This file is part of MPlayer. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29889
diff
changeset
|
3 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29889
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:
29889
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:
29889
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:
29889
diff
changeset
|
7 * (at your option) any later version. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29889
diff
changeset
|
8 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29889
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:
29889
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:
29889
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:
29889
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:
29889
diff
changeset
|
13 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29889
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:
29889
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:
29889
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:
29889
diff
changeset
|
17 */ |
27167
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
18 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
19 #include "config.h" |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
20 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
21 #include <unistd.h> |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
22 #include <stdlib.h> |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
23 #include <stdio.h> |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
24 #include <string.h> |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
25 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
26 #include "stream.h" |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
27 #include "network.h" |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
28 #include "libmpdemux/demuxer.h" |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
29 #include "help_mp.h" |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
30 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
31 static int _rtsp_streaming_seek(int fd, off_t pos, streaming_ctrl_t* streaming_ctrl) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
32 return -1; // For now, we don't handle RTSP stream seeking |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
33 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
34 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
35 static int rtsp_streaming_start(stream_t* stream) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
36 stream->streaming_ctrl->streaming_seek = _rtsp_streaming_seek; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
37 return 0; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
38 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
39 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
40 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
41 static int open_live_rtsp_sip(stream_t *stream,int mode, void* opts, int* file_format) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
42 URL_t *url; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
43 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
44 stream->streaming_ctrl = streaming_ctrl_new(); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
45 if( stream->streaming_ctrl==NULL ) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
46 return STREAM_ERROR; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
47 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
48 stream->streaming_ctrl->bandwidth = network_bandwidth; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
49 url = url_new(stream->url); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
50 stream->streaming_ctrl->url = check4proxies(url); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
51 //url_free(url); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
52 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
53 mp_msg(MSGT_OPEN, MSGL_INFO, "STREAM_LIVE555, URL: %s\n", stream->url); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
54 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
55 if(rtsp_streaming_start(stream) < 0) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
56 mp_msg(MSGT_NETWORK,MSGL_ERR,"rtsp_streaming_start failed\n"); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
57 goto fail; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
58 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
59 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
60 *file_format = DEMUXER_TYPE_RTP; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
61 stream->type = STREAMTYPE_STREAM; |
29889 | 62 stream->flags = STREAM_NON_CACHEABLE; |
27167
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
63 return STREAM_OK; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
64 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
65 fail: |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
66 streaming_ctrl_free( stream->streaming_ctrl ); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
67 stream->streaming_ctrl = NULL; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
68 return STREAM_ERROR; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
69 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
70 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
71 static int open_live_sdp(stream_t *stream,int mode, void* opts, int* file_format) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
72 int f; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
73 char *filename = stream->url; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
74 off_t len; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
75 char* sdpDescription; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
76 ssize_t numBytesRead; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
77 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
78 if(strncmp("sdp://",filename,6) == 0) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
79 filename += 6; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
80 f = open(filename,O_RDONLY|O_BINARY); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
81 if(f < 0) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
82 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_FileNotFound,filename); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
83 return STREAM_ERROR; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
84 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
85 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27167
diff
changeset
|
86 len=lseek(f,0,SEEK_END); |
27167
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
87 lseek(f,0,SEEK_SET); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
88 if(len == -1) |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
89 return STREAM_ERROR; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
90 if(len > SIZE_MAX - 1) |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
91 return STREAM_ERROR; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
92 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
93 sdpDescription = malloc(len+1); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
94 if(sdpDescription == NULL) return STREAM_ERROR; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
95 numBytesRead = read(f, sdpDescription, len); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
96 if(numBytesRead != len) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
97 free(sdpDescription); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
98 return STREAM_ERROR; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
99 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
100 sdpDescription[len] = '\0'; // to be safe |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
101 stream->priv = sdpDescription; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
102 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
103 stream->type = STREAMTYPE_SDP; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
104 *file_format = DEMUXER_TYPE_RTP; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
105 return STREAM_OK; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
106 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
107 return STREAM_UNSUPPORTED; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
108 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
109 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
110 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
111 const stream_info_t stream_info_rtsp_sip = { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
112 "standard RTSP and SIP", |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
113 "RTSP and SIP", |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
114 "Ross Finlayson", |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
115 "Uses LIVE555 Streaming Media library.", |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
116 open_live_rtsp_sip, |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
117 {"rtsp", "sip", NULL }, |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
118 NULL, |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
119 0 // Urls are an option string |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
120 }; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
121 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
122 const stream_info_t stream_info_sdp = { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
123 "SDP stream descriptor", |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
124 "SDP", |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
125 "Ross Finlayson", |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
126 "Uses LIVE555 Streaming Media library.", |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
127 open_live_sdp, |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
128 {"sdp", NULL }, |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
129 NULL, |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
130 0 // Urls are an option string |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
131 }; |