Changeset 72014 in vbox for trunk/src/VBox/Main
- Timestamp:
- Apr 25, 2018 1:28:31 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 122275
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/DisplayImpl.h
r71626 r72014 209 209 #ifdef VBOX_WITH_VIDEOREC 210 210 PVIDEORECCFG i_videoRecGetConfig(void) { return &mVideoRecCfg; } 211 VIDEORECFEATURES i_videoRecGet Enabled(void);211 VIDEORECFEATURES i_videoRecGetFeatures(void); 212 212 bool i_videoRecStarted(void); 213 213 void i_videoRecInvalidate(); -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r70773 r72014 5660 5660 pDisplay->i_videoRecInvalidate(); 5661 5661 5662 BOOL fEnabled; 5663 rc = mMachine->COMGETTER(VideoCaptureEnabled)(&fEnabled); 5664 AssertComRCReturnRC(rc); 5665 5662 5666 int vrc; 5663 5667 5664 if ( !mDisplay->i_videoRecStarted())5668 if (fEnabled) 5665 5669 { 5666 5670 # ifdef VBOX_WITH_AUDIO_VIDEOREC 5667 5671 /* Attach the video recording audio driver if required. */ 5668 if (mDisplay->i_videoRecGet Enabled() & VIDEORECFEATURE_AUDIO)5672 if (mDisplay->i_videoRecGetFeatures() & VIDEORECFEATURE_AUDIO) 5669 5673 mAudioVideoRec->doAttachDriverViaEmt(mpUVM, &alock); 5670 5674 # endif … … 9994 9998 if (pDisplay) 9995 9999 { 9996 pDisplay->i_videoRecInvalidate(); 9997 9998 /* If video recording fails for whatever reason here, this is 9999 * non-critical and should not be returned at this point -- otherwise 10000 * the display driver construction fails completely. */ 10001 int vrc2 = VINF_SUCCESS; 10000 BOOL fVideoRecEnabled = FALSE; 10001 rc = pConsole->mMachine->COMGETTER(VideoCaptureEnabled)(&fVideoRecEnabled); 10002 AssertComRCReturnVoid(rc); 10003 10004 if (fVideoRecEnabled) 10005 { 10006 pDisplay->i_videoRecInvalidate(); 10007 10008 /* If video recording fails for whatever reason here, this is 10009 * non-critical and should not be returned at this point -- otherwise 10010 * the display driver construction fails completely. */ 10011 int vrc2 = VINF_SUCCESS; 10002 10012 10003 10013 #ifdef VBOX_WITH_AUDIO_VIDEOREC 10004 /* Attach the video recording audio driver if required. */10005 if ( pDisplay->i_videoRecGetEnabled() & VIDEORECFEATURE_AUDIO10006 && pConsole->mAudioVideoRec)10007 vrc2 = pConsole->mAudioVideoRec->doAttachDriverViaEmt(pConsole->mpUVM, &alock);10014 /* Attach the video recording audio driver if required. */ 10015 if ( pDisplay->i_videoRecGetFeatures() & VIDEORECFEATURE_AUDIO 10016 && pConsole->mAudioVideoRec) 10017 vrc2 = pConsole->mAudioVideoRec->doAttachDriverViaEmt(pConsole->mpUVM, &alock); 10008 10018 #endif 10009 if ( RT_SUCCESS(vrc2) 10010 && pDisplay->i_videoRecGetEnabled()) /* Any video recording (audio and/or video) feature enabled? */ 10011 { 10012 vrc2 = pDisplay->i_videoRecStart(); 10013 if (RT_SUCCESS(vrc2)) 10014 fireVideoCaptureChangedEvent(pConsole->i_getEventSource()); 10019 if ( RT_SUCCESS(vrc2) 10020 && pDisplay->i_videoRecGetFeatures()) /* Any video recording (audio and/or video) feature enabled? */ 10021 { 10022 vrc2 = pDisplay->i_videoRecStart(); 10023 if (RT_SUCCESS(vrc2)) 10024 fireVideoCaptureChangedEvent(pConsole->i_getEventSource()); 10025 } 10015 10026 } 10016 10027 } -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r71651 r72014 2402 2402 * @returns Enables video capturing features. 2403 2403 */ 2404 VIDEORECFEATURES Display::i_videoRecGet Enabled(void)2405 { 2406 return VideoRecGet Enabled(&mVideoRecCfg);2404 VIDEORECFEATURES Display::i_videoRecGetFeatures(void) 2405 { 2406 return VideoRecGetFeatures(&mVideoRecCfg); 2407 2407 } 2408 2408 … … 2414 2414 bool Display::i_videoRecStarted(void) 2415 2415 { 2416 return VideoRecIs Active(mpVideoRecCtx);2416 return VideoRecIsStarted(mpVideoRecCtx); 2417 2417 } 2418 2418 … … 2431 2431 * Cache parameters from API. 2432 2432 */ 2433 BOOL fEnabled;2434 HRESULT hrc = pMachine->COMGETTER(VideoCaptureEnabled)(&fEnabled);2435 AssertComRCReturnVoid(hrc);2436 mVideoRecCfg.fEnabled = RT_BOOL(fEnabled);2437 2438 2433 com::SafeArray<BOOL> aScreens; 2439 hrc = pMachine->COMGETTER(VideoCaptureScreens)(ComSafeArrayAsOutParam(aScreens));2434 HRESULT hrc = pMachine->COMGETTER(VideoCaptureScreens)(ComSafeArrayAsOutParam(aScreens)); 2440 2435 AssertComRCReturnVoid(hrc); 2441 2436 … … 2465 2460 * Set sensible defaults. 2466 2461 */ 2467 mVideoRecCfg.Video.fEnabled = mVideoRecCfg.fEnabled;2462 mVideoRecCfg.Video.fEnabled = true; /* Enabled by default. */ 2468 2463 2469 2464 if (!mVideoRecCfg.Video.uFPS) /* Prevent division by zero. */ … … 2474 2469 #endif 2475 2470 2476 /* Note: Audio support is considered as being experimental, thus it's disabled by default.2477 * There be dragons! */2478 2471 #ifdef VBOX_WITH_AUDIO_VIDEOREC 2479 mVideoRecCfg.Audio.fEnabled = false; 2472 mVideoRecCfg.Audio.fEnabled = false; /* Disabled by default, unless set otherwise below. */ 2480 2473 /* By default we use 48kHz, 16-bit, stereo for the audio track. */ 2481 2474 mVideoRecCfg.Audio.uHz = 48000; … … 2582 2575 int Display::i_videoRecSendAudio(const void *pvData, size_t cbData, uint64_t uTimestampMs) 2583 2576 { 2584 if ( VideoRecIs Active(mpVideoRecCtx)2585 && VideoRecGet Enabled(&mVideoRecCfg) & VIDEORECFEATURE_AUDIO)2577 if ( VideoRecIsStarted(mpVideoRecCtx) 2578 && VideoRecGetFeatures(&mVideoRecCfg) & VIDEORECFEATURE_AUDIO) 2586 2579 { 2587 2580 return VideoRecSendAudioFrame(mpVideoRecCtx, pvData, cbData, uTimestampMs); … … 2599 2592 int Display::i_videoRecStart(void) 2600 2593 { 2601 if (VideoRecIs Active(mpVideoRecCtx))2594 if (VideoRecIsStarted(mpVideoRecCtx)) 2602 2595 return VINF_SUCCESS; 2596 2597 LogRel(("VideoRec: Starting ...\n")); 2603 2598 2604 2599 int rc = VideoRecContextCreate(mcMonitors, &mVideoRecCfg, &mpVideoRecCtx); … … 2631 2626 void Display::i_videoRecStop(void) 2632 2627 { 2633 if (!VideoRecIs Active(mpVideoRecCtx))2628 if (!VideoRecIsStarted(mpVideoRecCtx)) 2634 2629 return; 2630 2631 LogRel(("VideoRec: Stopping ...\n")); 2635 2632 2636 2633 VideoRecContextDestroy(mpVideoRecCtx); … … 2644 2641 void Display::i_videoRecScreenChanged(unsigned uScreenId) 2645 2642 { 2646 if ( !VideoRecIs Active(mpVideoRecCtx)2643 if ( !VideoRecIsStarted(mpVideoRecCtx) 2647 2644 || !maVideoRecEnabled[uScreenId]) 2648 2645 { … … 3366 3363 3367 3364 #ifdef VBOX_WITH_VIDEOREC 3368 if ( VideoRecIs Active(pDisplay->mpVideoRecCtx)3369 && VideoRecGet Enabled(&pDisplay->mVideoRecCfg) & VIDEORECFEATURE_VIDEO)3365 if ( VideoRecIsStarted(pDisplay->mpVideoRecCtx) 3366 && VideoRecGetFeatures(&pDisplay->mVideoRecCfg) & VIDEORECFEATURE_VIDEO) 3370 3367 { 3371 3368 do { … … 3832 3829 Assert(mfCrOglVideoRecState == CRVREC_STATE_SUBMITTED); 3833 3830 # ifdef VBOX_WITH_VIDEOREC 3834 if ( VideoRecIs Active(mpVideoRecCtx)3835 && VideoRecGet Enabled(&mVideoRecCfg) & VIDEORECFEATURE_VIDEO)3831 if ( VideoRecIsStarted(mpVideoRecCtx) 3832 && VideoRecGetFeatures(&mVideoRecCfg) & VIDEORECFEATURE_VIDEO) 3836 3833 { 3837 3834 int rc2 = VideoRecSendVideoFrame(mpVideoRecCtx, uScreen, x, y, -
trunk/src/VBox/Main/src-client/VideoRec.cpp
r71164 r72014 227 227 /** Semaphore to signal the encoding worker thread. */ 228 228 RTSEMEVENT WaitEvent; 229 /** Whether this conext is enabledor not. */230 bool f Enabled;229 /** Whether this conext is in started state or not. */ 230 bool fStarted; 231 231 /** Shutdown indicator. */ 232 232 bool fShutdown; … … 721 721 pCtx->tsStartMs = RTTimeMilliTS(); 722 722 pCtx->enmState = VIDEORECSTS_UNINITIALIZED; 723 pCtx->fStarted = false; 723 724 pCtx->fShutdown = false; 724 725 … … 738 739 { 739 740 pCtx->enmState = VIDEORECSTS_INITIALIZED; 740 pCtx->f Enabled = true;741 pCtx->fStarted = true; 741 742 742 743 if (ppCtx) … … 763 764 if (!pCtx) 764 765 return VINF_SUCCESS; 765 766 /* First, disable the context. */767 ASMAtomicWriteBool(&pCtx->fEnabled, false);768 766 769 767 if (pCtx->enmState == VIDEORECSTS_INITIALIZED) … … 778 776 if (RT_FAILURE(rc)) 779 777 return rc; 778 779 /* Disable the context. */ 780 ASMAtomicWriteBool(&pCtx->fStarted, false); 780 781 781 782 rc = RTSemEventDestroy(pCtx->WaitEvent); … … 1065 1066 PVIDEORECCFG pCfg = &pCtx->Cfg; 1066 1067 1067 pStream->pCtx 1068 pStream->pCtx = pCtx; 1068 1069 1069 1070 /** @todo Make the following parameters configurable on a per-stream basis? */ … … 1226 1227 * @param pCfg Pointer to recording configuration. 1227 1228 */ 1228 VIDEORECFEATURES VideoRecGetEnabled(PVIDEORECCFG pCfg) 1229 { 1230 if ( !pCfg 1231 || !pCfg->fEnabled) 1232 { 1229 VIDEORECFEATURES VideoRecGetFeatures(PVIDEORECCFG pCfg) 1230 { 1231 if (!pCfg) 1233 1232 return VIDEORECFEATURE_NONE; 1234 }1235 1233 1236 1234 VIDEORECFEATURES fFeatures = VIDEORECFEATURE_NONE; … … 1278 1276 1279 1277 /** 1280 * Returns whether video recording for a given recording context is activeor not.1278 * Returns whether a given recording context has been started or not. 1281 1279 * 1282 1280 * @returns true if active, false if not. 1283 1281 * @param pCtx Pointer to video recording context. 1284 1282 */ 1285 bool VideoRecIs Active(PVIDEORECCONTEXT pCtx)1283 bool VideoRecIsStarted(PVIDEORECCONTEXT pCtx) 1286 1284 { 1287 1285 if (!pCtx) 1288 1286 return false; 1289 1287 1290 return ASMAtomicReadBool(&pCtx->f Enabled);1288 return ASMAtomicReadBool(&pCtx->fStarted); 1291 1289 } 1292 1290 -
trunk/src/VBox/Main/src-client/VideoRec.h
r70035 r72014 58 58 { 59 59 VIDEORECCFG(void) 60 : fEnabled(false) 61 , enmDst(VIDEORECDEST_INVALID) 60 : enmDst(VIDEORECDEST_INVALID) 62 61 , uMaxTimeS(0) 63 62 { … … 69 68 70 69 /** Whether recording is enabled or not (as a whole). */ 71 bool fEnabled;70 //bool fEnabled; 72 71 /** Array of all screens containing whether they're enabled 73 72 * for recording or not. */ … … 143 142 VIDEORECCFG& operator=(const VIDEORECCFG &that) 144 143 { 145 fEnabled = that.fEnabled;146 147 144 aScreens.resize(that.aScreens.size()); 148 145 for (size_t i = 0; i < that.aScreens.size(); ++i) … … 179 176 int VideoRecStreamUninit(PVIDEORECCONTEXT pCtx, uint32_t uScreen); 180 177 181 VIDEORECFEATURES VideoRecGet Enabled(PVIDEORECCFG pCfg);178 VIDEORECFEATURES VideoRecGetFeatures(PVIDEORECCFG pCfg); 182 179 183 180 int VideoRecSendAudioFrame(PVIDEORECCONTEXT pCtx, const void *pvData, size_t cbData, uint64_t uTimestampMs); … … 187 184 uint8_t *puSrcData, uint64_t uTimeStampMs); 188 185 bool VideoRecIsReady(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t uTimeStampMs); 189 bool VideoRecIs Active(PVIDEORECCONTEXT pCtx);186 bool VideoRecIsStarted(PVIDEORECCONTEXT pCtx); 190 187 bool VideoRecIsLimitReached(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t tsNowMs); 191 188
Note:
See TracChangeset
for help on using the changeset viewer.