Changeset 82192 in vbox for trunk/src/VBox/Main
- Timestamp:
- Nov 25, 2019 6:08:10 PM (5 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/RecordingSettingsImpl.h
r78068 r82192 67 67 68 68 void i_reset(void); 69 int i_syncToMachineDisplays( void);69 int i_syncToMachineDisplays(uint32_t cMonitors); 70 70 int i_createScreenObj(RecordScreenSettingsMap &screenSettingsMap, uint32_t uScreenId, const settings::RecordingScreenSettings &data); 71 71 int i_destroyScreenObj(RecordScreenSettingsMap &screenSettingsMap, uint32_t uScreenId); -
trunk/src/VBox/Main/src-server/RecordingSettingsImpl.cpp
r81971 r82192 259 259 LogFlowThisFuncEnter(); 260 260 261 i_syncToMachineDisplays(); 261 AssertPtr(m->pMachine); 262 ComPtr<IGraphicsAdapter> pGraphicsAdapter; 263 m->pMachine->COMGETTER(GraphicsAdapter)(pGraphicsAdapter.asOutParam()); 264 ULONG cMonitors = 0; 265 if (!pGraphicsAdapter.isNull()) 266 pGraphicsAdapter->COMGETTER(MonitorCount)(&cMonitors); 267 268 i_syncToMachineDisplays(cMonitors); 262 269 263 270 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 285 292 LogFlowThisFuncEnter(); 286 293 287 i_syncToMachineDisplays(); 294 AssertPtr(m->pMachine); 295 ComPtr<IGraphicsAdapter> pGraphicsAdapter; 296 m->pMachine->COMGETTER(GraphicsAdapter)(pGraphicsAdapter.asOutParam()); 297 ULONG cMonitors = 0; 298 if (!pGraphicsAdapter.isNull()) 299 pGraphicsAdapter->COMGETTER(MonitorCount)(&cMonitors); 300 301 i_syncToMachineDisplays(cMonitors); 288 302 289 303 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 484 498 AssertComRCReturnRC(autoCaller.rc()); 485 499 486 int rc2 = i_syncToMachineDisplays(); 500 AssertPtr(m->pMachine); 501 ComPtr<IGraphicsAdapter> pGraphicsAdapter; 502 m->pMachine->COMGETTER(GraphicsAdapter)(pGraphicsAdapter.asOutParam()); 503 ULONG cMonitors = 0; 504 if (!pGraphicsAdapter.isNull()) 505 pGraphicsAdapter->COMGETTER(MonitorCount)(&cMonitors); 506 507 int rc2 = i_syncToMachineDisplays(cMonitors); 487 508 AssertRC(rc2); 488 509 … … 566 587 AssertComRCReturnVoid(autoCaller.rc()); 567 588 568 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);569 570 /* Initialize default capturing settings here. */571 m->bd->fEnabled = false;572 573 /* First, do a reset so that all internal screen settings objects are destroyed. */574 i_reset();575 /* Second, sync (again) to configured machine displays to (re-)create screen settings objects. */576 i_syncToMachineDisplays();577 }578 579 /**580 * Returns the full path to the default video capture file.581 */582 int RecordingSettings::i_getDefaultFilename(Utf8Str &strFile, bool fWithFileExtension)583 {584 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);585 586 strFile = m->pMachine->i_getSettingsFileFull(); // path/to/machinesfolder/vmname/vmname.vbox587 strFile.stripSuffix(); // path/to/machinesfolder/vmname/vmname588 if (fWithFileExtension)589 strFile.append(".webm"); // path/to/machinesfolder/vmname/vmname.webm590 591 return VINF_SUCCESS;592 }593 594 /**595 * Determines whether the recording settings currently can be changed or not.596 *597 * @returns \c true if the settings can be changed, \c false if not.598 */599 bool RecordingSettings::i_canChangeSettings(void)600 {601 AutoAnyStateDependency adep(m->pMachine);602 if (FAILED(adep.rc()))603 return false;604 605 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);606 607 /* Only allow settings to be changed when recording is disabled when the machine is running. */608 if ( Global::IsOnline(adep.machineState())609 && m->bd->fEnabled)610 {611 return false;612 }613 614 return true;615 }616 617 /**618 * Gets called when the machine object needs to know that the recording settings619 * have been changed.620 */621 void RecordingSettings::i_onSettingsChanged(void)622 {623 LogFlowThisFuncEnter();624 625 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);626 m->pMachine->i_setModified(Machine::IsModified_Recording);627 mlock.release();628 629 LogFlowThisFuncLeave();630 }631 632 /**633 * Synchronizes the screen settings (COM) objects and configuration data634 * to the number of the machine's configured displays.635 */636 int RecordingSettings::i_syncToMachineDisplays(void)637 {638 589 AssertPtr(m->pMachine); 639 590 ComPtr<IGraphicsAdapter> pGraphicsAdapter; … … 643 594 pGraphicsAdapter->COMGETTER(MonitorCount)(&cMonitors); 644 595 596 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 597 598 /* Initialize default capturing settings here. */ 599 m->bd->fEnabled = false; 600 601 /* First, do a reset so that all internal screen settings objects are destroyed. */ 602 i_reset(); 603 /* Second, sync (again) to configured machine displays to (re-)create screen settings objects. */ 604 i_syncToMachineDisplays(cMonitors); 605 } 606 607 /** 608 * Returns the full path to the default video capture file. 609 */ 610 int RecordingSettings::i_getDefaultFilename(Utf8Str &strFile, bool fWithFileExtension) 611 { 612 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 613 614 strFile = m->pMachine->i_getSettingsFileFull(); // path/to/machinesfolder/vmname/vmname.vbox 615 strFile.stripSuffix(); // path/to/machinesfolder/vmname/vmname 616 if (fWithFileExtension) 617 strFile.append(".webm"); // path/to/machinesfolder/vmname/vmname.webm 618 619 return VINF_SUCCESS; 620 } 621 622 /** 623 * Determines whether the recording settings currently can be changed or not. 624 * 625 * @returns \c true if the settings can be changed, \c false if not. 626 */ 627 bool RecordingSettings::i_canChangeSettings(void) 628 { 629 AutoAnyStateDependency adep(m->pMachine); 630 if (FAILED(adep.rc())) 631 return false; 632 633 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 634 635 /* Only allow settings to be changed when recording is disabled when the machine is running. */ 636 if ( Global::IsOnline(adep.machineState()) 637 && m->bd->fEnabled) 638 { 639 return false; 640 } 641 642 return true; 643 } 644 645 /** 646 * Gets called when the machine object needs to know that the recording settings 647 * have been changed. 648 */ 649 void RecordingSettings::i_onSettingsChanged(void) 650 { 651 LogFlowThisFuncEnter(); 652 653 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 654 m->pMachine->i_setModified(Machine::IsModified_Recording); 655 mlock.release(); 656 657 LogFlowThisFuncLeave(); 658 } 659 660 /** 661 * Synchronizes the screen settings (COM) objects and configuration data 662 * to the number of the machine's configured displays. 663 */ 664 int RecordingSettings::i_syncToMachineDisplays(uint32_t cMonitors) 665 { 645 666 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 646 667
Note:
See TracChangeset
for help on using the changeset viewer.