如何使用pipeline录制两种不同的格式?

coollofty
Posts: 16
Joined: Thu Feb 14, 2019 10:09 am

如何使用pipeline录制两种不同的格式?

Postby coollofty » 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);	
我使用上面这样的一段代码,是无法工作的,要么注释掉上面的WavEncoder,要么注释掉正面的AmrEncoder。请问要怎样才能在同一个程序里,可以录制Wav和AMR-WB两种格式?

jason.mao
Posts: 96
Joined: Mon Nov 19, 2018 2:05 am

Re: 如何使用pipeline录制两种不同的格式?

Postby jason.mao » Thu May 23, 2019 4:03 am

Hi

I2S element的数据是实时的,只要被下级element读走就没有了。根据你的描述,你参考 http_play_and_save_to_file example,把输入换成I2S,输出一路为WAV, 一路为AMR。

Who is online

Users browsing this forum: No registered users and 26 guests