Changeset feca357aaa88380d9e9c5c1bd21b2b25d4723acf

Show
Ignore:
Timestamp:
14/06/08 10:09:06 (4 months ago)
Author:
Jean-Paul Saman <jpsaman@videolan.org>
git-committer:
Jean-Paul Saman <jpsaman@videolan.org> 1213430946 +0200
git-parent:

[e5eae01a3ef40bc9399c7da03958163571355008]

git-author:
Jean-Paul Saman <jpsaman@videolan.org> 1213107913 +0200
Message:

Fix building of ActiveX control with 3 functions being unimplemented right now:
- VLCControl::setVariable()
- VLCControl::getVariable()
- VLCControl::get_PlaylistIndex()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • projects/activex/vlccontrol.cpp

    ra2ccb9b rfeca357  
    55 * 
    66 * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net> 
     7 *          Jean-Paul Saman <jpsaman@videolan.org> 
    78 * 
    89 * This program is free software; you can redistribute it and/or modify 
     
    404405STDMETHODIMP VLCControl::playFaster(void) 
    405406{ 
     407    int32_t rate = 2; 
     408 
    406409    HRESULT result = E_UNEXPECTED; 
    407     if( _p_instance->isRunning() ) 
    408     { 
    409         libvlc_instance_t *p_libvlc; 
    410         result = _p_instance->getVLC(&p_libvlc); 
    411         if( SUCCEEDED(result) ) 
    412         { 
    413             VLC_SpeedFaster(i_vlc); 
    414         } 
     410    if( !_p_instance->isRunning() ) 
     411        return result; 
     412 
     413    libvlc_instance_t* p_libvlc; 
     414    result = _p_instance->getVLC(&p_libvlc); 
     415    if( SUCCEEDED(result) ) 
     416    { 
     417        libvlc_exception_t ex; 
     418        libvlc_exception_init(&ex); 
     419 
     420        libvlc_media_player_t *p_md; 
     421        p_md = libvlc_playlist_get_media_player(p_libvlc, &ex); 
     422        if( ! libvlc_exception_raised(&ex) ) 
     423        { 
     424            libvlc_media_player_set_rate(p_md, rate, &ex); 
     425            libvlc_media_player_release(p_md); 
     426            if( ! libvlc_exception_raised(&ex) ) 
     427            { 
     428                return NOERROR; 
     429            } 
     430        } 
     431        _p_instance->setErrorInfo(IID_IVLCControl, 
     432                     libvlc_exception_get_message(&ex)); 
     433        libvlc_exception_clear(&ex); 
     434        return E_FAIL; 
    415435    } 
    416436    return result; 
     
    419439STDMETHODIMP VLCControl::playSlower(void) 
    420440{ 
     441    float rate = 0.5; 
     442 
    421443    HRESULT result = E_UNEXPECTED; 
    422     if( _p_instance->isRunning() ) 
    423     { 
    424         libvlc_instance_t *p_libvlc; 
    425         result = _p_instance->getVLC(&p_libvlc); 
    426         if( SUCCEEDED(result) ) 
    427         { 
    428             VLC_SpeedSlower(i_vlc); 
    429         } 
     444    if( !_p_instance->isRunning() ) 
     445        return result; 
     446 
     447    libvlc_instance_t* p_libvlc; 
     448    result = _p_instance->getVLC(&p_libvlc); 
     449    if( SUCCEEDED(result) ) 
     450    { 
     451        libvlc_exception_t ex; 
     452        libvlc_exception_init(&ex); 
     453 
     454        libvlc_media_player_t *p_md; 
     455        p_md = libvlc_playlist_get_media_player(p_libvlc, &ex); 
     456        if( ! libvlc_exception_raised(&ex) ) 
     457        { 
     458            libvlc_media_player_set_rate(p_md, rate, &ex); 
     459            libvlc_media_player_release(p_md); 
     460            if( ! libvlc_exception_raised(&ex) ) 
     461            { 
     462                return NOERROR; 
     463            } 
     464        } 
     465        _p_instance->setErrorInfo(IID_IVLCControl, 
     466                     libvlc_exception_get_message(&ex)); 
     467        libvlc_exception_clear(&ex); 
     468        return E_FAIL; 
    430469    } 
    431470    return result; 
     
    471510STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value) 
    472511{ 
     512    return E_INVALIDARG; 
     513#if 0 
    473514    if( 0 == SysStringLen(name) ) 
    474515        return E_INVALIDARG; 
     
    577618    } 
    578619    return hr; 
     620#endif 
    579621}; 
    580622 
    581623STDMETHODIMP VLCControl::getVariable( BSTR name, VARIANT *value) 
    582624{ 
     625    return E_INVALIDARG; 
     626#if 0 
    583627    if( NULL == value ) 
    584628        return E_POINTER; 
     
    650694    } 
    651695    return hr; 
     696#endif 
    652697}; 
    653698 
     
    9711016*/ 
    9721017 
    973 STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistMode mode, int position) 
     1018STDMETHODIMP VLCControl::addTarget(BSTR uri, VARIANT options, enum VLCPlaylistMode mode, int position) 
    9741019{ 
    9751020    if( 0 == SysStringLen(uri) ) 
     
    9901035            return E_INVALIDARG; 
    9911036 
    992         if( VLC_SUCCESS <= VLC_AddTarget(i_vlc, cUri, (const char **)cOptions, cOptionsCount, mode, position) ) 
    993         { 
    994             hr = NOERROR; 
    995             if( mode & PLAYLIST_GO ) 
    996                 _p_instance->fireOnPlayEvent(); 
    997         } 
    998         else 
    999         { 
    1000             hr = E_FAIL; 
    1001             if( mode & PLAYLIST_GO ) 
    1002                 _p_instance->fireOnStopEvent(); 
    1003         } 
     1037        libvlc_exception_t ex; 
     1038        libvlc_exception_init(&ex); 
     1039 
     1040        position = libvlc_playlist_add_extended(p_libvlc, cUri, cUri, 
     1041                                                cOptionsCount, 
     1042                                                const_cast<const char**>(cOptions), 
     1043                                                &ex); 
    10041044 
    10051045        FreeTargetOptions(cOptions, cOptionsCount); 
    10061046        CoTaskMemFree(cUri); 
     1047 
     1048        if( libvlc_exception_raised(&ex) ) 
     1049        { 
     1050            _p_instance->setErrorInfo(IID_IVLCPlaylist, 
     1051                libvlc_exception_get_message(&ex)); 
     1052            libvlc_exception_clear(&ex); 
     1053 
     1054            if( mode & VLCPlayListAppendAndGo ) 
     1055                _p_instance->fireOnStopEvent(); 
     1056            return E_FAIL; 
     1057        } 
     1058 
     1059        if( mode & VLCPlayListAppendAndGo ) 
     1060            _p_instance->fireOnPlayEvent(); 
     1061        return NOERROR; 
    10071062    } 
    10081063    return hr; 
     
    10111066STDMETHODIMP VLCControl::get_PlaylistIndex(int *index) 
    10121067{ 
     1068    return E_INVALIDARG; 
     1069#if 0 
    10131070    if( NULL == index ) 
    10141071        return E_POINTER; 
     
    10231080    *index = 0; 
    10241081    return result; 
     1082#endif 
    10251083}; 
    10261084