diff options
Diffstat (limited to 'camera')
-rw-r--r-- | camera/libcameraservice/Android.mk | 10 | ||||
-rw-r--r-- | camera/libcameraservice/CameraService.cpp | 60 | ||||
-rw-r--r-- | camera/libcameraservice/CameraService.h | 2 | ||||
-rw-r--r-- | camera/tests/CameraServiceTest/Android.mk | 12 |
4 files changed, 62 insertions, 22 deletions
diff --git a/camera/libcameraservice/Android.mk b/camera/libcameraservice/Android.mk index df5c166..4430541 100644 --- a/camera/libcameraservice/Android.mk +++ b/camera/libcameraservice/Android.mk @@ -48,9 +48,13 @@ LOCAL_SHARED_LIBRARIES:= \ libutils \ libbinder \ libcutils \ - libmedia \ - libcamera_client \ - libsurfaceflinger_client + libmedia + +ifneq ($(BOARD_USES_ECLAIR_LIBCAMERA),true) + LOCAL_SHARED_LIBRARIES += \ + libsurfaceflinger_client \ + libcamera_client +endif LOCAL_MODULE:= libcameraservice diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index 118249e..0ac089f 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -67,6 +67,16 @@ extern "C" { static int debug_frame_cnt; #endif +struct camera_size_type { + int width; + int height; +}; + +static const camera_size_type preview_sizes[] = { + { 1280, 720 }, // 720P + { 768, 432 }, +}; + static int getCallingPid() { return IPCThreadState::self()->getCallingPid(); } @@ -555,6 +565,13 @@ status_t CameraService::Client::setOverlay() CameraParameters params(mHardware->getParameters()); params.getPreviewSize(&w, &h); + //for 720p recording , preview can be 800X448 + if(w == preview_sizes[0].width && h==preview_sizes[0].height){ + LOGD("Changing overlay dimensions to 768X432 for 720p recording."); + w = preview_sizes[1].width; + h = preview_sizes[1].height; + } + if ( w != mOverlayW || h != mOverlayH ) { // Force the destruction of any previous overlay @@ -606,6 +623,13 @@ status_t CameraService::Client::registerPreviewBuffers() CameraParameters params(mHardware->getParameters()); params.getPreviewSize(&w, &h); + //for 720p recording , preview can be 800X448 + if(w == preview_sizes[0].width && h== preview_sizes[0].height){ + LOGD("registerpreviewbufs :changing dimensions to 768X432 for 720p recording."); + w = preview_sizes[1].width; + h = preview_sizes[1].height; + } + // don't use a hardcoded format here ISurface::BufferHeap buffers(w, h, w, h, HAL_PIXEL_FORMAT_YCrCb_420_SP, @@ -886,32 +910,39 @@ status_t CameraService::Client::takePicture() // snapshot taken void CameraService::Client::handleShutter( - image_rect_type *size // The width and height of yuv picture for + image_rect_type *size, // The width and height of yuv picture for // registerBuffer. If this is NULL, use the picture // size from parameters. + bool playShutterSoundOnly ) { // Play shutter sound. - if (mMediaPlayerClick.get() != NULL) { - // do not play shutter sound if stream volume is 0 - // (typically because ringer mode is silent). - int index; - AudioSystem::getStreamVolumeIndex(AudioSystem::ENFORCED_AUDIBLE, &index); - if (index != 0) { - mMediaPlayerClick->seekTo(0); - mMediaPlayerClick->start(); + + if(playShutterSoundOnly) { + + if (mMediaPlayerClick.get() != NULL) { + // do not play shutter sound if stream volume is 0 + // (typically because ringer mode is silent). + int index; + AudioSystem::getStreamVolumeIndex(AudioSystem::ENFORCED_AUDIBLE, &index); + if (index != 0) { + mMediaPlayerClick->seekTo(0); + mMediaPlayerClick->start(); + } + } + sp<ICameraClient> c = mCameraClient; + if (c != NULL) { + c->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0); } + return ; } + // Screen goes black after the buffer is unregistered. if (mSurface != 0 && !mUseOverlay) { mSurface->unregisterBuffers(); } - sp<ICameraClient> c = mCameraClient; - if (c != NULL) { - c->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0); - } mHardware->disableMsgType(CAMERA_MSG_SHUTTER); // It takes some time before yuvPicture callback to be called. @@ -928,6 +959,7 @@ void CameraService::Client::handleShutter( h &= ~1; LOGV("Snapshot image width=%d, height=%d", w, h); } + // FIXME: don't use hardcoded format constants here ISurface::BufferHeap buffers(w, h, w, h, HAL_PIXEL_FORMAT_YCrCb_420_SP, mOrientation, 0, @@ -1085,7 +1117,7 @@ void CameraService::Client::notifyCallback(int32_t msgType, int32_t ext1, int32_ switch (msgType) { case CAMERA_MSG_SHUTTER: // ext1 is the dimension of the yuv picture. - client->handleShutter((image_rect_type *)ext1); + client->handleShutter((image_rect_type *)ext1, (bool)ext2); break; default: sp<ICameraClient> c = client->mCameraClient; diff --git a/camera/libcameraservice/CameraService.h b/camera/libcameraservice/CameraService.h index 75e96c6..f04f39c 100644 --- a/camera/libcameraservice/CameraService.h +++ b/camera/libcameraservice/CameraService.h @@ -144,7 +144,7 @@ private: static sp<Client> getClientFromCookie(void* user); void handlePreviewData(const sp<IMemory>&); - void handleShutter(image_rect_type *image); + void handleShutter(image_rect_type *image, bool playShutterSoundOnly); void handlePostview(const sp<IMemory>&); void handleRawPicture(const sp<IMemory>&); void handleCompressedPicture(const sp<IMemory>&); diff --git a/camera/tests/CameraServiceTest/Android.mk b/camera/tests/CameraServiceTest/Android.mk index 9bb190a..5bacb30 100644 --- a/camera/tests/CameraServiceTest/Android.mk +++ b/camera/tests/CameraServiceTest/Android.mk @@ -6,7 +6,7 @@ LOCAL_SRC_FILES:= CameraServiceTest.cpp LOCAL_MODULE:= CameraServiceTest -LOCAL_MODULE_TAGS := tests +LOCAL_MODULE_TAGS := eng tests LOCAL_C_INCLUDES += \ frameworks/base/libs @@ -17,8 +17,12 @@ LOCAL_SHARED_LIBRARIES += \ libbinder \ libcutils \ libutils \ - libui \ - libcamera_client \ - libsurfaceflinger_client + libui + +ifneq ($(BOARD_USES_ECLAIR_LIBCAMERA),true) + LOCAL_SHARED_LIBRARIES += \ + libcamera_client \ + libsurfaceflinger_client +endif include $(BUILD_EXECUTABLE) |