如何在android中访问相机和麦克风?
我想写一个android程序,现在我在android的ui中使用jni通过openmax访问编解码器,我发现openmax组件中没有视频音频源或帧缓冲区。我的手机是高通的msm7227平台。在高通的网站上,它说 SOC 中有一个 amr 编解码器。
我可以使用V4L2访问摄像头并直接访问/dev/XX等音频设备来捕获音频数据吗?
例如我想捕获图片并对其进行编码,首先我分配一个缓冲区,通过V4L2用数据填充缓冲区,然后将地址和其他参数传递给openmax视频编码器组件。我不知道这是一个好方法。
有人有经验可以帮助我吗?
顺便说一句,java很慢,我想用C或C++编写代码。
I want to write a android progrom,now i access the codec via the openmax by use jni in android's ui,I found there is no video audio source or framebuffer in openmax components.My cell phone is qualcomm's msm7227 platform. in the qualcomm's website it says there is an amr codec int the SOC.
can i use V4L2 to access the camera and directy access the audio device like /dev/XX to capture audio data?
for example i want to capture a pic and encode it,first I allocate a buffer,fill the buffer with data by V4L2 then pass the address and other paremeters to openmax video encoder componenet. i don't know is it a good way.
some one has experience can help me ?
by the way,the java is very slow,i want to code in C or C++.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要仅仅假设 Java 很慢。我建议首先在 Java 中尝试,然后在确定您的应用程序不够快后,用 C++ 重写性能关键部分。
Java 的好处是您可以使用
Camera
class 和 媒体类 直接,它们很漂亮便于使用。Don't just assume that Java is slow. I would recommend to try it in Java first, and then rewrite performance-critical parts in C++ once you've determined that your app is not fast enough.
The good thing about Java is that you can use the
Camera
class and media classes directly, and they're pretty easy to use.