2 * stream layer for MPEG over RTP, based on previous work from Dave Chapman
4 * Copyright (C) 2006 Benjamin Zores
6 * This file is part of MPlayer.
8 * MPlayer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * MPlayer is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 rtp_streaming_read (int fd
, char *buffer
,
35 int size
, streaming_ctrl_t
*streaming_ctrl
)
37 return read_rtp_from_server (fd
, buffer
, size
);
41 rtp_streaming_start (stream_t
*stream
)
43 streaming_ctrl_t
*streaming_ctrl
;
49 streaming_ctrl
= stream
->streaming_ctrl
;
54 fd
= udp_open_socket (streaming_ctrl
->url
);
60 streaming_ctrl
->streaming_read
= rtp_streaming_read
;
61 streaming_ctrl
->streaming_seek
= nop_streaming_seek
;
62 streaming_ctrl
->prebuffer_size
= 64 * 1024; /* 64 KBytes */
63 streaming_ctrl
->buffering
= 0;
64 streaming_ctrl
->status
= streaming_playing_e
;
70 rtp_stream_open (stream_t
*stream
, int mode
, void *opts
, int *file_format
)
73 extern int network_bandwidth
;
75 mp_msg (MSGT_OPEN
, MSGL_INFO
, "STREAM_RTP, URL: %s\n", stream
->url
);
76 stream
->streaming_ctrl
= streaming_ctrl_new ();
77 if (!stream
->streaming_ctrl
)
80 stream
->streaming_ctrl
->bandwidth
= network_bandwidth
;
81 url
= url_new (stream
->url
);
82 stream
->streaming_ctrl
->url
= check4proxies (url
);
86 mp_msg (MSGT_NETWORK
, MSGL_ERR
,
87 "You must enter a port number for RTP streams!\n");
88 streaming_ctrl_free (stream
->streaming_ctrl
);
89 stream
->streaming_ctrl
= NULL
;
91 return STREAM_UNSUPPORTED
;
94 if (rtp_streaming_start (stream
) < 0)
96 mp_msg (MSGT_NETWORK
, MSGL_ERR
, "rtp_streaming_start failed\n");
97 streaming_ctrl_free (stream
->streaming_ctrl
);
98 stream
->streaming_ctrl
= NULL
;
100 return STREAM_UNSUPPORTED
;
103 stream
->type
= STREAMTYPE_STREAM
;
104 fixup_network_stream_cache (stream
);
109 const stream_info_t stream_info_rtp
= {
110 "MPEG over RTP streaming",
112 "Dave Chapman, Benjamin Zores",
113 "native rtp support",
117 0 // Urls are an option string