VirtualBox

Changeset 95770 in vbox for trunk/src/VBox/Main/xml


Ignore:
Timestamp:
Jul 21, 2022 10:05:38 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
152480
Message:

Main/Recording: Also serialize the screen settings feature map; we might want to use this later as well. bugref:9286

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r95741 r95770  
    27872787    /* Note: Needs to be kept in sync with FE/Qt's UIMachineSettingsDisplay::putToCache()! */
    27882788    return "vc_enabled=true,ac_enabled=false,ac_profile=med";
     2789}
     2790
     2791/**
     2792 * Returns a recording settings feature map from a given string.
     2793 *
     2794 * @returns VBox status code.
     2795 * @param   strFeatures         String of features to convert.
     2796 * @param   featureMap          Where to return the converted features on success.
     2797 */
     2798/* static */
     2799int RecordingScreenSettings::featuresFromString(const com::Utf8Str &strFeatures, RecordingFeatureMap &featureMap)
     2800{
     2801    featureMap.clear();
     2802
     2803    RTCList<RTCString> lstFeatures = strFeatures.split(" ");
     2804    for (size_t i = 0; i < lstFeatures.size(); i++)
     2805    {
     2806        if (lstFeatures.at(i).compare("video", RTCString::CaseInsensitive))
     2807            featureMap[RecordingFeature_Video] = true;
     2808        else if (lstFeatures.at(i).compare("audio", RTCString::CaseInsensitive))
     2809            featureMap[RecordingFeature_Audio] = true;
     2810        /* ignore everything else */
     2811    }
     2812
     2813    return VINF_SUCCESS;
     2814}
     2815
     2816/**
     2817 * Converts a feature map to a serializable string.
     2818 *
     2819 * @param   featureMap          Feature map to convert.
     2820 * @param   strFeatures         Where to return the features converted as a string.
     2821 */
     2822/* static */
     2823void RecordingScreenSettings::featuresToString(const RecordingFeatureMap &featureMap, com::Utf8Str &strFeatures)
     2824{
     2825    RecordingFeatureMap::const_iterator itFeature = featureMap.begin();
     2826    while (itFeature != featureMap.end())
     2827    {
     2828        if (itFeature->first == RecordingFeature_Video && itFeature->second)
     2829            strFeatures += "video ";
     2830        if (itFeature->first == RecordingFeature_Audio && itFeature->second)
     2831            strFeatures += "audio ";
     2832        strFeatures += " ";
     2833
     2834        ++itFeature;
     2835    }
     2836    strFeatures.strip();
    27892837}
    27902838
     
    60196067
    60206068            (*itScreen)->getAttributeValue("enabled",   screenSettings.fEnabled);
     6069            Utf8Str strFeatures;
     6070            (*itScreen)->getAttributeValue("featuresEnabled", strFeatures);
     6071            RecordingScreenSettings::featuresFromString(strFeatures, screenSettings.featureMap);
    60216072            (*itScreen)->getAttributeValue("maxTimeS",  screenSettings.ulMaxTimeS);
    60226073            (*itScreen)->getAttributeValue("options",   screenSettings.strOptions);
     
    80548105                pelmScreen->setAttribute("id",                  itScreen->first); /* The key equals the monitor ID. */
    80558106                pelmScreen->setAttribute("enabled",             itScreen->second.fEnabled);
     8107                com::Utf8Str strFeatures;
     8108                RecordingScreenSettings::featuresToString(itScreen->second.featureMap, strFeatures);
     8109                pelmScreen->setAttribute("featuresEnabled",     strFeatures);
    80568110                if (itScreen->second.ulMaxTimeS)
    80578111                    pelmScreen->setAttribute("maxTimeS",        itScreen->second.ulMaxTimeS);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette