From: Stefano Sabatini <stefasab@gmail.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Cc: Marton Balint <cus@passwd.hu> Subject: Re: [FFmpeg-devel] [PATCH 2/9] avcodec/bsf/pcm_rechunk: add some more supported PCM formats Date: Wed, 6 Mar 2024 15:18:40 +0100 Message-ID: <Zeh7QMXEQm3I1IQm@mariano> (raw) In-Reply-To: <20240305225147.6849-2-cus@passwd.hu> On date Tuesday 2024-03-05 23:51:40 +0100, Marton Balint wrote: > Signed-off-by: Marton Balint <cus@passwd.hu> > --- > 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); > +} Didn't verify these. > + > 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 Looks good to me. _______________________________________________ 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".
next prev parent reply other threads:[~2024-03-06 14:18 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-05 22:51 [FFmpeg-devel] [PATCH 1/9] avcodec/bsf/pcm_rechunk: reorder supported codec list Marton Balint 2024-03-05 22:51 ` [FFmpeg-devel] [PATCH 2/9] avcodec/bsf/pcm_rechunk: add some more supported PCM formats Marton Balint 2024-03-06 14:18 ` Stefano Sabatini [this message] 2024-03-05 22:51 ` [FFmpeg-devel] [PATCH 3/9] avformat/daudenc: force 2000 sample packet size with a bsf Marton Balint 2024-03-06 14:24 ` Stefano Sabatini 2024-03-05 22:51 ` [FFmpeg-devel] [PATCH 4/9] fate: make filter-channelsplit test use a fixed frame size Marton Balint 2024-03-05 22:51 ` [FFmpeg-devel] [PATCH 5/9] fate: use a fixed wav demux packet size for amix tests Marton Balint 2024-03-05 22:51 ` [FFmpeg-devel] [PATCH 6/9] fate: use atrim filter instead of -frames:a 20 for fate-filter-tremolo Marton Balint 2024-03-05 22:51 ` [FFmpeg-devel] [PATCH 7/9] avformat/pcm: use a common default packet size function for both wav and pcm Marton Balint 2024-03-06 20:37 ` Michael Niedermayer 2024-03-05 22:51 ` [FFmpeg-devel] [PATCH 8/9] avformat/pcm: remove max samples cap when calculating the default packet size Marton Balint 2024-03-05 22:51 ` [FFmpeg-devel] [PATCH 9/9] avformat/pcm: decrease target audio frame per sec to 10 Marton Balint 2024-03-06 13:47 ` [FFmpeg-devel] [PATCH 1/9] avcodec/bsf/pcm_rechunk: reorder supported codec list Stefano Sabatini 2024-03-08 0:53 ` [FFmpeg-devel] [PATCH v2 " Marton Balint 2024-03-08 0:53 ` [FFmpeg-devel] [PATCH v2 2/9] avcodec/bsf/pcm_rechunk: add some more supported PCM formats Marton Balint 2024-03-09 16:21 ` Stefano Sabatini 2024-03-08 0:53 ` [FFmpeg-devel] [PATCH v2 3/9] avformat/daudenc: force 2000 sample packet size with a bsf Marton Balint 2024-03-09 16:23 ` Stefano Sabatini 2024-03-08 0:53 ` [FFmpeg-devel] [PATCH v2 4/9] fate: make filter-channelsplit test use a fixed frame size Marton Balint 2024-03-08 0:53 ` [FFmpeg-devel] [PATCH v2 5/9] fate: use a fixed wav demux packet size for amix tests Marton Balint 2024-03-08 0:53 ` [FFmpeg-devel] [PATCH v2 6/9] fate: use atrim filter instead of -frames:a 20 for fate-filter-tremolo Marton Balint 2024-03-08 0:53 ` [FFmpeg-devel] [PATCH v2 7/9] avformat/pcm: factorize and improve determining the default packet size Marton Balint 2024-03-12 21:31 ` Marton Balint 2024-03-14 23:18 ` [FFmpeg-devel] [PATCH v3 " Marton Balint 2024-03-16 8:45 ` Marton Balint 2024-03-08 0:53 ` [FFmpeg-devel] [PATCH v2 8/9] avformat/wavdec: use ff_pcm_default_packet_size for " Marton Balint 2024-03-08 0:53 ` [FFmpeg-devel] [PATCH v2 9/9] avformat/pcm: decrease target audio frame per sec to 10 Marton Balint 2024-03-14 8:10 ` Tobias Rapp 2024-03-14 11:12 ` Paul B Mahol 2024-03-14 22:30 ` Marton Balint 2024-03-17 12:44 ` Paul B Mahol 2024-03-14 22:04 ` Marton Balint 2024-03-15 7:54 ` Tobias Rapp 2024-03-09 16:20 ` [FFmpeg-devel] [PATCH v2 1/9] avcodec/bsf/pcm_rechunk: reorder supported codec list Stefano Sabatini
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=Zeh7QMXEQm3I1IQm@mariano \ --to=stefasab@gmail.com \ --cc=cus@passwd.hu \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git