LibMedia: Support the MP3 and AAC codecs in our demuxer

This commit is contained in:
Zaggy1024 2025-09-23 18:32:32 -05:00 committed by Jelle Raaijmakers
parent 6b34003c2c
commit dd052832c1
3 changed files with 22 additions and 0 deletions

View File

@ -22,6 +22,8 @@ enum class CodecID : u32 {
H263,
H264,
H265,
MP3,
AAC,
// AOMedia
AV1,
// Xiph
@ -64,6 +66,12 @@ struct Formatter<Media::CodecID> : Formatter<StringView> {
case Media::CodecID::H265:
codec = "H.265"sv;
break;
case Media::CodecID::MP3:
codec = "MP3"sv;
break;
case Media::CodecID::AAC:
codec = "AAC"sv;
break;
case Media::CodecID::MPEG1:
codec = "MPEG1"sv;
break;

View File

@ -130,6 +130,12 @@ CodecID MatroskaDemuxer::get_codec_id_for_string(FlyString const& codec_id)
return CodecID::H264;
if (codec_id == "V_MPEGH/ISO/HEVC")
return CodecID::H265;
if (codec_id == "A_MPEG/L3")
return CodecID::MP3;
if (codec_id == "A_AAC" || codec_id == "A_AAC/MPEG4/LC"
|| codec_id == "A_AAC/MPEG4/LC/SBR" || codec_id == "A_AAC/MPEG4/LTP"
|| codec_id == "A_AAC/MPEG4/MAIN" || codec_id == "A_AAC/MPEG4/SSR")
return CodecID::AAC;
if (codec_id == "V_AV1")
return CodecID::AV1;
if (codec_id == "V_THEORA")

View File

@ -33,6 +33,10 @@ static inline AVCodecID ffmpeg_codec_id_from_media_codec_id(CodecID codec)
return AV_CODEC_ID_H264;
case CodecID::H265:
return AV_CODEC_ID_HEVC;
case CodecID::MP3:
return AV_CODEC_ID_MP3;
case CodecID::AAC:
return AV_CODEC_ID_AAC;
case CodecID::AV1:
return AV_CODEC_ID_AV1;
case CodecID::Theora:
@ -65,6 +69,10 @@ static inline CodecID media_codec_id_from_ffmpeg_codec_id(AVCodecID codec)
return CodecID::H264;
case AV_CODEC_ID_HEVC:
return CodecID::H265;
case AV_CODEC_ID_MP3:
return CodecID::MP3;
case AV_CODEC_ID_AAC:
return CodecID::AAC;
case AV_CODEC_ID_AV1:
return CodecID::AV1;
case AV_CODEC_ID_THEORA: