- Timestamp:
- Aug 20, 2012 10:00:07 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 80158
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/DisplayImpl.h
r42248 r42878 28 28 29 29 class Console; 30 struct VIDEORECCONTEXT; 30 31 31 32 enum { … … 294 295 volatile uint32_t mu32UpdateVBVAFlags; 295 296 #endif 297 298 #ifdef VBOX_WITH_VPX 299 VIDEORECCONTEXT *mpVideoRecContext; 300 #endif 296 301 }; 297 302 -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r42861 r42878 50 50 #ifdef VBOX_WITH_VPX 51 51 # include "VideoRec.h" 52 PVIDEORECCONTEXT pVideoRecContext;53 52 #endif 53 54 54 /** 55 55 * Display driver instance data. … … 428 428 * @param qemuConsoleData address of common console data structure 429 429 */ 430 HRESULT Display::init 430 HRESULT Display::init(Console *aParent) 431 431 { 432 432 ComAssertRet(aParent, E_INVALIDARG); 433 HRESULT res;434 433 /* Enclose the state transition NotReady->InInit->Ready */ 435 434 AutoInitSpan autoInitSpan(this); … … 444 443 ULONG ul; 445 444 mParent->machine()->COMGETTER(MonitorCount)(&ul); 445 446 446 #ifdef VBOX_WITH_VPX 447 ULONG ulVideoCaptureHorzRes;448 ULONG ulVideoCaptureVertRes;449 BSTR strVideoCaptureFile;450 447 BOOL fEnabled = false; 451 if (VideoRecContextCreate(& pVideoRecContext))452 { 453 LogFlow(("Failed to create Video Recording Context 448 if (VideoRecContextCreate(&mpVideoRecContext)) 449 { 450 LogFlow(("Failed to create Video Recording Context\n")); 454 451 return E_FAIL; 455 452 } 456 res = RTCritSectInit(&pVideoRecContext->CritSect); 457 AssertReturn(res == S_OK, E_UNEXPECTED); 458 pVideoRecContext->fEnabled = false; 459 mParent->machine()->COMGETTER(VideoCaptureWidth)(&ulVideoCaptureHorzRes); 460 mParent->machine()->COMGETTER(VideoCaptureHeight)(&ulVideoCaptureVertRes); 461 mParent->machine()->COMGETTER(VideoCaptureFile)(&strVideoCaptureFile); 453 int rc = RTCritSectInit(&mpVideoRecContext->CritSect); 454 AssertRCReturn(rc, E_UNEXPECTED); 455 456 mpVideoRecContext->fEnabled = false; 462 457 mParent->machine()->COMGETTER(VideoCaptureEnabled)(&fEnabled); 463 458 if (fEnabled) 464 459 { 465 LogFlow(("VidoeRecording VPX enabled \n")); 466 if (VideoRecContextInit(pVideoRecContext,strVideoCaptureFile, 467 ulVideoCaptureHorzRes, ulVideoCaptureVertRes)) 468 { 469 LogFlow(("Failed to initialize video recording context \n")); 460 ULONG ulVideoCaptureHorzRes; 461 mParent->machine()->COMGETTER(VideoCaptureWidth)(&ulVideoCaptureHorzRes); 462 ULONG ulVideoCaptureVertRes; 463 mParent->machine()->COMGETTER(VideoCaptureHeight)(&ulVideoCaptureVertRes); 464 BSTR strVideoCaptureFile; 465 mParent->machine()->COMGETTER(VideoCaptureFile)(&strVideoCaptureFile); 466 LogFlow(("VidoeRecording VPX enabled\n")); 467 if (VideoRecContextInit(mpVideoRecContext,strVideoCaptureFile, 468 ulVideoCaptureHorzRes, ulVideoCaptureVertRes)) 469 { 470 LogFlow(("Failed to initialize video recording context\n")); 470 471 return E_FAIL; 471 472 } 472 pVideoRecContext->fEnabled = true;473 mpVideoRecContext->fEnabled = true; 473 474 } 474 475 #endif 476 475 477 mcMonitors = ul; 476 478 … … 562 564 563 565 #ifdef VBOX_WITH_VPX 564 VideoRecContextClose(pVideoRecContext); 566 if ( mpVideoRecContext 567 && mpVideoRecContext->fEnabled) 568 VideoRecContextClose(mpVideoRecContext); 565 569 #endif 566 570 } … … 3204 3208 unsigned uScreenId; 3205 3209 3206 LogFlow(("DisplayRefreshCallback 3210 LogFlow(("DisplayRefreshCallback\n")); 3207 3211 for (uScreenId = 0; uScreenId < pDisplay->mcMonitors; uScreenId++) 3208 3212 { … … 3277 3281 3278 3282 #ifdef VBOX_WITH_VPX 3279 uint32_t u32VideoRecImgFormat = VPX_IMG_FMT_NONE;3280 DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN];3281 int rc;3282 3283 if (!pFBInfo->pFramebuffer.isNull() && !(pFBInfo->fDisabled) 3284 && pFBInfo->u32ResizeStatus==ResizeStatus_Void)3285 {3286 HRESULT rc;3287 ULONG ulPixelFormat = 0;3288 rc = pFBInfo->pFramebuffer->COMGETTER(PixelFormat)(&ulPixelFormat);3289 AssertComRC (rc);3290 3291 ULONG ulBitsPerPixel;3292 rc = pFBInfo->pFramebuffer->COMGETTER(BitsPerPixel)(&ulBitsPerPixel); 3293 AssertComRC (rc);3294 3295 ULONG ulGuestHeight = 0;3296 rc = pFBInfo->pFramebuffer->COMGETTER(Height)(&ulGuestHeight); 3297 AssertComRC (rc);3298 3299 ULONG ulGuestWidth = 0;3300 rc = pFBInfo->pFramebuffer->COMGETTER(Width)(&ulGuestWidth); 3301 AssertComRC (rc);3302 3303 BYTE *address = NULL;3304 rc = pFBInfo->pFramebuffer->COMGETTER(Address) (&address); 3305 AssertComRC (rc);3306 3307 ULONG ulBytesPerLine = 0;3308 rc = pFBInfo->pFramebuffer->COMGETTER(BytesPerLine) (&ulBytesPerLine); 3309 AssertComRC (rc);3310 3311 if(ulPixelFormat == FramebufferPixelFormat_FOURCC_RGB)3312 { 3313 switch (ulBitsPerPixel)3283 if (pDisplay->mpVideoRecContext->fEnabled) 3284 { 3285 uint32_t u32VideoRecImgFormat = VPX_IMG_FMT_NONE; 3286 DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN]; 3287 3288 if ( !pFBInfo->pFramebuffer.isNull() 3289 && !(pFBInfo->fDisabled) 3290 && pFBInfo->u32ResizeStatus == ResizeStatus_Void) 3291 { 3292 HRESULT rc; 3293 ULONG ulPixelFormat = 0; 3294 rc = pFBInfo->pFramebuffer->COMGETTER(PixelFormat)(&ulPixelFormat); 3295 AssertComRC(rc); 3296 3297 ULONG ulBitsPerPixel; 3298 rc = pFBInfo->pFramebuffer->COMGETTER(BitsPerPixel)(&ulBitsPerPixel); 3299 AssertComRC(rc); 3300 3301 ULONG ulGuestHeight = 0; 3302 rc = pFBInfo->pFramebuffer->COMGETTER(Height)(&ulGuestHeight); 3303 AssertComRC(rc); 3304 3305 ULONG ulGuestWidth = 0; 3306 rc = pFBInfo->pFramebuffer->COMGETTER(Width)(&ulGuestWidth); 3307 AssertComRC(rc); 3308 3309 BYTE *address = NULL; 3310 rc = pFBInfo->pFramebuffer->COMGETTER(Address)(&address); 3311 AssertComRC(rc); 3312 3313 ULONG ulBytesPerLine = 0; 3314 rc = pFBInfo->pFramebuffer->COMGETTER(BytesPerLine)(&ulBytesPerLine); 3315 AssertComRC(rc); 3316 3317 if (ulPixelFormat == FramebufferPixelFormat_FOURCC_RGB) 3314 3318 { 3315 case 32: 3316 u32VideoRecImgFormat = VPX_IMG_FMT_RGB32; 3317 Log2(("FFmpeg::RequestResize: setting ffmpeg pixel format to VPX_IMG_FMT_RGB32\n")); 3318 break; 3319 case 24: 3320 u32VideoRecImgFormat = VPX_IMG_FMT_RGB24; 3321 Log2(("FFmpeg::RequestResize: setting ffmpeg pixel format to VPX_IMG_FMT_RGB24\n")); 3322 break; 3323 case 16: 3324 u32VideoRecImgFormat = VPX_IMG_FMT_RGB565; 3325 Log2(("FFmpeg::RequestResize: setting ffmpeg pixel format to VPX_IMG_FMT_RGB565\n")); 3326 break; 3327 default: 3328 Log2(("No Proper Format detected\n")); 3329 3319 switch (ulBitsPerPixel) 3320 { 3321 case 32: 3322 u32VideoRecImgFormat = VPX_IMG_FMT_RGB32; 3323 Log2(("FFmpeg::RequestResize: setting ffmpeg pixel format to VPX_IMG_FMT_RGB32\n")); 3324 break; 3325 case 24: 3326 u32VideoRecImgFormat = VPX_IMG_FMT_RGB24; 3327 Log2(("FFmpeg::RequestResize: setting ffmpeg pixel format to VPX_IMG_FMT_RGB24\n")); 3328 break; 3329 case 16: 3330 u32VideoRecImgFormat = VPX_IMG_FMT_RGB565; 3331 Log2(("FFmpeg::RequestResize: setting ffmpeg pixel format to VPX_IMG_FMT_RGB565\n")); 3332 break; 3333 default: 3334 Log2(("No Proper Format detected\n")); 3335 break; 3336 } 3330 3337 } 3331 } 3332 3333 if (u32VideoRecImgFormat != VPX_IMG_FMT_NONE && address != NULL3334 && pVideoRecContext->fEnabled)3335 {3336 VideoRecCopyToIntBuffer(pVideoRecContext, pFBInfo->xOrigin, pFBInfo->yOrigin,3337 ulPixelFormat, ulBitsPerPixel, ulBytesPerLine,3338 ulGuestWidth, ulGuestHeight, address); 3339 3340 VideoRecDoRGBToYUV(pVideoRecContext, u32VideoRecImgFormat);3341 VideoRecEncodeAndWrite(pVideoRecContext, ulGuestWidth, ulGuestHeight);3338 3339 if ( u32VideoRecImgFormat != VPX_IMG_FMT_NONE 3340 && address) 3341 { 3342 VideoRecCopyToIntBuffer(pDisplay->mpVideoRecContext, pFBInfo->xOrigin, pFBInfo->yOrigin, 3343 ulPixelFormat, ulBitsPerPixel, ulBytesPerLine, 3344 ulGuestWidth, ulGuestHeight, address); 3345 3346 VideoRecDoRGBToYUV(pDisplay->mpVideoRecContext, u32VideoRecImgFormat); 3347 VideoRecEncodeAndWrite(pDisplay->mpVideoRecContext, ulGuestWidth, ulGuestHeight); 3348 } 3342 3349 } 3343 3350 }
Note:
See TracChangeset
for help on using the changeset viewer.