opengl: factorize program creation
[vlc.git] / modules / stream_out / rtp.h
blob81689f604df563aeefc11837bdc7ef2dc483a36a
1 /*****************************************************************************
2 * rtp.h: rtp stream output module header
3 *****************************************************************************
4 * Copyright (C) 2003-2007 VLC authors and VideoLAN
6 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
7 * RĂ©mi Denis-Courmont
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 typedef struct rtsp_stream_t rtsp_stream_t;
25 typedef struct rtsp_stream_id_t rtsp_stream_id_t;
26 typedef struct sout_stream_id_sys_t sout_stream_id_sys_t;
28 rtsp_stream_t *RtspSetup( vlc_object_t *owner, const char *path );
29 void RtspUnsetup( rtsp_stream_t *rtsp );
31 rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_sys_t *sid,
32 uint32_t ssrc, unsigned clock_rate,
33 int mcast_fd );
34 void RtspDelId( rtsp_stream_t *rtsp, rtsp_stream_id_t * );
36 char *RtspAppendTrackPath( rtsp_stream_id_t *id, const char *base );
38 int RtspTrackAttach( rtsp_stream_t *rtsp, const char *name,
39 rtsp_stream_id_t *id, sout_stream_id_sys_t *sout_id,
40 uint32_t *ssrc, uint16_t *seq_init );
41 void RtspTrackDetach( rtsp_stream_t *rtsp, const char *name,
42 sout_stream_id_sys_t *sout_id);
44 char *SDPGenerate( sout_stream_t *p_stream, const char *rtsp_url );
46 uint32_t rtp_compute_ts( unsigned i_clock_rate, vlc_tick_t i_pts );
47 int rtp_add_sink( sout_stream_id_sys_t *id, int fd, bool rtcp_mux, uint16_t *seq );
48 void rtp_del_sink( sout_stream_id_sys_t *id, int fd );
49 uint16_t rtp_get_seq( sout_stream_id_sys_t *id );
50 vlc_tick_t rtp_get_ts( const sout_stream_t *p_stream, const sout_stream_id_sys_t *id,
51 vlc_tick_t *p_npt );
53 /* RTP packetization */
54 void rtp_packetize_common (sout_stream_id_sys_t *id, block_t *out,
55 bool b_m_bit, vlc_tick_t i_pts);
56 void rtp_packetize_send (sout_stream_id_sys_t *id, block_t *out);
57 size_t rtp_mtu (const sout_stream_id_sys_t *id);
59 int rtp_packetize_xiph_config( sout_stream_id_sys_t *id, const char *fmtp,
60 vlc_tick_t i_pts );
62 /* RTCP */
63 typedef struct rtcp_sender_t rtcp_sender_t;
64 rtcp_sender_t *OpenRTCP (vlc_object_t *obj, int rtp_fd, int proto,
65 bool mux);
66 void CloseRTCP (rtcp_sender_t *rtcp);
67 void SendRTCP (rtcp_sender_t *restrict rtcp, const block_t *rtp);
69 typedef int (*pf_rtp_packetizer_t)( sout_stream_id_sys_t *, block_t * );
71 typedef struct rtp_format_t
73 /* Used for SDP and packetization */
74 uint8_t payload_type;
75 unsigned clock_rate;
76 unsigned channels;
77 enum es_format_category_e cat;
78 /* Used in SDP only */
79 unsigned bitrate;
80 const char *ptname;
81 char *fmtp;
82 /* Used for packetization only */
83 pf_rtp_packetizer_t pf_packetize;
84 } rtp_format_t;
86 int rtp_get_fmt( vlc_object_t *obj, const es_format_t *p_fmt, const char *mux,
87 rtp_format_t *p_rtp_fmt );
89 /* Only used by rtp_packetize_rawvideo */
90 void rtp_get_video_geometry( sout_stream_id_sys_t *id, int *width, int *height );
91 uint16_t rtp_get_extended_sequence( sout_stream_id_sys_t *id );