* Copyright (C) 2005 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
+ * Jean-Paul Saman <jpsaman@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
STDMETHODIMP VLCControl::play(void)
{
- int i_vlc;
- HRESULT result = _p_instance->getVLCObject(&i_vlc);
+ libvlc_instance_t* p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- VLC_Play(i_vlc);
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_playlist_play(p_libvlc, -1, 0, NULL, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
_p_instance->fireOnPlayEvent();
+ return NOERROR;
}
return result;
};
STDMETHODIMP VLCControl::pause(void)
{
- int i_vlc;
- HRESULT result = _p_instance->getVLCObject(&i_vlc);
+ libvlc_instance_t* p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- VLC_Pause(i_vlc);
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_playlist_pause(p_libvlc, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
_p_instance->fireOnPauseEvent();
+ return NOERROR;
}
return result;
};
STDMETHODIMP VLCControl::stop(void)
{
- int i_vlc;
- HRESULT result = _p_instance->getVLCObject(&i_vlc);
+ libvlc_instance_t* p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- VLC_Stop(i_vlc);
- _p_instance->fireOnStopEvent();
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_playlist_stop(p_libvlc, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
+ return NOERROR;
}
+ _p_instance->fireOnStopEvent();
return result;
};
HRESULT result = NOERROR;
if( _p_instance->isRunning() )
{
- int i_vlc;
- result = _p_instance->getVLCObject(&i_vlc);
+ libvlc_instance_t *p_libvlc;
+ result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- *isPlaying = VLC_IsPlaying(i_vlc) ? VARIANT_TRUE : VARIANT_FALSE;
+ if( libvlc_playlist_isplaying(p_libvlc, NULL) )
+ *isPlaying = VARIANT_TRUE;
+ else
+ *isPlaying = VARIANT_FALSE;
return NOERROR;
}
}
{
if( NULL == position )
return E_POINTER;
+ *position = 0.0f;
+ libvlc_instance_t* p_libvlc;
HRESULT result = E_UNEXPECTED;
- if( _p_instance->isRunning() )
+ result = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(result) )
{
- int i_vlc;
- result = _p_instance->getVLCObject(&i_vlc);
- if( SUCCEEDED(result) )
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_media_player_t *p_md;
+ p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
+ if( !libvlc_exception_raised(&ex) )
{
- *position = VLC_PositionGet(i_vlc);
- return NOERROR;
+ *position = libvlc_media_player_get_position(p_md, &ex);
+ libvlc_media_player_release(p_md);
+ if( ! libvlc_exception_raised(&ex) )
+ {
+ return NOERROR;
+ }
}
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
}
- *position = 0.0f;
return result;
};
STDMETHODIMP VLCControl::put_Position(float position)
{
HRESULT result = E_UNEXPECTED;
- if( _p_instance->isRunning() )
+ libvlc_instance_t* p_libvlc;
+ result = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(result) )
{
- int i_vlc;
- result = _p_instance->getVLCObject(&i_vlc);
- if( SUCCEEDED(result) )
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_media_player_t *p_md;
+ p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
+ if( ! libvlc_exception_raised(&ex) )
{
- VLC_PositionSet(i_vlc, position);
+ libvlc_media_player_set_position(p_md, position, &ex);
+ libvlc_media_player_release(p_md);
+ if( ! libvlc_exception_raised(&ex) )
+ {
+ return NOERROR;
+ }
}
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
}
return result;
};
if( NULL == seconds )
return E_POINTER;
- HRESULT result = NOERROR;
- if( _p_instance->isRunning() )
+ *seconds = 0;
+ libvlc_instance_t* p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(result) )
{
- int i_vlc;
- result = _p_instance->getVLCObject(&i_vlc);
- if( SUCCEEDED(result) )
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_media_player_t *p_md;
+ p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
+ if( ! libvlc_exception_raised(&ex) )
{
- *seconds = VLC_TimeGet(i_vlc);
+ *seconds = libvlc_media_player_get_time(p_md, &ex);
+ libvlc_media_player_release(p_md);
+ if( ! libvlc_exception_raised(&ex) )
+ {
+ return NOERROR;
+ }
}
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
}
- else
- *seconds = _p_instance->getTime();
-
return result;
};
STDMETHODIMP VLCControl::put_Time(int seconds)
{
+ /* setTime function of the plugin sets the time. */
_p_instance->setTime(seconds);
-
return NOERROR;
};
STDMETHODIMP VLCControl::shuttle(int seconds)
{
- HRESULT result = E_UNEXPECTED;
- if( _p_instance->isRunning() )
+ libvlc_instance_t* p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(result) )
{
- int i_vlc;
- result = _p_instance->getVLCObject(&i_vlc);
- if( SUCCEEDED(result) )
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_media_player_t *p_md;
+ p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
+ if( ! libvlc_exception_raised(&ex) )
{
- VLC_TimeSet(i_vlc, seconds, VLC_TRUE);
+ if( seconds < 0 ) seconds = 0;
+ libvlc_media_player_set_time(p_md, (int64_t)seconds, &ex);
+ libvlc_media_player_release(p_md);
+ if( ! libvlc_exception_raised(&ex) )
+ {
+ return NOERROR;
+ }
}
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
}
return result;
+
};
STDMETHODIMP VLCControl::fullscreen(void)
HRESULT result = E_UNEXPECTED;
if( _p_instance->isRunning() )
{
- int i_vlc;
- result = _p_instance->getVLCObject(&i_vlc);
+ libvlc_instance_t *p_libvlc;
+ result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- VLC_FullScreen(i_vlc);
+ if( libvlc_playlist_isplaying(p_libvlc, NULL) )
+ {
+ libvlc_media_player_t *p_md =
+ libvlc_playlist_get_media_player(p_libvlc, NULL);
+ if( p_md )
+ {
+ libvlc_toggle_fullscreen(p_md, NULL);
+ libvlc_media_player_release(p_md);
+ }
+ }
}
}
return result;
{
if( NULL == seconds )
return E_POINTER;
+ *seconds = 0;
- HRESULT result = NOERROR;
- if( _p_instance->isRunning() )
+ libvlc_instance_t* p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(result) )
{
- int i_vlc;
- result = _p_instance->getVLCObject(&i_vlc);
- if( SUCCEEDED(result) )
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_media_player_t *p_md;
+ p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
+ if( ! libvlc_exception_raised(&ex) )
{
- *seconds = VLC_LengthGet(i_vlc);
- return NOERROR;
+ *seconds = (double)libvlc_media_player_get_length(p_md, &ex);
+ libvlc_media_player_release(p_md);
+ if( ! libvlc_exception_raised(&ex) )
+ {
+ return NOERROR;
+ }
}
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
}
- *seconds = 0;
return result;
+
};
STDMETHODIMP VLCControl::playFaster(void)
{
+ int32_t rate = 2;
+
HRESULT result = E_UNEXPECTED;
- if( _p_instance->isRunning() )
+ if( !_p_instance->isRunning() )
+ return result;
+
+ libvlc_instance_t* p_libvlc;
+ result = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(result) )
{
- int i_vlc;
- result = _p_instance->getVLCObject(&i_vlc);
- if( SUCCEEDED(result) )
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_media_player_t *p_md;
+ p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
+ if( ! libvlc_exception_raised(&ex) )
{
- VLC_SpeedFaster(i_vlc);
+ libvlc_media_player_set_rate(p_md, rate, &ex);
+ libvlc_media_player_release(p_md);
+ if( ! libvlc_exception_raised(&ex) )
+ {
+ return NOERROR;
+ }
}
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
}
return result;
};
STDMETHODIMP VLCControl::playSlower(void)
{
+ float rate = 0.5;
+
HRESULT result = E_UNEXPECTED;
- if( _p_instance->isRunning() )
+ if( !_p_instance->isRunning() )
+ return result;
+
+ libvlc_instance_t* p_libvlc;
+ result = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(result) )
{
- int i_vlc;
- result = _p_instance->getVLCObject(&i_vlc);
- if( SUCCEEDED(result) )
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_media_player_t *p_md;
+ p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
+ if( ! libvlc_exception_raised(&ex) )
{
- VLC_SpeedSlower(i_vlc);
+ libvlc_media_player_set_rate(p_md, rate, &ex);
+ libvlc_media_player_release(p_md);
+ if( ! libvlc_exception_raised(&ex) )
+ {
+ return NOERROR;
+ }
}
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
}
return result;
};
STDMETHODIMP VLCControl::toggleMute(void)
{
- int i_vlc;
- HRESULT result = _p_instance->getVLCObject(&i_vlc);
+ libvlc_instance_t* p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- VLC_VolumeMute(i_vlc);
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_audio_toggle_mute(p_libvlc, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
+ return NOERROR;
}
return result;
};
STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value)
{
- if( 0 == SysStringLen(name) )
- return E_INVALIDARG;
-
- int i_vlc;
- HRESULT hr = _p_instance->getVLCObject(&i_vlc);
- if( SUCCEEDED(hr) )
+ libvlc_instance_t* p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(result) )
{
- int codePage = _p_instance->getCodePage();
- char *psz_varname = CStrFromBSTR(codePage, name);
- if( NULL == psz_varname )
- return E_OUTOFMEMORY;
-
- int i_type;
- vlc_value_t val;
-
- if( VLC_SUCCESS == VLC_VariableType(i_vlc, psz_varname, &i_type) )
- {
- VARIANT arg;
- VariantInit(&arg);
-
- switch( i_type )
- {
- case VLC_VAR_BOOL:
- hr = VariantChangeType(&arg, &value, 0, VT_BOOL);
- if( SUCCEEDED(hr) )
- val.b_bool = (VARIANT_TRUE == V_BOOL(&arg)) ? VLC_TRUE : VLC_FALSE;
- break;
-
- case VLC_VAR_INTEGER:
- case VLC_VAR_HOTKEY:
- hr = VariantChangeType(&arg, &value, 0, VT_I4);
- if( SUCCEEDED(hr) )
- val.i_int = V_I4(&arg);
- break;
-
- case VLC_VAR_FLOAT:
- hr = VariantChangeType(&arg, &value, 0, VT_R4);
- if( SUCCEEDED(hr) )
- val.f_float = V_R4(&arg);
- break;
-
- case VLC_VAR_STRING:
- case VLC_VAR_MODULE:
- case VLC_VAR_FILE:
- case VLC_VAR_DIRECTORY:
- case VLC_VAR_VARIABLE:
- hr = VariantChangeType(&arg, &value, 0, VT_BSTR);
- if( SUCCEEDED(hr) )
- {
- i_type = VLC_VAR_STRING;
- val.psz_string = CStrFromBSTR(codePage, V_BSTR(&arg));
- VariantClear(&arg);
- }
- break;
-
- case VLC_VAR_TIME:
- // use a double value to represent time (base is expressed in seconds)
- hr = VariantChangeType(&arg, &value, 0, VT_R8);
- if( SUCCEEDED(hr) )
- val.i_time = (signed __int64)(V_R8(&arg)*1000000.0);
- break;
-
- default:
- hr = DISP_E_TYPEMISMATCH;
- }
- }
- else {
- // no defined type, use type in VARIANT
- hr = NO_ERROR;
- switch( V_VT(&value) )
- {
- case VT_BOOL:
- val.b_bool = (VARIANT_TRUE == V_BOOL(&value)) ? VLC_TRUE : VLC_FALSE;
- i_type = VLC_VAR_BOOL;
- break;
- case VT_I4:
- val.i_int = V_I4(&value);
- i_type = VLC_VAR_INTEGER;
- break;
- case VT_R4:
- val.f_float = V_R4(&value);
- i_type = VLC_VAR_FLOAT;
- break;
- case VT_BSTR:
- val.psz_string = CStrFromBSTR(codePage, V_BSTR(&value));
- i_type = VLC_VAR_STRING;
- break;
- case VT_R8:
- // use a double value to represent time (base is expressed in seconds)
- val.i_time = (signed __int64)(V_R8(&value)*1000000.0);
- i_type = VLC_VAR_TIME;
- break;
- default:
- hr = DISP_E_TYPEMISMATCH;
- }
- }
- if( SUCCEEDED(hr) )
- {
- hr = (VLC_SUCCESS == VLC_VariableSet(i_vlc, psz_varname, val)) ? NOERROR : E_FAIL;
-
- if( (VLC_VAR_STRING == i_type) && (NULL != val.psz_string) )
- CoTaskMemFree(val.psz_string);
- }
- CoTaskMemFree(psz_varname);
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ "setVariable() is an unsafe interface to use. "
+ "It has been removed because of security implications." );
}
- return hr;
+ return E_FAIL;
};
-STDMETHODIMP VLCControl::getVariable( BSTR name, VARIANT *value)
+STDMETHODIMP VLCControl::getVariable(BSTR name, VARIANT *value)
{
- if( NULL == value )
- return E_POINTER;
-
- VariantInit(value);
-
- if( 0 == SysStringLen(name) )
- return E_INVALIDARG;
-
- int i_vlc;
- HRESULT hr = _p_instance->getVLCObject(&i_vlc);
- if( SUCCEEDED(hr) )
+ libvlc_instance_t* p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(result) )
{
- UINT codePage = _p_instance->getCodePage();
- char *psz_varname = CStrFromBSTR(codePage, name);
- if( NULL == psz_varname )
- return E_OUTOFMEMORY;
-
- hr = E_INVALIDARG;
-
- vlc_value_t val;
- int i_type;
-
- if( (VLC_SUCCESS == VLC_VariableGet(i_vlc, psz_varname, &val))
- && (VLC_SUCCESS == VLC_VariableType(i_vlc, psz_varname, &i_type)) )
- {
- hr = NOERROR;
- switch( i_type )
- {
- case VLC_VAR_BOOL:
- V_VT(value) = VT_BOOL;
- V_BOOL(value) = val.b_bool ? VARIANT_TRUE : VARIANT_FALSE;
- break;
-
- case VLC_VAR_INTEGER:
- case VLC_VAR_HOTKEY:
- V_VT(value) = VT_I4;
- V_I4(value) = val.i_int;
- break;
-
- case VLC_VAR_FLOAT:
- V_VT(value) = VT_R4;
- V_R4(value) = val.f_float;
- break;
-
- case VLC_VAR_STRING:
- case VLC_VAR_MODULE:
- case VLC_VAR_FILE:
- case VLC_VAR_DIRECTORY:
- case VLC_VAR_VARIABLE:
- V_VT(value) = VT_BSTR;
- V_BSTR(value) = BSTRFromCStr(codePage, val.psz_string);
- if( NULL != val.psz_string)
- free(val.psz_string);
- break;
-
- case VLC_VAR_TIME:
- // use a double value to represent time (base is expressed in seconds)
- V_VT(value) = VT_R8;
- V_R8(value) = ((double)val.i_time)/1000000.0;
- break;
-
- default:
- hr = DISP_E_TYPEMISMATCH;
- }
- }
- CoTaskMemFree(psz_varname);
- return hr;
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ "getVariable() is an unsafe interface to use. "
+ "It has been removed because of security implications." );
}
- return hr;
+ return E_FAIL;
};
void VLCControl::FreeTargetOptions(char **cOptions, int cOptionCount)
** for compatibility with some scripting language (JScript)
*/
-STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistMode mode, int position)
+STDMETHODIMP VLCControl::addTarget(BSTR uri, VARIANT options, enum VLCPlaylistMode mode, int position)
{
if( 0 == SysStringLen(uri) )
return E_INVALIDARG;
- int i_vlc;
- HRESULT hr = _p_instance->getVLCObject(&i_vlc);
+ libvlc_instance_t *p_libvlc;
+ HRESULT hr = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
{
char *cUri = CStrFromBSTR(CP_UTF8, uri);
if( FAILED(CreateTargetOptions(CP_UTF8, &options, &cOptions, &cOptionsCount)) )
return E_INVALIDARG;
- if( VLC_SUCCESS <= VLC_AddTarget(i_vlc, cUri, (const char **)cOptions, cOptionsCount, mode, position) )
- {
- hr = NOERROR;
- if( mode & PLAYLIST_GO )
- _p_instance->fireOnPlayEvent();
- }
- else
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ position = libvlc_playlist_add_extended(p_libvlc, cUri, cUri,
+ cOptionsCount,
+ const_cast<const char**>(cOptions),
+ &ex);
+
+ FreeTargetOptions(cOptions, cOptionsCount);
+ CoTaskMemFree(cUri);
+
+ if( libvlc_exception_raised(&ex) )
{
- hr = E_FAIL;
- if( mode & PLAYLIST_GO )
+ _p_instance->setErrorInfo(IID_IVLCPlaylist,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+
+ if( mode & VLCPlayListAppendAndGo )
_p_instance->fireOnStopEvent();
+ return E_FAIL;
}
- FreeTargetOptions(cOptions, cOptionsCount);
- CoTaskMemFree(cUri);
+ if( mode & VLCPlayListAppendAndGo )
+ _p_instance->fireOnPlayEvent();
+ return NOERROR;
}
return hr;
};
if( NULL == index )
return E_POINTER;
- int i_vlc;
- HRESULT result = _p_instance->getVLCObject(&i_vlc);
+ *index = 0;
+ libvlc_instance_t *p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- *index = VLC_PlaylistIndex(i_vlc);
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ *index = libvlc_playlist_get_current_index(p_libvlc, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
return NOERROR;
}
- *index = 0;
return result;
};
STDMETHODIMP VLCControl::get_PlaylistCount(int *count)
{
- int i_vlc;
- HRESULT result = _p_instance->getVLCObject(&i_vlc);
+ if( NULL == count )
+ return E_POINTER;
+
+ *count = 0;
+ libvlc_instance_t* p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- *count = VLC_PlaylistNumberOfItems(i_vlc);
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ *count = libvlc_playlist_items_count(p_libvlc, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
return NOERROR;
}
- *count = 0;
return result;
};
STDMETHODIMP VLCControl::playlistNext(void)
{
- int i_vlc;
- HRESULT result = _p_instance->getVLCObject(&i_vlc);
+ libvlc_instance_t* p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- VLC_PlaylistNext(i_vlc);
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_playlist_next(p_libvlc, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
return NOERROR;
}
return result;
STDMETHODIMP VLCControl::playlistPrev(void)
{
- int i_vlc;
- HRESULT result = _p_instance->getVLCObject(&i_vlc);
+ libvlc_instance_t* p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- VLC_PlaylistPrev(i_vlc);
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_playlist_prev(p_libvlc, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
return NOERROR;
}
return result;
STDMETHODIMP VLCControl::playlistClear(void)
{
- int i_vlc;
- HRESULT result = _p_instance->getVLCObject(&i_vlc);
+ libvlc_instance_t* p_libvlc;
+ HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- VLC_PlaylistClear(i_vlc);
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_playlist_clear(p_libvlc, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCControl,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
return NOERROR;
}
return result;
if( NULL == version )
return E_POINTER;
- const char *versionStr = VLC_Version();
+ const char *versionStr = libvlc_get_version();
if( NULL != versionStr )
{
*version = BSTRFromCStr(CP_UTF8, versionStr);
-
- return NULL == *version ? E_OUTOFMEMORY : NOERROR;
+ return (NULL == *version) ? E_OUTOFMEMORY : NOERROR;
}
*version = NULL;
return E_FAIL;