Changeset 68975 in vbox
- Timestamp:
- Oct 4, 2017 11:51:39 AM (7 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/DisplayImpl.h
r68971 r68975 105 105 { 106 106 ComPtr<IDisplaySourceBitmap> pSourceBitmap; 107 } video Capture;107 } videoRec; 108 108 #endif /* VBOX_WITH_VIDEOREC */ 109 109 } DISPLAYFBINFO; … … 209 209 210 210 #ifdef VBOX_WITH_VIDEOREC 211 PVIDEORECCFG i_video CaptureGetConfig(void) { return &mVideoRecCfg; }212 VIDEORECFEATURES i_video CaptureGetEnabled(void);213 bool i_video CaptureStarted(void);211 PVIDEORECCFG i_videoRecGetConfig(void) { return &mVideoRecCfg; } 212 VIDEORECFEATURES i_videoRecGetEnabled(void); 213 bool i_videoRecStarted(void); 214 214 # ifdef VBOX_WITH_AUDIO_VIDEOREC 215 int i_video CaptureConfigureAudioDriver(const Utf8Str& strAdapter, unsigned uInstance, unsigned uLun, bool fAttach);215 int i_videoRecConfigureAudioDriver(const Utf8Str& strAdapter, unsigned uInstance, unsigned uLun, bool fAttach); 216 216 # endif 217 static DECLCALLBACK(int) i_video CaptureConfigure(Display *pThis, PVIDEORECCFG pCfg, bool fAttachDetach);218 int i_video CaptureSendAudio(const void *pvData, size_t cbData, uint64_t uDurationMs);219 int i_video CaptureStart(void);220 void i_video CaptureStop(void);221 void i_video CaptureScreenChanged(unsigned uScreenId);217 static DECLCALLBACK(int) i_videoRecConfigure(Display *pThis, PVIDEORECCFG pCfg, bool fAttachDetach); 218 int i_videoRecSendAudio(const void *pvData, size_t cbData, uint64_t uDurationMs); 219 int i_videoRecStart(void); 220 void i_videoRecStop(void); 221 void i_videoRecScreenChanged(unsigned uScreenId); 222 222 #endif 223 223 … … 475 475 476 476 #ifdef VBOX_WITH_VIDEOREC 477 /* Serializes access to video capturesource bitmaps. */478 RTCRITSECT mVideo CaptureLock;477 /* Serializes access to video recording source bitmaps. */ 478 RTCRITSECT mVideoRecLock; 479 479 /** The current video recording configuration being used. */ 480 480 VIDEORECCFG mVideoRecCfg; -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r68971 r68975 5517 5517 5518 5518 int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY /*idDstCpu*/, 5519 (PFNRT)Display::i_video CaptureConfigure, 3,5520 pDisplay, pDisplay->i_video CaptureGetConfig(), true /* fAttachDetach */);5519 (PFNRT)Display::i_videoRecConfigure, 3, 5520 pDisplay, pDisplay->i_videoRecGetConfig(), true /* fAttachDetach */); 5521 5521 if (RT_SUCCESS(vrc)) 5522 5522 { … … 5524 5524 alock.acquire(); 5525 5525 5526 if (!mDisplay->i_video CaptureStarted())5526 if (!mDisplay->i_videoRecStarted()) 5527 5527 { 5528 vrc = mDisplay->i_video CaptureStart();5528 vrc = mDisplay->i_videoRecStart(); 5529 5529 if (RT_FAILURE(vrc)) 5530 5530 rc = setError(E_FAIL, tr("Unable to start video capturing (%Rrc)"), vrc); 5531 5531 } 5532 5532 else 5533 mDisplay->i_video CaptureStop();5533 mDisplay->i_videoRecStop(); 5534 5534 } 5535 5535 else … … 6736 6736 if (mDisplay) 6737 6737 { 6738 int rc2 = mDisplay->i_video CaptureSendAudio(pvData, cbData, uDurationMs);6738 int rc2 = mDisplay->i_videoRecSendAudio(pvData, cbData, uDurationMs); 6739 6739 AssertRC(rc2); 6740 6740 } -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r68944 r68975 3006 3006 /* Note: Don't do any driver attaching (fAttachDetach) here, as this will 3007 3007 * be done automatically as part of the VM startup process. */ 3008 pDisplay->i_video CaptureConfigure(pDisplay, pDisplay->i_videoCaptureGetConfig(), false /* fAttachDetach */);3008 pDisplay->i_videoRecConfigure(pDisplay, pDisplay->i_videoRecGetConfig(), false /* fAttachDetach */); 3009 3009 } 3010 3010 #endif /* VBOX_WITH_AUDIO_VIDEOREC */ -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r68972 r68975 147 147 148 148 #ifdef VBOX_WITH_VIDEOREC 149 rc = RTCritSectInit(&mVideo CaptureLock);149 rc = RTCritSectInit(&mVideoRecLock); 150 150 AssertRC(rc); 151 151 … … 180 180 181 181 #ifdef VBOX_WITH_VIDEOREC 182 if (RTCritSectIsInitialized(&mVideo CaptureLock))183 { 184 RTCritSectDelete(&mVideo CaptureLock);185 RT_ZERO(mVideo CaptureLock);182 if (RTCritSectIsInitialized(&mVideoRecLock)) 183 { 184 RTCritSectDelete(&mVideoRecLock); 185 RT_ZERO(mVideoRecLock); 186 186 } 187 187 #endif … … 731 731 maFramebuffers[uScreenId].pFramebuffer.setNull(); 732 732 #ifdef VBOX_WITH_VIDEOREC 733 maFramebuffers[uScreenId].video Capture.pSourceBitmap.setNull();733 maFramebuffers[uScreenId].videoRec.pSourceBitmap.setNull(); 734 734 #endif 735 735 } … … 1059 1059 1060 1060 #ifdef VBOX_WITH_VIDEOREC 1061 i_video CaptureScreenChanged(uScreenId);1061 i_videoRecScreenChanged(uScreenId); 1062 1062 #endif 1063 1063 … … 2402 2402 * @returns Enables video capturing features. 2403 2403 */ 2404 VIDEORECFEATURES Display::i_video CaptureGetEnabled(void)2404 VIDEORECFEATURES Display::i_videoRecGetEnabled(void) 2405 2405 { 2406 2406 return VideoRecGetEnabled(&mVideoRecCfg); … … 2412 2412 * @returns True if video capturing is active, false if not. 2413 2413 */ 2414 bool Display::i_video CaptureStarted(void)2414 bool Display::i_videoRecStarted(void) 2415 2415 { 2416 2416 return VideoRecIsActive(mpVideoRecCtx); … … 2429 2429 * @thread EMT 2430 2430 */ 2431 int Display::i_video CaptureConfigureAudioDriver(const Utf8Str& strDevice,2431 int Display::i_videoRecConfigureAudioDriver(const Utf8Str& strDevice, 2432 2432 unsigned uInstance, 2433 2433 unsigned uLun, … … 2502 2502 */ 2503 2503 /* static */ 2504 DECLCALLBACK(int) Display::i_video CaptureConfigure(Display *pThis, PVIDEORECCFG pCfg, bool fAttachDetach)2504 DECLCALLBACK(int) Display::i_videoRecConfigure(Display *pThis, PVIDEORECCFG pCfg, bool fAttachDetach) 2505 2505 { 2506 2506 AssertPtrReturn(pThis, VERR_INVALID_POINTER); … … 2664 2664 if (pCfg->Audio.fEnabled) /* Enable */ 2665 2665 { 2666 vrc2 = pThis->i_video CaptureConfigureAudioDriver(strAudioDev, uInstance, uLun, true /* fAttach */);2666 vrc2 = pThis->i_videoRecConfigureAudioDriver(strAudioDev, uInstance, uLun, true /* fAttach */); 2667 2667 if ( RT_SUCCESS(vrc2) 2668 2668 && fAttachDetach) … … 2682 2682 if (RT_SUCCESS(vrc2)) 2683 2683 { 2684 vrc2 = pThis->i_video CaptureConfigureAudioDriver(strAudioDev, uInstance, uLun, false /* fAttach */);2684 vrc2 = pThis->i_videoRecConfigureAudioDriver(strAudioDev, uInstance, uLun, false /* fAttach */); 2685 2685 } 2686 2686 … … 2707 2707 2708 2708 if (fChanged && i < pThis->mcMonitors) 2709 pThis->i_video CaptureScreenChanged(i);2709 pThis->i_videoRecScreenChanged(i); 2710 2710 2711 2711 } … … 2723 2723 * @param uTimestampMs Timestamp (in ms) of the audio data. 2724 2724 */ 2725 int Display::i_video CaptureSendAudio(const void *pvData, size_t cbData, uint64_t uTimestampMs)2725 int Display::i_videoRecSendAudio(const void *pvData, size_t cbData, uint64_t uTimestampMs) 2726 2726 { 2727 2727 if ( VideoRecIsActive(mpVideoRecCtx) … … 2740 2740 * @returns IPRT status code. 2741 2741 */ 2742 int Display::i_video CaptureStart(void)2742 int Display::i_videoRecStart(void) 2743 2743 { 2744 2744 if (VideoRecIsActive(mpVideoRecCtx)) … … 2757 2757 if (RT_SUCCESS(rc2)) 2758 2758 { 2759 i_video CaptureScreenChanged(uScreen);2759 i_videoRecScreenChanged(uScreen); 2760 2760 } 2761 2761 else 2762 LogRel((" Display::VideoCaptureStart: Failed to initialize video recording context #%u (%Rrc)\n", uScreen, rc2));2762 LogRel(("VideoRec: Failed to initialize video recording context #%u (%Rrc)\n", uScreen, rc2)); 2763 2763 2764 2764 if (RT_SUCCESS(rc)) … … 2771 2771 * Stops video capturing. Does nothing if video capturing is not active. 2772 2772 */ 2773 void Display::i_video CaptureStop(void)2773 void Display::i_videoRecStop(void) 2774 2774 { 2775 2775 if (!VideoRecIsActive(mpVideoRecCtx)) … … 2781 2781 unsigned uScreenId; 2782 2782 for (uScreenId = 0; uScreenId < mcMonitors; ++uScreenId) 2783 i_video CaptureScreenChanged(uScreenId);2784 } 2785 2786 void Display::i_video CaptureScreenChanged(unsigned uScreenId)2783 i_videoRecScreenChanged(uScreenId); 2784 } 2785 2786 void Display::i_videoRecScreenChanged(unsigned uScreenId) 2787 2787 { 2788 2788 if ( !VideoRecIsActive(mpVideoRecCtx) … … 2793 2793 } 2794 2794 2795 /* Get a new source bitmap which will be used by video capturecode. */2795 /* Get a new source bitmap which will be used by video recording code. */ 2796 2796 ComPtr<IDisplaySourceBitmap> pSourceBitmap; 2797 2797 QuerySourceBitmap(uScreenId, pSourceBitmap.asOutParam()); 2798 2798 2799 int rc2 = RTCritSectEnter(&mVideo CaptureLock);2799 int rc2 = RTCritSectEnter(&mVideoRecLock); 2800 2800 if (RT_SUCCESS(rc2)) 2801 2801 { 2802 maFramebuffers[uScreenId].video Capture.pSourceBitmap = pSourceBitmap;2803 2804 rc2 = RTCritSectLeave(&mVideo CaptureLock);2802 maFramebuffers[uScreenId].videoRec.pSourceBitmap = pSourceBitmap; 2803 2804 rc2 = RTCritSectLeave(&mVideoRecLock); 2805 2805 AssertRC(rc2); 2806 2806 } … … 3555 3555 if (VideoRecIsLimitReached(pDisplay->mpVideoRecCtx, uScreenId, u64Now)) 3556 3556 { 3557 pDisplay->i_video CaptureStop();3557 pDisplay->i_videoRecStop(); 3558 3558 pDisplay->mParent->i_machine()->COMSETTER(VideoCaptureEnabled)(false); 3559 3559 break; … … 3564 3564 { 3565 3565 ComPtr<IDisplaySourceBitmap> pSourceBitmap; 3566 int rc2 = RTCritSectEnter(&pDisplay->mVideo CaptureLock);3566 int rc2 = RTCritSectEnter(&pDisplay->mVideoRecLock); 3567 3567 if (RT_SUCCESS(rc2)) 3568 3568 { 3569 pSourceBitmap = pFBInfo->video Capture.pSourceBitmap;3570 RTCritSectLeave(&pDisplay->mVideo CaptureLock);3569 pSourceBitmap = pFBInfo->videoRec.pSourceBitmap; 3570 RTCritSectLeave(&pDisplay->mVideoRecLock); 3571 3571 } 3572 3572 … … 4591 4591 AutoWriteLock displayLock(pThis->pDisplay COMMA_LOCKVAL_SRC_POS); 4592 4592 #ifdef VBOX_WITH_VIDEOREC 4593 pThis->pDisplay->i_video CaptureStop();4593 pThis->pDisplay->i_videoRecStop(); 4594 4594 #endif 4595 4595 #ifdef VBOX_WITH_CRHGSMI … … 4704 4704 4705 4705 #ifdef VBOX_WITH_VIDEOREC 4706 LogRel(("Display: Debug: Calling i_video CaptureGetEnabled\n"));4707 if (pDisplay->i_video CaptureGetEnabled())4708 { 4709 LogRel(("Display: Debug: Calling i_video CaptureStart\n"));4710 int rc2 = pDisplay->i_video CaptureStart();4706 LogRel(("Display: Debug: Calling i_videoRecGetEnabled\n")); 4707 if (pDisplay->i_videoRecGetEnabled()) 4708 { 4709 LogRel(("Display: Debug: Calling i_videoRecStart\n")); 4710 int rc2 = pDisplay->i_videoRecStart(); 4711 4711 if (RT_SUCCESS(rc2)) 4712 4712 fireVideoCaptureChangedEvent(pDisplay->mParent->i_getEventSource()); 4713 4713 4714 /* If video capturing fails for whatever reason here, this is4714 /* If video recording fails for whatever reason here, this is 4715 4715 * non-critical and should not be returned at this point -- otherwise 4716 4716 * the display driver construction fails completely. */
Note:
See TracChangeset
for help on using the changeset viewer.