am 2530b32d: Merge "remove uses of Surface in favor of IGraphicBufferProducer" into jb-mr2-dev
* commit '2530b32de5c609fc6738b292baaf540e4ac10cd7': remove uses of Surface in favor of IGraphicBufferProducer
This commit is contained in:
@@ -544,13 +544,17 @@ static void android_hardware_Camera_setPreviewDisplay(JNIEnv *env, jobject thiz,
|
||||
sp<Camera> camera = get_native_camera(env, thiz, NULL);
|
||||
if (camera == 0) return;
|
||||
|
||||
sp<IGraphicBufferProducer> gbp;
|
||||
sp<Surface> surface;
|
||||
if (jSurface) {
|
||||
surface = android_view_Surface_getSurface(env, jSurface);
|
||||
if (surface != NULL) {
|
||||
gbp = surface->getIGraphicBufferProducer();
|
||||
}
|
||||
}
|
||||
|
||||
if (camera->setPreviewDisplay(surface) != NO_ERROR) {
|
||||
jniThrowException(env, "java/io/IOException", "setPreviewDisplay failed");
|
||||
if (camera->setPreviewTexture(gbp) != NO_ERROR) {
|
||||
jniThrowException(env, "java/io/IOException", "setPreviewTexture failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <android_runtime/android_view_Surface.h>
|
||||
#include <android_runtime/android_graphics_SurfaceTexture.h>
|
||||
|
||||
#include <binder/Parcel.h>
|
||||
|
||||
#include <gui/Surface.h>
|
||||
#include <gui/SurfaceControl.h>
|
||||
#include <gui/GLConsumer.h>
|
||||
@@ -334,10 +336,15 @@ static jint nativeReadFromParcel(JNIEnv* env, jclass clazz,
|
||||
if (self != NULL) {
|
||||
self->decStrong(&sRefBaseOwner);
|
||||
}
|
||||
sp<Surface> sur(Surface::readFromParcel(*parcel));
|
||||
if (sur != NULL) {
|
||||
|
||||
sp<Surface> sur;
|
||||
sp<IGraphicBufferProducer> gbp(
|
||||
interface_cast<IGraphicBufferProducer>(parcel->readStrongBinder()));
|
||||
if (gbp != NULL) {
|
||||
sur = new Surface(gbp);
|
||||
sur->incStrong(&sRefBaseOwner);
|
||||
}
|
||||
|
||||
return int(sur.get());
|
||||
}
|
||||
|
||||
@@ -349,7 +356,7 @@ static void nativeWriteToParcel(JNIEnv* env, jclass clazz,
|
||||
return;
|
||||
}
|
||||
sp<Surface> self(reinterpret_cast<Surface *>(nativeObject));
|
||||
Surface::writeToParcel(self, parcel);
|
||||
parcel->writeStrongBinder( self != 0 ? self->getIGraphicBufferProducer()->asBinder() : NULL);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -327,7 +327,7 @@ android_media_MediaRecorder_prepare(JNIEnv *env, jobject thiz)
|
||||
}
|
||||
|
||||
ALOGI("prepare: surface=%p", native_surface.get());
|
||||
if (process_media_recorder_call(env, mr->setPreviewSurface(native_surface), "java/lang/RuntimeException", "setPreviewSurface failed.")) {
|
||||
if (process_media_recorder_call(env, mr->setPreviewSurface(native_surface->getIGraphicBufferProducer()), "java/lang/RuntimeException", "setPreviewSurface failed.")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user