Skip to content
Snippets Groups Projects
Commit e94e45e4 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

rtp: pass pointer to "self"

Some payload type initialisation callbacks will be needing access to a
context soon enough.
parent c71d5786
No related branches found
No related tags found
1 merge request!870rtp: handle RTP map from SDP
......@@ -20,15 +20,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
****************************************************************************/
typedef struct rtp_pt_t rtp_pt_t;
typedef struct vlc_rtp_pt rtp_pt_t;
typedef struct rtp_session_t rtp_session_t;
struct vlc_demux_chained_t;
/** @section RTP payload format */
struct rtp_pt_t
struct vlc_rtp_pt
{
void *(*init) (demux_t *);
void *(*init)(struct vlc_rtp_pt *, demux_t *);
void (*destroy) (demux_t *, void *);
void (*decode) (demux_t *, void *, block_t *);
uint32_t frequency; /* RTP clock rate (Hz) */
......@@ -45,7 +45,7 @@ void *codec_init (demux_t *demux, es_format_t *fmt);
void codec_destroy (demux_t *demux, void *data);
void codec_decode (demux_t *demux, void *data, block_t *block);
void *theora_init (demux_t *demux);
void *theora_init(struct vlc_rtp_pt *, demux_t *demux);
void xiph_destroy (demux_t *demux, void *data);
void xiph_decode (demux_t *demux, void *data, block_t *block);
......
......@@ -102,7 +102,7 @@ static void stream_decode (demux_t *demux, void *data, block_t *block)
/* PT=0
* PCMU: G.711 µ-law (RFC3551)
*/
static void *pcmu_init (demux_t *demux)
static void *pcmu_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
es_format_t fmt;
......@@ -115,20 +115,21 @@ static void *pcmu_init (demux_t *demux)
/* PT=3
* GSM
*/
static void *gsm_init (demux_t *demux)
static void *gsm_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
es_format_t fmt;
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_GSM);
fmt.audio.i_rate = 8000;
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
(void) pt;
return codec_init (demux, &fmt);
}
/* PT=8
* PCMA: G.711 A-law (RFC3551)
*/
static void *pcma_init (demux_t *demux)
static void *pcma_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
es_format_t fmt;
......@@ -141,7 +142,7 @@ static void *pcma_init (demux_t *demux)
/* PT=10,11
* L16: 16-bits (network byte order) PCM
*/
static void *l16s_init (demux_t *demux)
static void *l16s_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
es_format_t fmt;
......@@ -151,7 +152,7 @@ static void *l16s_init (demux_t *demux)
return codec_init (demux, &fmt);
}
static void *l16m_init (demux_t *demux)
static void *l16m_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
es_format_t fmt;
......@@ -164,26 +165,28 @@ static void *l16m_init (demux_t *demux)
/* PT=12
* QCELP
*/
static void *qcelp_init (demux_t *demux)
static void *qcelp_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
es_format_t fmt;
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_QCELP);
fmt.audio.i_rate = 8000;
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
(void) pt;
return codec_init (demux, &fmt);
}
/* PT=14
* MPA: MPEG Audio (RFC2250, §3.4)
*/
static void *mpa_init (demux_t *demux)
static void *mpa_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
es_format_t fmt;
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MPGA);
fmt.audio.i_physical_channels = AOUT_CHANS_STEREO;
fmt.b_packetized = false;
(void) pt;
return codec_init (demux, &fmt);
}
......@@ -205,12 +208,13 @@ static void mpa_decode (demux_t *demux, void *data, block_t *block)
/* PT=32
* MPV: MPEG Video (RFC2250, §3.5)
*/
static void *mpv_init (demux_t *demux)
static void *mpv_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
es_format_t fmt;
es_format_Init (&fmt, VIDEO_ES, VLC_CODEC_MPGV);
fmt.b_packetized = false;
(void) pt;
return codec_init (demux, &fmt);
}
......@@ -238,8 +242,9 @@ static void mpv_decode (demux_t *demux, void *data, block_t *block)
/* PT=33
* MP2: MPEG TS (RFC2250, §2)
*/
static void *ts_init (demux_t *demux)
static void *ts_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
(void) pt;
return stream_init (demux, "ts");
}
......
......@@ -170,7 +170,7 @@ rtp_source_create (demux_t *demux, const rtp_session_t *session,
/* Initializes all payload */
for (unsigned i = 0; i < session->ptc; i++)
source->opaque[i] = session->ptv[i].init (demux);
source->opaque[i] = session->ptv[i].init(&session->ptv[i], demux);
msg_Dbg (demux, "added RTP source (%08x)", ssrc);
return source;
......@@ -204,7 +204,7 @@ static inline uint32_t rtp_timestamp (const block_t *block)
return GetDWBE (block->p_buffer + 4);
}
static const struct rtp_pt_t *
static const struct vlc_rtp_pt *
rtp_find_ptype (const rtp_session_t *session, rtp_source_t *source,
const block_t *block, void **pt_data)
{
......
......@@ -71,9 +71,9 @@ static void *vorbis_init (demux_t *demux)
/* PT=dynamic
* vorbis: Xiph Theora video
*/
void *theora_init (demux_t *demux)
void *theora_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
(void)demux;
(void) pt; (void) demux;
return xiph_init (false);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment