本文整理汇总了C++中ANativeWindow::cancelBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ ANativeWindow::cancelBuffer方法的具体用法?C++ ANativeWindow::cancelBuffer怎么用?C++ ANativeWindow::cancelBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ANativeWindow
的用法示例。
在下文中一共展示了ANativeWindow::cancelBuffer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cancel_buffer
int StreamAdapter::cancel_buffer(const camera2_stream_ops_t* w,
buffer_handle_t* buffer) {
int state = static_cast<const StreamAdapter*>(w)->mState;
if (state != ACTIVE) {
ALOGE("%s: Called when in bad state: %d", __FUNCTION__, state);
return INVALID_OPERATION;
}
ANativeWindow *a = toANW(w);
return a->cancelBuffer(a,
container_of(buffer, ANativeWindowBuffer, handle), -1);
}
示例2: IOMXHWBuffer_Cancel
int IOMXHWBuffer_Cancel( void *window, void *p_handle )
{
ANativeWindow *anw = (ANativeWindow *)window;
ANativeWindowBuffer_t *anb = (ANativeWindowBuffer_t *)p_handle;
status_t err = NO_ERROR;
CHECK_ANW();
CHECK_ANB();
#if ANDROID_API >= 18
err = anw->cancelBuffer_DEPRECATED( anw, anb );
#else
err = anw->cancelBuffer( anw, anb );
#endif
CHECK_ERR();
return 0;
}
示例3: ReleaseAllPendingVideoBuffersLocked
void OmxDecoder::ReleaseAllPendingVideoBuffersLocked()
{
Vector<BufferItem> releasingVideoBuffers;
{
Mutex::Autolock autoLock(mPendingVideoBuffersLock);
int size = mPendingVideoBuffers.size();
for (int i = 0; i < size; i++) {
releasingVideoBuffers.push(mPendingVideoBuffers[i]);
}
mPendingVideoBuffers.clear();
}
// Free all pending video buffers without holding mPendingVideoBuffersLock.
int size = releasingVideoBuffers.size();
for (int i = 0; i < size; i++) {
MediaBuffer *buffer;
buffer = releasingVideoBuffers[i].mMediaBuffer;
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
android::sp<Fence> fence;
int fenceFd = -1;
fence = releasingVideoBuffers[i].mReleaseFenceHandle.mFence;
if (fence.get() && fence->isValid()) {
fenceFd = fence->dup();
}
MOZ_ASSERT(buffer->refcount() == 1);
// This code expect MediaBuffer's ref count is 1.
// Return gralloc buffer to ANativeWindow
ANativeWindow* window = static_cast<ANativeWindow*>(mNativeWindowClient.get());
window->cancelBuffer(window,
buffer->graphicBuffer().get(),
fenceFd);
// Mark MediaBuffer as rendered.
// When gralloc buffer is directly returned to ANativeWindow,
// this mark is necesary.
sp<MetaData> metaData = buffer->meta_data();
metaData->setInt32(kKeyRendered, 1);
#endif
// Return MediaBuffer to OMXCodec.
buffer->release();
}
releasingVideoBuffers.clear();
}