VirtualBox

忽略:
時間撮記:
2013-5-8 上午08:47:02 (12 年 以前)
作者:
vboxsync
訊息:

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

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • 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}
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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