2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #include "libmpdemux/demuxer.h"
31 extern int network_bandwidth
;
33 static int _rtsp_streaming_seek(int fd
, off_t pos
, streaming_ctrl_t
* streaming_ctrl
) {
34 return -1; // For now, we don't handle RTSP stream seeking
37 static int rtsp_streaming_start(stream_t
* stream
) {
38 stream
->streaming_ctrl
->streaming_seek
= _rtsp_streaming_seek
;
43 static int open_live_rtsp_sip(stream_t
*stream
,int mode
, void* opts
, int* file_format
) {
46 stream
->streaming_ctrl
= streaming_ctrl_new();
47 if( stream
->streaming_ctrl
==NULL
) {
50 stream
->streaming_ctrl
->bandwidth
= network_bandwidth
;
51 url
= url_new(stream
->url
);
52 stream
->streaming_ctrl
->url
= check4proxies(url
);
55 mp_msg(MSGT_OPEN
, MSGL_INFO
, "STREAM_LIVE555, URL: %s\n", stream
->url
);
57 if(rtsp_streaming_start(stream
) < 0) {
58 mp_msg(MSGT_NETWORK
,MSGL_ERR
,"rtsp_streaming_start failed\n");
62 *file_format
= DEMUXER_TYPE_RTP
;
63 stream
->type
= STREAMTYPE_STREAM
;
64 stream
->flags
= STREAM_NON_CACHEABLE
;
68 streaming_ctrl_free( stream
->streaming_ctrl
);
69 stream
->streaming_ctrl
= NULL
;
73 static int open_live_sdp(stream_t
*stream
,int mode
, void* opts
, int* file_format
) {
75 char *filename
= stream
->url
;
80 if(strncmp("sdp://",filename
,6) == 0) {
82 f
= open(filename
,O_RDONLY
|O_BINARY
);
84 mp_msg(MSGT_OPEN
,MSGL_ERR
,MSGTR_FileNotFound
,filename
);
88 len
=lseek(f
,0,SEEK_END
);
92 if(len
> SIZE_MAX
- 1)
95 sdpDescription
= malloc(len
+1);
96 if(sdpDescription
== NULL
) return STREAM_ERROR
;
97 numBytesRead
= read(f
, sdpDescription
, len
);
98 if(numBytesRead
!= len
) {
102 sdpDescription
[len
] = '\0'; // to be safe
103 stream
->priv
= sdpDescription
;
105 stream
->type
= STREAMTYPE_SDP
;
106 *file_format
= DEMUXER_TYPE_RTP
;
109 return STREAM_UNSUPPORTED
;
113 const stream_info_t stream_info_rtsp_sip
= {
114 "standard RTSP and SIP",
117 "Uses LIVE555 Streaming Media library.",
119 {"rtsp", "sip", NULL
},
121 0 // Urls are an option string
124 const stream_info_t stream_info_sdp
= {
125 "SDP stream descriptor",
128 "Uses LIVE555 Streaming Media library.",
132 0 // Urls are an option string