Commit 6d004778 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

RTP: support for pulse code modulation

parent 8235fe32
......@@ -339,7 +339,7 @@ static void stream_decode (demux_t *demux, void *data, block_t *block)
*/
/* PT=0
* PCMU:
* PCMU: G.711 µ-law (RFC3551)
*/
static void *pcmu_init (demux_t *demux)
{
......@@ -352,7 +352,7 @@ static void *pcmu_init (demux_t *demux)
}
/* PT=8
* PCMA:
* PCMA: G.711 A-law (RFC3551)
*/
static void *pcma_init (demux_t *demux)
{
......@@ -364,6 +364,29 @@ static void *pcma_init (demux_t *demux)
return codec_init (demux, &fmt);
}
/* PT=10,11
* L16: 16-bits (network byte order) PCM
*/
static void *l16s_init (demux_t *demux)
{
es_format_t fmt;
es_format_Init (&fmt, AUDIO_ES, VLC_FOURCC ('s', '1', '6', 'b'));
fmt.audio.i_rate = 44100;
fmt.audio.i_channels = 2;
return codec_init (demux, &fmt);
}
static void *l16m_init (demux_t *demux)
{
es_format_t fmt;
es_format_Init (&fmt, AUDIO_ES, VLC_FOURCC ('s', '1', '6', 'b'));
fmt.audio.i_rate = 44100;
fmt.audio.i_channels = 1;
return codec_init (demux, &fmt);
}
/* PT=14
* MPA: MPEG Audio (RFC2250, §3.4)
*/
......@@ -449,6 +472,7 @@ static int Demux (demux_t *demux)
if (block)
{
/* Not using SDP, we need to guess the payload format used */
/* see http://www.iana.org/assignments/rtp-parameters */
if (p_sys->autodetect && block->i_buffer >= 2)
{
rtp_pt_t pt = {
......@@ -473,6 +497,18 @@ static int Demux (demux_t *demux)
pt.frequency = 8000;
break;
case 10:
msg_Dbg (demux, "detected stereo PCM");
pt.init = l16s_init;
pt.frequency = 44100;
break;
case 11:
msg_Dbg (demux, "detected mono PCM");
pt.init = l16m_init;
pt.frequency = 44100;
break;
case 14:
msg_Dbg (demux, "detected MPEG Audio");
pt.init = mpa_init;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment