]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/rtp.h
vpx: fix leak
[vlc] / modules / stream_out / rtp.h
index f136838f0020dc76d98362527d1b076e623d5644..eae375486fb61146c51d5ad449a6e865070def15 100644 (file)
 /*****************************************************************************
  * rtp.h: rtp stream output module header
  *****************************************************************************
- * Copyright (C) 2003-2007 the VideoLAN team
- * $Id: rtp.c 21407 2007-08-22 20:10:41Z courmisch $
+ * Copyright (C) 2003-2007 VLC authors and VideoLAN
+ * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          RĂ©mi Denis-Courmont
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-typedef struct rtsp_client_t rtsp_client_t;
+typedef struct rtsp_stream_t rtsp_stream_t;
+typedef struct rtsp_stream_id_t rtsp_stream_id_t;
 
-int RtspSetup( sout_stream_t *p_stream, vlc_url_t * );
+rtsp_stream_t *RtspSetup( vlc_object_t *owner, vod_media_t *media,
+                          const char *path );
+void RtspUnsetup( rtsp_stream_t *rtsp );
 
-int RtspCallbackId( httpd_callback_sys_t *, httpd_client_t *,
-                    httpd_message_t *, httpd_message_t * );
+rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_sys_t *sid,
+                             uint32_t ssrc, unsigned clock_rate,
+                             int mcast_fd );
+void RtspDelId( rtsp_stream_t *rtsp, rtsp_stream_id_t * );
 
-void RtspClientDel( sout_stream_t *, rtsp_client_t * );
+char *RtspAppendTrackPath( rtsp_stream_id_t *id, const char *base );
 
-char *SDPGenerate( const sout_stream_t *p_stream,
-                   const char *psz_destination, vlc_bool_t b_rtsp );
+int RtspTrackAttach( rtsp_stream_t *rtsp, const char *name,
+                     rtsp_stream_id_t *id, sout_stream_id_sys_t *sout_id,
+                     uint32_t *ssrc, uint16_t *seq_init );
+void RtspTrackDetach( rtsp_stream_t *rtsp, const char *name,
+                      sout_stream_id_sys_t *sout_id);
 
-int rtp_add_sink( sout_stream_id_t *id, sout_access_out_t *access );
-void rtp_del_sink( sout_stream_id_t *id, sout_access_out_t *access );
+char *SDPGenerate( sout_stream_t *p_stream, const char *rtsp_url );
+char *SDPGenerateVoD( const vod_media_t *p_media, const char *rtsp_url );
 
-typedef int (*pf_rtp_packetizer_t)( sout_stream_t *, sout_stream_id_t *,
-                                    block_t * );
+uint32_t rtp_compute_ts( unsigned i_clock_rate, int64_t i_pts );
+int rtp_add_sink( sout_stream_id_sys_t *id, int fd, bool rtcp_mux, uint16_t *seq );
+void rtp_del_sink( sout_stream_id_sys_t *id, int fd );
+uint16_t rtp_get_seq( sout_stream_id_sys_t *id );
+int64_t rtp_get_ts( const sout_stream_t *p_stream, const sout_stream_id_sys_t *id,
+                    const vod_media_t *p_media, const char *psz_vod_session,
+                    int64_t *p_npt );
 
-struct sout_stream_id_t
+/* RTP packetization */
+void rtp_packetize_common (sout_stream_id_sys_t *id, block_t *out,
+                           int b_marker, int64_t i_pts);
+void rtp_packetize_send (sout_stream_id_sys_t *id, block_t *out);
+size_t rtp_mtu (const sout_stream_id_sys_t *id);
+
+int rtp_packetize_xiph_config( sout_stream_id_sys_t *id, const char *fmtp,
+                               int64_t i_pts );
+
+/* RTCP */
+typedef struct rtcp_sender_t rtcp_sender_t;
+rtcp_sender_t *OpenRTCP (vlc_object_t *obj, int rtp_fd, int proto,
+                         bool mux);
+void CloseRTCP (rtcp_sender_t *rtcp);
+void SendRTCP (rtcp_sender_t *restrict rtcp, const block_t *rtp);
+
+typedef int (*pf_rtp_packetizer_t)( sout_stream_id_sys_t *, block_t * );
+
+typedef struct rtp_format_t
 {
-    sout_stream_t *p_stream;
-    /* rtp field */
-    uint8_t     i_payload_type;
-    uint16_t    i_sequence;
-    uint32_t    i_timestamp_start;
-    uint8_t     ssrc[4];
-
-    /* for sdp */
-    int         i_clock_rate;
-    char        *psz_rtpmap;
-    char        *psz_fmtp;
-    char        *psz_destination;
-    int         i_port;
-    int         i_cat;
-    int         i_bitrate;
-
-    /* Packetizer specific fields */
+    /* Used for SDP and packetization */
+    uint8_t      payload_type;
+    unsigned     clock_rate;
+    unsigned     channels;
+    int          cat;
+    /* Used in SDP only */
+    unsigned     bitrate;
+    const char  *ptname;
+    char        *fmtp;
+    /* Used for packetization only */
     pf_rtp_packetizer_t pf_packetize;
-    int           i_mtu;
+} rtp_format_t;
 
-    /* for sending the packets */
-    sout_access_out_t *p_access;
+int rtp_get_fmt( vlc_object_t *obj, const es_format_t *p_fmt, const char *mux,
+                 rtp_format_t *p_rtp_fmt );
 
-    vlc_mutex_t       lock_rtsp;
-    int               i_rtsp_access;
-    sout_access_out_t **rtsp_access;
+/* Only used by rtp_packetize_rawvideo */
+void rtp_get_video_geometry( sout_stream_id_sys_t *id, int *width, int *height );
+uint16_t rtp_get_extended_sequence( sout_stream_id_sys_t *id );
 
-    /* */
-    sout_input_t      *p_input;
+/* VoD */
+int  OpenVoD ( vlc_object_t * );
+void CloseVoD( vlc_object_t * );
 
-    /* RTSP url control */
-    httpd_url_t  *p_rtsp_url;
-};
+int vod_check_range(vod_media_t *p_media, const char *psz_session,
+                    int64_t start, int64_t end);
+void vod_play(vod_media_t *p_media, const char *psz_session,
+              int64_t *start, int64_t end);
+void vod_pause(vod_media_t *p_media, const char *psz_session, int64_t *npt);
+void vod_stop(vod_media_t *p_media, const char *psz_session);
+
+const char *vod_get_mux(const vod_media_t *p_media);
+int vod_init_id(vod_media_t *p_media, const char *psz_session, int es_id,
+                sout_stream_id_sys_t *sout_id, rtp_format_t *rtp_fmt,
+                uint32_t *ssrc, uint16_t *seq_init);
+void vod_detach_id(vod_media_t *p_media, const char *psz_session,
+                   sout_stream_id_sys_t *sout_id);
 
-struct sout_stream_sys_t
-{
-    /* sdp */
-    int64_t i_sdp_id;
-    int     i_sdp_version;
-    char    *psz_sdp;
-    vlc_mutex_t  lock_sdp;
-
-    char        *psz_session_name;
-    char        *psz_session_description;
-    char        *psz_session_url;
-    char        *psz_session_email;
-
-    /* */
-    vlc_bool_t b_export_sdp_file;
-    char *psz_sdp_file;
-    /* sap */
-    vlc_bool_t b_export_sap;
-    session_descriptor_t *p_session;
-
-    httpd_host_t *p_httpd_host;
-    httpd_file_t *p_httpd_file;
-
-    httpd_host_t *p_rtsp_host;
-    httpd_url_t  *p_rtsp_url;
-    char         *psz_rtsp_control;
-    char         *psz_rtsp_path;
-
-    /* */
-    char *psz_destination;
-    int  i_port;
-    int  i_port_audio;
-    int  i_port_video;
-    int  i_ttl;
-    vlc_bool_t b_latm;
-
-    /* when need to use a private one or when using muxer */
-    int i_payload_type;
-
-    /* in case we do TS/PS over rtp */
-    sout_mux_t        *p_mux;
-    sout_access_out_t *p_access;
-    int               i_mtu;
-    sout_access_out_t *p_grab;
-    uint16_t          i_sequence;
-    uint32_t          i_timestamp_start;
-    uint8_t           ssrc[4];
-    block_t           *packet;
-
-    /* */
-    vlc_mutex_t      lock_es;
-    int              i_es;
-    sout_stream_id_t **es;
-
-    /* */
-    int              i_rtsp;
-    rtsp_client_t    **rtsp;
-};