音訊硬體轉碼器驅動程式庫控制項。用於透過 FIDL 編碼器介面,控制音訊硬體編碼器驅動程式庫程式並從中取得資訊。請參閱 audio-driver-ctl,瞭解如何播放、錄製及設定音訊串流。
用量
audio-codec-ctl [-d|--device <device>] f[ormats]
audio-codec-ctl [-d|--device <device>] r[eset]
audio-codec-ctl [-d|--device <device>] d[ai] <number_of_channels>
<channels_to_use_bitmask> pdm|upcm|spcm|fpcm none|i2s|left-stereo|right-stereo|1tdm|2tdm|3tdm
<frame_rate> <bits_per_slot> <bits_per_sample>
audio-codec-ctl [-d|--device <device>] start
audio-codec-ctl [-d|--device <device>] stop
audio-codec-ctl [-d|--device <device>] p[lug_state]
audio-codec-ctl [-d|--device <device>] e[elements]
audio-codec-ctl [-d|--device <device>] t[opologies]
audio-codec-ctl [-d|--device <device>] w[atch] <id>
audio-codec-ctl [-d|--device <device>] set <id> [start|stop] [bypass] [gain <gain>]
[vendor <hex> <hex> ...]
audio-codec-ctl list
audio-codec-ctl [-h|--help]
指令
音訊硬體轉碼器驅動程式庫控制項 (指定完整路徑,例如 /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector 或只指定服務執行個體名稱,例如 default),或未指定 (選取 /svc/fuchsia.hardware.audio.CodecConnectorService 中的第一個裝置)。每次呼叫只能指定一個指令。<device>
list 指令
audio-codec-ctl list
列出所有可用的編解碼器裝置。
formats 指令
audio-codec-ctl [-d|--device <device>] f[ormats]
擷取轉碼器支援的 DAI 格式。
info 指令
audio-codec-ctl [-d|--device <device>] i[nfo]
擷取有關轉碼器的文字資訊。
capabilities_plug_detect 指令
audio-codec-ctl [-d|--device <device>] c[apabilities_plug_detect]
擷取插頭偵測功能。
reset 指令
audio-codec-ctl [-d|--device <device>] r[eset]
重設轉碼器。
dai 指令
audio-codec-ctl [-d|--device <device>] d[ai] <number_of_channels>
<channels_to_use_bitmask> pdm|upcm|spcm|fpcm none|i2s|left-stereo|right-stereo|1tdm|2tdm|3tdm
<frame_rate> <bits_per_slot> <bits_per_sample>
在轉碼器介面中設定要使用的 DAI 格式。
<number_of_channels>:頻道數量。
<channels_to_use_bitmask>:透過位元遮罩設定要啟用的通道。最低有效位元對應至管道索引 0。
pdm:脈衝密度調變樣本。
upcm:以主機位元組順序簽署的線性脈衝碼調變樣本。
spcm:主機位元組順序的未簽署線性脈衝碼調變樣本。
fpcm:以 IEEE-754 編碼的浮點樣本。
none:沒有影格格式,如沒有影格同步的樣本 (例如 PDM)。
i2s:格式如 I2S 規格中所指定。
left-stereo:靠左對齊,2 個聲道。
right-stereo:靠右對齊,2 個聲道。
1tdm:靠左對齊,通道數量可變,資料從影格同步變化開始,從低到高,在 sclk 的上升邊緣輸出。影格同步必須維持高電壓,時間剛好為 1 個時脈週期。
2tdm:靠左對齊,通道數量可變,資料會在訊框同步從低電平變更為高電平後的一個時脈週期開始,並在 sclk 的上升邊緣輸出。影格同步必須在 1 個時脈週期內保持高電位。
3tdm:靠左對齊,管道數量可變,資料會在訊框同步從低到高變化後,於 sclk 上升邊緣輸出,並在兩個時脈週期後開始。影格同步必須在 1 個時脈週期內保持高電位。
<frame_rate>:所有樣本的影格率。
<bits_per_slot>:所有管道的每個時段位元數。
<bits_per_sample>:所有樣本的每樣本位元數。必須小於每個管道的位元數,才能容納樣本。
start 指令
audio-codec-ctl [-d|--device <device>] start
開始/重新開始轉碼器作業。
stop 指令
audio-codec-ctl [-d|--device <device>] stop
停止轉碼器作業。
plug_state 指令
audio-codec-ctl [-d|--device <device>] p[lug_state]
取得插頭偵測狀態。
elements 指令
audio-codec-ctl [-d|--device <device>] e[lements]
傳回支援的處理元素向量。
topologies 指令
audio-codec-ctl [-d|--device <device>] t[opologies]
傳回支援的拓撲向量。
watch 指令
audio-codec-ctl [-d|--device <device>] w[atch] <id>
取得處理元素狀態。
set 指令
audio-codec-ctl [-d|--device <device>] set <id> [start|stop] [bypass] [gain <gain>]
[vendor <hex> <hex> ...]
控制處理元素。
<id>:處理元素 ID。
start:處理元素啟動狀態。
stop:程序元素停止狀態。
bypass:處理元素略過狀態。
<gain>:以 GainType 格式回報支援的處理元素向量中目前的增益。
<hex>:以十六進位格式提供給處理元素的廠商專屬原始位元組。
範例
列出所有可用的編解碼器裝置
audio-codec-ctl listdefault
擷取支援的 DAI 格式
audio-codec-ctl fExecuting on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
[ fuchsia_hardware_audio::DaiSupportedFormats{ number_of_channels = [ 2, 4, ], sample_formats = [ fuchsia_hardware_audio::DaiSampleFormat::kPcmSigned, ], frame_formats = [ fuchsia_hardware_audio::DaiFrameFormat::frame_format_standard(fuchsia_hardware_audio::DaiFrameFormatStandard::kI2S), fuchsia_hardware_audio::DaiFrameFormat::frame_format_standard(fuchsia_hardware_audio::DaiFrameFormatStandard::kTdm1), ], frame_rates = [ 48000, 96000, ], bits_per_slot = [ 16, 32, ], bits_per_sample = [ 16, 32, ], }, ]
擷取文字資訊
audio-codec-ctl iExecuting on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
fuchsia_hardware_audio::CodecInfo{ unique_id = "", manufacturer = "Texas Instruments", product_name = "TAS5825m", }
擷取外掛程式偵測功能
audio-codec-ctl cExecuting on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
fuchsia_hardware_audio::PlugDetectCapabilities::kHardwired
檢查轉碼器是否可橋接
audio-codec-ctl bExecuting on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
Is bridgeable: false
重設轉碼器
audio-codec-ctl rExecuting on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
Reset done
設定轉碼器的橋接模式
audio-codec-ctl -m trueSetting bridged mode to: true
Executing on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
在轉碼器介面中設定要使用的 DAI 格式
audio-codec-ctl d 2 1 s i 48000 16 32Setting DAI format:
fuchsia_hardware_audio::DaiFormat{ number_of_channels = 2, channels_to_use_bitmask = 1, sample_format = fuchsia_hardware_audio::DaiSampleFormat::kPcmSigned, frame_format = fuchsia_hardware_audio::DaiFrameFormat::frame_format_standard(fuchsia_hardware_audio::DaiFrameFormatStandard::kI2S), frame_rate = 48000, bits_per_slot = 16, bits_per_sample = 32, }
Executing on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
開始或重新啟動轉碼器作業
audio-codec-ctl startExecuting on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
Start done
停止轉碼器作業
audio-codec-ctl stopExecuting on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
Stop done
取得插頭偵測狀態
audio-codec-ctl pExecuting on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
fuchsia_hardware_audio::PlugState{ plugged = true, plug_state_time = 1167863520, }
取得支援的處理元素
audio-codec-ctl eExecuting on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
[ fuchsia_hardware_audio_signalprocessing::Element{ id = 1, type = fuchsia_hardware_audio_signalprocessing::ElementType::kGain, type_specific = fuchsia_hardware_audio_signalprocessing::TypeSpecificElement::gain(fuchsia_hardware_audio_signalprocessing::Gain{ type = fuchsia_hardware_audio_signalprocessing::GainType::kDecibels, min_gain = -63.5, max_gain = 0, min_gain_step = 0.5, }), }, fuchsia_hardware_audio_signalprocessing::Element{ id = 2, type = fuchsia_hardware_audio_signalprocessing::ElementType::kMute, }, ]
取得支援的拓撲
audio-codec-ctl tExecuting on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
[ fuchsia_hardware_audio_signalprocessing::Topology{ id = 1, processing_elements_edge_pairs = [ fuchsia_hardware_audio_signalprocessing::EdgePair{ processing_element_id_from = 1, processing_element_id_to = 2, }, fuchsia_hardware_audio_signalprocessing::EdgePair{ processing_element_id_from = 2, processing_element_id_to = 3, }, ], }, ]
取得處理元素狀態
audio-codec-ctl w 1Executing on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
fuchsia_hardware_audio_signalprocessing::ElementState{ type_specific = fuchsia_hardware_audio_signalprocessing::TypeSpecificElementState::gain(fuchsia_hardware_audio_signalprocessing::GainElementState{ gain = 0, }), started = true, }
控制處理元素
audio-codec-ctl set 1 start gain 1.23 vendor 0x12 0x98Setting element state:
fuchsia_hardware_audio_signalprocessing::SignalProcessingSetElementStateRequest{ processing_element_id = 1, state = fuchsia_hardware_audio_signalprocessing::ElementState{ type_specific = fuchsia_hardware_audio_signalprocessing::TypeSpecificElementState::gain(fuchsia_hardware_audio_signalprocessing::GainElementState{ gain = 1.23, }), started = true, vendor_specific_data = [ 18, 152, ], }, }
Executing on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
指定裝置
audio-codec-ctl -d default pExecuting on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
fuchsia_hardware_audio::PlugState{ plugged = true, plug_state_time = 1167863520, }
audio-codec-ctl -d non-existent pExecuting on device: /svc/fuchsia.hardware.audio.CodecConnectorService/non-existent/codec_connector
could not connect to:/svc/fuchsia.hardware.audio.CodecConnectorService/non-existent/codec_connector status:ZX_ERR_NOT_FOUND
audio-codec-ctl -d /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector pExecuting on device: /svc/fuchsia.hardware.audio.CodecConnectorService/default/codec_connector
fuchsia_hardware_audio::PlugState{ plugged = true, plug_state_time = 1167863520, }
原始碼
audio-codec-ctl 的原始碼://src/media/audio/tools/audio-codec-ctl/