[FFmpeg-devel] [PATCH 06/14] avformat/flvenc: refactor fourcc writing
Michael Niedermayer
michael at niedermayer.cc
Mon Dec 16 00:41:58 EET 2024
Hi Timo
On Thu, Dec 12, 2024 at 08:55:31PM +0100, Timo Rothenpieler wrote:
> ---
> libavformat/flvenc.c | 96 ++++++++++++++++++++++----------------------
> 1 file changed, 47 insertions(+), 49 deletions(-)
>
> diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> index 21e2bca5be..fbe5416353 100644
> --- a/libavformat/flvenc.c
> +++ b/libavformat/flvenc.c
> @@ -493,6 +493,45 @@ static void write_metadata(AVFormatContext *s, unsigned int ts)
> avio_wb32(pb, flv->metadata_totalsize + 11);
> }
>
> +static void write_codec_fourcc(AVIOContext *pb, enum AVCodecID codec_id)
> +{
> + switch (codec_id) {
> + case AV_CODEC_ID_AAC:
> + avio_write(pb, "mp4a", 4);
> + return;
> + case AV_CODEC_ID_OPUS:
> + avio_write(pb, "Opus", 4);
> + return;
> + case AV_CODEC_ID_FLAC:
> + avio_write(pb, "fLaC", 4);
> + return;
> + case AV_CODEC_ID_MP3:
> + avio_write(pb, ".mp3", 4);
> + return;
> + case AV_CODEC_ID_AC3:
> + avio_write(pb, "ac-3", 4);
> + return;
> + case AV_CODEC_ID_EAC3:
> + avio_write(pb, "ec-3", 4);
> + return;
> + case AV_CODEC_ID_H264:
> + avio_write(pb, "avc1", 4);
> + return;
> + case AV_CODEC_ID_HEVC:
> + avio_write(pb, "hvc1", 4);
> + return;
> + case AV_CODEC_ID_AV1:
> + avio_write(pb, "av01", 4);
> + return;
> + case AV_CODEC_ID_VP9:
> + avio_write(pb, "vp09", 4);
> + return;
> + default:
> + av_log(NULL, AV_LOG_ERROR, "Invalid codec FourCC write requested.\n");
> + av_assert0(0);
> + }
> +}
from the commit message i would have thought i would see something
similar to ff_codec_bmp_tags[]
such a table is more compact and can be used in both directions
thx
[..]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241215/8a7d6888/attachment.sig>
More information about the ffmpeg-devel
mailing list