Exemple #1
0
/******************************************************************************
*   Continuous Shutter Callback Handler
*       ext2: current continuous shutter number.
*******************************************************************************/
void
CameraClient::
handleMtkExtContinuousShutter(int32_t /*ext1*/, int32_t ext2)
{
    //if (mPlayShutterSound) {
    //    mCameraService->playSound(CameraService::SOUND_SHUTTER);
    //}

    sp<ICameraClient> c = mRemoteCallback;
    if (c != 0) {
//!++
#if 1
#else
        mLock.unlock();
#endif
//!--
        c->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0);
        if (!lockIfMessageWanted(CAMERA_MSG_SHUTTER)) return;
    }
    //disableMsgType(CAMERA_MSG_SHUTTER);

//!++
#if 1
#else
    mLock.unlock();
#endif
//!--

    //enableMsgType(CAMERA_MSG_SHUTTER);
    ALOGD("[handleMtkExtContinuousShutter] current continuous shutter number:%d \n", ext2);
}
// snapshot taken callback
void CameraClient::handleShutter(void) {
    if (mPlayShutterSound) {
        mCameraService->playSound(CameraService::SOUND_SHUTTER);
    }

    sp<ICameraClient> c = mRemoteCallback;
    if (c != 0) {
//!++
#if 1
#else
        mLock.unlock();
#endif
//!--
        c->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0);
        if (!lockIfMessageWanted(CAMERA_MSG_SHUTTER)) return;
    }
    disableMsgType(CAMERA_MSG_SHUTTER);

//!++
#if 1
#else
    mLock.unlock();
#endif
//!--
}
Exemple #3
0
/******************************************************************************
 *  Shutter Callback (not disable CAMERA_MSG_SHUTTER)
 *      ext2: 1: CameraService will play shutter sound.
 ******************************************************************************/
void
CameraClient::
handleMtkExtShutter(int32_t /*ext1*/, int32_t ext2)
{
    ALOGD("[%s] (ext2, mPlayShutterSound)=(%d, %d) \r\n", __FUNCTION__, ext2, mPlayShutterSound);

    if  ( 1 == ext2 ) {
        if (mPlayShutterSound) {
            mCameraService->playSound(CameraService::SOUND_SHUTTER);
        }
    }

    sp<ICameraClient> c = mRemoteCallback;
    if (c != 0) {
//!++
#if 1
#else
        mLock.unlock();
#endif
//!--
        c->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0);
        if (!lockIfMessageWanted(CAMERA_MSG_SHUTTER)) return;
    }
//    disableMsgType(CAMERA_MSG_SHUTTER);

//!++
#if 1
#else
    mLock.unlock();
#endif
//!--
}
// snapshot taken callback
// "size" is the width and height of yuv picture for registerBuffer.
// If it is NULL, use the picture size from parameters.
void CameraService::Client::handleShutter(image_rect_type *size
#ifdef BOARD_USE_CAF_LIBCAMERA
    , bool playShutterSoundOnly
#endif
) {

#ifdef BOARD_USE_CAF_LIBCAMERA
    if(playShutterSoundOnly) {
#endif
    mCameraService->playSound(SOUND_SHUTTER);
#ifdef BOARD_USE_CAF_LIBCAMERA
    sp<ICameraClient> c = mCameraClient;
    if (c != 0) {
        mLock.unlock();
        c->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0);
    }
    return;
    }
#endif

    // Screen goes black after the buffer is unregistered.
    if (mSurface != 0 && !mUseOverlay) {
        mSurface->unregisterBuffers();
    }

    sp<ICameraClient> c = mCameraClient;
    if (c != 0) {
        mLock.unlock();
        c->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0);
        if (!lockIfMessageWanted(CAMERA_MSG_SHUTTER)) return;
    }
    disableMsgType(CAMERA_MSG_SHUTTER);

    // It takes some time before yuvPicture callback to be called.
    // Register the buffer for raw image here to reduce latency.
    if (mSurface != 0 && !mUseOverlay) {
        int w, h;
        CameraParameters params(mHardware->getParameters());
        if (size == NULL) {
            params.getPictureSize(&w, &h);
        } else {
            w = size->width;
            h = size->height;
            w &= ~1;
            h &= ~1;
            LOG1("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,
            mHardware->getRawHeap());

        mSurface->registerBuffers(buffers);
        IPCThreadState::self()->flushCommands();
    }

    mLock.unlock();
}
// snapshot taken callback
void CameraService::Client::handleShutter(void) {
    if (mPlayShutterSound) {
        mCameraService->playSound(SOUND_SHUTTER);
    }

    sp<ICameraClient> c = mCameraClient;
    if (c != 0) {
        mLock.unlock();
        c->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0);
        if (!lockIfMessageWanted(CAMERA_MSG_SHUTTER)) return;
    }
    disableMsgType(CAMERA_MSG_SHUTTER);

    mLock.unlock();
}