summaryrefslogtreecommitdiffstats
path: root/libvideoeditor
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2012-06-13 16:29:51 -0700
committerJesse Hall <jessehall@google.com>2012-06-21 16:54:43 -0700
commit1e5b2b3361ddd07259bf4b29820ca4aa5f3a861b (patch)
tree75bbec756f6a14bdcbd0d8100a2af5ca25d95074 /libvideoeditor
parent95e6e6efcac831874b3d08947d1751d8f65503f9 (diff)
downloadframeworks_av-1e5b2b3361ddd07259bf4b29820ca4aa5f3a861b.zip
frameworks_av-1e5b2b3361ddd07259bf4b29820ca4aa5f3a861b.tar.gz
frameworks_av-1e5b2b3361ddd07259bf4b29820ca4aa5f3a861b.tar.bz2
Update ANativeWindow client code for sync
This change updates all the uses of ANativeWindow to use the new ANW functions that accept and return Sync HAL fence file descriptors. Change-Id: Id7db42d8d6380f8b440d88476ce9211c6225fb16
Diffstat (limited to 'libvideoeditor')
-rwxr-xr-xlibvideoeditor/lvpp/Android.mk1
-rwxr-xr-xlibvideoeditor/lvpp/NativeWindowRenderer.cpp12
-rwxr-xr-xlibvideoeditor/lvpp/PreviewRenderer.cpp9
3 files changed, 10 insertions, 12 deletions
diff --git a/libvideoeditor/lvpp/Android.mk b/libvideoeditor/lvpp/Android.mk
index c018d74..0ed7e6c 100755
--- a/libvideoeditor/lvpp/Android.mk
+++ b/libvideoeditor/lvpp/Android.mk
@@ -59,6 +59,7 @@ LOCAL_SHARED_LIBRARIES := \
libstagefright \
libstagefright_foundation \
libstagefright_omx \
+ libsync \
libui \
libutils \
libvideoeditor_osal \
diff --git a/libvideoeditor/lvpp/NativeWindowRenderer.cpp b/libvideoeditor/lvpp/NativeWindowRenderer.cpp
index b2c2675..2e15ff9 100755
--- a/libvideoeditor/lvpp/NativeWindowRenderer.cpp
+++ b/libvideoeditor/lvpp/NativeWindowRenderer.cpp
@@ -22,9 +22,9 @@
#include <cutils/log.h>
#include <gui/SurfaceTexture.h>
#include <gui/SurfaceTextureClient.h>
-#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/MetaData.h>
+#include <media/stagefright/foundation/ADebug.h>
#include "VideoEditorTools.h"
#define CHECK_EGL_ERROR CHECK(EGL_SUCCESS == eglGetError())
@@ -382,7 +382,7 @@ void NativeWindowRenderer::queueInternalBuffer(ANativeWindow *anw,
int64_t timeUs;
CHECK(buffer->meta_data()->findInt64(kKeyTime, &timeUs));
native_window_set_buffers_timestamp(anw, timeUs * 1000);
- status_t err = anw->queueBuffer(anw, buffer->graphicBuffer().get());
+ status_t err = anw->queueBuffer(anw, buffer->graphicBuffer().get(), -1);
if (err != 0) {
ALOGE("queueBuffer failed with error %s (%d)", strerror(-err), -err);
return;
@@ -399,18 +399,16 @@ void NativeWindowRenderer::queueExternalBuffer(ANativeWindow* anw,
native_window_set_usage(anw, GRALLOC_USAGE_SW_WRITE_OFTEN);
ANativeWindowBuffer* anb;
- anw->dequeueBuffer(anw, &anb);
+ CHECK(NO_ERROR == native_window_dequeue_buffer_and_wait(anw, &anb));
CHECK(anb != NULL);
- sp<GraphicBuffer> buf(new GraphicBuffer(anb, false));
- CHECK(NO_ERROR == anw->lockBuffer(anw, buf->getNativeBuffer()));
-
// Copy the buffer
uint8_t* img = NULL;
+ sp<GraphicBuffer> buf(new GraphicBuffer(anb, false));
buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
copyI420Buffer(buffer, img, width, height, buf->getStride());
buf->unlock();
- CHECK(NO_ERROR == anw->queueBuffer(anw, buf->getNativeBuffer()));
+ CHECK(NO_ERROR == anw->queueBuffer(anw, buf->getNativeBuffer(), -1));
}
void NativeWindowRenderer::copyI420Buffer(MediaBuffer* src, uint8_t* dst,
diff --git a/libvideoeditor/lvpp/PreviewRenderer.cpp b/libvideoeditor/lvpp/PreviewRenderer.cpp
index 4aa4eb3..b1cfc8e 100755
--- a/libvideoeditor/lvpp/PreviewRenderer.cpp
+++ b/libvideoeditor/lvpp/PreviewRenderer.cpp
@@ -97,13 +97,12 @@ PreviewRenderer::~PreviewRenderer() {
void PreviewRenderer::getBufferYV12(uint8_t **data, size_t *stride) {
int err = OK;
- if ((err = mSurface->ANativeWindow::dequeueBuffer(mSurface.get(), &mBuf)) != 0) {
- ALOGW("Surface::dequeueBuffer returned error %d", err);
+ if ((err = native_window_dequeue_buffer_and_wait(mSurface.get(),
+ &mBuf)) != 0) {
+ ALOGW("native_window_dequeue_buffer_and_wait returned error %d", err);
return;
}
- CHECK_EQ(0, mSurface->ANativeWindow::lockBuffer(mSurface.get(), mBuf));
-
GraphicBufferMapper &mapper = GraphicBufferMapper::get();
Rect bounds(mWidth, mHeight);
@@ -131,7 +130,7 @@ void PreviewRenderer::renderYV12() {
if (mBuf!= NULL) {
CHECK_EQ(0, mapper.unlock(mBuf->handle));
- if ((err = mSurface->ANativeWindow::queueBuffer(mSurface.get(), mBuf)) != 0) {
+ if ((err = mSurface->ANativeWindow::queueBuffer(mSurface.get(), mBuf, -1)) != 0) {
ALOGW("Surface::queueBuffer returned error %d", err);
}
}