VirtualBox

Changeset 35146 in vbox


Ignore:
Timestamp:
Dec 15, 2010 4:31:56 PM (14 years ago)
Author:
vboxsync
Message:

VRDE: use VRDE properties for video redirection settings.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/settings.h

    r34837 r35146  
    283283          ulAuthTimeout(5000),
    284284          fAllowMultiConnection(false),
    285           fReuseSingleConnection(false),
    286           fVideoChannel(false),
    287           ulVideoChannelQuality(75)
     285          fReuseSingleConnection(false)
    288286    {}
    289287
     
    295293    com::Utf8Str    strAuthLibrary;
    296294    bool            fAllowMultiConnection,
    297                     fReuseSingleConnection,
    298                     fVideoChannel;
    299     uint32_t        ulVideoChannelQuality;
     295                    fReuseSingleConnection;
    300296    com::Utf8Str    strVrdeExtPack;
    301297    StringsMap      mapProperties;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp

    r35105 r35146  
    653653            if (vrdeServer)
    654654            {
    655                 unsigned n = parseNum(a->argv[2], 100, "VRDE video redirection quality in percent");
    656 
    657                 CHECK_ERROR(vrdeServer, COMSETTER(VideoChannelQuality)(n));
     655                Bstr value = a->argv[2];
     656
     657                CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Quality").raw(), value.raw()));
    658658            }
    659659        }
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r35105 r35146  
    14061406            BOOL fReuseCon;
    14071407            vrdeServer->COMGETTER(ReuseSingleConnection)(&fReuseCon);
    1408             BOOL fVideoChannel;
    1409             vrdeServer->COMGETTER(VideoChannel)(&fVideoChannel);
    1410             ULONG ulVideoChannelQuality;
    1411             vrdeServer->COMGETTER(VideoChannelQuality)(&ulVideoChannelQuality);
     1408            Bstr videoChannel;
     1409            vrdeServer->GetVRDEProperty(Bstr("VideoChannel/Enabled").raw(), videoChannel.asOutParam());
     1410            BOOL fVideoChannel =    (videoChannel.compare(Bstr("true"), Bstr::CaseInsensitive)== 0)
     1411                                 || (videoChannel == "1");
     1412            Bstr videoChannelQuality;
     1413            vrdeServer->GetVRDEProperty(Bstr("VideoChannel/Quality").raw(), videoChannelQuality.asOutParam());
    14121414            AuthType_T authType;
    14131415            const char *strAuthType;
     
    14551457                RTPrintf("vrdevideochannel=\"%s\"\n", fVideoChannel ? "on" : "off");
    14561458                if (fVideoChannel)
    1457                     RTPrintf("vrdevideochannelquality=\"%d\"\n", ulVideoChannelQuality);
     1459                    RTPrintf("vrdevideochannelquality=\"%lS\"\n", videoChannelQuality.raw());
    14581460            }
    14591461            else
     
    14651467                   RTPrintf("VRDE port:       %d\n", currentPort);
    14661468                if (fVideoChannel)
    1467                     RTPrintf("Video redirection: enabled (Quality %d)\n", ulVideoChannelQuality);
     1469                    RTPrintf("Video redirection: enabled (Quality %lS)\n", videoChannelQuality.raw());
    14681470                else
    14691471                    RTPrintf("Video redirection: disabled\n");
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r35105 r35146  
    264264    { "--vrdpreusecon",             MODIFYVM_VRDPREUSECON,              RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
    265265    { "--vrdpvideochannel",         MODIFYVM_VRDPVIDEOCHANNEL,          RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
    266     { "--vrdpvideochannelquality",  MODIFYVM_VRDPVIDEOCHANNELQUALITY,   RTGETOPT_REQ_UINT32 },     /* deprecated */
     266    { "--vrdpvideochannelquality",  MODIFYVM_VRDPVIDEOCHANNELQUALITY,   RTGETOPT_REQ_STRING },     /* deprecated */
    267267    { "--vrdp",                     MODIFYVM_VRDP,                      RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
    268268    { "--vrdeproperty",             MODIFYVM_VRDEPROPERTY,              RTGETOPT_REQ_STRING },
     
    274274    { "--vrdereusecon",             MODIFYVM_VRDEREUSECON,              RTGETOPT_REQ_BOOL_ONOFF },
    275275    { "--vrdevideochannel",         MODIFYVM_VRDEVIDEOCHANNEL,          RTGETOPT_REQ_BOOL_ONOFF },
    276     { "--vrdevideochannelquality",  MODIFYVM_VRDEVIDEOCHANNELQUALITY,   RTGETOPT_REQ_UINT32 },
     276    { "--vrdevideochannelquality",  MODIFYVM_VRDEVIDEOCHANNELQUALITY,   RTGETOPT_REQ_STRING },
    277277    { "--vrdeextpack",              MODIFYVM_VRDE_EXTPACK,              RTGETOPT_REQ_STRING },
    278278    { "--vrde",                     MODIFYVM_VRDE,                      RTGETOPT_REQ_BOOL_ONOFF },
     
    19881988                ASSERT(vrdeServer);
    19891989
    1990                 CHECK_ERROR(vrdeServer, COMSETTER(VideoChannel)(ValueUnion.f));
     1990                CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Enabled").raw(),
     1991                                                        ValueUnion.f? Bstr("true").raw():  Bstr("false").raw()));
    19911992                break;
    19921993            }
     
    20002001                ASSERT(vrdeServer);
    20012002
    2002                 CHECK_ERROR(vrdeServer, COMSETTER(VideoChannelQuality)(ValueUnion.u32));
     2003                CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Quality").raw(),
     2004                                                        Bstr(ValueUnion.psz).raw()));
    20032005                break;
    20042006            }
  • trunk/src/VBox/Main/ConsoleVRDPServer.cpp

    r34969 r35146  
    650650        case VRDE_QP_VIDEO_CHANNEL:
    651651        {
    652             BOOL fVideoEnabled = FALSE;
    653 
    654             server->mConsole->getVRDEServer()->COMGETTER(VideoChannel)(&fVideoEnabled);
     652            com::Bstr bstr;
     653            HRESULT hrc = server->mConsole->getVRDEServer()->GetVRDEProperty(Bstr("VideoChannel/Enabled").raw(), bstr.asOutParam());
     654
     655            if (hrc != S_OK)
     656            {
     657                bstr = "";
     658            }
     659
     660            com::Utf8Str value = bstr;
     661
     662            BOOL fVideoEnabled =    RTStrICmp(value.c_str(), "true") == 0
     663                                 || RTStrICmp(value.c_str(), "1") == 0;
    655664
    656665            if (cbBuffer >= sizeof(uint32_t))
     
    669678        case VRDE_QP_VIDEO_CHANNEL_QUALITY:
    670679        {
    671             ULONG ulQuality = 0;
    672 
    673             server->mConsole->getVRDEServer()->COMGETTER(VideoChannelQuality)(&ulQuality);
     680            com::Bstr bstr;
     681            HRESULT hrc = server->mConsole->getVRDEServer()->GetVRDEProperty(Bstr("VideoChannel/Quality").raw(), bstr.asOutParam());
     682
     683            if (hrc != S_OK)
     684            {
     685                bstr = "";
     686            }
     687
     688            com::Utf8Str value = bstr;
     689
     690            ULONG ulQuality = RTStrToUInt32(value.c_str()); /* This returns 0 on invalid string which is ok. */
    674691
    675692            if (cbBuffer >= sizeof(uint32_t))
  • trunk/src/VBox/Main/VRDEServerImpl.cpp

    r35105 r35146  
    9393    mData->mAllowMultiConnection = FALSE;
    9494    mData->mReuseSingleConnection = FALSE;
    95     mData->mVideoChannel         = FALSE;
    96     mData->mVideoChannelQuality  = 75;
    9795    mData->mVrdeExtPack.setNull();
    9896
     
    212210    mData->mAllowMultiConnection = data.fAllowMultiConnection;
    213211    mData->mReuseSingleConnection = data.fReuseSingleConnection;
    214     mData->mVideoChannel = data.fVideoChannel;
    215     mData->mVideoChannelQuality = data.ulVideoChannelQuality;
    216212    mData->mVrdeExtPack = data.strVrdeExtPack;
    217213    mData->mProperties = data.mapProperties;
     
    240236    data.fAllowMultiConnection = !!mData->mAllowMultiConnection;
    241237    data.fReuseSingleConnection = !!mData->mReuseSingleConnection;
    242     data.fVideoChannel = !!mData->mVideoChannel;
    243     data.ulVideoChannelQuality = mData->mVideoChannelQuality;
    244238    data.strVrdeExtPack = mData->mVrdeExtPack;
    245239    data.mapProperties = mData->mProperties;
     
    870864
    871865        mParent->onVRDEServerChange(/* aRestart */ TRUE); // @todo needs a restart?
    872     }
    873 
    874     return S_OK;
    875 }
    876 
    877 STDMETHODIMP VRDEServer::COMGETTER(VideoChannel) (
    878     BOOL *aVideoChannel)
    879 {
    880     CheckComArgOutPointerValid(aVideoChannel);
    881 
    882     AutoCaller autoCaller(this);
    883     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    884 
    885     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    886 
    887     *aVideoChannel = mData->mVideoChannel;
    888 
    889     return S_OK;
    890 }
    891 
    892 STDMETHODIMP VRDEServer::COMSETTER(VideoChannel) (
    893     BOOL aVideoChannel)
    894 {
    895     AutoCaller autoCaller(this);
    896     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    897 
    898     /* the machine needs to be mutable */
    899     AutoMutableStateDependency adep(mParent);
    900     if (FAILED(adep.rc())) return adep.rc();
    901 
    902     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    903 
    904     if (mData->mVideoChannel != aVideoChannel)
    905     {
    906         mData.backup();
    907         mData->mVideoChannel = aVideoChannel;
    908 
    909         /* leave the lock before informing callbacks */
    910         alock.release();
    911 
    912         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, needs no locking
    913         mParent->setModified(Machine::IsModified_VRDEServer);
    914         mlock.release();
    915 
    916         mParent->onVRDEServerChange(/* aRestart */ TRUE);
    917     }
    918 
    919     return S_OK;
    920 }
    921 
    922 STDMETHODIMP VRDEServer::COMGETTER(VideoChannelQuality) (
    923     ULONG *aVideoChannelQuality)
    924 {
    925     CheckComArgOutPointerValid(aVideoChannelQuality);
    926 
    927     AutoCaller autoCaller(this);
    928     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    929 
    930     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    931 
    932     *aVideoChannelQuality = mData->mVideoChannelQuality;
    933 
    934     return S_OK;
    935 }
    936 
    937 STDMETHODIMP VRDEServer::COMSETTER(VideoChannelQuality) (
    938     ULONG aVideoChannelQuality)
    939 {
    940     AutoCaller autoCaller(this);
    941     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    942 
    943     /* the machine needs to be mutable */
    944     AutoMutableStateDependency adep(mParent);
    945     if (FAILED(adep.rc())) return adep.rc();
    946 
    947     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    948 
    949     aVideoChannelQuality = RT_CLAMP(aVideoChannelQuality, 10, 100);
    950 
    951     if (mData->mVideoChannelQuality != aVideoChannelQuality)
    952     {
    953         mData.backup();
    954         mData->mVideoChannelQuality = aVideoChannelQuality;
    955 
    956         /* leave the lock before informing callbacks */
    957         alock.release();
    958 
    959         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, needs no locking
    960         mParent->setModified(Machine::IsModified_VRDEServer);
    961         mlock.release();
    962 
    963         mParent->onVRDEServerChange(/* aRestart */ FALSE);
    964866    }
    965867
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r35134 r35146  
    1270212702  <interface
    1270312703    name="IVRDEServer" extends="$unknown"
    12704     uuid="b5bd49dc-26ef-42b4-ae7a-0c4b734a7653"
     12704    uuid="be24e0db-e1d6-4d58-b85b-21053d1511b4"
    1270512705    wsmap="managed"
    1270612706    >
     
    1272912729        must be established by the VRDE server, when a new client connects in single
    1273012730        connection mode.
    12731       </desc>
    12732     </attribute>
    12733 
    12734     <attribute name="videoChannel" type="boolean">
    12735       <desc>
    12736         Flag whether video redirectiron channel is enabled.
    12737       </desc>
    12738     </attribute>
    12739 
    12740     <attribute name="videoChannelQuality" type="unsigned long">
    12741       <desc>
    12742         Image quality in percents.
    1274312731      </desc>
    1274412732    </attribute>
  • trunk/src/VBox/Main/include/VRDEServerImpl.h

    r35105 r35146  
    4040        BOOL mAllowMultiConnection;
    4141        BOOL mReuseSingleConnection;
    42         BOOL mVideoChannel;
    43         ULONG mVideoChannelQuality;
    4442        Utf8Str mVrdeExtPack;
    4543        settings::StringsMap mProperties;
     
    8078    STDMETHOD(COMGETTER(ReuseSingleConnection)) (BOOL *aReuseSingleConnection);
    8179    STDMETHOD(COMSETTER(ReuseSingleConnection)) (BOOL aReuseSingleConnection);
    82     STDMETHOD(COMGETTER(VideoChannel)) (BOOL *aVideoChannel);
    83     STDMETHOD(COMSETTER(VideoChannel)) (BOOL aVideoChannel);
    84     STDMETHOD(COMGETTER(VideoChannelQuality)) (ULONG *aVideoChannelQuality);
    85     STDMETHOD(COMSETTER(VideoChannelQuality)) (ULONG aVideoChannelQuality);
    8680    STDMETHOD(COMGETTER(VRDEExtPack))(BSTR *aExtPack);
    8781    STDMETHOD(COMSETTER(VRDEExtPack))(IN_BSTR aExtPack);
  • trunk/src/VBox/Main/xml/Settings.cpp

    r35128 r35146  
    14011401                  && (fAllowMultiConnection     == v.fAllowMultiConnection)
    14021402                  && (fReuseSingleConnection    == v.fReuseSingleConnection)
    1403                   && (fVideoChannel             == v.fVideoChannel)
    1404                   && (ulVideoChannelQuality     == v.ulVideoChannelQuality)
    14051403                  && (strVrdeExtPack            == v.strVrdeExtPack)
    14061404                  && (mapProperties             == v.mapProperties)
     
    24932491            pelmHwChild->getAttributeValue("reuseSingleConnection", hw.vrdeSettings.fReuseSingleConnection);
    24942492
     2493            /* 3.2 and 4.0 betas, 4.0 has this information in VRDEProperties. */
    24952494            const xml::ElementNode *pelmVideoChannel;
    24962495            if ((pelmVideoChannel = pelmHwChild->findChildElement("VideoChannel")))
    24972496            {
    2498                 pelmVideoChannel->getAttributeValue("enabled", hw.vrdeSettings.fVideoChannel);
    2499                 pelmVideoChannel->getAttributeValue("quality", hw.vrdeSettings.ulVideoChannelQuality);
    2500                 hw.vrdeSettings.ulVideoChannelQuality = RT_CLAMP(hw.vrdeSettings.ulVideoChannelQuality, 10, 100);
     2497                bool fVideoChannel = false;
     2498                pelmVideoChannel->getAttributeValue("enabled", fVideoChannel);
     2499                hw.vrdeSettings.mapProperties["VideoChannel/Enabled"] = fVideoChannel? "true": "false";
     2500
     2501                uint32_t ulVideoChannelQuality = 75;
     2502                pelmVideoChannel->getAttributeValue("quality", ulVideoChannelQuality);
     2503                ulVideoChannelQuality = RT_CLAMP(ulVideoChannelQuality, 10, 100);
     2504                char *pszBuffer = NULL;
     2505                if (RTStrAPrintf(&pszBuffer, "%d", ulVideoChannelQuality) >= 0)
     2506                {
     2507                    hw.vrdeSettings.mapProperties["VideoChannel/Quality"] = pszBuffer;
     2508                    RTStrFree(pszBuffer);
     2509                }
     2510                else
     2511                    hw.vrdeSettings.mapProperties["VideoChannel/Quality"] = "75";
    25012512            }
    25022513            pelmHwChild->getAttributeValue("VRDEExtPack", hw.vrdeSettings.strVrdeExtPack);
     
    34803491        pelmVRDE->setAttribute("reuseSingleConnection", hw.vrdeSettings.fReuseSingleConnection);
    34813492
    3482     if (m->sv >= SettingsVersion_v1_10)
     3493    if (m->sv == SettingsVersion_v1_10)
    34833494    {
    34843495        xml::ElementNode *pelmVideoChannel = pelmVRDE->createChild("VideoChannel");
    3485         pelmVideoChannel->setAttribute("enabled", hw.vrdeSettings.fVideoChannel);
    3486         pelmVideoChannel->setAttribute("quality", hw.vrdeSettings.ulVideoChannelQuality);
     3496
     3497        /* In 4.0 videochannel settings were replaced with properties, so look at properties. */
     3498        Utf8Str str;
     3499        StringsMap::const_iterator it = hw.vrdeSettings.mapProperties.find("VideoChannel/Enabled");
     3500        if (it != hw.vrdeSettings.mapProperties.end())
     3501            str = it->second;
     3502        bool fVideoChannel =    RTStrICmp(str.c_str(), "true") == 0
     3503                             || RTStrCmp(str.c_str(), "1") == 0;
     3504        pelmVideoChannel->setAttribute("enabled", fVideoChannel);
     3505
     3506        it = hw.vrdeSettings.mapProperties.find("VideoChannel/Quality");
     3507        if (it != hw.vrdeSettings.mapProperties.end())
     3508            str = it->second;
     3509        uint32_t ulVideoChannelQuality = RTStrToUInt32(str.c_str()); /* This returns 0 on invalid string which is ok. */
     3510        if (ulVideoChannelQuality == 0)
     3511            ulVideoChannelQuality = 75;
     3512        else
     3513            ulVideoChannelQuality = RT_CLAMP(ulVideoChannelQuality, 10, 100);
     3514        pelmVideoChannel->setAttribute("quality", ulVideoChannelQuality);
    34873515    }
    34883516    if (m->sv >= SettingsVersion_v1_11)
     
    44084436    }
    44094437
    4410     if (m->sv < SettingsVersion_v1_11)
     4438    if (m->sv < SettingsVersion_v1_10)
    44114439    {
    44124440        /* If the properties contain elements other than "TCP/Ports" and "TCP/Address",
    4413          * then increase the version to VBox 4.0.
     4441         * then increase the version to at least VBox 3.2, which can have video channel properties.
    44144442         */
    44154443        unsigned cOldProperties = 0;
     
    44194447            cOldProperties++;
    44204448        it = hardwareMachine.vrdeSettings.mapProperties.find("TCP/Address");
     4449        if (it != hardwareMachine.vrdeSettings.mapProperties.end())
     4450            cOldProperties++;
     4451
     4452        if (hardwareMachine.vrdeSettings.mapProperties.size() != cOldProperties)
     4453            m->sv = SettingsVersion_v1_10;
     4454    }
     4455
     4456    if (m->sv < SettingsVersion_v1_11)
     4457    {
     4458        /* If the properties contain elements other than "TCP/Ports", "TCP/Address",
     4459         * "VideoChannel/Enabled" and "VideoChannel/Quality" then increase the version to VBox 4.0.
     4460         */
     4461        unsigned cOldProperties = 0;
     4462
     4463        StringsMap::const_iterator it = hardwareMachine.vrdeSettings.mapProperties.find("TCP/Ports");
     4464        if (it != hardwareMachine.vrdeSettings.mapProperties.end())
     4465            cOldProperties++;
     4466        it = hardwareMachine.vrdeSettings.mapProperties.find("TCP/Address");
     4467        if (it != hardwareMachine.vrdeSettings.mapProperties.end())
     4468            cOldProperties++;
     4469        it = hardwareMachine.vrdeSettings.mapProperties.find("VideoChannel/Enabled");
     4470        if (it != hardwareMachine.vrdeSettings.mapProperties.end())
     4471            cOldProperties++;
     4472        it = hardwareMachine.vrdeSettings.mapProperties.find("VideoChannel/Quality");
    44214473        if (it != hardwareMachine.vrdeSettings.mapProperties.end())
    44224474            cOldProperties++;
     
    45574609        if (   (hardwareMachine.ioSettings.fIoCacheEnabled != true)
    45584610            || (hardwareMachine.ioSettings.ulIoCacheSize != 5)
    4559                 // and remote desktop video redirection channel
    4560             || (hardwareMachine.vrdeSettings.fVideoChannel)
    45614611                // and page fusion
    45624612            || (hardwareMachine.fPageFusionEnabled)
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