将 wav 编码为 ogg vorbis 时出现问题
我有一个 MFC 应用程序。我有以 wav 格式存储的音频数据。我的问题是,如何将这些字节的数组编码为 ogg vorbis 格式?
我找到了一个例子:
http://svn.xiph.org/trunk/vorbis/ example/encoder_example.c
并尝试在我的应用程序中使用它。 首先,我尝试将其添加到我的项目中并进行编译。我必须添加上述文件中包含的文件,因此我在 libvorbis 和 libogg 库中找到了它们。但我仍然无法链接:
Error 4 error LNK2019: unresolved external symbol _oggpack_writetrunc referenced in function _vorbis_bitrate_addblock bitrate.obj
Error 2 error LNK2019: unresolved external symbol _oggpack_write referenced in function _vorbis_bitrate_addblock bitrate.obj
Error 8 error LNK2019: unresolved external symbol _oggpack_read referenced in function _vorbis_staticbook_unpack codebook.obj
Error 10 error LNK2019: unresolved external symbol _oggpack_look referenced in function _decode_packed_entry_number codebook.obj
Error 7 error LNK2019: unresolved external symbol _oggpack_get_buffer referenced in function _vorbis_bitrate_flushpacket bitrate.obj
Error 5 error LNK2019: unresolved external symbol _oggpack_bytes referenced in function _vorbis_bitrate_addblock bitrate.obj
Error 9 error LNK2019: unresolved external symbol _oggpack_adv referenced in function _decode_packed_entry_number codebook.obj
Error 3 error LNK2001: unresolved external symbol _oggpack_write codebook.obj
Error 6 error LNK2001: unresolved external symbol _oggpack_bytes codebook.obj
我找不到这些人的定义位置。 我将不胜感激任何帮助。
谢谢。
I have an MFC application. I have audio data stored in wav format. My question is, how can I encode an array of those bytes into an ogg vorbis format?
I found an example:
http://svn.xiph.org/trunk/vorbis/examples/encoder_example.c
and tried to use it in my application.
First, I tried to add it to my project and compile. I had to add files included in the above file, so I found them in the libraries libvorbis and libogg. And still I cannot link:
Error 4 error LNK2019: unresolved external symbol _oggpack_writetrunc referenced in function _vorbis_bitrate_addblock bitrate.obj
Error 2 error LNK2019: unresolved external symbol _oggpack_write referenced in function _vorbis_bitrate_addblock bitrate.obj
Error 8 error LNK2019: unresolved external symbol _oggpack_read referenced in function _vorbis_staticbook_unpack codebook.obj
Error 10 error LNK2019: unresolved external symbol _oggpack_look referenced in function _decode_packed_entry_number codebook.obj
Error 7 error LNK2019: unresolved external symbol _oggpack_get_buffer referenced in function _vorbis_bitrate_flushpacket bitrate.obj
Error 5 error LNK2019: unresolved external symbol _oggpack_bytes referenced in function _vorbis_bitrate_addblock bitrate.obj
Error 9 error LNK2019: unresolved external symbol _oggpack_adv referenced in function _decode_packed_entry_number codebook.obj
Error 3 error LNK2001: unresolved external symbol _oggpack_write codebook.obj
Error 6 error LNK2001: unresolved external symbol _oggpack_bytes codebook.obj
I could not find where those guys are defined.
I would appreciate any help.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
libsndfile 是一个流行的库,可以做你想做的事情。
至于您的链接错误,看起来您正在链接的代码依赖于定义以“oggpack”开头的符号的库,因此您需要在链接中包含该库。但使用 libsndfile 可能是更好的解决方案。
libsndfile is a popular library for doing what you want.
As for your link errors, it looks like you're linking with code that's dependent on a library that defines symbols starting with "oggpack," so you'd need to include that library in your link. But using libsndfile may be a better solution.
我有一些运气:
gcc program.c -lvorbis -o program
我希望 vorbis 能做一个小的工作示例
那会起作用的。
我尝试了所有的例子,但它们都不是很好。
I had some luck with:
gcc program.c -lvorbis -o program
I wish vorbis would make small working exampe
that would work.
I tried all there example and they are not very good.
gcc pc -lvorbisenc -o p
或
gcc pc -lvorbis -lvorbisenc -op
但我还没有检查它是否会编码 wav 。
gcc p.c -lvorbisenc -o p
or
gcc p.c -lvorbis -lvorbisenc -o p
But I have not checked if it will encode a wav yet.