Mercurial > mplayer.hg
annotate stream/stream_live555.c @ 30109:0f25d3062987
First steps to supporting different YUV->RGB conversion definitions.
The numbers are possibly still wrong though.
author | reimar |
---|---|
date | Thu, 31 Dec 2009 19:59:58 +0000 |
parents | 031fd59bcb79 |
children | ce0122361a39 |
rev | line source |
---|---|
27167
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
1 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
2 #include "config.h" |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
3 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
4 #include <unistd.h> |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
5 #include <stdlib.h> |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
6 #include <stdio.h> |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
7 #include <string.h> |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
8 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
9 #include "stream.h" |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
10 #include "network.h" |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
11 #include "libmpdemux/demuxer.h" |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
12 #include "help_mp.h" |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
13 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
14 extern int network_bandwidth; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
15 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
16 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
|
17 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
|
18 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
19 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
20 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
|
21 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
|
22 return 0; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
23 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
24 |
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 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
|
27 URL_t *url; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
28 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
29 stream->streaming_ctrl = streaming_ctrl_new(); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
30 if( stream->streaming_ctrl==NULL ) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
31 return STREAM_ERROR; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
32 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
33 stream->streaming_ctrl->bandwidth = network_bandwidth; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
34 url = url_new(stream->url); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
35 stream->streaming_ctrl->url = check4proxies(url); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
36 //url_free(url); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
37 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
38 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
|
39 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
40 if(rtsp_streaming_start(stream) < 0) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
41 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
|
42 goto fail; |
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 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
45 *file_format = DEMUXER_TYPE_RTP; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
46 stream->type = STREAMTYPE_STREAM; |
29889 | 47 stream->flags = STREAM_NON_CACHEABLE; |
27167
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
48 return STREAM_OK; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
49 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
50 fail: |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
51 streaming_ctrl_free( stream->streaming_ctrl ); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
52 stream->streaming_ctrl = NULL; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
53 return STREAM_ERROR; |
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 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
56 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
|
57 int f; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
58 char *filename = stream->url; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
59 off_t len; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
60 char* sdpDescription; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
61 ssize_t numBytesRead; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
62 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
63 if(strncmp("sdp://",filename,6) == 0) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
64 filename += 6; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
65 #if defined(__CYGWIN__) || defined(__MINGW32__) |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
66 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
|
67 #else |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
68 f = open(filename,O_RDONLY); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
69 #endif |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
70 if(f < 0) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
71 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
|
72 return STREAM_ERROR; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
73 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
74 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27167
diff
changeset
|
75 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
|
76 lseek(f,0,SEEK_SET); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
77 if(len == -1) |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
78 return STREAM_ERROR; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
79 if(len > SIZE_MAX - 1) |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
80 return STREAM_ERROR; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
81 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
82 sdpDescription = malloc(len+1); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
83 if(sdpDescription == NULL) return STREAM_ERROR; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
84 numBytesRead = read(f, sdpDescription, len); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
85 if(numBytesRead != len) { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
86 free(sdpDescription); |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
87 return STREAM_ERROR; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
88 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
89 sdpDescription[len] = '\0'; // to be safe |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
90 stream->priv = sdpDescription; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
91 |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
92 stream->type = STREAMTYPE_SDP; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
93 *file_format = DEMUXER_TYPE_RTP; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
94 return STREAM_OK; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
95 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
96 return STREAM_UNSUPPORTED; |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
97 } |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
98 |
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 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
|
101 "standard RTSP and SIP", |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
102 "RTSP and SIP", |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
103 "Ross Finlayson", |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
104 "Uses LIVE555 Streaming Media library.", |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
105 open_live_rtsp_sip, |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
106 {"rtsp", "sip", NULL }, |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
107 NULL, |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
108 0 // Urls are an option string |
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_sdp = { |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
112 "SDP stream descriptor", |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
113 "SDP", |
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_sdp, |
d9b61fc3c5b7
Rename stream_livedotcom.c to stream_live555.c, the name is used everywhere.
diego
parents:
diff
changeset
|
117 {"sdp", 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 }; |