]> git.sesse.net Git - vlc/blobdiff - projects/activex/vlccontrol2.cpp
lua_extension: factorize.
[vlc] / projects / activex / vlccontrol2.cpp
index 60006a755ef911ec70db349b991181e530292934..2940e4e4e97b6d033041eebab01d8e19bc3c31d4 100644 (file)
 
 // ---------
 
-HRESULT VLCInterfaceBase::report_exception(REFIID riid, libvlc_exception_t *ex)
-{
-    _plug->setErrorInfo(riid,libvlc_errmsg());
-    libvlc_exception_clear(ex);
-    return E_FAIL;
-}
-
 HRESULT VLCInterfaceBase::loadTypeInfo(REFIID riid)
 {
     // if( _ti ) return NOERROR; // unnecessairy
@@ -63,12 +56,9 @@ HRESULT VLCInterfaceBase::loadTypeInfo(REFIID riid)
 
 BIND_INTERFACE( VLCAudio )
 BIND_INTERFACE( VLCInput )
-BIND_INTERFACE( VLCMessage )
-BIND_INTERFACE( VLCMessages )
-BIND_INTERFACE( VLCMessageIterator )
-BIND_INTERFACE( VLCLog )
 BIND_INTERFACE( VLCMarquee )
 BIND_INTERFACE( VLCLogo )
+BIND_INTERFACE( VLCDeinterlace )
 BIND_INTERFACE( VLCPlaylistItems )
 BIND_INTERFACE( VLCPlaylist )
 BIND_INTERFACE( VLCVideo )
@@ -76,28 +66,44 @@ BIND_INTERFACE( VLCSubtitle )
 
 #undef  BIND_INTERFACE
 
-// ---------
+template<class I> static inline
+HRESULT object_get(I **dst, I *src)
+{
+    if( NULL == dst )
+        return E_POINTER;
 
+    *dst = src;
+    if( NULL != src )
+    {
+        src->AddRef();
+        return NOERROR;
+    }
+    return E_OUTOFMEMORY;
+}
+
+static inline
+VARIANT_BOOL varbool(bool b) { return b ? VARIANT_TRUE : VARIANT_FALSE; }
+
+// ---------
 
 STDMETHODIMP VLCAudio::get_mute(VARIANT_BOOL* mute)
 {
     if( NULL == mute )
         return E_POINTER;
 
-    libvlc_instance_t* p_libvlc;
-    HRESULT hr = getVLC(&p_libvlc);
+    libvlc_media_player_t *p_md;
+    HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
-        *mute = libvlc_audio_get_mute(p_libvlc) ?
-                        VARIANT_TRUE : VARIANT_FALSE;
+        *mute = varbool( libvlc_audio_get_mute(p_md) );
     return hr;
 };
 
 STDMETHODIMP VLCAudio::put_mute(VARIANT_BOOL mute)
 {
-    libvlc_instance_t* p_libvlc;
-    HRESULT hr = getVLC(&p_libvlc);
+    libvlc_media_player_t *p_md;
+    HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
-        libvlc_audio_set_mute(p_libvlc, VARIANT_FALSE != mute);
+        libvlc_audio_set_mute(p_md, VARIANT_FALSE != mute);
     return hr;
 };
 
@@ -106,24 +112,20 @@ STDMETHODIMP VLCAudio::get_volume(long* volume)
     if( NULL == volume )
         return E_POINTER;
 
-    libvlc_instance_t* p_libvlc;
-    HRESULT hr = getVLC(&p_libvlc);
+    libvlc_media_player_t *p_md;
+    HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
-        *volume = libvlc_audio_get_volume(p_libvlc);
+        *volume = libvlc_audio_get_volume(p_md);
     return hr;
 };
 
 STDMETHODIMP VLCAudio::put_volume(long volume)
 {
-    libvlc_instance_t* p_libvlc;
-    HRESULT hr = getVLC(&p_libvlc);
+    libvlc_media_player_t *p_md;
+    HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_audio_set_volume(p_libvlc, volume, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_audio_set_volume(p_md, volume);
     }
     return hr;
 };
@@ -137,11 +139,7 @@ STDMETHODIMP VLCAudio::get_track(long* track)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *track = libvlc_audio_get_track(p_md, &ex);
-        hr = exception_bridge(&ex);
+        *track = libvlc_audio_get_track(p_md);
     }
     return hr;
 };
@@ -152,11 +150,7 @@ STDMETHODIMP VLCAudio::put_track(long track)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_audio_set_track(p_md, track, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_audio_set_track(p_md, track);
     }
     return hr;
 };
@@ -170,11 +164,8 @@ STDMETHODIMP VLCAudio::get_count(long* trackNumber)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
         // get the number of audio track available and return it
-        *trackNumber = libvlc_audio_get_track_count(p_md, &ex);
-        hr = exception_bridge(&ex);
+        *trackNumber = libvlc_audio_get_track_count(p_md);
     }
     return hr;
 };
@@ -186,8 +177,6 @@ STDMETHODIMP VLCAudio::description(long trackID, BSTR* name)
         return E_POINTER;
 
     libvlc_media_player_t* p_md;
-    libvlc_exception_t ex;
-    libvlc_exception_init(&ex);
 
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
@@ -197,16 +186,14 @@ STDMETHODIMP VLCAudio::description(long trackID, BSTR* name)
         libvlc_track_description_t *p_trackDesc;
 
         // get tracks description
-        p_trackDesc = libvlc_audio_get_track_description(p_md, &ex);
-        hr = exception_bridge(&ex);
-        if( FAILED(hr) )
-            return hr;
+        p_trackDesc = libvlc_audio_get_track_description(p_md);
+        if( !p_trackDesc )
+            return E_FAIL;
 
         //get the number of available track
-        i_limit = libvlc_audio_get_track_count(p_md, &ex);
-        hr = exception_bridge(&ex);
-        if( FAILED(hr) )
-            return hr;
+        i_limit = libvlc_audio_get_track_count(p_md);
+        if( i_limit < 0 )
+            return E_FAIL;
 
         // check if the number given is a good one
         if ( ( trackID > ( i_limit -1 ) ) || ( trackID < 0 ) )
@@ -237,45 +224,63 @@ STDMETHODIMP VLCAudio::get_channel(long *channel)
     if( NULL == channel )
         return E_POINTER;
 
-    libvlc_instance_t* p_libvlc;
-    HRESULT hr = getVLC(&p_libvlc);
+    libvlc_media_player_t *p_md;
+    HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *channel = libvlc_audio_get_channel(p_libvlc, &ex);
-        hr = exception_bridge(&ex);
+        *channel = libvlc_audio_get_channel(p_md);
     }
     return hr;
 };
 
 STDMETHODIMP VLCAudio::put_channel(long channel)
 {
-    libvlc_instance_t* p_libvlc;
-    HRESULT hr = getVLC(&p_libvlc);
+    libvlc_media_player_t *p_md;
+    HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_audio_set_channel(p_libvlc, channel, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_audio_set_channel(p_md, channel);
     }
     return hr;
 };
 
 STDMETHODIMP VLCAudio::toggleMute()
 {
-    libvlc_instance_t* p_libvlc;
-    HRESULT hr = getVLC(&p_libvlc);
+    libvlc_media_player_t *p_md;
+    HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
-        libvlc_audio_toggle_mute(p_libvlc);
+        libvlc_audio_toggle_mute(p_md);
     return hr;
 };
 
 /****************************************************************************/
 
+STDMETHODIMP VLCDeinterlace::disable()
+{
+    libvlc_media_player_t *p_md;
+    HRESULT hr = getMD(&p_md);
+    if( SUCCEEDED(hr) )
+    {
+        libvlc_video_set_deinterlace(p_md, "");
+    }
+    return hr;
+}
+
+STDMETHODIMP VLCDeinterlace::enable(BSTR mode)
+{
+    libvlc_media_player_t *p_md;
+    HRESULT hr = getMD(&p_md);
+    if( SUCCEEDED(hr) )
+    {
+        char *psz_mode = CStrFromBSTR(CP_UTF8, mode);
+        libvlc_video_set_deinterlace(p_md, psz_mode);
+        CoTaskMemFree(psz_mode);
+    }
+    return hr;
+}
+
+/****************************************************************************/
+
 STDMETHODIMP VLCInput::get_length(double* length)
 {
     if( NULL == length )
@@ -286,11 +291,7 @@ STDMETHODIMP VLCInput::get_length(double* length)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *length = (double)libvlc_media_player_get_length(p_md, &ex);
-        hr = exception_bridge(&ex);
+        *length = (double)libvlc_media_player_get_length(p_md);
     }
     return hr;
 };
@@ -305,11 +306,7 @@ STDMETHODIMP VLCInput::get_position(double* position)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *position = libvlc_media_player_get_position(p_md, &ex);
-        hr = exception_bridge(&ex);
+        *position = libvlc_media_player_get_position(p_md);
     }
     return hr;
 };
@@ -320,11 +317,7 @@ STDMETHODIMP VLCInput::put_position(double position)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_media_player_set_position(p_md, position, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_media_player_set_position(p_md, position);
     }
     return hr;
 };
@@ -338,11 +331,7 @@ STDMETHODIMP VLCInput::get_time(double* time)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *time = (double)libvlc_media_player_get_time(p_md, &ex);
-        hr = exception_bridge(&ex);
+        *time = (double)libvlc_media_player_get_time(p_md);
     }
     return hr;
 };
@@ -353,11 +342,7 @@ STDMETHODIMP VLCInput::put_time(double time)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_media_player_set_time(p_md, (int64_t)time, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_media_player_set_time(p_md, (int64_t)time);
     }
     return hr;
 };
@@ -371,16 +356,7 @@ STDMETHODIMP VLCInput::get_state(long* state)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *state = libvlc_media_player_get_state(p_md, &ex);
-        if( libvlc_exception_raised(&ex) )
-        {
-            // don't fail, just return the idle state
-            *state = 0;
-            libvlc_exception_clear(&ex);
-        }
+        *state = libvlc_media_player_get_state(p_md);
     }
     return hr;
 };
@@ -394,11 +370,7 @@ STDMETHODIMP VLCInput::get_rate(double* rate)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *rate = libvlc_media_player_get_rate(p_md, &ex);
-        hr = exception_bridge(&ex);
+        *rate = libvlc_media_player_get_rate(p_md);
     }
     return hr;
 };
@@ -409,11 +381,7 @@ STDMETHODIMP VLCInput::put_rate(double rate)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_media_player_set_rate(p_md, rate, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_media_player_set_rate(p_md, rate);
     }
     return hr;
 };
@@ -428,11 +396,7 @@ STDMETHODIMP VLCInput::get_fps(double* fps)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *fps = libvlc_media_player_get_fps(p_md, &ex);
-        hr = exception_bridge(&ex);
+        *fps = libvlc_media_player_get_fps(p_md);
     }
     return hr;
 };
@@ -446,86 +410,7 @@ STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *hasVout = libvlc_media_player_has_vout(p_md, &ex) ?
-                                VARIANT_TRUE : VARIANT_FALSE;
-        hr = exception_bridge(&ex);
-    }
-    return hr;
-};
-
-/****************************************************************************/
-
-VLCLog::~VLCLog()
-{
-    delete _p_vlcmessages;
-    if( _p_log )
-        libvlc_log_close(_p_log);
-}
-
-STDMETHODIMP VLCLog::get_messages(IVLCMessages** obj)
-{
-    if( NULL == obj )
-        return E_POINTER;
-
-    *obj = _p_vlcmessages;
-    if( NULL != _p_vlcmessages )
-    {
-        _p_vlcmessages->AddRef();
-        return NOERROR;
-    }
-    return E_OUTOFMEMORY;
-};
-
-STDMETHODIMP VLCLog::get_verbosity(long* level)
-{
-    if( NULL == level )
-        return E_POINTER;
-
-    if( _p_log )
-    {
-        libvlc_instance_t* p_libvlc;
-        HRESULT hr = getVLC(&p_libvlc);
-        if( SUCCEEDED(hr) )
-            *level = libvlc_get_log_verbosity(p_libvlc);
-        return hr;
-    }
-    else
-    {
-        /* log is not enabled, return -1 */
-        *level = -1;
-        return NOERROR;
-    }
-};
-
-STDMETHODIMP VLCLog::put_verbosity(long verbosity)
-{
-    libvlc_instance_t* p_libvlc;
-    HRESULT hr = getVLC(&p_libvlc);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        if( verbosity >= 0 )
-        {
-            if( ! _p_log )
-            {
-                _p_log = libvlc_log_open(p_libvlc, &ex);
-                hr = exception_bridge(&ex);
-            }
-            if( SUCCEEDED(hr) )
-                libvlc_set_log_verbosity(p_libvlc, (unsigned)verbosity);
-        }
-        else if( _p_log )
-        {
-            /* close log  when verbosity is set to -1 */
-            libvlc_log_close(_p_log);
-            _p_log = NULL;
-        }
-        hr = exception_bridge(&ex);
+        *hasVout = varbool( libvlc_media_player_has_vout(p_md) );
     }
     return hr;
 };
@@ -538,10 +423,7 @@ HRESULT VLCMarquee::do_put_int(unsigned idx, LONG val)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-        libvlc_video_set_marquee_int(p_md, idx, val, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_video_set_marquee_int(p_md, idx, val);
     }
     return hr;
 }
@@ -555,10 +437,7 @@ HRESULT VLCMarquee::do_get_int(unsigned idx, LONG *val)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-        *val = libvlc_video_get_marquee_int(p_md, idx, &ex);
-        hr = exception_bridge(&ex);
+        *val = libvlc_video_get_marquee_int(p_md, idx);
     }
     return hr;
 }
@@ -570,7 +449,6 @@ STDMETHODIMP VLCMarquee::get_position(BSTR* val)
 
     LONG i;
     HRESULT hr = do_get_int(libvlc_marquee_Position, &i);
-
     if(SUCCEEDED(hr))
         *val = BSTRFromCStr(CP_UTF8, position_bynumber(i));
 
@@ -603,13 +481,8 @@ STDMETHODIMP VLCMarquee::get_text(BSTR *val)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        psz = libvlc_video_get_marquee_string(p_md, libvlc_marquee_Text, &ex);
-
-        hr = exception_bridge(&ex);
-        if(SUCCEEDED(hr))
+        psz = libvlc_video_get_marquee_string(p_md, libvlc_marquee_Text);
+        if( psz )
             *val = BSTRFromCStr(CP_UTF8, psz);
     }
     return hr;
@@ -621,13 +494,8 @@ STDMETHODIMP VLCMarquee::put_text(BSTR val)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
         char *psz_text = CStrFromBSTR(CP_UTF8, val);
-        libvlc_video_set_marquee_string(p_md, libvlc_marquee_Text,
-                                        psz_text, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_video_set_marquee_string(p_md, libvlc_marquee_Text, psz_text);
         CoTaskMemFree(psz_text);
     }
     return hr;
@@ -635,285 +503,19 @@ STDMETHODIMP VLCMarquee::put_text(BSTR val)
 
 /****************************************************************************/
 
-/* STL forward iterator used by VLCEnumIterator class to implement IEnumVARIANT */
-
-class VLCMessageSTLIterator
-{
-
-public:
-
-    VLCMessageSTLIterator(IVLCMessageIterator* iter) : iter(iter), msg(NULL)
-    {
-        // get first message
-        operator++();
-    };
-
-    VLCMessageSTLIterator(const VLCMessageSTLIterator& other)
-    {
-        iter = other.iter;
-        if( iter )
-            iter->AddRef();
-        msg = other.msg;
-        if( msg )
-            msg->AddRef();
-    };
-
-    virtual ~VLCMessageSTLIterator()
-    {
-        if( msg )
-            msg->Release();
-
-        if( iter )
-            iter->Release();
-    };
-
-    // we only need prefix ++ operator
-    VLCMessageSTLIterator& operator++()
-    {
-        VARIANT_BOOL hasNext = VARIANT_FALSE;
-        if( iter )
-        {
-            iter->get_hasNext(&hasNext);
-
-            if( msg )
-            {
-                msg->Release();
-                msg = NULL;
-            }
-            if( VARIANT_TRUE == hasNext ) {
-                iter->next(&msg);
-            }
-        }
-        return *this;
-    };
-
-    VARIANT operator*() const
-    {
-        VARIANT v;
-        VariantInit(&v);
-        if( msg )
-        {
-            if( SUCCEEDED(msg->QueryInterface(IID_IDispatch,
-                          (LPVOID*)&V_DISPATCH(&v))) )
-            {
-                V_VT(&v) = VT_DISPATCH;
-            }
-        }
-        return v;
-    };
-
-    bool operator==(const VLCMessageSTLIterator& other) const
-    {
-        return msg == other.msg;
-    };
-
-    bool operator!=(const VLCMessageSTLIterator& other) const
-    {
-        return msg != other.msg;
-    };
-
-private:
-    IVLCMessageIterator* iter;
-    IVLCMessage*         msg;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP VLCMessages::get__NewEnum(LPUNKNOWN* _NewEnum)
-{
-    if( NULL == _NewEnum )
-        return E_POINTER;
-
-    IVLCMessageIterator* iter = NULL;
-    iterator(&iter);
-
-    *_NewEnum= new VLCEnumIterator<IID_IEnumVARIANT,
-                       IEnumVARIANT,
-                       VARIANT,
-                       VLCMessageSTLIterator>
-                       (VLCMessageSTLIterator(iter), VLCMessageSTLIterator(NULL));
-
-    return *_NewEnum ? S_OK : E_OUTOFMEMORY;
-};
-
-STDMETHODIMP VLCMessages::clear()
-{
-    libvlc_log_t *p_log = _p_vlclog->_p_log;
-    if( p_log )
-        libvlc_log_clear(p_log);
-    return NOERROR;
-};
-
-STDMETHODIMP VLCMessages::get_count(long* count)
-{
-    if( NULL == count )
-        return E_POINTER;
-
-    libvlc_log_t *p_log = _p_vlclog->_p_log;
-    *count = libvlc_log_count(p_log);
-    return S_OK;
-};
-
-STDMETHODIMP VLCMessages::iterator(IVLCMessageIterator** iter)
-{
-    if( NULL == iter )
-        return E_POINTER;
-
-    *iter = new VLCMessageIterator(Instance(), _p_vlclog);
-
-    return *iter ? S_OK : E_OUTOFMEMORY;
-};
-
-/****************************************************************************/
-
-VLCMessageIterator::VLCMessageIterator(VLCPlugin *p, VLCLog* p_vlclog ):
-        VLCInterface<VLCMessageIterator,IVLCMessageIterator>(p),
-        _refcount(1),
-        _p_vlclog(p_vlclog),
-        _p_iter(_p_vlclog && _p_vlclog->_p_log ?
-                libvlc_log_get_iterator(_p_vlclog->_p_log, NULL) : NULL)
-{
-}
-
-STDMETHODIMP VLCMessageIterator::get_hasNext(VARIANT_BOOL* hasNext)
-{
-    if( NULL == hasNext )
-        return E_POINTER;
-
-    *hasNext = (_p_iter && _p_vlclog->_p_log &&
-                libvlc_log_iterator_has_next(_p_iter)) ?
-                VARIANT_TRUE : VARIANT_FALSE;
-    return S_OK;
-};
-
-STDMETHODIMP VLCMessageIterator::next(IVLCMessage** message)
-{
-    HRESULT hr = S_OK;
-
-    if( NULL == message )
-        return E_POINTER;
-
-    if( _p_iter &&  _p_vlclog->_p_log )
-    {
-        struct libvlc_log_message_t buffer;
-
-        buffer.sizeof_msg = sizeof(buffer);
-
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_log_iterator_next(_p_iter, &buffer, &ex);
-        *message = new VLCMessage(Instance(), buffer);
-        if( !message )
-            hr = E_OUTOFMEMORY;
-    }
-    return hr;
-};
-
-/****************************************************************************/
-
-inline const char *msgSeverity(int sev)
-{
-    switch( sev )
-    {
-        case 0:
-            return "info";
-        case 1:
-            return "error";
-        case 2:
-            return "warning";
-        default:
-            return "debug";
-    }
-};
-
-STDMETHODIMP VLCMessage::get__Value(VARIANT* _Value)
-{
-    if( NULL == _Value )
-        return E_POINTER;
-
-    char buffer[256];
-
-    snprintf(buffer, sizeof(buffer), "%s %s %s: %s",
-        _msg.psz_type, _msg.psz_name, msgSeverity(_msg.i_severity), _msg.psz_message);
-
-    V_VT(_Value) = VT_BSTR;
-    V_BSTR(_Value) = BSTRFromCStr(CP_UTF8, buffer);
-
-    return S_OK;
-};
-
-STDMETHODIMP VLCMessage::get_severity(long* level)
-{
-    if( NULL == level )
-        return E_POINTER;
-
-    *level = _msg.i_severity;
-
-    return S_OK;
-};
-
-STDMETHODIMP VLCMessage::get_type(BSTR* type)
-{
-    if( NULL == type )
-        return E_POINTER;
-
-    *type = BSTRFromCStr(CP_UTF8, _msg.psz_type);
-
-    return NOERROR;
-};
-
-STDMETHODIMP VLCMessage::get_name(BSTR* name)
-{
-    if( NULL == name )
-        return E_POINTER;
-
-    *name = BSTRFromCStr(CP_UTF8, _msg.psz_name);
-
-    return NOERROR;
-};
-
-STDMETHODIMP VLCMessage::get_header(BSTR* header)
-{
-    if( NULL == header )
-        return E_POINTER;
-
-    *header = BSTRFromCStr(CP_UTF8, _msg.psz_header);
-
-    return NOERROR;
-};
-
-STDMETHODIMP VLCMessage::get_message(BSTR* message)
-{
-    if( NULL == message )
-        return E_POINTER;
-
-    *message = BSTRFromCStr(CP_UTF8, _msg.psz_message);
-
-    return NOERROR;
-};
-
-/****************************************************************************/
-
 STDMETHODIMP VLCPlaylistItems::get_count(long* count)
 {
     if( NULL == count )
         return E_POINTER;
 
-    libvlc_exception_t ex;
-    libvlc_exception_init(&ex);
-
-    *count = Instance()->playlist_count(&ex);
-    return exception_bridge(&ex);
+    *count = Instance()->playlist_count();
+    return S_OK;
 };
 
 STDMETHODIMP VLCPlaylistItems::clear()
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init(&ex);
-
-    Instance()->playlist_clear(&ex);
-    return exception_bridge(&ex);
+    Instance()->playlist_clear();
+    return S_OK;
 };
 
 STDMETHODIMP VLCPlaylistItems::remove(long item)
@@ -922,11 +524,7 @@ STDMETHODIMP VLCPlaylistItems::remove(long item)
     HRESULT hr = getVLC(&p_libvlc);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        Instance()->playlist_delete_item(item, &ex);
-        hr = exception_bridge(&ex);
+        Instance()->playlist_delete_item(item);
     }
     return hr;
 };
@@ -939,11 +537,8 @@ STDMETHODIMP VLCPlaylist::get_itemCount(long* count)
         return E_POINTER;
 
     *count = 0;
-    libvlc_exception_t ex;
-    libvlc_exception_init(&ex);
-
-    *count = Instance()->playlist_count(&ex);
-    return exception_bridge(&ex);
+    *count = Instance()->playlist_count();
+    return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying)
@@ -955,12 +550,7 @@ STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *isPlaying = libvlc_media_player_is_playing(p_md, &ex) ?
-                     VARIANT_TRUE: VARIANT_FALSE;
-        libvlc_exception_clear(&ex);
+        *isPlaying = varbool( libvlc_media_player_is_playing(p_md) );
     }
     return hr;
 };
@@ -977,9 +567,6 @@ STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* ite
     HRESULT hr = getVLC(&p_libvlc);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
         char *psz_uri = NULL;
         if( SysStringLen(Instance()->getBaseURL()) > 0 )
         {
@@ -1032,33 +619,26 @@ STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* ite
         }
 
         *item = Instance()->playlist_add_extended_untrusted(psz_uri,
-                    i_options, const_cast<const char **>(ppsz_options), &ex);
+                    i_options, const_cast<const char **>(ppsz_options));
 
         VLCControl::FreeTargetOptions(ppsz_options, i_options);
         CoTaskMemFree(psz_uri);
         if( psz_name ) /* XXX Do we even need to check? */
             CoTaskMemFree(psz_name);
-        hr = exception_bridge(&ex);
     }
     return hr;
 };
 
 STDMETHODIMP VLCPlaylist::play()
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init(&ex);
-
-    Instance()->playlist_play(&ex);
-    return exception_bridge(&ex);
+    Instance()->playlist_play();
+    return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::playItem(long item)
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init(&ex);
-
-    Instance()->playlist_play_item(item,&ex);
-    return exception_bridge(&ex);;
+    Instance()->playlist_play_item(item);
+    return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::togglePause()
@@ -1067,11 +647,7 @@ STDMETHODIMP VLCPlaylist::togglePause()
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_media_player_pause(p_md, &ex);
-        hr = exception_bridge(&ex);;
+        libvlc_media_player_pause(p_md);
     }
     return hr;
 };
@@ -1082,40 +658,27 @@ STDMETHODIMP VLCPlaylist::stop()
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_media_player_stop(p_md, &ex);
-        hr = exception_bridge(&ex);;
+        libvlc_media_player_stop(p_md);
     }
     return hr;
 };
 
 STDMETHODIMP VLCPlaylist::next()
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init(&ex);
-
-    Instance()->playlist_next(&ex);
-    return exception_bridge(&ex);;
+    Instance()->playlist_next();
+    return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::prev()
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init(&ex);
-
-    Instance()->playlist_prev(&ex);
-    return exception_bridge(&ex);;
+    Instance()->playlist_prev();
+    return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::clear()
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init(&ex);
-
-    Instance()->playlist_clear(&ex);
-    return exception_bridge(&ex);;
+    Instance()->playlist_clear();
+    return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::removeItem(long item)
@@ -1124,11 +687,7 @@ STDMETHODIMP VLCPlaylist::removeItem(long item)
     HRESULT hr = getVLC(&p_libvlc);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        Instance()->playlist_delete_item(item, &ex);
-        hr = exception_bridge(&ex);;
+        Instance()->playlist_delete_item(item);
     }
     return hr;
 };
@@ -1158,11 +717,7 @@ STDMETHODIMP VLCSubtitle::get_track(long* spu)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *spu = libvlc_video_get_spu(p_md, &ex);
-        hr = exception_bridge(&ex);
+        *spu = libvlc_video_get_spu(p_md);
     }
     return hr;
 };
@@ -1173,11 +728,7 @@ STDMETHODIMP VLCSubtitle::put_track(long spu)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_video_set_spu(p_md, spu, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_video_set_spu(p_md, spu);
     }
     return hr;
 };
@@ -1191,11 +742,8 @@ STDMETHODIMP VLCSubtitle::get_count(long* spuNumber)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
         // get the number of video subtitle available and return it
-        *spuNumber = libvlc_video_get_spu_count(p_md, &ex);
-        hr = exception_bridge(&ex);
+        *spuNumber = libvlc_video_get_spu_count(p_md);
     }
     return hr;
 };
@@ -1207,8 +755,6 @@ STDMETHODIMP VLCSubtitle::description(long nameID, BSTR* name)
        return E_POINTER;
 
     libvlc_media_player_t* p_md;
-    libvlc_exception_t ex;
-    libvlc_exception_init(&ex);
 
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
@@ -1218,16 +764,14 @@ STDMETHODIMP VLCSubtitle::description(long nameID, BSTR* name)
         libvlc_track_description_t *p_spuDesc;
 
         // get subtitles description
-        p_spuDesc = libvlc_video_get_spu_description(p_md, &ex);
-        hr = exception_bridge(&ex);
-        if( FAILED(hr) )
-            return hr;
+        p_spuDesc = libvlc_video_get_spu_description(p_md);
+        if( !p_spuDesc )
+            return E_FAIL;
 
         // get the number of available subtitle
-        i_limit = libvlc_video_get_spu_count(p_md, &ex);
-        hr = exception_bridge(&ex);
-        if( FAILED(hr) )
-            return hr;
+        i_limit = libvlc_video_get_spu_count(p_md);
+        if( i_limit < 0 )
+            return E_FAIL;
 
         // check if the number given is a good one
         if ( ( nameID > ( i_limit -1 ) ) || ( nameID < 0 ) )
@@ -1264,12 +808,7 @@ STDMETHODIMP VLCVideo::get_fullscreen(VARIANT_BOOL* fullscreen)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *fullscreen = libvlc_get_fullscreen(p_md, &ex) ?
-                      VARIANT_TRUE : VARIANT_FALSE;
-        hr = exception_bridge(&ex);
+        *fullscreen = varbool( libvlc_get_fullscreen(p_md) );
     }
     return hr;
 };
@@ -1280,11 +819,7 @@ STDMETHODIMP VLCVideo::put_fullscreen(VARIANT_BOOL fullscreen)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_set_fullscreen(p_md, VARIANT_FALSE != fullscreen, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_set_fullscreen(p_md, VARIANT_FALSE != fullscreen);
     }
     return hr;
 };
@@ -1298,11 +833,7 @@ STDMETHODIMP VLCVideo::get_width(long* width)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *width = libvlc_video_get_width(p_md, &ex);
-        hr = exception_bridge(&ex);
+        *width = libvlc_video_get_width(p_md);
     }
     return hr;
 };
@@ -1316,11 +847,7 @@ STDMETHODIMP VLCVideo::get_height(long* height)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *height = libvlc_video_get_height(p_md, &ex);
-        hr = exception_bridge(&ex);
+        *height = libvlc_video_get_height(p_md);
     }
     return hr;
 };
@@ -1334,18 +861,15 @@ STDMETHODIMP VLCVideo::get_aspectRatio(BSTR* aspect)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        char *psz_aspect = libvlc_video_get_aspect_ratio(p_md, &ex);
+        char *psz_aspect = libvlc_video_get_aspect_ratio(p_md);
 
-        hr = exception_bridge(&ex);
-        if( SUCCEEDED(hr) && NULL != psz_aspect )
+        if( !psz_aspect )
         {
             *aspect = BSTRFromCStr(CP_UTF8, psz_aspect);
             if( NULL == *aspect )
                 hr = E_OUTOFMEMORY;
-        } else if( NULL == psz_aspect) hr = E_OUTOFMEMORY; // strdup("") failed
+        } else if( NULL == psz_aspect)
+                hr = E_OUTOFMEMORY;
         free( psz_aspect );
     }
     return hr;
@@ -1360,19 +884,15 @@ STDMETHODIMP VLCVideo::put_aspectRatio(BSTR aspect)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
         char *psz_aspect = CStrFromBSTR(CP_UTF8, aspect);
-        if( NULL == psz_aspect )
+        if( !psz_aspect )
         {
             return E_OUTOFMEMORY;
         }
 
-        libvlc_video_set_aspect_ratio(p_md, psz_aspect, &ex);
+        libvlc_video_set_aspect_ratio(p_md, psz_aspect);
 
         CoTaskMemFree(psz_aspect);
-        hr = exception_bridge(&ex);
     }
     return hr;
 };
@@ -1386,11 +906,7 @@ STDMETHODIMP VLCVideo::get_subtitle(long* spu)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *spu = libvlc_video_get_spu(p_md, &ex);
-        hr = exception_bridge(&ex);
+        *spu = libvlc_video_get_spu(p_md);
     }
     return hr;
 };
@@ -1401,11 +917,7 @@ STDMETHODIMP VLCVideo::put_subtitle(long spu)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_video_set_spu(p_md, spu, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_video_set_spu(p_md, spu);
     }
     return hr;
 };
@@ -1419,17 +931,14 @@ STDMETHODIMP VLCVideo::get_crop(BSTR* geometry)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        char *psz_geometry = libvlc_video_get_crop_geometry(p_md, &ex);
-
-        hr = exception_bridge(&ex);
-        if( SUCCEEDED(&ex) && NULL != psz_geometry )
+        char *psz_geometry = libvlc_video_get_crop_geometry(p_md);
+        if( !psz_geometry )
         {
             *geometry = BSTRFromCStr(CP_UTF8, psz_geometry);
-            if( NULL == geometry ) hr = E_OUTOFMEMORY;
-        } else if( NULL == psz_geometry ) hr = E_OUTOFMEMORY;
+            if( !geometry )
+                hr = E_OUTOFMEMORY;
+        } else if( !psz_geometry )
+                hr = E_OUTOFMEMORY;
         free( psz_geometry );
     }
     return hr;
@@ -1447,19 +956,15 @@ STDMETHODIMP VLCVideo::put_crop(BSTR geometry)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
         char *psz_geometry = CStrFromBSTR(CP_UTF8, geometry);
-        if( NULL == psz_geometry )
+        if( !psz_geometry )
         {
             return E_OUTOFMEMORY;
         }
 
-        libvlc_video_set_crop_geometry(p_md, psz_geometry, &ex);
+        libvlc_video_set_crop_geometry(p_md, psz_geometry);
 
         CoTaskMemFree(psz_geometry);
-        hr = exception_bridge(&ex);
     }
     return hr;
 };
@@ -1473,59 +978,20 @@ STDMETHODIMP VLCVideo::get_teletext(long* page)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        *page = libvlc_video_get_teletext(p_md, &ex);
-        hr = exception_bridge(&ex);
+        *page = libvlc_video_get_teletext(p_md);
     }
-    return hr;
-};
-
-STDMETHODIMP VLCVideo::put_teletext(long page)
-{
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
 
-        libvlc_video_set_teletext(p_md, page, &ex);
-        hr = exception_bridge(&ex);
-    }
     return hr;
 };
 
-STDMETHODIMP VLCVideo::deinterlaceDisable()
+STDMETHODIMP VLCVideo::put_teletext(long page)
 {
     libvlc_media_player_t *p_md;
     HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_video_set_deinterlace(p_md, 0, "", &ex);
-        hr = exception_bridge(&ex);
-    }
-    return hr;
-};
 
-STDMETHODIMP VLCVideo::deinterlaceEnable(BSTR mode)
-{
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-        /* get deinterlace mode from the user */
-        char *psz_mode = CStrFromBSTR(CP_UTF8, mode);
-        /* enable deinterlace filter if possible */
-        libvlc_video_set_deinterlace(p_md, 1, psz_mode, &ex);
-        hr = exception_bridge(&ex);
-        CoTaskMemFree(psz_mode);
+        libvlc_video_set_teletext(p_md, page);
     }
     return hr;
 };
@@ -1539,9 +1005,6 @@ STDMETHODIMP VLCVideo::takeSnapshot(LPPICTUREDISP* picture)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
         static int uniqueId = 0;
         TCHAR path[MAX_PATH+1];
 
@@ -1601,9 +1064,7 @@ STDMETHODIMP VLCVideo::takeSnapshot(LPPICTUREDISP* picture)
             return E_FAIL;
 
         /* take snapshot into file */
-        libvlc_video_take_snapshot(p_md, psz_filepath, 0, 0, &ex);
-        hr = exception_bridge(&ex);
-        if( SUCCEEDED(hr) )
+        if( libvlc_video_take_snapshot(p_md, 0, psz_filepath, 0, 0) == 0 )
         {
             /* open snapshot file */
             HANDLE snapPic = LoadImage(NULL, filepath, IMAGE_BITMAP, 0, 0,
@@ -1637,11 +1098,7 @@ STDMETHODIMP VLCVideo::toggleFullscreen()
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_toggle_fullscreen(p_md, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_toggle_fullscreen(p_md);
     }
     return hr;
 };
@@ -1652,43 +1109,25 @@ STDMETHODIMP VLCVideo::toggleTeletext()
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_toggle_teletext(p_md, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_toggle_teletext(p_md);
     }
     return hr;
 };
 
 STDMETHODIMP VLCVideo::get_marquee(IVLCMarquee** obj)
 {
-    if( NULL == obj )
-        return E_POINTER;
-
-    *obj = _p_vlcmarquee;
-    if( NULL != _p_vlcmarquee )
-    {
-        _p_vlcmarquee->AddRef();
-        return NOERROR;
-    }
-    return E_OUTOFMEMORY;
-};
+    return object_get(obj,_p_vlcmarquee);
+}
 
 STDMETHODIMP VLCVideo::get_logo(IVLCLogo** obj)
 {
-    if( NULL == obj )
-        return E_POINTER;
-
-    *obj = _p_vlclogo;
-    if( NULL != _p_vlclogo )
-    {
-        _p_vlclogo->AddRef();
-        return NOERROR;
-    }
-    return E_OUTOFMEMORY;
+    return object_get(obj,_p_vlclogo);
 }
 
+STDMETHODIMP VLCVideo::get_deinterlace(IVLCDeinterlace** obj)
+{
+    return object_get(obj,_p_vlcdeint);
+}
 
 /****************************************************************************/
 
@@ -1698,10 +1137,7 @@ HRESULT VLCLogo::do_put_int(unsigned idx, LONG val)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-        libvlc_video_set_logo_int(p_md, idx, val, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_video_set_logo_int(p_md, idx, val);
     }
     return hr;
 }
@@ -1715,10 +1151,7 @@ HRESULT VLCLogo::do_get_int(unsigned idx, LONG *val)
     HRESULT hr = getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-        *val = libvlc_video_get_logo_int(p_md, idx, &ex);
-        hr = exception_bridge(&ex);
+        *val = libvlc_video_get_logo_int(p_md, idx);
     }
     return hr;
 }
@@ -1733,10 +1166,7 @@ STDMETHODIMP VLCLogo::file(BSTR fname)
 
     if( SUCCEEDED(hr) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-        libvlc_video_set_logo_string(p_md, libvlc_logo_file, n, &ex);
-        hr = exception_bridge(&ex);
+        libvlc_video_set_logo_string(p_md, libvlc_logo_file, n);
     }
 
     CoTaskMemFree(n);
@@ -1780,7 +1210,6 @@ VLCControl2::VLCControl2(VLCPlugin *p_instance) :
     _p_typeinfo(NULL),
     _p_vlcaudio(new VLCAudio(p_instance)),
     _p_vlcinput(new VLCInput(p_instance)),
-    _p_vlclog(new VLCLog(p_instance)),
     _p_vlcplaylist(new VLCPlaylist(p_instance)),
     _p_vlcsubtitle(new VLCSubtitle(p_instance)),
     _p_vlcvideo(new VLCVideo(p_instance))
@@ -1792,7 +1221,6 @@ VLCControl2::~VLCControl2()
     delete _p_vlcvideo;
     delete _p_vlcsubtitle;
     delete _p_vlcplaylist;
-    delete _p_vlclog;
     delete _p_vlcinput;
     delete _p_vlcaudio;
     if( _p_typeinfo )
@@ -1875,7 +1303,7 @@ STDMETHODIMP VLCControl2::get_AutoLoop(VARIANT_BOOL *autoloop)
     if( NULL == autoloop )
         return E_POINTER;
 
-    *autoloop = _p_instance->getAutoLoop() ? VARIANT_TRUE: VARIANT_FALSE;
+    *autoloop = varbool( _p_instance->getAutoLoop() );
     return S_OK;
 };
 
@@ -1890,7 +1318,7 @@ STDMETHODIMP VLCControl2::get_AutoPlay(VARIANT_BOOL *autoplay)
     if( NULL == autoplay )
         return E_POINTER;
 
-    *autoplay = _p_instance->getAutoPlay() ? VARIANT_TRUE: VARIANT_FALSE;
+    *autoplay = varbool( _p_instance->getAutoPlay() );
     return S_OK;
 };
 
@@ -1952,7 +1380,7 @@ STDMETHODIMP VLCControl2::get_Toolbar(VARIANT_BOOL *visible)
      */
 
     /* DISABLED for now */
-    //  *visible = _p_instance->getShowToolbar() ? VARIANT_TRUE: VARIANT_FALSE;
+    //  *visible = varbool( _p_instance->getShowToolbar() );
 
     *visible = VARIANT_FALSE;
 
@@ -1972,15 +1400,13 @@ STDMETHODIMP VLCControl2::get_StartTime(long *seconds)
         return E_POINTER;
 
     *seconds = _p_instance->getStartTime();
-
     return S_OK;
 };
 
 STDMETHODIMP VLCControl2::put_StartTime(long seconds)
 {
     _p_instance->setStartTime(seconds);
-
-    return NOERROR;
+    return S_OK;
 };
 
 STDMETHODIMP VLCControl2::get_VersionInfo(BSTR *version)
@@ -2004,16 +1430,15 @@ STDMETHODIMP VLCControl2::get_Visible(VARIANT_BOOL *isVisible)
     if( NULL == isVisible )
         return E_POINTER;
 
-    *isVisible = _p_instance->getVisible() ? VARIANT_TRUE : VARIANT_FALSE;
+    *isVisible = varbool( _p_instance->getVisible() );
 
-    return NOERROR;
+    return S_OK;
 };
 
 STDMETHODIMP VLCControl2::put_Visible(VARIANT_BOOL isVisible)
 {
     _p_instance->setVisible(isVisible != VARIANT_FALSE);
-
-    return NOERROR;
+    return S_OK;
 };
 
 STDMETHODIMP VLCControl2::get_Volume(long *volume)
@@ -2022,13 +1447,13 @@ STDMETHODIMP VLCControl2::get_Volume(long *volume)
         return E_POINTER;
 
     *volume  = _p_instance->getVolume();
-    return NOERROR;
+    return S_OK;
 };
 
 STDMETHODIMP VLCControl2::put_Volume(long volume)
 {
     _p_instance->setVolume(volume);
-    return NOERROR;
+    return S_OK;
 };
 
 STDMETHODIMP VLCControl2::get_BackColor(OLE_COLOR *backcolor)
@@ -2037,95 +1462,36 @@ STDMETHODIMP VLCControl2::get_BackColor(OLE_COLOR *backcolor)
         return E_POINTER;
 
     *backcolor  = _p_instance->getBackColor();
-    return NOERROR;
+    return S_OK;
 };
 
 STDMETHODIMP VLCControl2::put_BackColor(OLE_COLOR backcolor)
 {
     _p_instance->setBackColor(backcolor);
-    return NOERROR;
+    return S_OK;
 };
 
 STDMETHODIMP VLCControl2::get_audio(IVLCAudio** obj)
 {
-    if( NULL == obj )
-        return E_POINTER;
-
-    *obj = _p_vlcaudio;
-    if( NULL != _p_vlcaudio )
-    {
-        _p_vlcaudio->AddRef();
-        return NOERROR;
-    }
-    return E_OUTOFMEMORY;
-};
+    return object_get(obj,_p_vlcaudio);
+}
 
 STDMETHODIMP VLCControl2::get_input(IVLCInput** obj)
 {
-    if( NULL == obj )
-        return E_POINTER;
-
-    *obj = _p_vlcinput;
-    if( NULL != _p_vlcinput )
-    {
-        _p_vlcinput->AddRef();
-        return NOERROR;
-    }
-    return E_OUTOFMEMORY;
-};
-
-STDMETHODIMP VLCControl2::get_log(IVLCLog** obj)
-{
-    if( NULL == obj )
-        return E_POINTER;
-
-    *obj = _p_vlclog;
-    if( NULL != _p_vlclog )
-    {
-        _p_vlclog->AddRef();
-        return NOERROR;
-    }
-    return E_OUTOFMEMORY;
-};
+    return object_get(obj,_p_vlcinput);
+}
 
 STDMETHODIMP VLCControl2::get_playlist(IVLCPlaylist** obj)
 {
-    if( NULL == obj )
-        return E_POINTER;
-
-    *obj = _p_vlcplaylist;
-    if( NULL != _p_vlcplaylist )
-    {
-        _p_vlcplaylist->AddRef();
-        return NOERROR;
-    }
-    return E_OUTOFMEMORY;
-};
+    return object_get(obj,_p_vlcplaylist);
+}
 
 STDMETHODIMP VLCControl2::get_subtitle(IVLCSubtitle** obj)
 {
-    if( NULL == obj )
-        return E_POINTER;
-
-    *obj = _p_vlcsubtitle;
-    if( NULL != _p_vlcsubtitle )
-    {
-        _p_vlcsubtitle->AddRef();
-        return NOERROR;
-    }
-    return E_OUTOFMEMORY;
-};
+    return object_get(obj,_p_vlcsubtitle);
+}
 
 STDMETHODIMP VLCControl2::get_video(IVLCVideo** obj)
 {
-    if( NULL == obj )
-        return E_POINTER;
-
-    *obj = _p_vlcvideo;
-    if( NULL != _p_vlcvideo )
-    {
-        _p_vlcvideo->AddRef();
-        return NOERROR;
-    }
-    return E_OUTOFMEMORY;
-};
+    return object_get(obj,_p_vlcvideo);
+}