コード例 #1
0
void SfDelegate::OnResponseStarted(net::URLRequest *request) {
    if (request->status().status() != net::URLRequestStatus::SUCCESS) {
        MY_LOGI(StringPrintf(
                    "Request failed with status %d and os_error %d",
                    request->status().status(),
                    request->status().os_error()).c_str());

        delete mURLRequest;
        mURLRequest = NULL;

        mOwner->onConnectionFailed(ERROR_IO);
        return;
    } else if (mRangeRequested && request->GetResponseCode() != 206) {
        MY_LOGI(StringPrintf(
                    "We requested a content range, but server didn't "
                    "support that. (responded with %d)",
                    request->GetResponseCode()).c_str());

        delete mURLRequest;
        mURLRequest = NULL;

        mOwner->onConnectionFailed(-EPIPE);
        return;
    } else if ((request->GetResponseCode() / 100) != 2) {
        MY_LOGI(StringPrintf(
                    "Server responded with http status %d",
                    request->GetResponseCode()).c_str());

        delete mURLRequest;
        mURLRequest = NULL;

        mOwner->onConnectionFailed(ERROR_IO);
        return;
    }

    MY_LOGV("OnResponseStarted");

    std::string headers;
    request->GetAllResponseHeaders(&headers);

    MY_LOGV(StringPrintf("response headers: %s", headers.c_str()).c_str());

    std::string contentType;
    request->GetResponseHeaderByName("Content-Type", &contentType);

    mOwner->onConnectionEstablished(
            request->GetExpectedContentSize(), contentType.c_str());
}
コード例 #2
0
MBOOL
Pass2NodeImpl::
dequePass2()
{
    CAM_TRACE_CALL();
    MBOOL ret = MFALSE;
    QParams dequeParams;
    Vector<Input>::const_iterator iterIn;
    Vector<Output>::const_iterator iterOut;
    //
    MY_LOGV("type(%d) cnt %d: deque", mPass2Type, muDeqFrameCnt);
    if( !mpPostProcPipe->deque(dequeParams, PASS2_TIMEOUT) )
    {
        MY_LOGE("type(%d) pass2 cnt %d: deque fail", mPass2Type, muDeqFrameCnt);
        aee_system_exception(
            LOG_TAG,
            NULL,
            DB_OPT_DEFAULT,
            "\nCRDISPATCH_KEY:MtkCam/P1Node:ISP pass2 deque fail");
        goto lbExit;
    }

    if( !handleP2Done(dequeParams) )
    {
        MY_LOGE("handle p2 callback failed");
        goto lbExit;
    }

    ret = MTRUE;
lbExit:
    CAM_TRACE_FMT_END();
    return ret;
}
コード例 #3
0
void SfDelegate::OnSetCookie(
        net::URLRequest *request,
        const std::string &cookie_line,
        const net::CookieOptions &options,
        bool blocked_by_policy) {
    MY_LOGV("OnSetCookie");
}
コード例 #4
0
MBOOL
Pass2NodeImpl::
dequePass2()
{
    NG_TRACE_CALL();
    MBOOL ret = MFALSE;
    QParams dequeParams;
    Vector<Input>::const_iterator iterIn;
    Vector<Output>::const_iterator iterOut;
    //
    MY_LOGV("type(%d) cnt %d: deque", mPass2Type, muDeqFrameCnt);
    if( !mpPostProcPipe->deque(dequeParams, PASS2_TIMEOUT) )
    {
        MY_LOGE("type(%d) pass2 cnt %d: deque fail", mPass2Type, muDeqFrameCnt);
        AEE_ASSERT("ISP pass2 deque fail");
        goto lbExit;
    }

    if( !handleP2Done(dequeParams) )
    {
        MY_LOGE("handle p2 callback failed");
        goto lbExit;
    }

    ret = MTRUE;
lbExit:
    NG_TRACE_FMT_END();
    return ret;
}
コード例 #5
0
/******************************************************************************
* convert image format by HW Bitblt 
*******************************************************************************/
bool hwConvertImageFormat(uint8_t *pbufIn, uint32_t inFmt, uint32_t width, uint32_t height, uint8_t *pbufOut, uint32_t outFmt)
{
    int32_t status = 0;

    // It's hw convert, the buffer address must be physical address
    MY_LOGV("[converImgFmt] pbufIn: 0x%x, inFmt = 0x%d, width: %d, height: %d , pbufOut: 0x%x, outFmt = %d\n",
                          (uint32_t) pbufIn, inFmt, width, height, (uint32_t) pbufOut, outFmt);

    mHalBltParam_t bltParam;
    memset(&bltParam, 0, sizeof(bltParam));
    bltParam.srcAddr   = (MUINT32)(pbufIn);
    bltParam.srcX      = 0;
    bltParam.srcY      = 0;
    bltParam.srcW      = width;
    bltParam.srcWStride= width;
    bltParam.srcH      = height;
    bltParam.srcHStride= height;
    bltParam.srcFormat = inFmt;
    bltParam.dstAddr   = (MUINT32)(pbufOut);
    bltParam.dstW      = width;
    bltParam.dstH      = height;
    bltParam.dstFormat = outFmt;
    bltParam.pitch     = width;
    bltParam.orientation = MHAL_BITBLT_ROT_0;

    status = mHalIoCtrl(MHAL_IOCTL_BITBLT, &bltParam, sizeof(bltParam), NULL, 0, NULL);
    if (0 != status) {
        MY_LOGE("[converImgFmt] err: %d, can't do bitblt operation \n", status);
    }
    return (status != 0) ? true : false;
}
コード例 #6
0
MVOID
SImager::
setCallback(SImagerNotifyCallback_t notify_cb, MVOID* user)
{
    MY_LOGV("(notify_cb, user)=(%p, %p, %p)", notify_cb, user);
    mpCbUser = user;
    mNotifyCb = notify_cb;
}
コード例 #7
0
MBOOL 
Pass2NodeImpl::
threadLoopUpdate()
{
    MY_LOGV("+");

    MBOOL ret = MTRUE;

#if PASS2_CALLBACL_ENABLE
    ret = enquePass2(MTRUE);
#else
    // use p2 thread to deque
    ret = dequePass2();
#endif

    MY_LOGV("-");
    return ret;
}
コード例 #8
0
MVOID
CamShotImp::
setCallbacks(CamShotNotifyCallback_t notify_cb, CamShotDataCallback_t data_cb, MVOID* user)
{
    MY_LOGV("(notify_cb, data_cb, user)=(%p, %p, %p)", notify_cb, data_cb, user);
    mpCbUser = user;
    mNotifyCb = notify_cb;
    mDataCb = data_cb;
}
コード例 #9
0
MVOID
PipeImp::
setCallbacks(PipeNotifyCallback_t notify_cb, PipeDataCallback_t data_cb, MVOID* user)
{
    MY_LOGV("(notify_cb, data_cb, user)=(%p, %p, %p)", notify_cb, data_cb, user);
    mpCbUser = user;
    mNotifyCb = notify_cb;
    mDataCb = data_cb;
}
コード例 #10
0
void SfDelegate::readMore(net::URLRequest *request) {
    while (mNumBytesRead < mNumBytesTotal) {
        size_t copy = mNumBytesTotal - mNumBytesRead;
        if (copy > mReadBuffer->size()) {
            copy = mReadBuffer->size();
        }

        int n;
        if (request->Read(mReadBuffer, copy, &n)) {
            MY_LOGV(StringPrintf("Read %d bytes directly.", n).c_str());

            CHECK_LE((size_t)n, copy);

            memcpy((uint8_t *)mDataDestination + mNumBytesRead,
                   mReadBuffer->data(),
                   n);

            mNumBytesRead += n;

            if (n == 0) {
                mAtEOS = true;
                break;
            }
        } else {
            MY_LOGV("readMore pending read");

            if (request->status().status() != net::URLRequestStatus::IO_PENDING) {
                MY_LOGI(StringPrintf(
                            "Direct read failed w/ status %d\n",
                            request->status().status()).c_str());

                mOwner->onReadCompleted(ERROR_IO);
                return;
            }

            return;
        }
    }

    mOwner->onReadCompleted(mNumBytesRead);
}
コード例 #11
0
/******************************************************************************
*   convert i420 Yuv to Yuv 420p (YV12)
*******************************************************************************/
bool convertYuv420iToYuv420p(uint8_t *pbufIn, uint8_t *pbufOut, uint32_t width, uint32_t height)
{
    MY_LOGV("+ pbufIn(%p), pbufOut(%p), %dx%d", pbufIn, pbufOut, width, height);
    //
    size_t const sizeY = width * height;
    size_t const sizeU = sizeY / 4;
    size_t const sizeV = sizeY / 4;
    //
    uint8_t*const pbufInY = pbufIn;
    uint8_t*const pbufInV = pbufIn + sizeY;
    uint8_t*const pbufInU = pbufIn + sizeY + sizeV;
    //
    uint8_t*const pbufOutY = pbufOut;
    uint8_t*const pbufOutU = pbufOut + sizeY;
    uint8_t*const pbufOutV = pbufOut + sizeY + sizeU;
    //
    ::memcpy(pbufOutY, pbufInY, sizeY);
    ::memcpy(pbufOutU, pbufInU, sizeU);
    ::memcpy(pbufOutV, pbufInV, sizeV);
    //
    MY_LOGV("-");
    return  true;
}
コード例 #12
0
ICamDevice::
ICamDevice()
    : camera_device_t()
    , RefBase()
    , mDevOps()
    //
    , mMtxLock()
    //
{
    MY_LOGV("+");
    ::memset(static_cast<camera_device_t*>(this), 0, sizeof(camera_device_t));
    this->priv  = this;
    this->ops   = &mDevOps;
    mDevOps     = gCameraDevOps;
}
コード例 #13
0
ファイル: support.cpp プロジェクト: LuckJC/pro-fw
void SfDelegate::OnReceivedRedirect(
            net::URLRequest *request, const GURL &new_url, bool *defer_redirect) {

#ifndef ANDROID_DEFAULT_CODE
     const char *uri =NULL;   
      uri = new_url.spec().c_str();
      MY_LOGI(StringPrintf("OnReceivedRedirect,original_url=%s ",request->original_url().spec().c_str()).c_str());
      MY_LOGI(StringPrintf("OnReceivedRedirect, new_url=%s", new_url.spec().c_str()).c_str());
      MY_LOGI(StringPrintf("OnReceivedRedirect,defer_redirect=%d",*defer_redirect).c_str());
    
      mOwner->OnReceivedRedirect( uri);
#else
    MY_LOGV("OnReceivedRedirect");
#endif
}
コード例 #14
0
MBOOL 
Pass2NodeImpl::
onReturnBuffer(MUINT32 const data, MUINT32 const buf, MUINT32 const ext)
{
    MY_LOGV("data %d, buf 0x%x", data, buf);
    ICamBufHandler* pBufHdl = getBufferHandler(data);
    if( !pBufHdl )
    {
        MY_LOGE("no buffer hdl for data %d, buf 0x%x", data, buf);
        return MFALSE;
    }

    MBOOL ret = pBufHdl->enqueBuffer(data, (IImageBuffer*)buf);
    if( !ret )
    {
        MY_LOGE("enque fail: data %d, buf 0x%x", data, buf);
    }
    //FUNC_END;
    return MTRUE; //return status?
}
コード例 #15
0
void SfDelegate::OnReadCompleted(net::URLRequest *request, int bytes_read) {
    if (bytes_read == -1) {
        MY_LOGI(StringPrintf(
                    "OnReadCompleted, read failed, status %d",
                    request->status().status()).c_str());

        mOwner->onReadCompleted(ERROR_IO);
        return;
    }

    MY_LOGV(StringPrintf("OnReadCompleted, read %d bytes", bytes_read).c_str());

    if (bytes_read < 0) {
        MY_LOGI(StringPrintf(
                    "Read failed w/ status %d\n",
                    request->status().status()).c_str());

        mOwner->onReadCompleted(ERROR_IO);
        return;
    } else if (bytes_read == 0) {
        mAtEOS = true;
        mOwner->onReadCompleted(mNumBytesRead);
        return;
    }

    CHECK_GT(bytes_read, 0);
    CHECK_LE(mNumBytesRead + bytes_read, mNumBytesTotal);

    memcpy((uint8_t *)mDataDestination + mNumBytesRead,
           mReadBuffer->data(),
           bytes_read);

    mNumBytesRead += bytes_read;

    readMore(request);
}
コード例 #16
0
status_t SfRequestContext::updateProxyConfig(
        const char *host, int32_t port, const char *exclusionList) {
    Mutex::Autolock autoLock(mProxyConfigLock);

    if (host == NULL || *host == '\0') {
        MY_LOGV("updateProxyConfig NULL");

        std::string proxy;
        std::string exList;
        mProxyConfigService->UpdateProxySettings(proxy, exList);
    } else {
#if !defined(LOG_NDEBUG) || LOG_NDEBUG == 0
        LOG_PRI(ANDROID_LOG_VERBOSE, LOG_TAG,
                "updateProxyConfig %s:%d, exclude '%s'",
                host, port, exclusionList);
#endif

        std::string proxy = StringPrintf("%s:%d", host, port).c_str();
        std::string exList = exclusionList;
        mProxyConfigService->UpdateProxySettings(proxy, exList);
    }

    return OK;
}
コード例 #17
0
void SfDelegate::OnGetCookies(net::URLRequest *request, bool blocked_by_policy) {
    MY_LOGV("OnGetCookies");
}
コード例 #18
0
void SfDelegate::OnCertificateRequested(
            net::URLRequest *request, net::SSLCertRequestInfo *cert_request_info) {
    MY_LOGV("OnCertificateRequested");

    inherited::OnCertificateRequested(request, cert_request_info);
}
コード例 #19
0
void SfDelegate::OnAuthRequired(
            net::URLRequest *request, net::AuthChallengeInfo *auth_info) {
    MY_LOGV("OnAuthRequired");

    inherited::OnAuthRequired(request, auth_info);
}
コード例 #20
0
void SfDelegate::OnReceivedRedirect(
            net::URLRequest *request, const GURL &new_url, bool *defer_redirect) {
    MY_LOGV("OnReceivedRedirect");
}
コード例 #21
0
ファイル: support.cpp プロジェクト: LuckJC/pro-fw
void SfDelegate::OnResponseStarted(net::URLRequest *request) {
    if (request->status().status() != net::URLRequestStatus::SUCCESS) {
        MY_LOGI(StringPrintf(
                    "Request failed with status %d and os_error %d",
                    request->status().status(),
                    request->status().os_error()).c_str());

        delete mURLRequest;
        mURLRequest = NULL;

        mOwner->onConnectionFailed(ERROR_IO);
        return;
#ifndef ANDROID_DEFAULT_CODE//Listen.apk, server return 200 when we request partial content
	} else if (mRangeRequested && request->GetResponseCode() != 206 && request->GetResponseCode() != 200) {
#else
    } else if (mRangeRequested && request->GetResponseCode() != 206) {
#endif
        MY_LOGI(StringPrintf(
                    "We requested a content range, but server didn't "
                    "support that. (responded with %d)",
                    request->GetResponseCode()).c_str());

        delete mURLRequest;
        mURLRequest = NULL;

        mOwner->onConnectionFailed(-EPIPE);
        return;
    } else if ((request->GetResponseCode() / 100) != 2) {
        MY_LOGI(StringPrintf(
                    "Server responded with http status %d",
                    request->GetResponseCode()).c_str());
#ifndef ANDROID_DEFAULT_CODE
        bool bResNotFound = false;
        if ((request->GetResponseCode() == 404) || (request->GetResponseCode() == 410)){
            bResNotFound = true;
        }

#endif


        delete mURLRequest;
        mURLRequest = NULL;

#ifndef ANDROID_DEFAULT_CODE
        //if the ResponseCode is 404, notify that it's our_of_range 
       mOwner->onConnectionFailed(bResNotFound ? ERROR_OUT_OF_RANGE : ERROR_IO);
#else
        mOwner->onConnectionFailed(ERROR_IO);
#endif
        return;
    }

    MY_LOGV("OnResponseStarted");

    std::string headers;
    request->GetAllResponseHeaders(&headers);

    MY_LOGV(StringPrintf("response headers: %s", headers.c_str()).c_str());

    std::string contentType;
    request->GetResponseHeaderByName("Content-Type", &contentType);

#ifndef ANDROID_DEFAULT_CODE
	MY_LOGI(StringPrintf("contentType org=%s", contentType.c_str()).c_str());
	size_t pos = contentType.find(';');
	if (pos != std::string::npos)
		contentType.erase(pos);//Remove parameters from content type
	MY_LOGI(StringPrintf("contentType now=%s", contentType.c_str()).c_str());
#endif

    mOwner->onConnectionEstablished(
            request->GetExpectedContentSize(), contentType.c_str());
}