11 #include "libmpdemux/demuxer.h"
14 extern int network_bandwidth
;
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
20 static int rtsp_streaming_start(stream_t
* stream
) {
21 stream
->streaming_ctrl
->streaming_seek
= _rtsp_streaming_seek
;
26 static int open_live_rtsp_sip(stream_t
*stream
,int mode
, void* opts
, int* file_format
) {
29 stream
->streaming_ctrl
= streaming_ctrl_new();
30 if( stream
->streaming_ctrl
==NULL
) {
33 stream
->streaming_ctrl
->bandwidth
= network_bandwidth
;
34 url
= url_new(stream
->url
);
35 stream
->streaming_ctrl
->url
= check4proxies(url
);
38 mp_msg(MSGT_OPEN
, MSGL_INFO
, "STREAM_LIVE555, URL: %s\n", stream
->url
);
40 if(rtsp_streaming_start(stream
) < 0) {
41 mp_msg(MSGT_NETWORK
,MSGL_ERR
,"rtsp_streaming_start failed\n");
45 *file_format
= DEMUXER_TYPE_RTP
;
46 stream
->type
= STREAMTYPE_STREAM
;
50 streaming_ctrl_free( stream
->streaming_ctrl
);
51 stream
->streaming_ctrl
= NULL
;
55 static int open_live_sdp(stream_t
*stream
,int mode
, void* opts
, int* file_format
) {
57 char *filename
= stream
->url
;
62 if(strncmp("sdp://",filename
,6) == 0) {
64 #if defined(__CYGWIN__) || defined(__MINGW32__)
65 f
= open(filename
,O_RDONLY
|O_BINARY
);
67 f
= open(filename
,O_RDONLY
);
70 mp_tmsg(MSGT_OPEN
,MSGL_ERR
,"File not found: '%s'\n",filename
);
74 len
=lseek(f
,0,SEEK_END
);
78 if(len
> SIZE_MAX
- 1)
81 sdpDescription
= malloc(len
+1);
82 if(sdpDescription
== NULL
) return STREAM_ERROR
;
83 numBytesRead
= read(f
, sdpDescription
, len
);
84 if(numBytesRead
!= len
) {
88 sdpDescription
[len
] = '\0'; // to be safe
89 stream
->priv
= sdpDescription
;
91 stream
->type
= STREAMTYPE_SDP
;
92 *file_format
= DEMUXER_TYPE_RTP
;
95 return STREAM_UNSUPPORTED
;
99 const stream_info_t stream_info_rtsp_sip
= {
100 "standard RTSP and SIP",
103 "Uses LIVE555 Streaming Media library.",
105 {"rtsp", "sip", NULL
},
107 0 // Urls are an option string
110 const stream_info_t stream_info_sdp
= {
111 "SDP stream descriptor",
114 "Uses LIVE555 Streaming Media library.",
118 0 // Urls are an option string