在 Objective-C Mac 应用程序中使用 TagLib(C++ 库)
我正在寻找使用 TagLib,一个 C++ 库,用于从各种内容获取标记信息音频文件,在一个新的 Objective-C 项目中。
- 有人有在 Objective-C 项目中使用这样的 C++ 库的经验吗?
- 我应该期待什么样的障碍?
- 谁能给我指点关于这个主题的好的教程或指南?
另外... TagLib 是一个不错的选择吗?我需要支持 MP3、WMA、FLAC、MP4、M4A、AAC 和 OGG 文件。我不相信有一个原生 Mac 框架可以支持所有这些。
谢谢你!
I'm looking to use TagLib, a C++ library for getting tagging information from a variety of audio files, in a new Objective-C project.
- Does anyone have experience using a C++ library such as this in an Objective-C project?
- What kind of roadblocks should I expect?
- Can anyone point me a good tutorials or guides for this subject?
Also... is TagLib even a good choice? I need to support MP3, WMA, FLAC, MP4, M4A, AAC, and OGG files. I don't believe there is a native Mac framework that will support all of these.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
混合 Objective-C 和 C++ 非常容易;几乎没有问题。 阅读 Apple 的此文档。正如那里所描述的,有一种叫做 Objective-C++ 的东西,它允许您在同一个文件中混合 C++ 和 Objective-C++。在 XCode 中,只需使用文件扩展名
.mm
即可使用 Objective-C++。它并不试图统一所有 Objective-C 对象和 C++ 对象;您可以同时、独立地使用它们。所以 Objective-C 对象由
retain
/release
管理,C++ 对象由new
/delete
管理。有一些棘手的事情,例如将非指针 C++ 对象作为 Objective-C 类中的 ivar,但如果您始终使用 C++ 指针(而不是非指针对象),您将不会遇到任何重大问题。It is very easy to mix Objective-C and C++; there is practically no problem. Read this documentation at Apple. As described there, there is something called Objective-C++, which allows you to mix C++ and Objective-C++ in the same file. In XCode, just use a file extension
.mm
to use Objective-C++.It does not attempt to unify at all the Objective-C objects and C++ objects; you can just use them simultaneously, independently. So the Objective-C objects are managed by
retain
/release
, and C++ objects are managed bynew
/delete
. There are a few tricky things like putting a non-pointer C++ object as an ivar inside an Objective-C class, but if you always use C++ pointers (instead of non-pointer objects) you won't face any major problem.