[vlc-devel] commit: RTP: support for pulse code modulation ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed Jun 4 22:10:31 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Wed Jun  4 23:06:27 2008 +0300| [6d004778d445e1666c33b6ea4515a32428218e05]

RTP: support for pulse code modulation

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6d004778d445e1666c33b6ea4515a32428218e05
---

 modules/demux/rtp.c |   40 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/modules/demux/rtp.c b/modules/demux/rtp.c
index 4254796..df5a9d6 100644
--- a/modules/demux/rtp.c
+++ b/modules/demux/rtp.c
@@ -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;




More information about the vlc-devel mailing list