Changeset 75324 in vbox for trunk/src/VBox/Main/src-server/CaptureScreenSettingsImpl.cpp
- Timestamp:
- Nov 8, 2018 3:39:50 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 126445
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/CaptureScreenSettingsImpl.cpp
r75313 r75324 17 17 */ 18 18 19 #define LOG_GROUP LOG_GROUP_MAIN_CAPTURESCREENSETTINGS 20 #include "LoggingNew.h" 21 19 22 #include "CaptureScreenSettingsImpl.h" 23 #include "CaptureSettingsImpl.h" 20 24 #include "MachineImpl.h" 21 25 … … 27 31 #include "AutoCaller.h" 28 32 #include "Global.h" 29 #include "Logging.h"30 33 31 34 //////////////////////////////////////////////////////////////////////////////// … … 38 41 { 39 42 Data() 40 : p Machine(NULL)43 : pParent(NULL) 41 44 { } 42 45 43 Machine * const pMachine;46 CaptureSettings * const pParent; 44 47 ComObjPtr<CaptureScreenSettings> pPeer; 45 48 uint32_t uScreenId; … … 73 76 * @returns COM result indicator 74 77 */ 75 HRESULT CaptureScreenSettings::init( Machine*aParent, uint32_t uScreenId, const settings::CaptureScreenSettings& data)78 HRESULT CaptureScreenSettings::init(CaptureSettings *aParent, uint32_t uScreenId, const settings::CaptureScreenSettings& data) 76 79 { 77 80 LogFlowThisFuncEnter(); … … 86 89 m = new Data(); 87 90 88 /* Share the parent weakly. */89 unconst(m->p Machine)= aParent;91 /* Share the parent & machine weakly. */ 92 unconst(m->pParent) = aParent; 90 93 /* mPeer is left null. */ 91 94 … … 120 123 * it shares data with is destroyed. 121 124 */ 122 HRESULT CaptureScreenSettings::init( Machine*aParent, CaptureScreenSettings *that)125 HRESULT CaptureScreenSettings::init(CaptureSettings *aParent, CaptureScreenSettings *that) 123 126 { 124 127 LogFlowThisFuncEnter(); … … 133 136 m = new Data(); 134 137 135 unconst(m->p Machine) = aParent;138 unconst(m->pParent) = aParent; 136 139 m->pPeer = that; 137 140 … … 163 166 * of the original object passed as an argument. 164 167 */ 165 HRESULT CaptureScreenSettings::initCopy( Machine*aParent, CaptureScreenSettings *that)168 HRESULT CaptureScreenSettings::initCopy(CaptureSettings *aParent, CaptureScreenSettings *that) 166 169 { 167 170 LogFlowThisFuncEnter(); … … 176 179 m = new Data(); 177 180 178 unconst(m->p Machine) = aParent;181 unconst(m->pParent) = aParent; 179 182 /* mPeer is left null. */ 180 183 … … 217 220 218 221 unconst(m->pPeer) = NULL; 219 unconst(m->p Machine) = NULL;222 unconst(m->pParent) = NULL; 220 223 221 224 delete m; … … 227 230 HRESULT CaptureScreenSettings::isFeatureEnabled(CaptureFeature_T aFeature, BOOL *aEnabled) 228 231 { 232 AutoCaller autoCaller(this); 233 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 234 235 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 236 229 237 settings::CaptureFeatureMap::const_iterator itFeature = m->bd->featureMap.find(aFeature); 230 238 … … 237 245 HRESULT CaptureScreenSettings::getEnabled(BOOL *enabled) 238 246 { 247 AutoCaller autoCaller(this); 248 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 249 239 250 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 240 251 … … 246 257 HRESULT CaptureScreenSettings::setEnabled(BOOL enabled) 247 258 { 259 AutoCaller autoCaller(this); 260 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 261 262 LogFlowThisFunc(("Screen %RU32\n", m->uScreenId)); 263 264 if (!m->pParent->i_canChangeSettings()) 265 return setError(E_INVALIDARG, tr("Cannot change enabled state of screen while capturing is enabled")); 266 248 267 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 249 268 … … 254 273 alock.release(); 255 274 256 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 257 m->pMachine->i_setModified(Machine::IsModified_Capture); 258 mlock.release(); 259 260 HRESULT rc = m->pMachine->i_onCaptureChange(); 261 if (FAILED(rc)) return rc; 262 263 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 264 AutoAnyStateDependency adep(m->pMachine); 265 AssertComRCReturn(adep.rc(), E_UNEXPECTED); 266 267 if (Global::IsOnline(adep.machineState())) 268 m->pMachine->i_saveSettings(NULL); 275 m->pParent->i_onSettingsChanged(); 269 276 } 270 277 278 LogFlowThisFunc(("Screen %RU32\n", m->uScreenId)); 271 279 return S_OK; 272 280 } … … 274 282 HRESULT CaptureScreenSettings::getFeatures(ULONG *aFeatures) 275 283 { 284 AutoCaller autoCaller(this); 285 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 286 276 287 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 277 288 … … 292 303 HRESULT CaptureScreenSettings::setFeatures(ULONG aFeatures) 293 304 { 294 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 295 296 if (m->bd->fEnabled) 305 AutoCaller autoCaller(this); 306 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 307 308 if (!m->pParent->i_canChangeSettings()) 297 309 return setError(E_INVALIDARG, tr("Cannot change features while capturing is enabled")); 310 311 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 298 312 299 313 m->bd.backup(); … … 307 321 alock.release(); 308 322 309 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);310 m->pMachine->i_setModified(Machine::IsModified_Capture);311 mlock.release();312 313 323 return S_OK; 314 324 } … … 316 326 HRESULT CaptureScreenSettings::getDestination(CaptureDestination_T *aDestination) 317 327 { 328 AutoCaller autoCaller(this); 329 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 330 318 331 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 319 332 … … 325 338 HRESULT CaptureScreenSettings::setDestination(CaptureDestination_T aDestination) 326 339 { 327 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 328 329 if (m->bd->fEnabled) 340 AutoCaller autoCaller(this); 341 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 342 343 if (!m->pParent->i_canChangeSettings()) 330 344 return setError(E_INVALIDARG, tr("Cannot change destination type while capturing is enabled")); 331 345 346 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 347 332 348 m->bd.backup(); 333 349 m->bd->enmDest = aDestination; 334 350 335 alock.release();336 337 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);338 m->pMachine->i_setModified(Machine::IsModified_Capture);339 mlock.release();340 341 351 return S_OK; 342 352 } … … 344 354 HRESULT CaptureScreenSettings::getFileName(com::Utf8Str &aFileName) 345 355 { 356 AutoCaller autoCaller(this); 357 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 358 346 359 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 347 360 … … 353 366 HRESULT CaptureScreenSettings::setFileName(const com::Utf8Str &aFileName) 354 367 { 355 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 356 357 if (m->bd->fEnabled) 368 AutoCaller autoCaller(this); 369 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 370 371 if (!m->pParent->i_canChangeSettings()) 358 372 return setError(E_INVALIDARG, tr("Cannot change file name while capturing is enabled")); 373 374 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 359 375 360 376 Utf8Str strFile(aFileName); … … 366 382 m->bd->File.strName = strFile; 367 383 368 alock.release();369 370 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);371 m->pMachine->i_setModified(Machine::IsModified_Capture);372 mlock.release();373 374 384 return S_OK; 375 385 } … … 377 387 HRESULT CaptureScreenSettings::getMaxTime(ULONG *aMaxTimeS) 378 388 { 389 AutoCaller autoCaller(this); 390 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 391 379 392 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 380 393 … … 386 399 HRESULT CaptureScreenSettings::setMaxTime(ULONG aMaxTimeS) 387 400 { 388 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 389 390 if (m->bd->fEnabled) 401 AutoCaller autoCaller(this); 402 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 403 404 if (!m->pParent->i_canChangeSettings()) 391 405 return setError(E_INVALIDARG, tr("Cannot change maximum time while capturing is enabled")); 392 406 407 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 408 393 409 m->bd.backup(); 394 410 m->bd->ulMaxTimeS = aMaxTimeS; 395 411 396 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);397 m->pMachine->i_setModified(Machine::IsModified_Capture);398 mlock.release();399 400 412 return S_OK; 401 413 } … … 403 415 HRESULT CaptureScreenSettings::getMaxFileSize(ULONG *aMaxFileSizeMB) 404 416 { 417 AutoCaller autoCaller(this); 418 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 419 405 420 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 406 421 … … 412 427 HRESULT CaptureScreenSettings::setMaxFileSize(ULONG aMaxFileSize) 413 428 { 414 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 415 416 if (m->bd->fEnabled) 429 AutoCaller autoCaller(this); 430 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 431 432 if (!m->pParent->i_canChangeSettings()) 417 433 return setError(E_INVALIDARG, tr("Cannot change maximum file size while capturing is enabled")); 418 434 435 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 436 419 437 m->bd.backup(); 420 438 m->bd->File.ulMaxSizeMB = aMaxFileSize; 421 439 422 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);423 m->pMachine->i_setModified(Machine::IsModified_Capture);424 mlock.release();425 426 440 return S_OK; 427 441 } … … 429 443 HRESULT CaptureScreenSettings::getOptions(com::Utf8Str &aOptions) 430 444 { 445 AutoCaller autoCaller(this); 446 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 447 431 448 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 432 449 … … 438 455 HRESULT CaptureScreenSettings::setOptions(const com::Utf8Str &aOptions) 439 456 { 440 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 441 442 if (m->bd->fEnabled) 457 AutoCaller autoCaller(this); 458 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 459 460 if (!m->pParent->i_canChangeSettings()) 443 461 return setError(E_INVALIDARG, tr("Cannot change options while capturing is enabled")); 444 462 463 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 464 445 465 m->bd.backup(); 446 466 m->bd->strOptions = aOptions; 447 467 448 alock.release();449 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);450 m->pMachine->i_setModified(Machine::IsModified_Capture);451 452 468 return S_OK; 453 469 } … … 455 471 HRESULT CaptureScreenSettings::getAudioCodec(CaptureAudioCodec_T *aCodec) 456 472 { 473 AutoCaller autoCaller(this); 474 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 475 457 476 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 458 477 … … 464 483 HRESULT CaptureScreenSettings::setAudioCodec(CaptureAudioCodec_T aCodec) 465 484 { 466 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 467 468 if (m->bd->fEnabled) 485 AutoCaller autoCaller(this); 486 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 487 488 if (!m->pParent->i_canChangeSettings()) 469 489 return setError(E_INVALIDARG, tr("Cannot change audio codec while capturing is enabled")); 470 490 491 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 492 471 493 m->bd.backup(); 472 494 m->bd->Audio.enmAudioCodec = aCodec; 473 495 474 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);475 m->pMachine->i_setModified(Machine::IsModified_Capture);476 mlock.release();477 478 496 return S_OK; 479 497 } … … 481 499 HRESULT CaptureScreenSettings::getAudioHz(ULONG *aHz) 482 500 { 501 AutoCaller autoCaller(this); 502 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 503 483 504 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 484 505 … … 490 511 HRESULT CaptureScreenSettings::setAudioHz(ULONG aHz) 491 512 { 492 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 493 494 if (m->bd->fEnabled) 513 AutoCaller autoCaller(this); 514 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 515 516 if (!m->pParent->i_canChangeSettings()) 495 517 return setError(E_INVALIDARG, tr("Cannot change audio Hertz rate while capturing is enabled")); 496 518 519 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 520 497 521 m->bd.backup(); 498 522 m->bd->Audio.uHz = (uint16_t)aHz; 499 523 500 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);501 m->pMachine->i_setModified(Machine::IsModified_Capture);502 mlock.release();503 504 524 return S_OK; 505 525 } … … 507 527 HRESULT CaptureScreenSettings::getAudioBits(ULONG *aBits) 508 528 { 529 AutoCaller autoCaller(this); 530 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 531 509 532 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 510 533 … … 516 539 HRESULT CaptureScreenSettings::setAudioBits(ULONG aBits) 517 540 { 518 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 519 520 if (m->bd->fEnabled) 541 AutoCaller autoCaller(this); 542 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 543 544 if (!m->pParent->i_canChangeSettings()) 521 545 return setError(E_INVALIDARG, tr("Cannot change audio bits while capturing is enabled")); 522 546 547 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 548 523 549 m->bd.backup(); 524 550 m->bd->Audio.cBits = (uint8_t)aBits; 525 551 526 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);527 m->pMachine->i_setModified(Machine::IsModified_Capture);528 mlock.release();529 530 552 return S_OK; 531 553 } … … 533 555 HRESULT CaptureScreenSettings::getAudioChannels(ULONG *aChannels) 534 556 { 557 AutoCaller autoCaller(this); 558 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 559 535 560 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 536 561 … … 542 567 HRESULT CaptureScreenSettings::setAudioChannels(ULONG aChannels) 543 568 { 544 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 545 546 if (m->bd->fEnabled) 569 AutoCaller autoCaller(this); 570 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 571 572 if (!m->pParent->i_canChangeSettings()) 547 573 return setError(E_INVALIDARG, tr("Cannot change audio channels while capturing is enabled")); 548 574 575 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 576 549 577 m->bd.backup(); 550 578 m->bd->Audio.cChannels = (uint8_t)aChannels; 551 579 552 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);553 m->pMachine->i_setModified(Machine::IsModified_Capture);554 mlock.release();555 556 580 return S_OK; 557 581 } … … 559 583 HRESULT CaptureScreenSettings::getVideoCodec(CaptureVideoCodec_T *aCodec) 560 584 { 585 AutoCaller autoCaller(this); 586 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 587 561 588 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 562 589 … … 568 595 HRESULT CaptureScreenSettings::setVideoCodec(CaptureVideoCodec_T aCodec) 569 596 { 570 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 571 572 if (m->bd->fEnabled) 597 AutoCaller autoCaller(this); 598 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 599 600 if (!m->pParent->i_canChangeSettings()) 573 601 return setError(E_INVALIDARG, tr("Cannot change video codec while capturing is enabled")); 574 602 603 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 604 575 605 m->bd.backup(); 576 606 m->bd->Video.enmCodec = aCodec; 577 607 578 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);579 m->pMachine->i_setModified(Machine::IsModified_Capture);580 mlock.release();581 582 608 return S_OK; 583 609 } … … 585 611 HRESULT CaptureScreenSettings::getVideoWidth(ULONG *aVideoWidth) 586 612 { 613 AutoCaller autoCaller(this); 614 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 615 587 616 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 588 617 … … 594 623 HRESULT CaptureScreenSettings::setVideoWidth(ULONG aVideoWidth) 595 624 { 596 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 597 598 if (m->bd->fEnabled) 625 AutoCaller autoCaller(this); 626 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 627 628 if (!m->pParent->i_canChangeSettings()) 599 629 return setError(E_INVALIDARG, tr("Cannot change video width while capturing is enabled")); 600 630 631 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 632 601 633 m->bd.backup(); 602 634 m->bd->Video.ulWidth = aVideoWidth; 603 635 604 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);605 m->pMachine->i_setModified(Machine::IsModified_Capture);606 mlock.release();607 608 636 return S_OK; 609 637 } … … 611 639 HRESULT CaptureScreenSettings::getVideoHeight(ULONG *aVideoHeight) 612 640 { 641 AutoCaller autoCaller(this); 642 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 643 613 644 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 614 645 … … 620 651 HRESULT CaptureScreenSettings::setVideoHeight(ULONG aVideoHeight) 621 652 { 622 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 623 624 if (m->bd->fEnabled) 653 AutoCaller autoCaller(this); 654 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 655 656 if (!m->pParent->i_canChangeSettings()) 625 657 return setError(E_INVALIDARG, tr("Cannot change video height while capturing is enabled")); 626 658 659 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 660 627 661 m->bd.backup(); 628 662 m->bd->Video.ulHeight = aVideoHeight; 629 663 630 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);631 m->pMachine->i_setModified(Machine::IsModified_Capture);632 mlock.release();633 634 664 return S_OK; 635 665 } … … 637 667 HRESULT CaptureScreenSettings::getVideoRate(ULONG *aVideoRate) 638 668 { 669 AutoCaller autoCaller(this); 670 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 671 639 672 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 640 673 … … 646 679 HRESULT CaptureScreenSettings::setVideoRate(ULONG aVideoRate) 647 680 { 648 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 649 650 if (m->bd->fEnabled) 681 AutoCaller autoCaller(this); 682 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 683 684 if (!m->pParent->i_canChangeSettings()) 651 685 return setError(E_INVALIDARG, tr("Cannot change video rate while capturing is enabled")); 652 686 687 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 688 653 689 m->bd.backup(); 654 690 m->bd->Video.ulRate = aVideoRate; 655 691 656 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);657 m->pMachine->i_setModified(Machine::IsModified_Capture);658 mlock.release();659 660 692 return S_OK; 661 693 } … … 663 695 HRESULT CaptureScreenSettings::getVideoRateControlMode(CaptureVideoRateControlMode_T *aMode) 664 696 { 697 AutoCaller autoCaller(this); 698 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 699 665 700 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 666 701 … … 672 707 HRESULT CaptureScreenSettings::setVideoRateControlMode(CaptureVideoRateControlMode_T aMode) 673 708 { 674 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 675 676 if (m->bd->fEnabled) 709 AutoCaller autoCaller(this); 710 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 711 712 if (!m->pParent->i_canChangeSettings()) 677 713 return setError(E_INVALIDARG, tr("Cannot change video rate control mode while capturing is enabled")); 714 715 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 678 716 679 717 /** @todo Implement this. */ … … 685 723 HRESULT CaptureScreenSettings::getVideoFPS(ULONG *aVideoFPS) 686 724 { 725 AutoCaller autoCaller(this); 726 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 727 687 728 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 688 729 … … 694 735 HRESULT CaptureScreenSettings::setVideoFPS(ULONG aVideoFPS) 695 736 { 696 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 697 698 if (m->bd->fEnabled) 737 AutoCaller autoCaller(this); 738 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 739 740 if (!m->pParent->i_canChangeSettings()) 699 741 return setError(E_INVALIDARG, tr("Cannot change video FPS while capturing is enabled")); 700 742 743 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 744 701 745 m->bd.backup(); 702 746 m->bd->Video.ulFPS = aVideoFPS; 703 747 704 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);705 m->pMachine->i_setModified(Machine::IsModified_Capture);706 mlock.release();707 708 748 return S_OK; 709 749 } … … 711 751 HRESULT CaptureScreenSettings::getVideoScalingMethod(CaptureVideoScalingMethod_T *aMode) 712 752 { 753 AutoCaller autoCaller(this); 754 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 755 713 756 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 714 757 … … 720 763 HRESULT CaptureScreenSettings::setVideoScalingMethod(CaptureVideoScalingMethod_T aMode) 721 764 { 722 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 723 724 if (m->bd->fEnabled) 765 AutoCaller autoCaller(this); 766 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 767 768 if (!m->pParent->i_canChangeSettings()) 725 769 return setError(E_INVALIDARG, tr("Cannot change video rate scaling method while capturing is enabled")); 770 771 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 726 772 727 773 /** @todo Implement this. */ … … 729 775 730 776 return E_NOTIMPL; 731 }732 733 /**734 * Returns the full path to the default video capture file.735 */736 int CaptureScreenSettings::i_getDefaultFileName(Utf8Str &strFile)737 {738 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);739 740 strFile = m->pMachine->i_getSettingsFileFull(); // path/to/machinesfolder/vmname/vmname.vbox741 strFile.stripSuffix(); // path/to/machinesfolder/vmname/vmname742 strFile.append(".webm"); // path/to/machinesfolder/vmname/vmname.webm743 744 return VINF_SUCCESS;745 777 } 746 778 … … 753 785 { 754 786 Assert(m); 755 return i_getDefaultFileName(m->bd->File.strName); 756 } 757 787 788 int rc = VINF_SUCCESS; 789 790 switch (m->bd->enmDest) 791 { 792 case CaptureDestination_File: 793 { 794 if (m->bd->File.strName.isEmpty()) 795 rc = m->pParent->i_getDefaultFileName(m->bd->File.strName); 796 break; 797 } 798 799 default: 800 break; 801 } 802 803 return rc; 804 } 805
Note:
See TracChangeset
for help on using the changeset viewer.