VirtualBox

Changeset 45941 in vbox


Ignore:
Timestamp:
May 8, 2013 8:47:02 AM (12 years ago)
Author:
vboxsync
Message:

Main/VPX: some code restructuring to be able to log errors / success during initialization

Location:
trunk/src/VBox/Main/src-client
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r45926 r45941  
    479479    }
    480480
    481 #ifdef VBOX_WITH_VPX
    482     if (VideoRecContextCreate(&mpVideoRecCtx))
    483     {
    484         LogFlow(("Failed to create Video Recording Context\n"));
    485         return E_FAIL;
    486     }
    487 
    488     BOOL fEnabled = false;
    489     mParent->machine()->COMGETTER(VideoCaptureEnabled)(&fEnabled);
    490     if (fEnabled)
    491     {
    492         ULONG ulWidth;
    493         mParent->machine()->COMGETTER(VideoCaptureWidth)(&ulWidth);
    494         ULONG ulHeight;
    495         mParent->machine()->COMGETTER(VideoCaptureHeight)(&ulHeight);
    496         ULONG ulRate;
    497         mParent->machine()->COMGETTER(VideoCaptureRate)(&ulRate);
    498         ULONG ulFps;
    499         mParent->machine()->COMGETTER(VideoCaptureFps)(&ulFps);
    500         BSTR strFile;
    501         mParent->machine()->COMGETTER(VideoCaptureFile)(&strFile);
    502         if (VideoRecContextInit(mpVideoRecCtx, strFile, ulWidth, ulHeight, ulRate, ulFps))
    503         {
    504             LogFlow(("Failed to initialize video recording context!\n"));
    505             return E_FAIL;
    506         }
    507         LogFlow(("Video recording as VPX with %lux%lu @ %lukbps to '%ls' enabled!\n",
    508                   ulWidth, ulHeight, ulRate, strFile));
    509     }
    510 #endif
    511 
    512481    {
    513482        // register listener for state change events
     
    662631    if (!finished)
    663632    {
    664         LogRelFlowFunc (("External framebuffer wants us to wait!\n"));
     633        LogRelFlowFunc(("External framebuffer wants us to wait!\n"));
    665634        return VINF_VGA_RESIZE_IN_PROGRESS;
    666635    }
     
    684653                                  uint32_t cbLine, int w, int h, uint16_t flags)
    685654{
    686     LogRel (("Display::handleDisplayResize(): uScreenId = %d, pvVRAM=%p "
    687              "w=%d h=%d bpp=%d cbLine=0x%X, flags=0x%X\n",
    688              uScreenId, pvVRAM, w, h, bpp, cbLine, flags));
     655    LogRel(("Display::handleDisplayResize(): uScreenId = %d, pvVRAM=%p "
     656            "w=%d h=%d bpp=%d cbLine=0x%X, flags=0x%X\n",
     657            uScreenId, pvVRAM, w, h, bpp, cbLine, flags));
    689658
    690659    /* If there is no framebuffer, this call is not interesting. */
     
    732701         * Note: the resize information is only accessed on EMT so no serialization is required.
    733702         */
    734         LogRel (("Display::handleDisplayResize(): Warning: resize postponed.\n"));
     703        LogRel(("Display::handleDisplayResize(): Warning: resize postponed.\n"));
    735704
    736705        maFramebuffers[uScreenId].pendingResize.fPending    = true;
     
    866835
    867836        /* Inform VRDP server about the change of display parameters. */
    868         LogRelFlowFunc (("Calling VRDP\n"));
     837        LogRelFlowFunc(("Calling VRDP\n"));
    869838        mParent->consoleVRDPServer()->SendResize();
    870839
     
    927896    DISPLAYFBINFO *pInfo = pInfos;
    928897    unsigned uScreenId;
    929     LogSunlover (("mapCoordsToScreen: %d,%d %dx%d\n", *px, *py, *pw, *ph));
     898    LogSunlover(("mapCoordsToScreen: %d,%d %dx%d\n", *px, *py, *pw, *ph));
    930899    for (uScreenId = 0; uScreenId < cInfos; uScreenId++, pInfo++)
    931900    {
    932         LogSunlover (("    [%d] %d,%d %dx%d\n", uScreenId, pInfo->xOrigin, pInfo->yOrigin, pInfo->w, pInfo->h));
     901        LogSunlover(("    [%d] %d,%d %dx%d\n", uScreenId, pInfo->xOrigin, pInfo->yOrigin, pInfo->w, pInfo->h));
    933902        if (   (pInfo->xOrigin <= *px && *px < pInfo->xOrigin + (int)pInfo->w)
    934903            && (pInfo->yOrigin <= *py && *py < pInfo->yOrigin + (int)pInfo->h))
     
    937906            *px -= pInfo->xOrigin;
    938907            *py -= pInfo->yOrigin;
    939             LogSunlover (("    -> %d,%d", *px, *py));
     908            LogSunlover(("    -> %d,%d", *px, *py));
    940909            break;
    941910        }
     
    946915        uScreenId = 0;
    947916    }
    948     LogSunlover ((" scr %d\n", uScreenId));
     917    LogSunlover((" scr %d\n", uScreenId));
    949918    return uScreenId;
    950919}
     
    966935
    967936#ifdef DEBUG_sunlover
    968     LogFlowFunc (("%d,%d %dx%d (checked)\n", x, y, w, h));
     937    LogFlowFunc(("%d,%d %dx%d (checked)\n", x, y, w, h));
    969938#endif /* DEBUG_sunlover */
    970939
     
    980949
    981950#ifdef DEBUG_sunlover
    982     LogFlowFunc (("[%d] %d,%d %dx%d (%d,%d)\n",
    983                   uScreenId, x, y, w, h, mpDrv->IConnector.cx, mpDrv->IConnector.cy));
     951    LogFlowFunc(("[%d] %d,%d %dx%d (%d,%d)\n",
     952                 uScreenId, x, y, w, h, mpDrv->IConnector.cx, mpDrv->IConnector.cy));
    984953#endif /* DEBUG_sunlover */
    985954
     
    12191188static void vbvaRgnDirtyRect (VBVADIRTYREGION *prgn, unsigned uScreenId, VBVACMDHDR *phdr)
    12201189{
    1221     LogSunlover (("x = %d, y = %d, w = %d, h = %d\n",
    1222                   phdr->x, phdr->y, phdr->w, phdr->h));
     1190    LogSunlover(("x = %d, y = %d, w = %d, h = %d\n",
     1191                 phdr->x, phdr->y, phdr->w, phdr->h));
    12231192
    12241193    /*
     
    14201389     * acceleration after a mode change.
    14211390     */
    1422     LogRelFlowFunc (("mfVideoAccelEnabled = %d, fEnable = %d, pVbvaMemory = %p\n",
     1391    LogRelFlowFunc(("mfVideoAccelEnabled = %d, fEnable = %d, pVbvaMemory = %p\n",
    14231392                  mfVideoAccelEnabled, fEnable, pVbvaMemory));
    14241393
     
    14371406        Assert (!mfVideoAccelEnabled);
    14381407
    1439         LogRelFlowFunc (("Machine is not yet running.\n"));
     1408        LogRelFlowFunc(("Machine is not yet running.\n"));
    14401409
    14411410        if (fEnable)
     
    15051474    }
    15061475
    1507     LogRelFlowFunc (("VideoAccelEnable: rc = %Rrc.\n", rc));
     1476    LogRelFlowFunc(("VideoAccelEnable: rc = %Rrc.\n", rc));
    15081477
    15091478    return rc;
     
    16601629
    16611630#ifdef DEBUG_sunlover
    1662     LogFlowFunc (("first = %d, free = %d\n",
    1663                   indexRecordFirst, indexRecordFree));
     1631    LogFlowFunc(("first = %d, free = %d\n",
     1632                 indexRecordFirst, indexRecordFree));
    16641633#endif /* DEBUG_sunlover */
    16651634
     
    16781647
    16791648#ifdef DEBUG_sunlover
    1680     LogFlowFunc (("cbRecord = 0x%08X\n", pRecord->cbRecord));
     1649    LogFlowFunc(("cbRecord = 0x%08X\n", pRecord->cbRecord));
    16811650#endif /* DEBUG_sunlover */
    16821651
     
    16891658        Assert (mpu8VbvaPartial);
    16901659
    1691         LogFlowFunc (("continue partial record mcbVbvaPartial = %d cbRecord 0x%08X, first = %d, free = %d\n",
     1660        LogFlowFunc(("continue partial record mcbVbvaPartial = %d cbRecord 0x%08X, first = %d, free = %d\n",
    16921661                      mcbVbvaPartial, pRecord->cbRecord, indexRecordFirst, indexRecordFree));
    16931662
     
    17141683
    17151684#ifdef DEBUG_sunlover
    1716             LogFlowFunc (("partial done ok, data = %d, free = %d\n",
     1685            LogFlowFunc(("partial done ok, data = %d, free = %d\n",
    17171686                          mpVbvaMemory->off32Data, mpVbvaMemory->off32Free));
    17181687#endif /* DEBUG_sunlover */
     
    17341703            }
    17351704
    1736             LogFlowFunc (("started partial record mcbVbvaPartial = 0x%08X cbRecord 0x%08X, first = %d, free = %d\n",
     1705            LogFlowFunc(("started partial record mcbVbvaPartial = 0x%08X cbRecord 0x%08X, first = %d, free = %d\n",
    17371706                          mcbVbvaPartial, pRecord->cbRecord, indexRecordFirst, indexRecordFree));
    17381707        }
     
    17691738            if (!dst)
    17701739            {
    1771                 LogRelFlowFunc (("could not allocate %d bytes from heap!!!\n", cbRecord));
     1740                LogRelFlowFunc(("could not allocate %d bytes from heap!!!\n", cbRecord));
    17721741                mpVbvaMemory->off32Data = (mpVbvaMemory->off32Data + cbRecord) % VBVA_RING_BUFFER_SIZE;
    17731742                return false;
     
    17791748
    17801749#ifdef DEBUG_sunlover
    1781             LogFlowFunc (("Allocated from heap %p\n", dst));
     1750            LogFlowFunc(("Allocated from heap %p\n", dst));
    17821751#endif /* DEBUG_sunlover */
    17831752        }
     
    17901759
    17911760#ifdef DEBUG_sunlover
    1792     LogFlowFunc (("done ok, data = %d, free = %d\n",
    1793                   mpVbvaMemory->off32Data, mpVbvaMemory->off32Free));
     1761    LogFlowFunc(("done ok, data = %d, free = %d\n",
     1762                 mpVbvaMemory->off32Data, mpVbvaMemory->off32Free));
    17941763#endif /* DEBUG_sunlover */
    17951764
     
    18161785
    18171786#ifdef DEBUG_sunlover
    1818         LogFlowFunc (("Free heap %p\n", pHdr));
     1787        LogFlowFunc(("Free heap %p\n", pHdr));
    18191788#endif /* DEBUG_sunlover */
    18201789
     
    18531822{
    18541823#ifdef DEBUG_sunlover_2
    1855     LogFlowFunc (("mfVideoAccelEnabled = %d\n", mfVideoAccelEnabled));
     1824    LogFlowFunc(("mfVideoAccelEnabled = %d\n", mfVideoAccelEnabled));
    18561825#endif /* DEBUG_sunlover_2 */
    18571826
     
    18661835
    18671836#ifdef DEBUG_sunlover_2
    1868     LogFlowFunc (("indexRecordFirst = %d, indexRecordFree = %d, off32Data = %d, off32Free = %d\n",
     1837    LogFlowFunc(("indexRecordFirst = %d, indexRecordFree = %d, off32Data = %d, off32Free = %d\n",
    18691838                  mpVbvaMemory->indexRecordFirst, mpVbvaMemory->indexRecordFree, mpVbvaMemory->off32Data, mpVbvaMemory->off32Free));
    18701839#endif /* DEBUG_sunlover_2 */
     
    19091878        {
    19101879#ifdef DEBUG_sunlover
    1911             LogFlowFunc (("hdr: cbCmd = %d, x=%d, y=%d, w=%d, h=%d\n",
    1912                           cbCmd, phdr->x, phdr->y, phdr->w, phdr->h));
     1880            LogFlowFunc(("hdr: cbCmd = %d, x=%d, y=%d, w=%d, h=%d\n",
     1881                         cbCmd, phdr->x, phdr->y, phdr->w, phdr->h));
    19131882#endif /* DEBUG_sunlover */
    19141883
     
    20241993    ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel)
    20251994{
    2026     LogRelFlowFunc (("aScreenId = %d\n", aScreenId));
     1995    LogRelFlowFunc(("aScreenId = %d\n", aScreenId));
    20271996
    20281997    AutoCaller autoCaller(this);
     
    20682037STDMETHODIMP Display::SetFramebuffer(ULONG aScreenId, IFramebuffer *aFramebuffer)
    20692038{
    2070     LogRelFlowFunc (("\n"));
     2039    LogRelFlowFunc(("\n"));
    20712040
    20722041    if (aFramebuffer != NULL)
     
    21292098}
    21302099
    2131 STDMETHODIMP Display::GetFramebuffer (ULONG aScreenId,
    2132     IFramebuffer **aFramebuffer, LONG *aXOrigin, LONG *aYOrigin)
    2133 {
    2134     LogRelFlowFunc (("aScreenId = %d\n", aScreenId));
     2100STDMETHODIMP Display::GetFramebuffer(ULONG aScreenId,
     2101                                     IFramebuffer **aFramebuffer, LONG *aXOrigin, LONG *aYOrigin)
     2102{
     2103    LogRelFlowFunc(("aScreenId = %d\n", aScreenId));
    21352104
    21362105    CheckComArgOutPointerValid(aFramebuffer);
     
    23052274
    23062275                rc = pDisplay->mpDrv->pUpPort->pfnCopyRect(pDisplay->mpDrv->pUpPort,
    2307                                                       width, height,
    2308                                                       pu8Src,
    2309                                                       xSrc, ySrc,
    2310                                                       u32SrcWidth, u32SrcHeight,
    2311                                                       u32SrcLineSize, u32SrcBitsPerPixel,
    2312                                                       pu8Dst,
    2313                                                       xDst, yDst,
    2314                                                       u32DstWidth, u32DstHeight,
    2315                                                       u32DstLineSize, u32DstBitsPerPixel);
     2276                                                           width, height,
     2277                                                           pu8Src,
     2278                                                           xSrc, ySrc,
     2279                                                           u32SrcWidth, u32SrcHeight,
     2280                                                           u32SrcLineSize, u32SrcBitsPerPixel,
     2281                                                           pu8Dst,
     2282                                                           xDst, yDst,
     2283                                                           u32DstWidth, u32DstHeight,
     2284                                                           u32DstLineSize, u32DstBitsPerPixel);
    23162285                if (RT_SUCCESS(rc))
    23172286                {
     
    27472716    //  within the Console lock to make it atomic).
    27482717
    2749     LogRelFlowFunc (("address=%p, x=%d, y=%d, width=%d, height=%d\n",
     2718    LogRelFlowFunc(("address=%p, x=%d, y=%d, width=%d, height=%d\n",
    27502719                  (void *)address, x, y, width, height));
    27512720
     
    27952764//    }
    27962765
    2797     LogRelFlowFunc (("rc=%08X\n", rc));
     2766    LogRelFlowFunc(("rc=%08X\n", rc));
    27982767    return rc;
    27992768}
     
    29032872    HRESULT rc = S_OK;
    29042873
    2905     LogRelFlowFunc (("Sending DPYUPDATE request\n"));
     2874    LogRelFlowFunc(("Sending DPYUPDATE request\n"));
    29062875
    29072876    /* Have to release the lock when calling EMT.  */
     
    29172886                      tr("Could not invalidate and update the screen (%Rrc)"), rcVBox);
    29182887
    2919     LogRelFlowFunc (("rc=%08X\n", rc));
     2888    LogRelFlowFunc(("rc=%08X\n", rc));
    29202889    return rc;
    29212890}
     
    29292898STDMETHODIMP Display::ResizeCompleted(ULONG aScreenId)
    29302899{
    2931     LogRelFlowFunc (("\n"));
     2900    LogRelFlowFunc(("\n"));
    29322901
    29332902    /// @todo (dmik) can we AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); here?
     
    30102979void Display::updateDisplayData(void)
    30112980{
    3012     LogRelFlowFunc (("\n"));
     2981    LogRelFlowFunc(("\n"));
    30132982
    30142983    /* the driver might not have been constructed yet */
     
    30703039        mpDrv->IConnector.cy = 0;
    30713040    }
    3072     LogRelFlowFunc (("leave\n"));
     3041    LogRelFlowFunc(("leave\n"));
    30733042}
    30743043
     
    31243093                                              unsigned uScreenId)
    31253094{
    3126     LogRelFlowFunc (("uScreenId = %d\n", uScreenId));
     3095    LogRelFlowFunc(("uScreenId = %d\n", uScreenId));
    31273096
    31283097    AssertReturn(that, VERR_INVALID_PARAMETER);
     
    31823151    }
    31833152
    3184     LogRelFlowFunc (("leave\n"));
     3153    LogRelFlowFunc(("leave\n"));
    31853154    return VINF_SUCCESS;
    31863155}
     
    31963165    PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
    31973166
    3198     LogRelFlowFunc (("bpp %d, pvVRAM %p, cbLine %d, cx %d, cy %d\n",
     3167    LogRelFlowFunc(("bpp %d, pvVRAM %p, cbLine %d, cx %d, cy %d\n",
    31993168                  bpp, pvVRAM, cbLine, cx, cy));
    32003169
     
    32133182
    32143183#ifdef DEBUG_sunlover
    3215     LogFlowFunc (("mfVideoAccelEnabled = %d, %d,%d %dx%d\n",
    3216                   pDrv->pDisplay->mfVideoAccelEnabled, x, y, cx, cy));
     3184    LogFlowFunc(("mfVideoAccelEnabled = %d, %d,%d %dx%d\n",
     3185                 pDrv->pDisplay->mfVideoAccelEnabled, x, y, cx, cy));
    32173186#endif /* DEBUG_sunlover */
    32183187
     
    32393208
    32403209#ifdef DEBUG_sunlover_2
    3241     LogFlowFunc (("pDrv->pDisplay->mfVideoAccelEnabled = %d\n",
    3242                   pDrv->pDisplay->mfVideoAccelEnabled));
     3210    LogFlowFunc(("pDrv->pDisplay->mfVideoAccelEnabled = %d\n",
     3211                 pDrv->pDisplay->mfVideoAccelEnabled));
    32433212#endif /* DEBUG_sunlover_2 */
    32443213
     
    32593228        if (u32ResizeStatus == ResizeStatus_UpdateDisplayData)
    32603229        {
    3261             LogRelFlowFunc (("ResizeStatus_UpdateDisplayData %d\n", uScreenId));
     3230            LogRelFlowFunc(("ResizeStatus_UpdateDisplayData %d\n", uScreenId));
    32623231            fNoUpdate = true; /* Always set it here, because pfnUpdateDisplayAll can cause a new resize. */
    32633232            /* The framebuffer was resized and display data need to be updated. */
     
    32763245        {
    32773246            /* The framebuffer is being resized. Do not call the VGA device back. Immediately return. */
    3278             LogRelFlowFunc (("ResizeStatus_InProcess\n"));
     3247            LogRelFlowFunc(("ResizeStatus_InProcess\n"));
    32793248            fNoUpdate = true;
    32803249            continue;
     
    33203289
    33213290#ifdef VBOX_WITH_VPX
    3322     if (   pDisplay->mpVideoRecCtx
    3323         && VideoRecIsEnabled(pDisplay->mpVideoRecCtx))
     3291    if (VideoRecIsEnabled(pDisplay->mpVideoRecCtx))
    33243292    {
    33253293        DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN];
     
    33563324#endif /* DEBUG_sunlover */
    33573325#ifdef DEBUG_sunlover_2
    3358     LogFlowFunc (("leave\n"));
     3326    LogFlowFunc(("leave\n"));
    33593327#endif /* DEBUG_sunlover_2 */
    33603328}
     
    33693337    PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
    33703338
    3371     LogRelFlowFunc (("\n"));
     3339    LogRelFlowFunc(("\n"));
    33723340
    33733341   /* Disable VBVA mode. */
     
    33843352    PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
    33853353
    3386     LogRelFlowFunc (("fEnabled=%d\n", fEnabled));
     3354    LogRelFlowFunc(("fEnabled=%d\n", fEnabled));
    33873355
    33883356    NOREF(fEnabled);
     
    41934161        {
    41944162            /* VRDP server still need this notification. */
    4195             LogRelFlowFunc (("Calling VRDP\n"));
     4163            LogRelFlowFunc(("Calling VRDP\n"));
    41964164            pThis->mParent->consoleVRDPServer()->SendResize();
    41974165        }
     
    43064274     * Init Interfaces.
    43074275     */
    4308     pDrvIns->IBase.pfnQueryInterface        = Display::drvQueryInterface;
    4309 
    4310     pThis->IConnector.pfnResize             = Display::displayResizeCallback;
    4311     pThis->IConnector.pfnUpdateRect         = Display::displayUpdateCallback;
    4312     pThis->IConnector.pfnRefresh            = Display::displayRefreshCallback;
    4313     pThis->IConnector.pfnReset              = Display::displayResetCallback;
    4314     pThis->IConnector.pfnLFBModeChange      = Display::displayLFBModeChangeCallback;
    4315     pThis->IConnector.pfnProcessAdapterData = Display::displayProcessAdapterDataCallback;
    4316     pThis->IConnector.pfnProcessDisplayData = Display::displayProcessDisplayDataCallback;
     4276    pDrvIns->IBase.pfnQueryInterface           = Display::drvQueryInterface;
     4277
     4278    pThis->IConnector.pfnResize                = Display::displayResizeCallback;
     4279    pThis->IConnector.pfnUpdateRect            = Display::displayUpdateCallback;
     4280    pThis->IConnector.pfnRefresh               = Display::displayRefreshCallback;
     4281    pThis->IConnector.pfnReset                 = Display::displayResetCallback;
     4282    pThis->IConnector.pfnLFBModeChange         = Display::displayLFBModeChangeCallback;
     4283    pThis->IConnector.pfnProcessAdapterData    = Display::displayProcessAdapterDataCallback;
     4284    pThis->IConnector.pfnProcessDisplayData    = Display::displayProcessDisplayDataCallback;
    43174285#ifdef VBOX_WITH_VIDEOHWACCEL
    4318     pThis->IConnector.pfnVHWACommandProcess = Display::displayVHWACommandProcess;
     4286    pThis->IConnector.pfnVHWACommandProcess    = Display::displayVHWACommandProcess;
    43194287#endif
    43204288#ifdef VBOX_WITH_CRHGSMI
     
    43234291#endif
    43244292#ifdef VBOX_WITH_HGSMI
    4325     pThis->IConnector.pfnVBVAEnable         = Display::displayVBVAEnable;
    4326     pThis->IConnector.pfnVBVADisable        = Display::displayVBVADisable;
    4327     pThis->IConnector.pfnVBVAUpdateBegin    = Display::displayVBVAUpdateBegin;
    4328     pThis->IConnector.pfnVBVAUpdateProcess  = Display::displayVBVAUpdateProcess;
    4329     pThis->IConnector.pfnVBVAUpdateEnd      = Display::displayVBVAUpdateEnd;
    4330     pThis->IConnector.pfnVBVAResize         = Display::displayVBVAResize;
     4293    pThis->IConnector.pfnVBVAEnable            = Display::displayVBVAEnable;
     4294    pThis->IConnector.pfnVBVADisable           = Display::displayVBVADisable;
     4295    pThis->IConnector.pfnVBVAUpdateBegin       = Display::displayVBVAUpdateBegin;
     4296    pThis->IConnector.pfnVBVAUpdateProcess     = Display::displayVBVAUpdateProcess;
     4297    pThis->IConnector.pfnVBVAUpdateEnd         = Display::displayVBVAUpdateEnd;
     4298    pThis->IConnector.pfnVBVAResize            = Display::displayVBVAResize;
    43314299    pThis->IConnector.pfnVBVAMousePointerShape = Display::displayVBVAMousePointerShape;
    43324300#endif
     
    43594327        return rc;
    43604328    }
    4361     pThis->pDisplay = (Display *)pv;        /** @todo Check this cast! */
     4329    Display *pDisplay = (Display *)pv;      /** @todo Check this cast! */
     4330    pThis->pDisplay = pDisplay;
    43624331    pThis->pDisplay->mpDrv = pThis;
    4363 
    43644332    /*
    43654333     * Update our display information according to the framebuffer
    43664334     */
    4367     pThis->pDisplay->updateDisplayData();
     4335    pDisplay->updateDisplayData();
    43684336
    43694337    /*
     
    43734341
    43744342#ifdef VBOX_WITH_CRHGSMI
    4375     pThis->pDisplay->setupCrHgsmiData();
     4343    pDisplay->setupCrHgsmiData();
     4344#endif
     4345
     4346#ifdef VBOX_WITH_VPX
     4347    rc = VideoRecContextCreate(&pDisplay->mpVideoRecCtx);
     4348    if (RT_FAILURE(rc))
     4349    {
     4350        LogFlow(("Failed to create video recording context (%Rrc)!\n", rc));
     4351        return E_FAIL;
     4352    }
     4353
     4354    ComPtr<IMachine> pMachine = pDisplay->mParent->machine();
     4355    BOOL fEnabled = false;
     4356    pMachine->COMGETTER(VideoCaptureEnabled)(&fEnabled);
     4357    if (fEnabled)
     4358    {
     4359        ULONG ulWidth;
     4360        int hrc = pMachine->COMGETTER(VideoCaptureWidth)(&ulWidth);
     4361        AssertComRCReturnRC(hrc);
     4362        ULONG ulHeight;
     4363        hrc = pMachine->COMGETTER(VideoCaptureHeight)(&ulHeight);
     4364        AssertComRCReturnRC(hrc);
     4365        ULONG ulRate;
     4366        hrc = pMachine->COMGETTER(VideoCaptureRate)(&ulRate);
     4367        AssertComRCReturnRC(hrc);
     4368        ULONG ulFps;
     4369        hrc = pMachine->COMGETTER(VideoCaptureFps)(&ulFps);
     4370        AssertComRCReturnRC(hrc);
     4371        BSTR strFile;
     4372        hrc = pMachine->COMGETTER(VideoCaptureFile)(&strFile);
     4373        AssertComRCReturnRC(hrc);
     4374        rc = VideoRecContextInit(pDisplay->mpVideoRecCtx, com::Utf8Str(strFile).c_str(),
     4375                                 ulWidth, ulHeight, ulRate, ulFps);
     4376        if (RT_SUCCESS(rc))
     4377            LogRel(("WebM/VP8 video recording with %ux%u @ %u kbps, %u fps to '%s' enabled!\n",
     4378                   ulWidth, ulHeight, ulRate, ulFps, com::Utf8Str(strFile).c_str()));
     4379        else
     4380            LogRel(("Failed to initialize video recording context (%Rrc)!\n", rc));
     4381    }
    43764382#endif
    43774383
  • trunk/src/VBox/Main/src-client/VideoRec.cpp

    r45926 r45941  
    3939static int videoRecEncodeAndWrite(PVIDEORECCONTEXT pVideoRecCtx);
    4040static int videoRecRGBToYUV(PVIDEORECCONTEXT pVideoRecCtx);
    41 
    42 /* RGB buffer */
    43 enum
    44 {
    45     /* RGB buffer empty */
    46     VIDREC_RGB_EMPTY = 0,
    47     /* RGB buffer filled */
    48     VIDREC_RGB_FILLED
    49 };
    5041
    5142/* encoding */
     
    9788    /* pixel format of the current frame */
    9889    uint32_t            u32PixelFormat;
    99     /* maximum number of frames per second */
     90    /* minimal delay between two frames */
    10091    uint32_t            uDelay;
     92    /* time stamp of the last frame we encoded */
    10193    uint64_t            u64LastTimeStamp;
    10294    /* time stamp of the current frame */
     
    428420 * @param   uTargetHeight       Height of the target image in video recording file.
    429421 */
    430 int VideoRecContextInit(PVIDEORECCONTEXT pVideoRecCtx, com::Bstr strFile,
     422int VideoRecContextInit(PVIDEORECCONTEXT pVideoRecCtx, const char *pszFile,
    431423                        uint32_t uWidth, uint32_t uHeight, uint32_t uRate, uint32_t uFps)
    432424{
     
    436428    AssertReturn(pVideoRecCtx->pu8RgbBuf, VERR_NO_MEMORY);
    437429
    438     int rc = RTFileOpen(&pVideoRecCtx->ebml.file,
    439                         com::Utf8Str(strFile).c_str(),
     430    int rc = RTFileOpen(&pVideoRecCtx->ebml.file, pszFile,
    440431                        RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);
    441432    if (RT_FAILURE(rc))
    442433    {
    443         LogFlow(("Failed to open the output File \n"));
    444         return VERR_GENERAL_FAILURE;
     434        LogFlow(("Failed to open the output File\n"));
     435        return rc;
    445436    }
    446437
     
    448439    if (rcv != VPX_CODEC_OK)
    449440    {
    450         LogFlow(("Failed to configure codec \n", vpx_codec_err_to_string(rcv)));
    451         return VERR_GENERAL_FAILURE;
     441        LogFlow(("Failed to configure codec\n", vpx_codec_err_to_string(rcv)));
     442        return rc;
    452443    }
    453444
     
    487478    pVideoRecCtx->pu8YuvBuf = pVideoRecCtx->VpxRawImage.planes[0];
    488479
    489     int vrc = RTSemEventCreate(&pVideoRecCtx->WaitEvent);
    490     AssertRCReturn(vrc, vrc);
    491 
    492     vrc = RTThreadCreate(&pVideoRecCtx->Thread, VideoRecThread,
    493                          (void*)pVideoRecCtx, 0,
    494                          RTTHREADTYPE_MAIN_WORKER, 0, "VideoRec");
    495     AssertRCReturn(vrc, vrc);
     480    rc = RTSemEventCreate(&pVideoRecCtx->WaitEvent);
     481    AssertRCReturn(rc, rc);
     482
     483    rc = RTThreadCreate(&pVideoRecCtx->Thread, VideoRecThread,
     484                        (void*)pVideoRecCtx, 0,
     485                        RTTHREADTYPE_MAIN_WORKER, 0, "VideoRec");
     486    AssertRCReturn(rc, rc);
    496487
    497488    pVideoRecCtx->fEnabled = true;
     
    542533bool VideoRecIsEnabled(PVIDEORECCONTEXT pVideoRecCtx)
    543534{
    544     AssertPtr(pVideoRecCtx);
     535    if (!pVideoRecCtx)
     536        return false;
     537
    545538    return pVideoRecCtx->fEnabled;
    546539}
  • trunk/src/VBox/Main/src-client/VideoRec.h

    r45926 r45941  
    2323
    2424int  VideoRecContextCreate(PVIDEORECCONTEXT *ppVideoRecContext);
    25 int  VideoRecContextInit(PVIDEORECCONTEXT pVideoRecContext, com::Bstr mFileName,
     25int  VideoRecContextInit(PVIDEORECCONTEXT pVideoRecContext, const char *pszFile,
    2626                         uint32_t uWidth, uint32_t uHeight, uint32_t uRate, uint32_t uFps);
    2727void VideoRecContextClose(PVIDEORECCONTEXT pVideoRecContext);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette