Ejemplo n.º 1
0
MBOOL      
CamShotImp::
handleDataCallback(MINT32 const i4Msg, MUINT32 const ext1, MUINT32 const ext2, MUINT8* puData, MUINT32 const u4Size)
{
    MBOOL ret = MTRUE; 
    if (isDataMsgEnabled(i4Msg)) 
    {
        CamShotDataInfo rCbDataInfo(i4Msg, 
                                    ext1, 
                                    ext2, 
                                    puData, 
                                    u4Size
                                   ); 
        ret = onDataCallback(rCbDataInfo); 
    }
    return ret; 
}
Ejemplo n.º 2
0
MBOOL
MultiShotNcc::
start(SensorParam const & rSensorParam, MUINT32 u4ShotCount)
{
    FUNCTION_LOG_START;
    AutoCPTLog cptlog(Event_MShot_start);

    mSensorParam = rSensorParam;
    //
    dumpSensorParam(mSensorParam);

    MY_LOGD("[start] enabled msg (nitify, data) = (0x%x, 0x%x)", mi4NotifyMsgSet, mi4DataMsgSet);
    //
    if (!isDataMsgEnabled(ECamShot_DATA_MSG_ALL) && !isNotifyMsgEnabled(ECamShot_NOTIFY_MSG_ALL))
    {
        MY_LOGE("[start] No data msg enable !");
        return MFALSE;
    }

    mbSet3ACapMode = MTRUE;
    mbCancelShot = MFALSE;
    mbIsLastShot = MFALSE;
    mu4JpegCount = 0;
    mu4ShotCount = u4ShotCount;
    mbJpegSemPost = MFALSE;
    ::sem_init(&semJpeg, 0, 0);
    ::sem_init(&semThumbnail, 0, 0);
    ::sem_init(&semStartEnd, 0, 0);

    MY_LOGD("mu4ShotCount = %d", mu4ShotCount);


    EImageFormat eImgFmt = querySensorFmt(rSensorParam.u4DeviceID, rSensorParam.u4Scenario, rSensorParam.u4Bitdepth);

    CPTLogStr(Event_MShot_start, CPTFlagSeparator, "create/init CamIOPipe");
    // (1). Create Instance
    if (NULL == mpCamIOPipe)
    {
        mpCamIOPipe = ICamIOPipe::createInstance(eSWScenarioID_CAPTURE_NORMAL, static_cast<EScenarioFmt>(mapScenarioType(eImgFmt)));
        CHECK_OBJECT(mpCamIOPipe);
        // (2). Query port property
    #warning [TODO] Query port property
        // (3). init
        mpCamIOPipe->init();
     }

    // (2) prepare buffer
    CPTLogStr(Event_MShot_start, CPTFlagSeparator, "prepare buffer");
    // (2.1) raw buffer
    mRawImgBufInfo = querySensorRawImgBufInfo();
    // (2.2) yuv buffer
    mYuvImgBufInfoWrite = queryYuvRawImgBufInfo();
    mYuvImgBufInfoReady = queryYuvRawImgBufInfo();
    mYuvImgBufInfoRead = queryYuvRawImgBufInfo();
    // (2.3) PostView buffer
    mPostViewImgBufInfoWrite = queryPostViewImgInfo();
    mPostViewImgBufInfoReady = queryPostViewImgInfo();
    mPostViewImgBufInfoRead = queryPostViewImgInfo();
    // (2.4) jpeg buffer
    mJpegImgBufInfoWrite = queryJpegImgBufInfo();
    mJpegImgBufInfoReady = queryJpegImgBufInfo();

    // (2.5) Thumb buffer
    mThumbImgBufInfoYuv = queryThumbYuvImgBufInfo();
    mThumbImgBufInfoWrite = queryThumbImgBufInfo();
    mThumbImgBufInfoReady = queryThumbImgBufInfo();
    mThumbImgBufInfoTemp = queryThumbTempImgBufInfo();

    // (3) init thread
    CPTLogStr(Event_MShot_start, CPTFlagSeparator, "init image create thread");
    initImageCreateThread();

    // (4) start c-shot loop
    CPTLogStr(Event_MShot_start, CPTFlagSeparator, "wakeup create thread");
    mpImageCreateThread->postCommand(Command(Command::eID_WAKEUP));
    //onCreateImage();


    FUNCTION_LOG_END;
    //
    return MTRUE;
}