Changeset 75287 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Nov 6, 2018 2:10:14 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r75276 r75287 5607 5607 * @param pAutoLock Pointer to auto write lock to use for attaching/detaching required driver(s) at runtime. 5608 5608 */ 5609 int Console::i_video CaptureEnable(BOOL fEnable, util::AutoWriteLock *pAutoLock)5609 int Console::i_videoRecEnable(BOOL fEnable, util::AutoWriteLock *pAutoLock) 5610 5610 { 5611 5611 AssertPtrReturn(pAutoLock, VERR_INVALID_POINTER); … … 5616 5616 if (pDisplay) 5617 5617 { 5618 if (RT_BOOL(fEnable) != Capture.mpVideoRecCtx->IsStarted()) 5618 const bool fEnabled = Capture.mpVideoRecCtx 5619 && Capture.mpVideoRecCtx->IsStarted(); 5620 5621 if (RT_BOOL(fEnable) != fEnabled) 5619 5622 { 5620 5623 LogRel(("VideoRec: %s\n", fEnable ? "Enabling" : "Disabling")); … … 5624 5627 if (fEnable) 5625 5628 { 5629 vrc = i_videoRecCreate(); 5630 if (RT_SUCCESS(vrc)) 5631 { 5626 5632 # ifdef VBOX_WITH_AUDIO_VIDEOREC 5627 /* Attach the video recording audio driver if required. */5628 if ( Capture.mpVideoRecCtx->IsFeatureEnabled(CaptureFeature_Audio)5629 && Capture.mAudioVideoRec)5630 {5631 vrc = Capture.mAudioVideoRec->applyConfiguration(Capture.mpVideoRecCtx->GetConfig());5632 if (RT_SUCCESS(vrc))5633 vrc = Capture.mAudioVideoRec->doAttachDriverViaEmt(mpUVM, pAutoLock);5634 }5633 /* Attach the video recording audio driver if required. */ 5634 if ( Capture.mpVideoRecCtx->IsFeatureEnabled(CaptureFeature_Audio) 5635 && Capture.mAudioVideoRec) 5636 { 5637 vrc = Capture.mAudioVideoRec->applyConfiguration(Capture.mpVideoRecCtx->GetConfig()); 5638 if (RT_SUCCESS(vrc)) 5639 vrc = Capture.mAudioVideoRec->doAttachDriverViaEmt(mpUVM, pAutoLock); 5640 } 5635 5641 # endif 5636 if ( RT_SUCCESS(vrc) 5637 && Capture.mpVideoRecCtx->IsReady()) /* Any video recording (audio and/or video) feature enabled? */ 5638 { 5639 vrc = i_videoRecStart(); 5642 if ( RT_SUCCESS(vrc) 5643 && Capture.mpVideoRecCtx->IsReady()) /* Any video recording (audio and/or video) feature enabled? */ 5644 { 5645 vrc = i_videoRecStart(); 5646 } 5640 5647 } 5641 5648 } … … 5646 5653 Capture.mAudioVideoRec->doDetachDriverViaEmt(mpUVM, pAutoLock); 5647 5654 # endif 5655 i_videoRecDestroy(); 5648 5656 } 5649 5657 … … 5680 5688 AssertComRCReturnRC(rc); 5681 5689 5682 int vrc = i_video CaptureEnable(fEnabled, &alock);5690 int vrc = i_videoRecEnable(fEnabled, &alock); 5683 5691 if (RT_SUCCESS(vrc)) 5684 5692 { … … 6884 6892 6885 6893 #ifdef VBOX_WITH_VIDEOREC 6886 int Console::i_videoRec Load(settings::CaptureSettings &Settings)6894 int Console::i_videoRecGetSettings(settings::CaptureSettings &Settings) 6887 6895 { 6888 6896 Assert(mMachine.isNotNull()); … … 6930 6938 6931 6939 /** 6940 * Creates the recording context. 6941 * 6942 * @returns IPRT status code. 6943 */ 6944 int Console::i_videoRecCreate(void) 6945 { 6946 AssertReturn(Capture.mpVideoRecCtx == NULL, VERR_WRONG_ORDER); 6947 6948 int rc = VINF_SUCCESS; 6949 6950 try 6951 { 6952 Capture.mpVideoRecCtx = new CaptureContext(this); 6953 } 6954 catch (std::bad_alloc &) 6955 { 6956 return VERR_NO_MEMORY; 6957 } 6958 catch (int &rc2) 6959 { 6960 return rc2; 6961 } 6962 6963 return rc; 6964 } 6965 6966 /** 6967 * Destroys the recording context. 6968 */ 6969 void Console::i_videoRecDestroy(void) 6970 { 6971 if (Capture.mpVideoRecCtx) 6972 delete Capture.mpVideoRecCtx; 6973 } 6974 6975 /** 6932 6976 * Starts capturing. Does nothing if capturing is already active. 6933 6977 * … … 6936 6980 int Console::i_videoRecStart(void) 6937 6981 { 6938 if (Capture.mpVideoRecCtx && Capture.mpVideoRecCtx->IsStarted()) 6982 AssertPtrReturn(Capture.mpVideoRecCtx, VERR_WRONG_ORDER); 6983 6984 if (Capture.mpVideoRecCtx->IsStarted()) 6939 6985 return VINF_SUCCESS; 6940 6986 6941 6987 LogRel(("VideoRec: Starting ...\n")); 6942 6988 6943 try6944 {6945 Capture.mpVideoRecCtx = new CaptureContext(this);6946 }6947 catch (std::bad_alloc &)6948 {6949 return VERR_NO_MEMORY;6950 }6951 catch (int &rc)6952 {6953 return rc;6954 }6955 6956 6989 settings::CaptureSettings Settings; 6957 int rc = i_videoRec Load(Settings);6990 int rc = i_videoRecGetSettings(Settings); 6958 6991 if (RT_SUCCESS(rc)) 6959 6992 { … … 6977 7010 int Console::i_videoRecStop(void) 6978 7011 { 6979 if (!Capture.mpVideoRecCtx || !Capture.mpVideoRecCtx->IsStarted()) 7012 AssertPtrReturn(Capture.mpVideoRecCtx, VERR_WRONG_ORDER); 7013 7014 if (!Capture.mpVideoRecCtx->IsStarted()) 6980 7015 return VINF_SUCCESS; 6981 7016 … … 10098 10133 if (fCaptureEnabled) 10099 10134 { 10100 int vrc2 = pConsole->i_video CaptureEnable(fCaptureEnabled, &alock);10135 int vrc2 = pConsole->i_videoRecEnable(fCaptureEnabled, &alock); 10101 10136 if (RT_SUCCESS(vrc2)) 10102 10137 {
Note:
See TracChangeset
for help on using the changeset viewer.