Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/audio/ffmpeg_dec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ else()
if(CONFIG_FFMPEG_DEC_OPUS OR CONFIG_COMP_FFMPEG_DEC_STUB)
add_local_sources(sof ffmpeg_dec-opus.c)
endif()
if(CONFIG_FFMPEG_DEC_ALAC OR CONFIG_COMP_FFMPEG_DEC_STUB)
add_local_sources(sof ffmpeg_dec-alac.c)
endif()
if(CONFIG_FFMPEG_DEC_SBC OR CONFIG_COMP_FFMPEG_DEC_STUB)
add_local_sources(sof ffmpeg_dec-sbc.c)
endif()
if(CONFIG_FFMPEG_DEC_G722 OR CONFIG_COMP_FFMPEG_DEC_STUB)
add_local_sources(sof ffmpeg_dec-g722.c)
endif()
if(CONFIG_FFMPEG_DEC_APTX OR CONFIG_COMP_FFMPEG_DEC_STUB)
add_local_sources(sof ffmpeg_dec-aptx.c)
endif()

if(CONFIG_COMP_FFMPEG_DEC_STUB)
add_local_sources(sof ffmpeg_dec-stub.c)
Expand All @@ -34,6 +46,21 @@ else()
if(CONFIG_FFMPEG_ENC_AAC)
add_local_sources(sof ffmpeg-enc-aac.c)
endif()
if(CONFIG_FFMPEG_ENC_FLAC)
add_local_sources(sof ffmpeg-enc-flac.c)
endif()
if(CONFIG_FFMPEG_ENC_ALAC)
add_local_sources(sof ffmpeg-enc-alac.c)
endif()
if(CONFIG_FFMPEG_ENC_SBC)
add_local_sources(sof ffmpeg-enc-sbc.c)
endif()
if(CONFIG_FFMPEG_ENC_G722)
add_local_sources(sof ffmpeg-enc-g722.c)
endif()
if(CONFIG_FFMPEG_ENC_APTX)
add_local_sources(sof ffmpeg-enc-aptx.c)
endif()
if(CONFIG_FFMPEG_FILTER)
add_local_sources(sof ffmpeg-filter.c)
endif()
Expand Down Expand Up @@ -63,6 +90,21 @@ else()
if(CONFIG_FFMPEG_ENC_AAC)
list(APPEND _ffmpeg_dec_sources ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg-enc-aac.c)
endif()
if(CONFIG_FFMPEG_ENC_FLAC)
list(APPEND _ffmpeg_dec_sources ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg-enc-flac.c)
endif()
if(CONFIG_FFMPEG_ENC_ALAC)
list(APPEND _ffmpeg_dec_sources ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg-enc-alac.c)
endif()
if(CONFIG_FFMPEG_ENC_SBC)
list(APPEND _ffmpeg_dec_sources ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg-enc-sbc.c)
endif()
if(CONFIG_FFMPEG_ENC_G722)
list(APPEND _ffmpeg_dec_sources ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg-enc-g722.c)
endif()
if(CONFIG_FFMPEG_ENC_APTX)
list(APPEND _ffmpeg_dec_sources ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg-enc-aptx.c)
endif()
if(CONFIG_FFMPEG_FILTER)
list(APPEND _ffmpeg_dec_sources ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg-filter.c)
endif()
Expand Down
75 changes: 74 additions & 1 deletion src/audio/ffmpeg_dec/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,38 @@ config FFMPEG_DEC_MP3
MPEG-1/2 Layer III decoder. Enables --enable-decoder=mp3 and the
mpegaudio parser in the libavcodec build. Uses the float math layer.

config FFMPEG_DEC_ALAC
bool "ALAC decoder"
help
Apple Lossless Audio Codec (ALAC) decoder. Pure 16/24-bit integer
lossless decoder with no floating-point math dependency. Enables
--enable-decoder=alac in the libavcodec build for compress playback
streams requesting SND_AUDIOCODEC_ALAC.

config FFMPEG_DEC_SBC
bool "Bluetooth SBC / mSBC decoder"
help
Bluetooth A2DP Subband Codec (SBC) and HFP Wideband Speech (mSBC)
decoder. Pure integer synthesis filterbank with no floating-point
math dependency. Enables --enable-decoder=sbc --enable-parser=sbc
in the libavcodec build.

config FFMPEG_DEC_G722
bool "ITU-T G.722 ADPCM wideband speech decoder"
help
ITU-T G.722 7 kHz wideband speech ADPCM decoder (64/56/48 kbps).
Pure integer QMF + 2-band ADPCM decoder with no floating-point math
dependency. Enables --enable-decoder=adpcm_g722 in the libavcodec
build for compress playback streams requesting SND_AUDIOCODEC_G722.

config FFMPEG_DEC_APTX
bool "Bluetooth aptX decoder"
help
Bluetooth aptX audio decoder. Pure integer 4-band QMF + ADPCM
decoder with no floating-point math dependency. Enables
--enable-decoder=aptx in the libavcodec build for compress playback
streams requesting SND_AUDIOCODEC_APTX.

comment "FFmpeg encoders to build (footprint scales with selection)"

config FFMPEG_ENC_MP3
Expand All @@ -71,11 +103,52 @@ config FFMPEG_ENC_AAC
Selected at runtime for compress capture streams requesting
SND_AUDIOCODEC_AAC.

config FFMPEG_ENC_FLAC
bool "FLAC encoder (native libavcodec, fixed LPC)"
help
Lossless FLAC encoder via native libavcodec flac encoder configured
with fixed integer LPC predictors (FF_LPC_TYPE_FIXED, compression_level 1).
Emits a self-contained native .flac stream ("fLaC" + STREAMINFO + frames).
Selected at runtime for compress capture streams requesting
SND_AUDIOCODEC_FLAC.

config FFMPEG_ENC_ALAC
bool "ALAC encoder (native libavcodec, fixed LPC)"
help
Apple Lossless Audio Codec (ALAC) encoder via native libavcodec alac
encoder configured with fixed integer LPC prediction (compression_level 1).
Selected at runtime for compress capture streams requesting
SND_AUDIOCODEC_ALAC.

config FFMPEG_ENC_SBC
bool "Bluetooth SBC / mSBC encoder (native libavcodec)"
help
Bluetooth A2DP Subband Codec (SBC) and HFP Wideband Speech (mSBC)
encoder via native libavcodec sbc encoder. Pure integer analysis
filterbank with no floating-point math dependency. Selected at
runtime for compress capture streams requesting SND_AUDIOCODEC_SBC.

config FFMPEG_ENC_G722
bool "ITU-T G.722 ADPCM wideband speech encoder (native libavcodec)"
help
ITU-T G.722 7 kHz wideband speech ADPCM encoder (64 kbps) via
native libavcodec g722 encoder. Pure integer QMF + 2-band ADPCM
encoder with no floating-point math dependency. Selected at runtime
for compress capture streams requesting SND_AUDIOCODEC_G722.

config FFMPEG_ENC_APTX
bool "Bluetooth aptX encoder (native libavcodec)"
help
Bluetooth aptX audio encoder via native libavcodec aptx encoder.
Pure integer 4-band QMF + ADPCM encoder with no floating-point math
dependency. Selected at runtime for compress capture streams
requesting SND_AUDIOCODEC_APTX.

# Selected automatically when any encoder is enabled. Gates compilation of the
# runtime encode path (ffmpeg-encode.c).
config FFMPEG_ENC
bool
default y if FFMPEG_ENC_MP3 || FFMPEG_ENC_AAC
default y if FFMPEG_ENC_MP3 || FFMPEG_ENC_AAC || FFMPEG_ENC_FLAC || FFMPEG_ENC_ALAC || FFMPEG_ENC_SBC || FFMPEG_ENC_G722 || FFMPEG_ENC_APTX

comment "FFmpeg audio filters to build (libavfilter)"
depends on IPC_MAJOR_4
Expand Down
6 changes: 6 additions & 0 deletions src/audio/ffmpeg_dec/ffmpeg-enc-aac.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ static int ffmpeg_enc_aac_validate_params(struct processing_module *mod,
struct comp_dev *dev = mod->dev;
uint32_t ch = codec_params->ch_in ? codec_params->ch_in : codec_params->ch_out;

if (codec_params->rate_control != 0 &&
codec_params->rate_control != SND_RATECONTROLMODE_CONSTANTBITRATE) {
comp_err(dev, "unsupported AAC rate_control mode 0x%x",
codec_params->rate_control);
return -ENOTSUP;
}
/* vo-aacenc writes the ADTS MPEG ID bit as 1 (MPEG-2 ADTS) unconditionally,
* so only UNDEFINED and MP2ADTS can be honored accurately.
*/
Expand Down
Loading
Loading