[vlc-commits] [Git][videolan/vlc][master] 5 commits: rtp/pcm: fix typo

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Dec 6 23:43:58 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
a6a673d6 by Rémi Denis-Courmont at 2021-12-06T23:30:28+00:00
rtp/pcm: fix typo

The fourCC value is not really used for anything in this particular
case, so this does not fix any functional bug.

- - - - -
267113c9 by Rémi Denis-Courmont at 2021-12-06T23:30:28+00:00
Add little-endian variant of G.726

Due to some ITU-T brain damage, this ADPCM codec is used in different
endianess depending on the scenario...

- - - - -
a461aab1 by Rémi Denis-Courmont at 2021-12-06T23:30:28+00:00
rtp/pcm: add audio/32kadpcm

This is really big-endian G.726.

- - - - -
7afeddcc by Rémi Denis-Courmont at 2021-12-06T23:30:28+00:00
sout/rtp: fix G.726 fourCC

- - - - -
2780aca5 by Rémi Denis-Courmont at 2021-12-06T23:30:28+00:00
sout/rtp: add audio/32kadpcm

- - - - -


5 changed files:

- include/vlc_fourcc.h
- modules/access/rtp/pcm.c
- modules/codec/avcodec/fourcc.c
- modules/stream_out/rtpfmt.c
- src/misc/fourcc_list.h


Changes:

=====================================
include/vlc_fourcc.h
=====================================
@@ -499,6 +499,7 @@
 #define VLC_CODEC_ADPCM_IMA_WS               VLC_FOURCC('A','I','W','S')
 #define VLC_CODEC_ADPCM_G722                 VLC_FOURCC('g','7','2','2')
 #define VLC_CODEC_ADPCM_G726                 VLC_FOURCC('g','7','2','6')
+#define VLC_CODEC_ADPCM_G726_LE              VLC_FOURCC('g','7','2','s')
 #define VLC_CODEC_ADPCM_SWF                  VLC_FOURCC('S','W','F','a')
 #define VLC_CODEC_ADPCM_MS                   VLC_FOURCC('m','s',0x00,0x02)
 #define VLC_CODEC_ADPCM_IMA_WAV              VLC_FOURCC('m','s',0x00,0x11)


=====================================
modules/access/rtp/pcm.c
=====================================
@@ -164,7 +164,7 @@ static void *rtp_g726_init(struct vlc_rtp_pt *pt)
     struct rtp_pcm *sys = pt->opaque;
     es_format_t fmt;
 
-    es_format_Init(&fmt, AUDIO_ES, VLC_CODEC_ADPCM_G726);
+    es_format_Init(&fmt, AUDIO_ES, sys->fourcc);
     fmt.audio.i_rate = 8000;
     fmt.audio.i_physical_channels = sys->channel_mask;
     fmt.audio.i_channels = sys->channel_count;
@@ -238,13 +238,13 @@ static int rtp_pcm_open(vlc_object_t *obj, struct vlc_rtp_pt *pt,
         bits = 8;
 
     } else if (vlc_ascii_strcasecmp(desc->name, "G722") == 0) {
-        fourcc = VLC_CODEC_ADPCM_G726; /* RFC33551 §4.5.2 */
+        fourcc = VLC_CODEC_ADPCM_G722; /* RFC3551 §4.5.2 */
         bits = 8;
         ops = &rtp_g722_ops;
 
     } else if (sscanf(desc->name, "G726-%u", &bits) == 1
             || sscanf(desc->name, "g726-%u", &bits) == 1) {
-        fourcc = VLC_CODEC_ADPCM_G726; /* RFC33551 §4.5.4 */
+        fourcc = VLC_CODEC_ADPCM_G726_LE; /* RFC3551 §4.5.4 */
         bits /= 8;
         ops = &rtp_g726_ops;
 
@@ -255,6 +255,11 @@ static int rtp_pcm_open(vlc_object_t *obj, struct vlc_rtp_pt *pt,
         fourcc = VLC_CODEC_DAT12; /* RFC3190 §3 */
         bits = 12;
 
+    } else if (vlc_ascii_strcasecmp(desc->name, "32kadpcm") == 0) {
+        fourcc = VLC_CODEC_ADPCM_G726; /* RFC2422 */
+        bits = 4;
+        ops = &rtp_g726_ops;
+
     } else
         return VLC_ENOTSUP;
 
@@ -302,6 +307,6 @@ vlc_module_begin()
     add_shortcut("audio/L8", "audio/L16", "audio/L20", "audio/L24",
                  "audio/DAT12", "audio/PCMA", "audio/PCMU", "audio/G722",
                  "audio/G726-16", "audio/G726-24", "audio/G726-32",
-                 "audio/G726-40")
+                 "audio/G726-40", "audio/32kadpcm")
     /* TODO? DVI4, VDVI */
 vlc_module_end()


=====================================
modules/codec/avcodec/fourcc.c
=====================================
@@ -381,6 +381,7 @@ static const struct vlc_avcodec_fourcc audio_codecs[] =
     { VLC_CODEC_ADPCM_ADX, AV_CODEC_ID_ADPCM_ADX },
     { VLC_CODEC_ADPCM_EA, AV_CODEC_ID_ADPCM_EA },
     { VLC_CODEC_ADPCM_G726, AV_CODEC_ID_ADPCM_G726 },
+    { VLC_CODEC_ADPCM_G726_LE, AV_CODEC_ID_ADPCM_G726LE },
     { VLC_CODEC_ADPCM_CREATIVE, AV_CODEC_ID_ADPCM_CT },
     { VLC_CODEC_ADPCM_SWF, AV_CODEC_ID_ADPCM_SWF },
     { VLC_CODEC_ADPCM_YAMAHA, AV_CODEC_ID_ADPCM_YAMAHA },


=====================================
modules/stream_out/rtpfmt.c
=====================================
@@ -249,7 +249,7 @@ int rtp_get_fmt( vlc_object_t *obj, const es_format_t *p_fmt, const char *mux,
             rtp_fmt->ptname = "MPV";
             rtp_fmt->pf_packetize = rtp_packetize_mpv;
             break;
-        case VLC_CODEC_ADPCM_G726:
+        case VLC_CODEC_ADPCM_G726_LE:
             switch( p_fmt->i_bitrate / 1000 )
             {
             case 16:
@@ -274,6 +274,16 @@ int rtp_get_fmt( vlc_object_t *obj, const es_format_t *p_fmt, const char *mux,
                 return VLC_EGENERIC;
             }
             break;
+        case VLC_CODEC_ADPCM_G726:
+            if( p_fmt->i_bitrate != 32000 )
+            {
+                msg_Err( obj, "cannot add this stream (unsupported "
+                        "G.726 bit rate: %u)", p_fmt->i_bitrate );
+                return VLC_EGENERIC;
+            }
+            rtp_fmt->ptname = "32kadpcm";
+            rtp_fmt->pf_packetize = rtp_packetize_g726_32;
+            break;
         case VLC_CODEC_A52:
             rtp_fmt->ptname = "ac3";
             rtp_fmt->pf_packetize = rtp_packetize_ac3;


=====================================
src/misc/fourcc_list.h
=====================================
@@ -1430,6 +1430,10 @@ static const staticentry_t p_list_audio[] = {
     B(VLC_CODEC_ADPCM_G726, "G.726 ADPCM Audio"),
         A("g726"),
 
+    /* G.726 ADPCM */
+    B(VLC_CODEC_ADPCM_G726_LE, "G.726 ADPCM Audio (little-endian)"),
+        A("g72s"),
+
     /* G.722 ADPCM */
     B(VLC_CODEC_ADPCM_G722, "G.722 ADPCM Audio"),
         A("g722"),



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bf8e63018d6727b7edd58d63519e2fe29ca29fd8...2780aca58e89452543b4a2b965765df70cfdc2aa

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bf8e63018d6727b7edd58d63519e2fe29ca29fd8...2780aca58e89452543b4a2b965765df70cfdc2aa
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list