From: Jack Bruienne <jackbruienne@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v7 3/3] libavformat: Added DFPWM WAV container support Date: Mon, 7 Mar 2022 22:30:24 -0500 Message-ID: <193e12fa-5bea-5fab-6def-a5ebd3a4be63@gmail.com> (raw) [-- Attachment #1: Type: text/plain, Size: 973 bytes --] This commit adds support for storing DFPWM audio in a WAV container. It uses the WAVEFORMATEXTENSIBLE structure, following these conventions: https://gist.github.com/MCJack123/90c24b64c8e626c7f130b57e9800962c The implementation is very simple: it just adds the GUID to the list of WAV GUIDs, and modifies the WAV muxer to always use WAVEFORMATEXTENSIBLE format with that GUID. This creates a standard container format for DFPWM besides raw data. It will allow users to transfer DFPWM audio in a standard container format, with the sample rate and channel count contained in the file as opposed to being an external parameter as in the raw format. This format is already supported in my AUKit library, which is the CC analog to libav (albeit much smaller). Support in other applications is TBD. Signed-off-by: Jack Bruienne <jackbruienne@gmail.com> --- libavformat/riff.c | 3 +++ libavformat/riffenc.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) [-- Attachment #2: v7-0003-libavformat-Added-DFPWM-WAV-container-support.patch --] [-- Type: text/x-patch, Size: 2551 bytes --] diff --git a/libavformat/riff.c b/libavformat/riff.c index 0c19d3f..f098c1d 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -587,6 +587,8 @@ const AVCodecTag ff_codec_wav_tags[] = { { AV_CODEC_ID_AAC, 0xA106 }, { AV_CODEC_ID_SPEEX, 0xA109 }, { AV_CODEC_ID_FLAC, 0xF1AC }, + /* DFPWM does not have an assigned format tag; it uses a GUID in WAVEFORMATEX instead */ + { AV_CODEC_ID_DFPWM, 0xFFFE }, { AV_CODEC_ID_ADPCM_SWF, ('S' << 8) + 'F' }, /* HACK/FIXME: Does Vorbis in WAV/AVI have an (in)official ID? */ { AV_CODEC_ID_VORBIS, ('V' << 8) + 'o' }, @@ -637,5 +639,6 @@ const AVCodecGuid ff_codec_wav_guids[] = { { AV_CODEC_ID_EAC3, { 0xAF, 0x87, 0xFB, 0xA7, 0x02, 0x2D, 0xFB, 0x42, 0xA4, 0xD4, 0x05, 0xCD, 0x93, 0x84, 0x3B, 0xDD } }, { AV_CODEC_ID_MP2, { 0x2B, 0x80, 0x6D, 0xE0, 0x46, 0xDB, 0xCF, 0x11, 0xB4, 0xD1, 0x00, 0x80, 0x5F, 0x6C, 0xBB, 0xEA } }, { AV_CODEC_ID_ADPCM_AGM,{ 0x82, 0xEC, 0x1F, 0x6A, 0xCA, 0xDB, 0x19, 0x45, 0xBD, 0xE7, 0x56, 0xD3, 0xB3, 0xEF, 0x98, 0x1D } }, + { AV_CODEC_ID_DFPWM, { 0x3A, 0xC1, 0xFA, 0x38, 0x81, 0x1D, 0x43, 0x61, 0xA4, 0x0D, 0xCE, 0x53, 0xCA, 0x60, 0x7C, 0xD1 } }, { AV_CODEC_ID_NONE } }; diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c index ffccfa3..96750e7 100644 --- a/libavformat/riffenc.c +++ b/libavformat/riffenc.c @@ -81,7 +81,7 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, par->channels == 1 && par->channel_layout && par->channel_layout != AV_CH_LAYOUT_MONO || par->channels == 2 && par->channel_layout && par->channel_layout != AV_CH_LAYOUT_STEREO || par->sample_rate > 48000 || - par->codec_id == AV_CODEC_ID_EAC3 || + par->codec_id == AV_CODEC_ID_EAC3 || par->codec_id == AV_CODEC_ID_DFPWM || av_get_bits_per_sample(par->codec_id) > 16; if (waveformatextensible) @@ -188,7 +188,7 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, /* dwChannelMask */ avio_wl32(pb, write_channel_mask ? par->channel_layout : 0); /* GUID + next 3 */ - if (par->codec_id == AV_CODEC_ID_EAC3) { + if (par->codec_id == AV_CODEC_ID_EAC3 || par->codec_id == AV_CODEC_ID_DFPWM) { ff_put_guid(pb, ff_get_codec_guid(par->codec_id, ff_codec_wav_guids)); } else { avio_wl32(pb, par->codec_tag); [-- Attachment #3: Type: text/plain, Size: 251 bytes --] _______________________________________________ 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 reply other threads:[~2022-03-08 3:30 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-08 3:30 Jack Bruienne [this message] 2022-03-10 12:42 ` Paul B Mahol
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=193e12fa-5bea-5fab-6def-a5ebd3a4be63@gmail.com \ --to=jackbruienne@gmail.com \ --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