]> git.sesse.net Git - vlc/blob - modules/stream_out/rtp.h
stream_filter/httplive.c: do not crash on strdup(NULL)
[vlc] / modules / stream_out / rtp.h
1 /*****************************************************************************
2  * rtp.h: rtp stream output module header
3  *****************************************************************************
4  * Copyright (C) 2003-2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8  *          RĂ©mi Denis-Courmont
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 typedef struct rtsp_stream_t rtsp_stream_t;
26 typedef struct rtsp_stream_id_t rtsp_stream_id_t;
27
28 rtsp_stream_t *RtspSetup( vlc_object_t *owner, vod_media_t *media,
29                           const vlc_url_t *url );
30 void RtspUnsetup( rtsp_stream_t *rtsp );
31
32 rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid,
33                              uint32_t ssrc, unsigned clock_rate,
34                              int mcast_fd );
35 void RtspDelId( rtsp_stream_t *rtsp, rtsp_stream_id_t * );
36
37 char *RtspAppendTrackPath( rtsp_stream_id_t *id, const char *base );
38
39 int RtspTrackAttach( rtsp_stream_t *rtsp, const char *name,
40                      rtsp_stream_id_t *id, sout_stream_id_t *sout_id,
41                      uint32_t *ssrc, uint16_t *seq_init );
42 void RtspTrackDetach( rtsp_stream_t *rtsp, const char *name,
43                       sout_stream_id_t *sout_id);
44
45 char *SDPGenerate( sout_stream_t *p_stream, const char *rtsp_url );
46 char *SDPGenerateVoD( const vod_media_t *p_media, const char *rtsp_url );
47
48 uint32_t rtp_compute_ts( unsigned i_clock_rate, int64_t i_pts );
49 int rtp_add_sink( sout_stream_id_t *id, int fd, bool rtcp_mux, uint16_t *seq );
50 void rtp_del_sink( sout_stream_id_t *id, int fd );
51 uint16_t rtp_get_seq( sout_stream_id_t *id );
52 int64_t rtp_get_ts( const sout_stream_t *p_stream, const sout_stream_id_t *id,
53                     const vod_media_t *p_media, const char *psz_vod_session );
54
55 /* RTP packetization */
56 void rtp_packetize_common (sout_stream_id_t *id, block_t *out,
57                            int b_marker, int64_t i_pts);
58 void rtp_packetize_send (sout_stream_id_t *id, block_t *out);
59 size_t rtp_mtu (const sout_stream_id_t *id);
60
61 int rtp_packetize_xiph_config( sout_stream_id_t *id, const char *fmtp,
62                                int64_t i_pts );
63
64 /* RTCP */
65 typedef struct rtcp_sender_t rtcp_sender_t;
66 rtcp_sender_t *OpenRTCP (vlc_object_t *obj, int rtp_fd, int proto,
67                          bool mux);
68 void CloseRTCP (rtcp_sender_t *rtcp);
69 void SendRTCP (rtcp_sender_t *restrict rtcp, const block_t *rtp);
70
71 typedef int (*pf_rtp_packetizer_t)( sout_stream_id_t *, block_t * );
72
73 typedef struct rtp_format_t
74 {
75     /* Used for SDP and packetization */
76     uint8_t      payload_type;
77     unsigned     clock_rate;
78     unsigned     channels;
79     int          cat;
80     /* Used in SDP only */
81     unsigned     bitrate;
82     const char  *ptname;
83     char        *fmtp;
84     /* Used for packetization only */
85     pf_rtp_packetizer_t pf_packetize;
86 } rtp_format_t;
87
88 int rtp_get_fmt( vlc_object_t *obj, es_format_t *p_fmt, const char *mux,
89                  rtp_format_t *p_rtp_fmt );
90
91 /* VoD */
92 int  OpenVoD ( vlc_object_t * );
93 void CloseVoD( vlc_object_t * );
94
95 int vod_check_range(vod_media_t *p_media, const char *psz_session,
96                     int64_t start, int64_t end);
97 void vod_play(vod_media_t *p_media, const char *psz_session,
98               int64_t start, int64_t end, bool running);
99 void vod_pause(vod_media_t *p_media, const char *psz_session);
100 void vod_stop(vod_media_t *p_media, const char *psz_session);
101
102 const char *vod_get_mux(const vod_media_t *p_media);
103 int vod_init_id(vod_media_t *p_media, const char *psz_session, int es_id,
104                 sout_stream_id_t *sout_id, rtp_format_t *rtp_fmt,
105                 uint32_t *ssrc, uint16_t *seq_init);
106 void vod_detach_id(vod_media_t *p_media, const char *psz_session,
107                    sout_stream_id_t *sout_id);
108