Changeset 75341 in vbox for trunk/src/VBox/Main/xml/Settings.cpp
- Timestamp:
- Nov 9, 2018 8:37:28 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/Settings.cpp
r75324 r75341 2371 2371 } 2372 2372 2373 CaptureScreenSettings::CaptureScreenSettings(void)2373 RecordScreenSettings::RecordScreenSettings(void) 2374 2374 { 2375 2375 applyDefaults(); 2376 2376 } 2377 2377 2378 CaptureScreenSettings::~CaptureScreenSettings()2379 { 2380 2381 } 2382 2383 void CaptureScreenSettings::applyDefaults(void)2378 RecordScreenSettings::~RecordScreenSettings() 2379 { 2380 2381 } 2382 2383 void RecordScreenSettings::applyDefaults(void) 2384 2384 { 2385 2385 /* … … 2388 2388 2389 2389 fEnabled = false; 2390 enmDest = CaptureDestination_File;2390 enmDest = RecordDestination_File; 2391 2391 ulMaxTimeS = 0; 2392 2392 strOptions = ""; 2393 2393 File.ulMaxSizeMB = 0; 2394 2394 File.strName = ""; 2395 Video.enmCodec = CaptureVideoCodec_VP8;2395 Video.enmCodec = RecordVideoCodec_VP8; 2396 2396 Video.ulWidth = 1024; 2397 2397 Video.ulHeight = 768; 2398 2398 Video.ulRate = 512; 2399 2399 Video.ulFPS = 25; 2400 Audio.enmAudioCodec = CaptureAudioCodec_Opus;2400 Audio.enmAudioCodec = RecordAudioCodec_Opus; 2401 2401 Audio.cBits = 16; 2402 2402 Audio.cChannels = 2; 2403 2403 Audio.uHz = 22050; 2404 2404 2405 featureMap[ CaptureFeature_Video] = true;2406 featureMap[ CaptureFeature_Audio] = false;2405 featureMap[RecordFeature_Video] = true; 2406 featureMap[RecordFeature_Audio] = false; 2407 2407 } 2408 2408 … … 2410 2410 * Check if all settings have default values. 2411 2411 */ 2412 bool CaptureScreenSettings::areDefaultSettings(void) const2412 bool RecordScreenSettings::areDefaultSettings(void) const 2413 2413 { 2414 2414 return fEnabled == false 2415 && enmDest == CaptureDestination_File2415 && enmDest == RecordDestination_File 2416 2416 && ulMaxTimeS == 0 2417 2417 && strOptions == "" 2418 2418 && File.ulMaxSizeMB == 0 2419 2419 && File.strName == "" 2420 && Video.enmCodec == CaptureVideoCodec_VP82420 && Video.enmCodec == RecordVideoCodec_VP8 2421 2421 && Video.ulWidth == 1024 2422 2422 && Video.ulHeight == 768 2423 2423 && Video.ulRate == 512 2424 2424 && Video.ulFPS == 25 2425 && Audio.enmAudioCodec == CaptureAudioCodec_Opus2425 && Audio.enmAudioCodec == RecordAudioCodec_Opus 2426 2426 && Audio.cBits == 16 2427 2427 && Audio.cChannels == 2 … … 2429 2429 } 2430 2430 2431 bool CaptureScreenSettings::isFeatureEnabled(CaptureFeature_T enmFeature) const2432 { 2433 CaptureFeatureMap::const_iterator itFeature = featureMap.find(enmFeature);2431 bool RecordScreenSettings::isFeatureEnabled(RecordFeature_T enmFeature) const 2432 { 2433 RecordFeatureMap::const_iterator itFeature = featureMap.find(enmFeature); 2434 2434 if (itFeature != featureMap.end()) 2435 2435 return itFeature->second; … … 2443 2443 * machine settings have really changed and thus need to be written out to disk. 2444 2444 */ 2445 bool CaptureScreenSettings::operator==(const CaptureScreenSettings &d) const2445 bool RecordScreenSettings::operator==(const RecordScreenSettings &d) const 2446 2446 { 2447 2447 return fEnabled == d.fEnabled … … 2465 2465 * Constructor. Needs to set sane defaults which stand the test of time. 2466 2466 */ 2467 CaptureSettings::CaptureSettings()2467 RecordSettings::RecordSettings() 2468 2468 { 2469 2469 applyDefaults(); … … 2473 2473 * Applies the default settings. 2474 2474 */ 2475 void CaptureSettings::applyDefaults(void)2475 void RecordSettings::applyDefaults(void) 2476 2476 { 2477 2477 fEnabled = false; … … 2482 2482 { 2483 2483 /* Always add screen 0 to the default configuration. */ 2484 CaptureScreenSettings screenSettings; /* Apply default settings for screen 0. */2484 RecordScreenSettings screenSettings; /* Apply default settings for screen 0. */ 2485 2485 screenSettings.fEnabled = true; /* Enabled by default. */ 2486 2486 mapScreens[0] = screenSettings; … … 2495 2495 * Check if all settings have default values. 2496 2496 */ 2497 bool CaptureSettings::areDefaultSettings() const2497 bool RecordSettings::areDefaultSettings() const 2498 2498 { 2499 2499 const bool fDefault = fEnabled == false … … 2502 2502 return false; 2503 2503 2504 CaptureScreenMap::const_iterator itScreen = mapScreens.begin();2504 RecordScreenMap::const_iterator itScreen = mapScreens.begin(); 2505 2505 return itScreen->first == 0 2506 2506 && itScreen->second.areDefaultSettings(); … … 2512 2512 * machine settings have really changed and thus need to be written out to disk. 2513 2513 */ 2514 bool CaptureSettings::operator==(const CaptureSettings &d) const2514 bool RecordSettings::operator==(const RecordSettings &d) const 2515 2515 { 2516 2516 if (this == &d) … … 2521 2521 return false; 2522 2522 2523 CaptureScreenMap::const_iterator itScreen = mapScreens.begin();2523 RecordScreenMap::const_iterator itScreen = mapScreens.begin(); 2524 2524 uint32_t i = 0; 2525 2525 while (itScreen != mapScreens.end()) 2526 2526 { 2527 CaptureScreenMap::const_iterator itScreenThat = d.mapScreens.find(i);2527 RecordScreenMap::const_iterator itScreenThat = d.mapScreens.find(i); 2528 2528 if (itScreen->second == itScreenThat->second) 2529 2529 { … … 4409 4409 else if (pelmHwChild->nameEquals("VideoCapture")) 4410 4410 { 4411 pelmHwChild->getAttributeValue("enabled", hw. captureSettings.fEnabled);4411 pelmHwChild->getAttributeValue("enabled", hw.recordSettings.fEnabled); 4412 4412 4413 4413 /* Right now I don't want to bump the settings version, so just convert the enabled … … 4418 4418 /* At the moment we only support one capturing configuration, that is, all screens 4419 4419 * have the same configuration. So load/save to/from screen 0. */ 4420 Assert(hw. captureSettings.mapScreens.size()); /* At least screen must be present. */4421 CaptureScreenSettings &screen0Settings = hw.captureSettings.mapScreens[0];4420 Assert(hw.recordSettings.mapScreens.size()); /* At least screen must be present. */ 4421 RecordScreenSettings &screen0Settings = hw.recordSettings.mapScreens[0]; 4422 4422 4423 4423 pelmHwChild->getAttributeValue("maxTime", screen0Settings.ulMaxTimeS); … … 4433 4433 { 4434 4434 /* Add screen i to config in any case. */ 4435 hw. captureSettings.mapScreens[i] = screen0Settings;4435 hw.recordSettings.mapScreens[i] = screen0Settings; 4436 4436 4437 4437 if (u64VideoCaptureScreens & RT_BIT_64(i)) /* Screen i enabled? */ 4438 hw. captureSettings.mapScreens[i].fEnabled = true;4438 hw.recordSettings.mapScreens[i].fEnabled = true; 4439 4439 } 4440 4440 } … … 5820 5820 } 5821 5821 5822 if (m->sv >= SettingsVersion_v1_14 && !hw. captureSettings.areDefaultSettings())5822 if (m->sv >= SettingsVersion_v1_14 && !hw.recordSettings.areDefaultSettings()) 5823 5823 { 5824 5824 xml::ElementNode *pelmVideoCapture = pelmHardware->createChild("VideoCapture"); 5825 5825 5826 if (hw. captureSettings.fEnabled)5827 pelmVideoCapture->setAttribute("enabled", hw. captureSettings.fEnabled);5826 if (hw.recordSettings.fEnabled) 5827 pelmVideoCapture->setAttribute("enabled", hw.recordSettings.fEnabled); 5828 5828 5829 5829 /* Right now I don't want to bump the settings version, so just convert the enabled 5830 5830 * screens to the former uint64t_t bit array and vice versa. */ 5831 5831 uint64_t u64VideoCaptureScreens = 0; 5832 CaptureScreenMap::const_iterator itScreen = hw.captureSettings.mapScreens.begin();5833 while (itScreen != hw. captureSettings.mapScreens.end())5832 RecordScreenMap::const_iterator itScreen = hw.recordSettings.mapScreens.begin(); 5833 while (itScreen != hw.recordSettings.mapScreens.end()) 5834 5834 { 5835 5835 if (itScreen->second.fEnabled) … … 5843 5843 /* At the moment we only support one capturing configuration, that is, all screens 5844 5844 * have the same configuration. So load/save to/from screen 0. */ 5845 Assert(hw. captureSettings.mapScreens.size());5846 const CaptureScreenMap::const_iterator itScreen0Settings = hw.captureSettings.mapScreens.find(0);5847 Assert(itScreen0Settings != hw. captureSettings.mapScreens.end());5845 Assert(hw.recordSettings.mapScreens.size()); 5846 const RecordScreenMap::const_iterator itScreen0Settings = hw.recordSettings.mapScreens.find(0); 5847 Assert(itScreen0Settings != hw.recordSettings.mapScreens.end()); 5848 5848 5849 5849 if (itScreen0Settings->second.ulMaxTimeS) … … 7442 7442 || hardwareMachine.enmLongMode != Hardware::LongMode_Legacy 7443 7443 || machineUserData.ovIcon.size() > 0 7444 || hardwareMachine. captureSettings.fEnabled)7444 || hardwareMachine.recordSettings.fEnabled) 7445 7445 { 7446 7446 m->sv = SettingsVersion_v1_14;
Note:
See TracChangeset
for help on using the changeset viewer.