简体   繁体   English

如何在C / C ++中使用lame将mp3解码为wav?

[英]How to decode mp3 into wav using lame in C/C++?

I learned how to encode wav into an mp3 using lame_encode_buffer_interleaved from this question: Is there any LAME c++ wraper\\simplifier (working on Linux Mac and Win from pure code)? 我学会了如何使用lame_encode_buffer_interleaved将wav编码为mp3: 是否有任何LAME c ++ wraper \\ simplifier(在Linux Mac上工作,从纯代码中获胜)?

Now I want to decode the mp3 back into wav. 现在我想将mp3解码回wav。 I know there's lame_decode but I don't know how to use it since it requires two pcm buffers ( pcm_l and pcm_r ). 我知道有lame_decode但我不知道如何使用它,因为它需要两个pcm缓冲区( pcm_lpcm_r )。 I don't understand how to put them together into a well-formed wav file, because I don't really know how they works. 我不明白如何将它们组合成一个格式良好的wav文件,因为我真的不知道它们是如何工作的。

Now can someone provide a simple working example on decoding an mp3 into a wav using lame in C/C++? 现在有人可以提供一个简单的工作示例,使用C / C ++中的lame将mp3解码为wav吗?

Thanks. 谢谢。

Take a look into the lame frontend source code. 看看蹩脚的前端源代码。 Start at the lame_decoder() function in the .../frontend/lame_main.c file, it decodes an MP3 file and writes the wave header. .../frontend/lame_main.c文件中的lame_decoder()函数开始,它解码MP3文件并写入波形头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM