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"
30 extern int network_bandwidth
;
32 static int _rtsp_streaming_seek(int fd
, off_t pos
, streaming_ctrl_t
* streaming_ctrl
) {
33 return -1; // For now, we don't handle RTSP stream seeking
36 static int rtsp_streaming_start(stream_t
* stream
) {
37 stream
->streaming_ctrl
->streaming_seek
= _rtsp_streaming_seek
;
42 static int open_live_rtsp_sip(stream_t
*stream
,int mode
, void* opts
, int* file_format
) {
45 stream
->streaming_ctrl
= streaming_ctrl_new();
46 if( stream
->streaming_ctrl
==NULL
) {
49 stream
->streaming_ctrl
->bandwidth
= network_bandwidth
;
50 url
= url_new(stream
->url
);
51 stream
->streaming_ctrl
->url
= check4proxies(url
);
54 mp_msg(MSGT_OPEN
, MSGL_INFO
, "STREAM_LIVE555, URL: %s\n", stream
->url
);
56 if(rtsp_streaming_start(stream
) < 0) {
57 mp_msg(MSGT_NETWORK
,MSGL_ERR
,"rtsp_streaming_start failed\n");
61 *file_format
= DEMUXER_TYPE_RTP
;
62 stream
->type
= STREAMTYPE_STREAM
;
63 stream
->flags
= STREAM_NON_CACHEABLE
;
67 streaming_ctrl_free( stream
->streaming_ctrl
);
68 stream
->streaming_ctrl
= NULL
;
72 static int open_live_sdp(stream_t
*stream
,int mode
, void* opts
, int* file_format
) {
74 char *filename
= stream
->url
;
79 if(strncmp("sdp://",filename
,6) == 0) {
81 f
= open(filename
,O_RDONLY
|O_BINARY
);
83 mp_tmsg(MSGT_OPEN
,MSGL_ERR
,"File not found: '%s'\n",filename
);
87 len
=lseek(f
,0,SEEK_END
);
91 if(len
> SIZE_MAX
- 1)
94 sdpDescription
= malloc(len
+1);
95 if(sdpDescription
== NULL
) return STREAM_ERROR
;
96 numBytesRead
= read(f
, sdpDescription
, len
);
97 if(numBytesRead
!= len
) {
101 sdpDescription
[len
] = '\0'; // to be safe
102 stream
->priv
= sdpDescription
;
104 stream
->type
= STREAMTYPE_SDP
;
105 *file_format
= DEMUXER_TYPE_RTP
;
108 return STREAM_UNSUPPORTED
;
112 const stream_info_t stream_info_rtsp_sip
= {
113 "standard RTSP and SIP",
116 "Uses LIVE555 Streaming Media library.",
118 {"rtsp", "sip", NULL
},
120 0 // Urls are an option string
123 const stream_info_t stream_info_sdp
= {
124 "SDP stream descriptor",
127 "Uses LIVE555 Streaming Media library.",
131 0 // Urls are an option string