diff mbox

[FFmpeg-devel] lavf/rtpenc: Add support for 24 bit pcm encoding

Message ID CAB0OVGpb9hON-CQJ85+hcLdgKwzQ53WtbdjTwOoF0ZeFSo36fA@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Oct. 24, 2017, 9:10 p.m. UTC
Hi!

Attached patch allows sending pcm_s24be over rtp, defined in rfc 3190.

Please comment, Carl Eugen

Comments

Carl Eugen Hoyos Oct. 29, 2017, 2:31 p.m. UTC | #1
2017-10-24 23:10 GMT+02:00 Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> Hi!
>
> Attached patch allows sending pcm_s24be over rtp, defined in rfc 3190.

Patch applied, Carl Eugen
Paul B Mahol Oct. 29, 2017, 2:36 p.m. UTC | #2
On 10/29/17, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> 2017-10-24 23:10 GMT+02:00 Carl Eugen Hoyos <ceffmpeg@gmail.com>:
>> Hi!
>>
>> Attached patch allows sending pcm_s24be over rtp, defined in rfc 3190.
>
> Patch applied, Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

without review
diff mbox

Patch

From 488a5065dac2ab04d03694b9086fd329421840cc Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Tue, 24 Oct 2017 23:03:02 +0200
Subject: [PATCH] lavf/rtpenc: Add support for 24 bit pcm encoding as defined
 by RFC 3190.

Fixes ticket #6770.
---
 libavformat/rtpenc.c  |    3 +++
 libavformat/sdp.c     |    6 ++++++
 libavformat/version.h |    2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 573593f..63047be 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -66,6 +66,7 @@  static int is_supported(enum AVCodecID id)
     case AV_CODEC_ID_PCM_S8:
     case AV_CODEC_ID_PCM_S16BE:
     case AV_CODEC_ID_PCM_S16LE:
+    case AV_CODEC_ID_PCM_S24BE:
     case AV_CODEC_ID_PCM_U16BE:
     case AV_CODEC_ID_PCM_U16LE:
     case AV_CODEC_ID_PCM_U8:
@@ -544,6 +545,8 @@  static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
     case AV_CODEC_ID_PCM_S16BE:
     case AV_CODEC_ID_PCM_S16LE:
         return rtp_send_samples(s1, pkt->data, size, 16 * st->codecpar->channels);
+    case AV_CODEC_ID_PCM_S24BE:
+        return rtp_send_samples(s1, pkt->data, size, 24 * st->codecpar->channels);
     case AV_CODEC_ID_ADPCM_G722:
         /* The actual sample size is half a byte per sample, but since the
          * stream clock rate is 8000 Hz while the sample rate is 16000 Hz,
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 0242ca3..e714916 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -584,6 +584,12 @@  static char *sdp_write_media_attributes(char *buff, int size, AVStream *st, int
                                          payload_type,
                                          p->sample_rate, p->channels);
             break;
+        case AV_CODEC_ID_PCM_S24BE:
+            if (payload_type >= RTP_PT_PRIVATE)
+                av_strlcatf(buff, size, "a=rtpmap:%d L24/%d/%d\r\n",
+                                         payload_type,
+                                         p->sample_rate, p->channels);
+            break;
         case AV_CODEC_ID_PCM_MULAW:
             if (payload_type >= RTP_PT_PRIVATE)
                 av_strlcatf(buff, size, "a=rtpmap:%d PCMU/%d/%d\r\n",
diff --git a/libavformat/version.h b/libavformat/version.h
index 0feb788..8ae091f 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@ 
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
 #define LIBAVFORMAT_VERSION_MINOR   0
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \
-- 
1.7.10.4