Commit 8fa162cf authored by JP Dinger's avatar JP Dinger

Cosmetics: activex plugin: add a helper for bool -> VARIANT_BOOL.

parent d9fed02a
...@@ -87,8 +87,10 @@ HRESULT object_get(I **dst, I *src) ...@@ -87,8 +87,10 @@ HRESULT object_get(I **dst, I *src)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
// --------- static inline
VARIANT_BOOL varbool(bool b) { return b ? VARIANT_TRUE : VARIANT_FALSE; }
// ---------
STDMETHODIMP VLCAudio::get_mute(VARIANT_BOOL* mute) STDMETHODIMP VLCAudio::get_mute(VARIANT_BOOL* mute)
{ {
...@@ -98,8 +100,7 @@ STDMETHODIMP VLCAudio::get_mute(VARIANT_BOOL* mute) ...@@ -98,8 +100,7 @@ STDMETHODIMP VLCAudio::get_mute(VARIANT_BOOL* mute)
libvlc_instance_t* p_libvlc; libvlc_instance_t* p_libvlc;
HRESULT hr = getVLC(&p_libvlc); HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
*mute = libvlc_audio_get_mute(p_libvlc) ? *mute = varbool( libvlc_audio_get_mute(p_libvlc) );
VARIANT_TRUE : VARIANT_FALSE;
return hr; return hr;
}; };
...@@ -460,8 +461,7 @@ STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout) ...@@ -460,8 +461,7 @@ STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout)
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
*hasVout = libvlc_media_player_has_vout(p_md, &ex) ? *hasVout = varbool( libvlc_media_player_has_vout(p_md, &ex) );
VARIANT_TRUE : VARIANT_FALSE;
hr = exception_bridge(&ex); hr = exception_bridge(&ex);
} }
return hr; return hr;
...@@ -635,8 +635,7 @@ STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying) ...@@ -635,8 +635,7 @@ STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying)
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
*isPlaying = libvlc_media_player_is_playing(p_md) ? *isPlaying = varbool( libvlc_media_player_is_playing(p_md) );
VARIANT_TRUE: VARIANT_FALSE;
libvlc_exception_clear(&ex); libvlc_exception_clear(&ex);
} }
return hr; return hr;
...@@ -944,8 +943,7 @@ STDMETHODIMP VLCVideo::get_fullscreen(VARIANT_BOOL* fullscreen) ...@@ -944,8 +943,7 @@ STDMETHODIMP VLCVideo::get_fullscreen(VARIANT_BOOL* fullscreen)
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
*fullscreen = libvlc_get_fullscreen(p_md, &ex) ? *fullscreen = varbool( libvlc_get_fullscreen(p_md, &ex) );
VARIANT_TRUE : VARIANT_FALSE;
hr = exception_bridge(&ex); hr = exception_bridge(&ex);
} }
return hr; return hr;
...@@ -1537,7 +1535,7 @@ STDMETHODIMP VLCControl2::get_AutoLoop(VARIANT_BOOL *autoloop) ...@@ -1537,7 +1535,7 @@ STDMETHODIMP VLCControl2::get_AutoLoop(VARIANT_BOOL *autoloop)
if( NULL == autoloop ) if( NULL == autoloop )
return E_POINTER; return E_POINTER;
*autoloop = _p_instance->getAutoLoop() ? VARIANT_TRUE: VARIANT_FALSE; *autoloop = varbool( _p_instance->getAutoLoop() );
return S_OK; return S_OK;
}; };
...@@ -1552,7 +1550,7 @@ STDMETHODIMP VLCControl2::get_AutoPlay(VARIANT_BOOL *autoplay) ...@@ -1552,7 +1550,7 @@ STDMETHODIMP VLCControl2::get_AutoPlay(VARIANT_BOOL *autoplay)
if( NULL == autoplay ) if( NULL == autoplay )
return E_POINTER; return E_POINTER;
*autoplay = _p_instance->getAutoPlay() ? VARIANT_TRUE: VARIANT_FALSE; *autoplay = varbool( _p_instance->getAutoPlay() );
return S_OK; return S_OK;
}; };
...@@ -1614,7 +1612,7 @@ STDMETHODIMP VLCControl2::get_Toolbar(VARIANT_BOOL *visible) ...@@ -1614,7 +1612,7 @@ STDMETHODIMP VLCControl2::get_Toolbar(VARIANT_BOOL *visible)
*/ */
/* DISABLED for now */ /* DISABLED for now */
// *visible = _p_instance->getShowToolbar() ? VARIANT_TRUE: VARIANT_FALSE; // *visible = varbool( _p_instance->getShowToolbar() );
*visible = VARIANT_FALSE; *visible = VARIANT_FALSE;
...@@ -1666,7 +1664,7 @@ STDMETHODIMP VLCControl2::get_Visible(VARIANT_BOOL *isVisible) ...@@ -1666,7 +1664,7 @@ STDMETHODIMP VLCControl2::get_Visible(VARIANT_BOOL *isVisible)
if( NULL == isVisible ) if( NULL == isVisible )
return E_POINTER; return E_POINTER;
*isVisible = _p_instance->getVisible() ? VARIANT_TRUE : VARIANT_FALSE; *isVisible = varbool( _p_instance->getVisible() );
return NOERROR; return NOERROR;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment