From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id CA90D49173 for ; Tue, 5 Mar 2024 22:52:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2E4AE68CA47; Wed, 6 Mar 2024 00:52:03 +0200 (EET) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C429368C90C for ; Wed, 6 Mar 2024 00:51:56 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 95E62E9CE4; Tue, 5 Mar 2024 23:51:56 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OPvXGlq6LGGn; Tue, 5 Mar 2024 23:51:55 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 09178E9D0F; Tue, 5 Mar 2024 23:51:55 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Tue, 5 Mar 2024 23:51:40 +0100 Message-Id: <20240305225147.6849-2-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240305225147.6849-1-cus@passwd.hu> References: <20240305225147.6849-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/9] avcodec/bsf/pcm_rechunk: add some more supported PCM formats X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: Marton Balint --- libavcodec/bsf/pcm_rechunk.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/libavcodec/bsf/pcm_rechunk.c b/libavcodec/bsf/pcm_rechunk.c index 9bbc5a74d6..7198554c17 100644 --- a/libavcodec/bsf/pcm_rechunk.c +++ b/libavcodec/bsf/pcm_rechunk.c @@ -108,6 +108,18 @@ static int get_next_nb_samples(AVBSFContext *ctx) } } +static void set_silence(AVCodecParameters *par, uint8_t *buf, size_t size) +{ + int c = 0; + switch (par->codec_id) { + case AV_CODEC_ID_PCM_ALAW: c = 0xd5; break; + case AV_CODEC_ID_PCM_MULAW: + case AV_CODEC_ID_PCM_VIDC: c = 0xff; break; + case AV_CODEC_ID_PCM_U8: c = 0x80; break; + } + memset(buf, c, size); +} + static int rechunk_filter(AVBSFContext *ctx, AVPacket *pkt) { PCMContext *s = ctx->priv_data; @@ -158,7 +170,7 @@ static int rechunk_filter(AVBSFContext *ctx, AVPacket *pkt) ret = ff_bsf_get_packet_ref(ctx, s->in_pkt); if (ret == AVERROR_EOF && s->out_pkt->size) { if (s->pad) { - memset(s->out_pkt->data + s->out_pkt->size, 0, data_size - s->out_pkt->size); + set_silence(ctx->par_in, s->out_pkt->data + s->out_pkt->size, data_size - s->out_pkt->size); s->out_pkt->size = data_size; } else { nb_samples = s->out_pkt->size / s->sample_size; @@ -194,11 +206,17 @@ static const AVClass pcm_rechunk_class = { static const enum AVCodecID codec_ids[] = { // 8 bit + AV_CODEC_ID_PCM_ALAW, + AV_CODEC_ID_PCM_MULAW, + AV_CODEC_ID_PCM_VIDC, AV_CODEC_ID_PCM_S8, + AV_CODEC_ID_PCM_SGA, + AV_CODEC_ID_PCM_U8, // 16 bit AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE, // 24 bit + AV_CODEC_ID_PCM_S24DAUD, AV_CODEC_ID_PCM_S24BE, AV_CODEC_ID_PCM_S24LE, // 32 bit -- 2.35.3 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".