如何使用pipeline录制两种不同的格式?
Posted: Tue May 14, 2019 10:27 am
Code: Select all
//WAV
audio_pipeline_cfg_t pipeline_wav = DEFAULT_AUDIO_PIPELINE_CONFIG();
wav_encoder_cfg_t wav_enc_cfg = DEFAULT_WAV_ENCODER_CONFIG();
wavRecorder = audio_pipeline_init(&pipeline_wav);
audio_pipeline_register(wavRecorder, i2s_stream_reader, "i2s");
audio_pipeline_register(wavRecorder, wav_encoder_init(&wav_enc_cfg), "wav");
audio_pipeline_register(wavRecorder, fs_stream_writer, "file");
audio_pipeline_link(wavRecorder, (const char *[]) {"i2s", "wav", "file"}, 3);
// AMR-WB
audio_pipeline_cfg_t pipeline_amr = DEFAULT_AUDIO_PIPELINE_CONFIG();
amrwb_encoder_cfg_t amr_enc_cfg = DEFAULT_AMRWB_ENCODER_CONFIG();
amrRecorder = audio_pipeline_init(&pipeline_amr);
audio_pipeline_register(amrRecorder, i2s_stream_reader, "i2s");
audio_pipeline_register(amrRecorder, amrwb_encoder_init(&amr_enc_cfg), "Wamr");
audio_pipeline_register(amrRecorder, fs_stream_writer, "file");
audio_pipeline_link(amrRecorder, (const char *[]) {"i2s", "Wamr", "file"}, 3);