summaryrefslogtreecommitdiffstats
path: root/libs/camera
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2010-08-10 16:37:53 -0700
committerJamie Gennis <jgennis@google.com>2010-08-23 14:31:30 -0700
commit85cfdd011241a5f2fb7fabc65b5943a39af7e1de (patch)
tree556bd6f34ae8d300d9fa05fe46bb0dc4d8aa43e0 /libs/camera
parent7fdaa2329e755c0e5c25724a43b8c361b88e9623 (diff)
downloadframeworks_base-85cfdd011241a5f2fb7fabc65b5943a39af7e1de.zip
frameworks_base-85cfdd011241a5f2fb7fabc65b5943a39af7e1de.tar.gz
frameworks_base-85cfdd011241a5f2fb7fabc65b5943a39af7e1de.tar.bz2
Change the framework to use the new camera preview path.
This change makes the camera HAL interface take an ANativeWindow interface from which all the camera preview buffers will be allocated. The framework code running in application processes now passes a Surface object rather than an ISurface to the camera server via Binder when setting the preview surface. The camera server then forwards that Surface object (which implements the ANativeWindow interface) to the camera HAL, which uses it to communicate with SurfaceFlinger to allocate the camera preview buffers. Change-Id: Ie438f721559cd7de5e4f848a26d96360dda07b5f
Diffstat (limited to 'libs/camera')
-rw-r--r--libs/camera/Camera.cpp19
-rw-r--r--libs/camera/ICamera.cpp9
2 files changed, 7 insertions, 21 deletions
diff --git a/libs/camera/Camera.cpp b/libs/camera/Camera.cpp
index 7efc6d7..b5f78e8 100644
--- a/libs/camera/Camera.cpp
+++ b/libs/camera/Camera.cpp
@@ -167,32 +167,20 @@ status_t Camera::unlock()
return c->unlock();
}
-// pass the buffered ISurface to the camera service
+// pass the buffered Surface to the camera service
status_t Camera::setPreviewDisplay(const sp<Surface>& surface)
{
- LOGV("setPreviewDisplay");
+ LOGV("setPreviewDisplay(%p)", surface.get());
sp <ICamera> c = mCamera;
if (c == 0) return NO_INIT;
if (surface != 0) {
- return c->setPreviewDisplay(surface->getISurface());
+ return c->setPreviewDisplay(surface);
} else {
LOGD("app passed NULL surface");
return c->setPreviewDisplay(0);
}
}
-status_t Camera::setPreviewDisplay(const sp<ISurface>& surface)
-{
- LOGV("setPreviewDisplay");
- if (surface == 0) {
- LOGD("app passed NULL surface");
- }
- sp <ICamera> c = mCamera;
- if (c == 0) return NO_INIT;
- return c->setPreviewDisplay(surface);
-}
-
-
// start preview mode
status_t Camera::startPreview()
{
@@ -375,4 +363,3 @@ void Camera::DeathNotifier::binderDied(const wp<IBinder>& who) {
}
}; // namespace android
-
diff --git a/libs/camera/ICamera.cpp b/libs/camera/ICamera.cpp
index 13673b5..94dc5c1 100644
--- a/libs/camera/ICamera.cpp
+++ b/libs/camera/ICamera.cpp
@@ -64,13 +64,13 @@ public:
remote()->transact(DISCONNECT, data, &reply);
}
- // pass the buffered ISurface to the camera service
- status_t setPreviewDisplay(const sp<ISurface>& surface)
+ // pass the buffered Surface to the camera service
+ status_t setPreviewDisplay(const sp<Surface>& surface)
{
LOGV("setPreviewDisplay");
Parcel data, reply;
data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- data.writeStrongBinder(surface->asBinder());
+ Surface::writeToParcel(surface, &data);
remote()->transact(SET_PREVIEW_DISPLAY, data, &reply);
return reply.readInt32();
}
@@ -258,7 +258,7 @@ status_t BnCamera::onTransact(
case SET_PREVIEW_DISPLAY: {
LOGV("SET_PREVIEW_DISPLAY");
CHECK_INTERFACE(ICamera, data, reply);
- sp<ISurface> surface = interface_cast<ISurface>(data.readStrongBinder());
+ sp<Surface> surface = Surface::readFromParcel(data);
reply->writeInt32(setPreviewDisplay(surface));
return NO_ERROR;
} break;
@@ -376,4 +376,3 @@ status_t BnCamera::onTransact(
// ----------------------------------------------------------------------------
}; // namespace android
-