]> git.sesse.net Git - vlc/blob - modules/access/rtp/rtp.h
rtp: option to assume Theora for unknown dynamic payloads
[vlc] / modules / access / rtp / rtp.h
1 /**
2  * @file rtp.h
3  * @brief RTP demux module shared declarations
4  */
5 /*****************************************************************************
6  * Copyright © 2008 Rémi Denis-Courmont
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This library 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.
17  *
18  * You should have received a copy of the GNU General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  ****************************************************************************/
22
23 typedef struct rtp_pt_t rtp_pt_t;
24 typedef struct rtp_session_t rtp_session_t;
25
26 /** @section RTP payload format */
27 struct rtp_pt_t
28 {
29     void   *(*init) (demux_t *);
30     void    (*destroy) (demux_t *, void *);
31     void    (*decode) (demux_t *, void *, block_t *);
32     uint32_t  frequency; /* RTP clock rate (Hz) */
33     uint8_t   number;
34 };
35 int rtp_autodetect (demux_t *, rtp_session_t *, const block_t *);
36
37 static inline uint8_t rtp_ptype (const block_t *block)
38 {
39     return block->p_buffer[1] & 0x7F;
40 }
41
42 void *codec_init (demux_t *demux, es_format_t *fmt);
43 void codec_destroy (demux_t *demux, void *data);
44 void codec_decode (demux_t *demux, void *data, block_t *block);
45
46 void *theora_init (demux_t *demux);
47 void xiph_destroy (demux_t *demux, void *data);
48 void xiph_decode (demux_t *demux, void *data, block_t *block);
49
50 /** @section RTP session */
51 rtp_session_t *rtp_session_create (demux_t *);
52 void rtp_session_destroy (demux_t *, rtp_session_t *);
53 void rtp_queue (demux_t *, rtp_session_t *, block_t *);
54 bool rtp_dequeue (demux_t *, const rtp_session_t *, mtime_t *);
55 int rtp_add_type (demux_t *demux, rtp_session_t *ses, const rtp_pt_t *pt);
56
57 void *rtp_thread (void *data);
58
59 /* Global data */
60 struct demux_sys_t
61 {
62     rtp_session_t *session;
63 #ifdef HAVE_SRTP
64     struct srtp_session_t *srtp;
65 #endif
66     int           fd;
67     int           rtcp_fd;
68     vlc_thread_t  thread;
69     vlc_timer_t   timer;
70     vlc_mutex_t   lock;
71
72     mtime_t       timeout;
73     unsigned      caching;
74     uint16_t      max_dropout; /**< Max packet forward misordering */
75     uint16_t      max_misorder; /**< Max packet backward misordering */
76     uint8_t       max_src; /**< Max simultaneous RTP sources */
77     bool          framed_rtp; /**< Framed RTP packets over TCP */
78     bool          thread_ready;
79 #if 0
80     bool          dead; /**< End of stream */
81 #endif
82 };
83