Changeset 75366 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Nov 9, 2018 4:07:55 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/RecordingScreenSettingsImpl.cpp
r75361 r75366 116 116 117 117 /** 118 * Initializes the capture settings object given another capturesettings object118 * Initializes the recording settings object given another recording settings object 119 119 * (a kind of copy constructor). This object shares data with 120 120 * the object passed as an argument. … … 386 386 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 387 387 388 /* Get default file name if an empty string or a single "." is passed. */ 388 389 Utf8Str strFile(aFileName); 390 if ( strFile.isEmpty() 391 || strFile.equals(".")) 392 { 393 int vrc = m->pParent->i_getDefaultFileName(strFile); 394 if (RT_FAILURE(vrc)) 395 return setError(E_INVALIDARG, tr("Error retrieving default file name")); 396 } 389 397 390 398 if (!RTPathStartsWithRoot(strFile.c_str())) 391 return setError(E_INVALIDARG, tr(" Capturefile name '%s' is not absolute"), strFile.c_str());399 return setError(E_INVALIDARG, tr("Recording file name '%s' is not absolute"), strFile.c_str()); 392 400 393 401 m->bd.backup(); … … 477 485 m->bd.backup(); 478 486 m->bd->strOptions = aOptions; 487 488 int vrc = RecordingScreenSettings::i_parseOptionsString(aOptions, *m->bd.data()); 489 if (RT_FAILURE(vrc)) 490 return setError(E_INVALIDARG, tr("Invalid option specified")); 479 491 480 492 return S_OK; … … 816 828 } 817 829 830 /** 831 * Parses a recording screen options string and stores the parsed result in the specified screen settings. 832 * 833 * @returns IPRT status code. 834 * @param strOptions Options string to parse. 835 * @param screenSettings Where to store the parsed result into. 836 */ 837 /* static */ 838 int RecordingScreenSettings::i_parseOptionsString(const com::Utf8Str &strOptions, 839 settings::RecordingScreenSettings &screenSettings) 840 { 841 /* 842 * Parse options string. 843 */ 844 size_t pos = 0; 845 com::Utf8Str key, value; 846 while ((pos = strOptions.parseKeyValue(key, value, pos)) != com::Utf8Str::npos) 847 { 848 if (key.compare("vc_quality", Utf8Str::CaseInsensitive) == 0) 849 { 850 #ifdef VBOX_WITH_LIBVPX 851 if (value.compare("realtime", Utf8Str::CaseInsensitive) == 0) 852 mVideoRecCfg.Video.Codec.VPX.uEncoderDeadline = VPX_DL_REALTIME; 853 else if (value.compare("good", Utf8Str::CaseInsensitive) == 0) 854 mVideoRecCfg.Video.Codec.VPX.uEncoderDeadline = 1000000 / mVideoRecCfg.Video.uFPS; 855 else if (value.compare("best", Utf8Str::CaseInsensitive) == 0) 856 mVideoRecCfg.Video.Codec.VPX.uEncoderDeadline = VPX_DL_BEST_QUALITY; 857 else 858 { 859 mVideoRecCfg.Video.Codec.VPX.uEncoderDeadline = value.toUInt32(); 860 } 861 #endif 862 } 863 else if (key.compare("vc_enabled", Utf8Str::CaseInsensitive) == 0) 864 { 865 if (value.compare("false", Utf8Str::CaseInsensitive) == 0) 866 { 867 screenSettings.featureMap[RecordingFeature_Video] = false; 868 } 869 } 870 else if (key.compare("ac_enabled", Utf8Str::CaseInsensitive) == 0) 871 { 872 #ifdef VBOX_WITH_AUDIO_RECORDING 873 if (value.compare("true", Utf8Str::CaseInsensitive) == 0) 874 { 875 screenSettings.featureMap[RecordingFeature_Audio] = true; 876 } 877 #endif 878 } 879 else if (key.compare("ac_profile", Utf8Str::CaseInsensitive) == 0) 880 { 881 #ifdef VBOX_WITH_AUDIO_RECORDING 882 if (value.compare("low", Utf8Str::CaseInsensitive) == 0) 883 { 884 screenSettings.Audio.uHz = 8000; 885 screenSettings.Audio.cBits = 16; 886 screenSettings.Audio.cChannels = 1; 887 } 888 else if (value.startsWith("med" /* "med[ium]" */, Utf8Str::CaseInsensitive) == 0) 889 { 890 /* Stay with the default set above. */ 891 } 892 else if (value.compare("high", Utf8Str::CaseInsensitive) == 0) 893 { 894 screenSettings.Audio.uHz = 48000; 895 screenSettings.Audio.cBits = 16; 896 screenSettings.Audio.cChannels = 2; 897 } 898 #endif 899 } 900 /* else just ignore. */ 901 902 } /* while */ 903 904 return VINF_SUCCESS; 905 } 906
Note:
See TracChangeset
for help on using the changeset viewer.