Changeset 75313 in vbox for trunk/src/VBox
- Timestamp:
- Nov 7, 2018 5:13:56 PM (6 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r75307 r75313 886 886 CCaptureSettings captureSettings = machine.GetCaptureSettings(); 887 887 Assert(captureSettings.isOk()); 888 /* For now all screens have the same config: */ 889 CCaptureScreenSettings captureScreen0Settings = captureSettings.GetScreenSettings(0); 890 Assert(captureScreen0Settings.isOk()); 891 if (!captureScreen0Settings.GetEnabled()) 888 if (!captureSettings.GetEnabled()) 892 889 setState(UIIndicatorStateRecording_Disabled); 893 890 else if (!fMachinePaused) … … 919 916 else if (m_eRecordingMode & UIIndicatorStateRecordingMode_Video) 920 917 strToolTip = "Video capture file"; 918 919 /* For now all screens have the same config: */ 920 CCaptureScreenSettings captureScreen0Settings = captureSettings.GetScreenSettings(0); 921 Assert(captureScreen0Settings.isOk()); 921 922 922 923 strFullData += s_strTableRow2 /** @todo r=andy Refine this tooltip (audio and/or video). */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r75307 r75313 1587 1587 fSuccess = recordingScreenSettings.isOk(); 1588 1588 } 1589 /* Save recording options: */ 1590 if (fSuccess && newDisplayData.m_strRecordingVideoOptions != oldDisplayData.m_strRecordingVideoOptions) 1591 { 1592 recordingScreenSettings.SetOptions(newDisplayData.m_strRecordingVideoOptions); 1593 fSuccess = recordingScreenSettings.isOk(); 1594 } 1589 1595 /* Save recording screens: */ 1590 1596 if (fSuccess && newDisplayData.m_vecRecordingScreens != oldDisplayData.m_vecRecordingScreens) 1591 1597 { 1592 1598 recordingScreenSettings.SetEnabled(newDisplayData.m_vecRecordingScreens[iScreenIndex]); 1593 fSuccess = recordingScreenSettings.isOk();1594 }1595 /* Save recording options: */1596 if (fSuccess && newDisplayData.m_strRecordingVideoOptions != oldDisplayData.m_strRecordingVideoOptions)1597 {1598 recordingScreenSettings.SetOptions(newDisplayData.m_strRecordingVideoOptions);1599 1599 fSuccess = recordingScreenSettings.isOk(); 1600 1600 } -
trunk/src/VBox/Main/include/CaptureScreenSettingsImpl.h
r75307 r75313 102 102 103 103 // internal methods 104 bool i_canChangeSettings();105 104 int i_getDefaultFileName(Utf8Str &strFile); 106 105 int i_initInternal(); -
trunk/src/VBox/Main/include/VideoRec.h
r75307 r75313 29 29 #include "VideoRecInternals.h" 30 30 #include "VideoRecStream.h" 31 32 #if 033 /**34 * Enumeration for definining a video / audio35 * profile setting.36 */37 typedef enum VIDEORECPROFILE38 {39 VIDEORECPROFILE_NONE = 0,40 VIDEORECPROFILE_LOW,41 VIDEORECPROFILE_MEDIUM,42 VIDEORECPROFILE_HIGH,43 VIDEORECPROFILE_BEST,44 VIDEORECPROFILE_REALTIME45 } VIDEORECPROFILE;46 47 /** Stores video recording features. */48 typedef uint32_t VIDEORECFEATURES;49 50 /** Video recording is disabled completely. */51 #define VIDEORECFEATURE_NONE 052 /** Capturing video is enabled. */53 #define VIDEORECFEATURE_VIDEO RT_BIT(0)54 /** Capturing audio is enabled. */55 #define VIDEORECFEATURE_AUDIO RT_BIT(1)56 57 /**58 * Structure for keeping a screen recording configuration.59 */60 typedef struct VIDEORECSCREENCFG61 {62 VIDEORECSCREENCFG(void)63 : enmDst(VIDEORECDEST_INVALID)64 , uMaxTimeS(0)65 {66 #ifdef VBOX_WITH_AUDIO_VIDEOREC67 RT_ZERO(Audio);68 #endif69 RT_ZERO(Video);70 }71 72 VIDEORECSCREENCFG& operator=(const VIDEORECSCREENCFG &that)73 {74 enmDst = that.enmDst;75 76 File.strName = that.File.strName;77 File.uMaxSizeMB = that.File.uMaxSizeMB;78 #ifdef VBOX_WITH_AUDIO_VIDEOREC79 Audio = that.Audio;80 #endif81 Video = that.Video;82 uMaxTimeS = that.uMaxTimeS;83 return *this;84 }85 86 unsigned long uScreenId;87 /** Destination where to write the stream to. */88 VIDEORECDEST enmDst;89 90 /**91 * Structure for keeping recording parameters if92 * destination is a file.93 */94 struct95 {96 /** File name (as absolute path). */97 com::Bstr strName;98 /** Maximum file size (in MB) to record. */99 uint32_t uMaxSizeMB;100 } File;101 102 #ifdef VBOX_WITH_AUDIO_VIDEOREC103 /**104 * Structure for keeping the audio recording parameters.105 */106 struct107 {108 /** Whether audio recording is enabled or not. */109 bool fEnabled;110 /** The device LUN the audio driver is attached / configured to. */111 unsigned uLUN;112 /** Hertz (Hz) rate. */113 uint16_t uHz;114 /** Bits per sample. */115 uint8_t cBits;116 /** Number of audio channels. */117 uint8_t cChannels;118 /** Audio profile which is being used. */119 VIDEORECPROFILE enmProfile;120 } Audio;121 #endif122 123 /**124 * Structure for keeping the video recording parameters.125 */126 struct127 {128 /** Whether video recording is enabled or not. */129 bool fEnabled;130 /** Target width (in pixels). */131 uint32_t uWidth;132 /** Target height (in pixels). */133 uint32_t uHeight;134 /** Target encoding rate. */135 uint32_t uRate;136 /** Target FPS. */137 uint32_t uFPS;138 139 #ifdef VBOX_WITH_LIBVPX140 union141 {142 struct143 {144 /** Encoder deadline. */145 unsigned int uEncoderDeadline;146 } VPX;147 } Codec;148 #endif149 150 } Video;151 152 /** Maximum time (in s) to record.153 * Specify 0 to disable this check. */154 uint32_t uMaxTimeS;155 } VIDEORECSCREENCFG, *PVIDEORECSCREENCFG;156 #endif157 31 158 32 class Console; … … 212 86 protected: 213 87 88 /** 89 * Enumeration for a recording context state. 90 */ 91 enum VIDEORECSTS 92 { 93 /** Context not initialized. */ 94 VIDEORECSTS_UNINITIALIZED = 0, 95 /** Context was created. */ 96 VIDEORECSTS_CREATED = 1, 97 /** Context was started. */ 98 VIDEORECSTS_STARTED = 2, 99 /** The usual 32-bit hack. */ 100 VIDEORECSTS_32BIT_HACK = 0x7fffffff 101 }; 102 214 103 /** Pointer to the console object. */ 215 104 Console *pConsole; … … 217 106 settings::CaptureSettings Settings; 218 107 /** The current state. */ 219 uint32_tenmState;108 VIDEORECSTS enmState; 220 109 /** Critical section to serialize access. */ 221 110 RTCRITSECT CritSect; 222 111 /** Semaphore to signal the encoding worker thread. */ 223 112 RTSEMEVENT WaitEvent; 224 /** Whether this context is in started state or not. */225 bool fStarted;226 113 /** Shutdown indicator. */ 227 114 bool fShutdown; -
trunk/src/VBox/Main/include/VideoRecStream.h
r75307 r75313 109 109 public: 110 110 111 CaptureStream( void);112 113 CaptureStream( uint32_t uScreen, const settings::CaptureScreenSettings &Settings);111 CaptureStream(CaptureContext *pCtx); 112 113 CaptureStream(CaptureContext *pCtx, uint32_t uScreen, const settings::CaptureScreenSettings &Settings); 114 114 115 115 virtual ~CaptureStream(void); … … 117 117 public: 118 118 119 int Init( uint32_t uScreen, const settings::CaptureScreenSettings &Settings);119 int Init(CaptureContext *pCtx, uint32_t uScreen, const settings::CaptureScreenSettings &Settings); 120 120 int Uninit(void); 121 121 … … 133 133 int close(void); 134 134 135 int initInternal( uint32_t uScreen, const settings::CaptureScreenSettings &Settings);135 int initInternal(CaptureContext *pCtx, uint32_t uScreen, const settings::CaptureScreenSettings &Settings); 136 136 int uninitInternal(void); 137 137 … … 153 153 protected: 154 154 155 /** 156 * Enumeration for a recording stream state. 157 */ 158 enum RECORDINGSTREAMSTATE 159 { 160 /** Stream not initialized. */ 161 RECORDINGSTREAMSTATE_UNINITIALIZED = 0, 162 /** Stream was initialized. */ 163 RECORDINGSTREAMSTATE_INITIALIZED = 1, 164 /** The usual 32-bit hack. */ 165 RECORDINGSTREAMSTATE_32BIT_HACK = 0x7fffffff 166 }; 167 155 168 /** Recording context this stream is associated to. */ 156 CaptureContext *pCtx; 169 CaptureContext *pCtx; 170 /** The current state. */ 171 RECORDINGSTREAMSTATE enmState; 157 172 struct 158 173 { -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r75307 r75313 5629 5629 vrc = i_videoRecCreate(); 5630 5630 if (RT_SUCCESS(vrc)) 5631 vrc = i_videoRecStart();5632 5633 if (RT_SUCCESS(vrc))5634 5631 { 5635 5632 # ifdef VBOX_WITH_AUDIO_VIDEOREC … … 6899 6896 Assert(mMachine.isNotNull()); 6900 6897 6898 Settings.applyDefaults(); 6899 6901 6900 ComPtr<ICaptureSettings> pCaptureSettings; 6902 6901 HRESULT hrc = mMachine->COMGETTER(CaptureSettings)(pCaptureSettings.asOutParam()); 6903 6902 AssertComRCReturn(hrc, VERR_INVALID_PARAMETER); 6904 6903 6904 BOOL fTemp; 6905 hrc = pCaptureSettings->COMGETTER(Enabled)(&fTemp); 6906 AssertComRCReturn(hrc, VERR_INVALID_PARAMETER); 6907 Settings.fEnabled = RT_BOOL(fTemp); 6908 6905 6909 SafeIfaceArray<ICaptureScreenSettings> paCaptureScreens; 6906 6910 hrc = pCaptureSettings->COMGETTER(Screens)(ComSafeArrayAsOutParam(paCaptureScreens)); 6907 6911 AssertComRCReturn(hrc, VERR_INVALID_PARAMETER); 6908 6912 6909 Settings.applyDefaults();6910 6911 6913 for (unsigned long i = 0; i < (unsigned long)paCaptureScreens.size(); ++i) 6912 6914 { … … 6914 6916 ComPtr<ICaptureScreenSettings> pCaptureScreenSettings = paCaptureScreens[i]; 6915 6917 6918 hrc = pCaptureScreenSettings->COMGETTER(Enabled)(&fTemp); 6919 AssertComRCReturn(hrc, VERR_INVALID_PARAMETER); 6920 CaptureScreenSettings.fEnabled = RT_BOOL(fTemp); 6916 6921 hrc = pCaptureScreenSettings->COMGETTER(MaxTime)((ULONG *)&CaptureScreenSettings.ulMaxTimeS); 6917 6922 AssertComRCReturn(hrc, VERR_INVALID_PARAMETER); … … 7006 7011 LogRel(("VideoRec: Starting ...\n")); 7007 7012 7008 int rc = VINF_SUCCESS; 7009 7010 for (unsigned uScreen = 0; uScreen < Capture.mpVideoRecCtx->GetStreamCount(); uScreen++) 7011 mDisplay->i_videoRecScreenChanged(uScreen); 7013 int rc = Capture.mpVideoRecCtx->Start(); 7014 if (RT_SUCCESS(rc)) 7015 { 7016 for (unsigned uScreen = 0; uScreen < Capture.mpVideoRecCtx->GetStreamCount(); uScreen++) 7017 mDisplay->i_videoRecScreenChanged(uScreen); 7018 } 7012 7019 7013 7020 if (RT_FAILURE(rc)) … … 7029 7036 LogRel(("VideoRec: Stopping ...\n")); 7030 7037 7031 const size_t cStreams = Capture.mpVideoRecCtx->GetStreamCount(); 7032 for (unsigned uScreen = 0; uScreen < cStreams; ++uScreen) 7033 mDisplay->i_videoRecScreenChanged(uScreen); 7034 7035 ComPtr<ICaptureSettings> pCaptureSettings; 7036 HRESULT hrc = mMachine->COMGETTER(CaptureSettings)(pCaptureSettings.asOutParam()); 7037 ComAssertComRC(hrc); 7038 hrc = pCaptureSettings->COMSETTER(Enabled)(false); 7039 ComAssertComRC(hrc); 7040 7041 LogRel(("VideoRec: Stopped\n")); 7042 7043 LogFlowFuncLeaveRC(VINF_SUCCESS); 7044 return VINF_SUCCESS; 7038 int rc = Capture.mpVideoRecCtx->Stop(); 7039 if (RT_SUCCESS(rc)) 7040 { 7041 const size_t cStreams = Capture.mpVideoRecCtx->GetStreamCount(); 7042 for (unsigned uScreen = 0; uScreen < cStreams; ++uScreen) 7043 mDisplay->i_videoRecScreenChanged(uScreen); 7044 7045 ComPtr<ICaptureSettings> pCaptureSettings; 7046 HRESULT hrc = mMachine->COMGETTER(CaptureSettings)(pCaptureSettings.asOutParam()); 7047 ComAssertComRC(hrc); 7048 hrc = pCaptureSettings->COMSETTER(Enabled)(false); 7049 ComAssertComRC(hrc); 7050 7051 LogRel(("VideoRec: Stopped\n")); 7052 } 7053 else 7054 LogRel(("VideoRec: Failed to stop video recording (%Rrc)\n", rc)); 7055 7056 LogFlowFuncLeaveRC(rc); 7057 return rc; 7045 7058 } 7046 7059 #endif /* VBOX_WITH_VIDEOREC */ -
trunk/src/VBox/Main/src-client/VideoRec.cpp
r75307 r75313 56 56 //# define VBOX_VIDEOREC_DUMP 57 57 #endif 58 59 /**60 * Enumeration for a recording state.61 */62 enum VIDEORECSTS63 {64 /** Not initialized. */65 VIDEORECSTS_UNINITIALIZED = 0,66 /** Created. */67 VIDEORECSTS_CREATED = 1,68 /** Started. */69 VIDEORECSTS_STARTED = 2,70 /** The usual 32-bit hack. */71 VIDEORECSTS_32BIT_HACK = 0x7fffffff72 };73 74 58 75 59 #ifdef VBOX_VIDEOREC_DUMP … … 205 189 try 206 190 { 207 pStream = new CaptureStream( itScreen->first /* Screen ID */, itScreen->second);191 pStream = new CaptureStream(this, itScreen->first /* Screen ID */, itScreen->second); 208 192 this->vecStreams.push_back(pStream); 209 193 } … … 213 197 break; 214 198 } 199 200 ++itScreen; 215 201 } 216 202 … … 219 205 this->tsStartMs = RTTimeMilliTS(); 220 206 this->enmState = VIDEORECSTS_CREATED; 221 this->fStarted = false;222 207 this->fShutdown = false; 223 208 … … 246 231 247 232 int rc = RTThreadCreate(&this->Thread, CaptureContext::threadMain, (void *)this, 0, 248 RTTHREADTYPE_MAIN_WORKER, RTTHREADFLAGS_WAITABLE, " VideoRec");233 RTTHREADTYPE_MAIN_WORKER, RTTHREADFLAGS_WAITABLE, "Record"); 249 234 250 235 if (RT_SUCCESS(rc)) /* Wait for the thread to start. */ … … 254 239 { 255 240 this->enmState = VIDEORECSTS_STARTED; 256 this->fStarted = true;257 241 } 258 242 … … 265 249 return VINF_SUCCESS; 266 250 267 Log Func(("Shutting down thread ...\n"));251 LogThisFunc(("Shutting down thread ...\n")); 268 252 269 253 /* Set shutdown indicator. */ … … 275 259 rc = RTThreadWait(this->Thread, 30 * 1000 /* 10s timeout */, NULL); 276 260 261 if (RT_SUCCESS(rc)) 262 { 263 this->enmState = VIDEORECSTS_CREATED; 264 } 265 266 LogFlowThisFunc(("%Rrc\n", rc)); 277 267 return rc; 278 268 } … … 283 273 int CaptureContext::destroyInternal(void) 284 274 { 285 int rc = VINF_SUCCESS; 286 287 if (this->enmState == VIDEORECSTS_STARTED) 288 { 289 rc = stopInternal(); 290 if (RT_SUCCESS(rc)) 291 { 292 /* Disable the context. */ 293 ASMAtomicWriteBool(&this->fStarted, false); 294 295 int rc2 = RTSemEventDestroy(this->WaitEvent); 296 AssertRC(rc2); 297 298 this->WaitEvent = NIL_RTSEMEVENT; 299 } 300 } 301 275 int rc = stopInternal(); 302 276 if (RT_FAILURE(rc)) 303 {304 AssertRC(rc);305 277 return rc; 306 } 278 279 rc = RTSemEventDestroy(this->WaitEvent); 280 AssertRC(rc); 281 282 this->WaitEvent = NIL_RTSEMEVENT; 307 283 308 284 rc = RTCritSectEnter(&this->CritSect); … … 338 314 } 339 315 316 LogFlowThisFunc(("%Rrc\n", rc)); 340 317 return rc; 341 318 } … … 411 388 } 412 389 390 /** 391 * Returns if this recording context is ready to start recording. 392 * 393 * @returns @c true if recording context is ready, @c false if not. 394 */ 413 395 bool CaptureContext::IsReady(void) const 414 396 { 415 return this->fStarted;416 } 417 418 /** 419 * Checks if recording engineis ready to accept new recording data for a given screen.420 * 421 * @returns true if recording engine is ready,false if not.397 return (this->enmState >= VIDEORECSTS_CREATED); 398 } 399 400 /** 401 * Returns if this recording context is ready to accept new recording data for a given screen. 402 * 403 * @returns @c true if the specified screen is ready, @c false if not. 422 404 * @param uScreen Screen ID. 423 405 * @param uTimeStampMs Current time stamp (in ms). Currently not being used. … … 450 432 bool CaptureContext::IsStarted(void) const 451 433 { 452 return this->fStarted;434 return (this->enmState == VIDEORECSTS_STARTED); 453 435 } 454 436 -
trunk/src/VBox/Main/src-client/VideoRecStream.cpp
r75307 r75313 42 42 43 43 44 CaptureStream::CaptureStream(void) 45 : tsStartMs(0) 44 CaptureStream::CaptureStream(CaptureContext *a_pCtx) 45 : pCtx(a_pCtx) 46 , enmState(RECORDINGSTREAMSTATE_UNINITIALIZED) 47 , tsStartMs(0) 46 48 { 47 49 File.pWEBM = NULL; … … 49 51 } 50 52 51 CaptureStream::CaptureStream(uint32_t uScreen, const settings::CaptureScreenSettings &Settings) 52 : tsStartMs(0) 53 CaptureStream::CaptureStream(CaptureContext *a_pCtx, uint32_t uScreen, const settings::CaptureScreenSettings &Settings) 54 : enmState(RECORDINGSTREAMSTATE_UNINITIALIZED) 55 , tsStartMs(0) 53 56 { 54 57 File.pWEBM = NULL; 55 58 File.hFile = NIL_RTFILE; 56 59 57 int rc2 = initInternal( uScreen, Settings);60 int rc2 = initInternal(a_pCtx, uScreen, Settings); 58 61 if (RT_FAILURE(rc2)) 59 62 throw rc2; … … 645 648 VideoRecVideoFrameFree(pFrame); 646 649 647 lock();650 unlock(); 648 651 649 652 return rc; 650 653 } 651 654 652 int CaptureStream::Init(uint32_t uScreen, const settings::CaptureScreenSettings &Settings)653 {654 return initInternal(uScreen, Settings);655 }656 657 655 /** 658 656 * Initializes a recording stream. 659 657 * 660 658 * @returns IPRT status code. 659 * @param a_pCtx Pointer to recording context. 661 660 * @param uScreen Screen number to use for this recording stream. 662 661 * @param Settings Capturing configuration to use for initialization. 663 662 */ 664 int CaptureStream::initInternal(uint32_t uScreen, const settings::CaptureScreenSettings &Settings) 663 int CaptureStream::Init(CaptureContext *a_pCtx, uint32_t uScreen, const settings::CaptureScreenSettings &Settings) 664 { 665 return initInternal(a_pCtx, uScreen, Settings); 666 } 667 668 /** 669 * Initializes a recording stream, internal version. 670 * 671 * @returns IPRT status code. 672 * @param a_pCtx Pointer to recording context. 673 * @param uScreen Screen number to use for this recording stream. 674 * @param Settings Capturing configuration to use for initialization. 675 */ 676 int CaptureStream::initInternal(CaptureContext *a_pCtx, uint32_t uScreen, const settings::CaptureScreenSettings &Settings) 665 677 { 666 678 int rc = parseOptionsString(Settings.strOptions); … … 770 782 if (RT_SUCCESS(rc)) 771 783 { 784 this->pCtx = a_pCtx; 785 this->enmState = RECORDINGSTREAMSTATE_INITIALIZED; 772 786 this->fEnabled = true; 773 787 this->uScreenID = uScreen; … … 870 884 int CaptureStream::uninitInternal(void) 871 885 { 886 if (this->enmState != RECORDINGSTREAMSTATE_INITIALIZED) 887 return VINF_SUCCESS; 888 872 889 int rc = close(); 873 890 if (RT_FAILURE(rc)) … … 883 900 RTCritSectDelete(&this->CritSect); 884 901 902 this->enmState = RECORDINGSTREAMSTATE_UNINITIALIZED; 885 903 this->fEnabled = false; 886 904 … … 911 929 int CaptureStream::uninitVideoVPX(void) 912 930 { 913 vpx_img_free(&this->Video.Codec.VPX.RawImage); 931 PVIDEORECVIDEOCODEC pCodec = &this->Video.Codec; 932 vpx_img_free(&pCodec->VPX.RawImage); 933 pCodec->VPX.pu8YuvBuf = NULL; /* Was pointing to VPX.RawImage. */ 934 914 935 vpx_codec_err_t rcv = vpx_codec_destroy(&this->Video.Codec.VPX.Ctx); 915 936 Assert(rcv == VPX_CODEC_OK); RT_NOREF(rcv); -
trunk/src/VBox/Main/src-server/CaptureScreenSettingsImpl.cpp
r75307 r75313 292 292 HRESULT CaptureScreenSettings::setFeatures(ULONG aFeatures) 293 293 { 294 if (!i_canChangeSettings()) 294 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 295 296 if (m->bd->fEnabled) 295 297 return setError(E_INVALIDARG, tr("Cannot change features while capturing is enabled")); 296 297 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);298 298 299 299 m->bd.backup(); … … 325 325 HRESULT CaptureScreenSettings::setDestination(CaptureDestination_T aDestination) 326 326 { 327 if (!i_canChangeSettings()) 327 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 328 329 if (m->bd->fEnabled) 328 330 return setError(E_INVALIDARG, tr("Cannot change destination type while capturing is enabled")); 329 331 330 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);331 332 332 m->bd.backup(); 333 333 m->bd->enmDest = aDestination; … … 353 353 HRESULT CaptureScreenSettings::setFileName(const com::Utf8Str &aFileName) 354 354 { 355 if (!i_canChangeSettings()) 355 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 356 357 if (m->bd->fEnabled) 356 358 return setError(E_INVALIDARG, tr("Cannot change file name while capturing is enabled")); 357 358 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);359 359 360 360 Utf8Str strFile(aFileName); … … 388 388 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 389 389 390 if ( !i_canChangeSettings())390 if (m->bd->fEnabled) 391 391 return setError(E_INVALIDARG, tr("Cannot change maximum time while capturing is enabled")); 392 392 … … 414 414 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 415 415 416 if ( !i_canChangeSettings())416 if (m->bd->fEnabled) 417 417 return setError(E_INVALIDARG, tr("Cannot change maximum file size while capturing is enabled")); 418 418 … … 440 440 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 441 441 442 if ( !i_canChangeSettings())443 return setError(E_INVALIDARG, tr("Cannot change options stringwhile capturing is enabled"));442 if (m->bd->fEnabled) 443 return setError(E_INVALIDARG, tr("Cannot change options while capturing is enabled")); 444 444 445 445 m->bd.backup(); 446 446 m->bd->strOptions = aOptions; 447 447 448 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);449 m->pMachine->i_setModified(Machine::IsModified_Capture);450 m lock.release();448 alock.release(); 449 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 450 m->pMachine->i_setModified(Machine::IsModified_Capture); 451 451 452 452 return S_OK; … … 466 466 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 467 467 468 if ( !i_canChangeSettings())468 if (m->bd->fEnabled) 469 469 return setError(E_INVALIDARG, tr("Cannot change audio codec while capturing is enabled")); 470 470 … … 492 492 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 493 493 494 if ( !i_canChangeSettings())494 if (m->bd->fEnabled) 495 495 return setError(E_INVALIDARG, tr("Cannot change audio Hertz rate while capturing is enabled")); 496 496 … … 518 518 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 519 519 520 if ( !i_canChangeSettings())520 if (m->bd->fEnabled) 521 521 return setError(E_INVALIDARG, tr("Cannot change audio bits while capturing is enabled")); 522 522 … … 544 544 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 545 545 546 if ( !i_canChangeSettings())546 if (m->bd->fEnabled) 547 547 return setError(E_INVALIDARG, tr("Cannot change audio channels while capturing is enabled")); 548 548 … … 570 570 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 571 571 572 if ( !i_canChangeSettings())572 if (m->bd->fEnabled) 573 573 return setError(E_INVALIDARG, tr("Cannot change video codec while capturing is enabled")); 574 574 … … 596 596 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 597 597 598 if ( !i_canChangeSettings())598 if (m->bd->fEnabled) 599 599 return setError(E_INVALIDARG, tr("Cannot change video width while capturing is enabled")); 600 600 … … 622 622 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 623 623 624 if ( !i_canChangeSettings())624 if (m->bd->fEnabled) 625 625 return setError(E_INVALIDARG, tr("Cannot change video height while capturing is enabled")); 626 626 … … 648 648 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 649 649 650 if ( !i_canChangeSettings())650 if (m->bd->fEnabled) 651 651 return setError(E_INVALIDARG, tr("Cannot change video rate while capturing is enabled")); 652 652 … … 674 674 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 675 675 676 if ( !i_canChangeSettings())676 if (m->bd->fEnabled) 677 677 return setError(E_INVALIDARG, tr("Cannot change video rate control mode while capturing is enabled")); 678 678 … … 696 696 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 697 697 698 if ( !i_canChangeSettings())698 if (m->bd->fEnabled) 699 699 return setError(E_INVALIDARG, tr("Cannot change video FPS while capturing is enabled")); 700 700 … … 722 722 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 723 723 724 if ( !i_canChangeSettings())724 if (m->bd->fEnabled) 725 725 return setError(E_INVALIDARG, tr("Cannot change video rate scaling method while capturing is enabled")); 726 726 … … 729 729 730 730 return E_NOTIMPL; 731 }732 733 bool CaptureScreenSettings::i_canChangeSettings(void)734 {735 AutoAnyStateDependency adep(m->pMachine);736 AssertComRCReturn(adep.rc(), false);737 738 if ( Global::IsOnline(adep.machineState())739 && m->bd->fEnabled)740 return false;741 742 return true;743 731 } 744 732 -
trunk/src/VBox/Main/xml/Settings.cpp
r75307 r75313 2483 2483 /* Always add screen 0 to the default configuration. */ 2484 2484 CaptureScreenSettings screenSettings; /* Apply default settings for screen 0. */ 2485 screenSettings.fEnabled = true; /* Enabled by default. */ 2485 2486 mapScreens[0] = screenSettings; 2486 2487 }
Note:
See TracChangeset
for help on using the changeset viewer.