简体   繁体   English

除了将位复制到ANativeWindow缓冲区之外,还有其他方法吗?

[英]Any other method than copying bits to an ANativeWindow buffer?

I'm using native window in android to show a video in a surface view. 我正在使用android中的本机窗口以表面视图显示视频。 Here's the part of my code. 这是我的代码的一部分。

ANativeWindow_lock(window, &windowBuffer, NULL);
memcpy(windowBuffer.bits, buffer,  size);
ANativeWindow_unlockAndPost(window);

But the memcpy is taking too much time. 但是memcpy需要太多时间。 Is there any other method without memcpy so that I can directly use the buffer allocated in native code? 还有没有memcpy的其他方法,以便我可以直接使用本机代码中分配的缓冲区? I want to fill the surface view completely with data in buffer. 我想用缓冲区中的数据完全填充表面视图。

Surfaces aren't buffers, they're queues of buffers. 表面不是缓冲区,它们是缓冲区的队列。 Anything headed to the display will be double- or triple-buffered. 前往显示屏的所有内容都会被双缓冲或三缓冲。

You can generate your output directly into the buffer returned by ANativeWindow_lock() . 您可以将输出直接生成到ANativeWindow_lock()返回的缓冲区中。 Because it's (at least) double-buffered, there is no penalty for locking the next buffer right after you unlock the previous one -- you won't prevent the compositor from seeing the just-finished frame by immediately calling lock. 因为它(至少)是双缓冲的,所以在解锁前一个缓冲区后立即锁定下一个缓冲区没有任何惩罚-您不会通过立即调用lock来阻止合成器看到刚完成的帧。

See the Android graphics architecture doc for more details, particularly this section . 有关更多详细信息,请参阅Android图形架构文档,尤其是本部分

暂无
暂无

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

相关问题 从 ANativeWindow_Buffer 获取 ANativeWindowBuffer - Getting a ANativeWindowBuffer from ANativeWindow_Buffer 为什么不同设备的 ANativeWindow_Buffer.stride 不同 - Why ANativeWindow_Buffer.stride is different for different devices 除了XML之外,还有其他方法可以为Android应用程序创建UI吗? - Is there any other method to creating UI for android application rather than XML? 有什么方法可以在ANativeWindow上呈现原始视频并将其同时写入文件? - Any way to render a raw video on a ANativeWindow and at the same time write it to a file? 除了AsyncTask以外的其他方式吗? - any way other than AsyncTask? 除OpenFileChooser以外的任何选项 - Any Option other than OpenFileChooser OnSharedPreferencesChanged 在更改首选项后不会调用任何其他方法而不是使用 EditTextPreference - OnSharedPreferencesChanged is not called after changing preferences any other method than using EditTextPreference 除了在线文档外,还有什么方法可以找出Android中给定类,方法等的最低api版本 - Other than the Online Documentation is there any way to find out the minimum api version for a given class, method etc in Android 除了Paypal还有其他支付模块吗? - Is there any other payment module other than Paypal? 除了onNewIntent()方法之外,我是否可以通过其他任何方式在Android应用程序中获得Twitter API响应? - Can I get Twitter API response in my Android app any other way than with onNewIntent() method?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM