VirtualBox

Changeset 96172 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Aug 12, 2022 1:27:46 PM (2 years ago)
Author:
vboxsync
Message:

Recording/Main: Changed IRecordingScreenSettings::features attribute to get/set a safe array of RecordingFeature entries instead of an anonymous ULONG. Makes it much easier to use. bugref:10275

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/RecordingScreenSettingsImpl.cpp

    r96141 r96172  
    304304}
    305305
    306 HRESULT RecordingScreenSettings::getFeatures(ULONG *aFeatures)
    307 {
    308     AutoCaller autoCaller(this);
    309     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    310 
    311     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    312 
    313     *aFeatures = 0;
     306HRESULT RecordingScreenSettings::getFeatures(std::vector<RecordingFeature_T> &aFeatures)
     307{
     308    AutoCaller autoCaller(this);
     309    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     310
     311    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     312
     313    aFeatures.clear();
    314314
    315315    settings::RecordingFeatureMap::const_iterator itFeature = m->bd->featureMap.begin();
     
    317317    {
    318318        if (itFeature->second) /* Is feature enable? */
    319             *aFeatures |= (ULONG)itFeature->first;
     319            aFeatures.push_back(itFeature->first);
    320320
    321321        ++itFeature;
     
    325325}
    326326
    327 HRESULT RecordingScreenSettings::setFeatures(ULONG aFeatures)
     327HRESULT RecordingScreenSettings::setFeatures(const std::vector<RecordingFeature_T> &aFeatures)
    328328{
    329329    AutoCaller autoCaller(this);
     
    340340    m->bd->featureMap.clear();
    341341
    342     if (aFeatures & RecordingFeature_Audio)
    343         m->bd->featureMap[RecordingFeature_Audio] = true;
    344     if (aFeatures & RecordingFeature_Video)
    345         m->bd->featureMap[RecordingFeature_Video] = true;
     342    for (size_t i = 0; i < aFeatures.size(); i++)
     343    {
     344        switch (aFeatures[i])
     345        {
     346            case RecordingFeature_Audio:
     347                m->bd->featureMap[RecordingFeature_Audio] = true;
     348                break;
     349
     350            case RecordingFeature_Video:
     351                m->bd->featureMap[RecordingFeature_Video] = true;
     352                break;
     353
     354            default:
     355                break;
     356        }
     357    }
    346358
    347359    if (m->bd->featureMap != featureMapOld)
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