Commit af6b6d2d authored by Damien Fouilleul's avatar Damien Fouilleul

- added support for non OLE containers, such as Windows Script Host WScript.CreateObject.

- made time property persistable, use 'StartTime' under HTML
- removed functions with stdcall suffix from exported functions in DLL
parent d9b6bd48
...@@ -81,7 +81,7 @@ libaxvlc_a_DEPENDENCIES = axvlc.def $(DATA_axvlc_rc) ...@@ -81,7 +81,7 @@ libaxvlc_a_DEPENDENCIES = axvlc.def $(DATA_axvlc_rc)
axvlc$(LIBEXT): $(libaxvlc_a_OBJECTS) \ axvlc$(LIBEXT): $(libaxvlc_a_OBJECTS) \
$(libaxvlc_a_DEPENDENCIES) stamp-pic $(libaxvlc_a_DEPENDENCIES) stamp-pic
$(CXXLINK) $(libaxvlc_a_OBJECTS) $(DATA_axvlc_rc) \ $(CXXLINK) $(libaxvlc_a_OBJECTS) $(DATA_axvlc_rc) \
-Wl,--enable-stdcall-fixup $(srcdir)/axvlc.def \ $(srcdir)/axvlc.def \
$(LIBRARIES_libvlc) -shared $(LIBRARIES_libvlc) $(LDFLAGS_activex) \ $(LIBRARIES_libvlc) -shared $(LIBRARIES_libvlc) $(LDFLAGS_activex) \
$(INCLUDED_LIBINTL) $(INCLUDED_LIBINTL)
# Cygwin work-around # Cygwin work-around
......
LIBRARY AXVLC.DLL LIBRARY AXVLC.DLL
EXPORTS EXPORTS
CLSID_VLCPlugin data DllMain = DllMain@12
DllMain DllMain@12 DllCanUnloadNow = DllCanUnloadNow@0
DllCanUnloadNow DllCanUnloadNow@0 DllGetClassObject = DllGetClassObject@12
DllGetClassObject DllGetClassObject@12 DllRegisterServer = DllRegisterServer@0
DllRegisterServer DllRegisterServer@0 DllUnregisterServer = DllUnregisterServer@0
DllUnregisterServer DllUnregisterServer@0
...@@ -167,6 +167,14 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr ...@@ -167,6 +167,14 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr
_p_instance->setVolume(V_I4(&value)); _p_instance->setVolume(V_I4(&value));
VariantClear(&value); VariantClear(&value);
} }
V_VT(&value) = VT_I4;
if( S_OK == pPropBag->Read(OLESTR("starttime"), &value, pErrorLog) )
{
_p_instance->setTime(V_I4(&value));
VariantClear(&value);
}
return _p_instance->onLoad(); return _p_instance->onLoad();
}; };
...@@ -212,6 +220,11 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt ...@@ -212,6 +220,11 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt
pPropBag->Write(OLESTR("Volume"), &value); pPropBag->Write(OLESTR("Volume"), &value);
VariantClear(&value); VariantClear(&value);
V_VT(&value) = VT_I4;
V_I4(&value) = _p_instance->getTime();
pPropBag->Write(OLESTR("StartTime"), &value);
VariantClear(&value);
if( fClearDirty ) if( fClearDirty )
_p_instance->setDirty(FALSE); _p_instance->setDirty(FALSE);
......
...@@ -473,6 +473,7 @@ HRESULT VLCPlugin::onInit(void) ...@@ -473,6 +473,7 @@ HRESULT VLCPlugin::onInit(void)
_b_visible = TRUE; _b_visible = TRUE;
_b_mute = FALSE; _b_mute = FALSE;
_i_volume = 50; _i_volume = 50;
_i_time = 0;
// set default/preferred size (320x240) pixels in HIMETRIC // set default/preferred size (320x240) pixels in HIMETRIC
HDC hDC = CreateDevDC(NULL); HDC hDC = CreateDevDC(NULL);
_extent.cx = 320; _extent.cx = 320;
...@@ -538,7 +539,7 @@ HRESULT VLCPlugin::onLoad(void) ...@@ -538,7 +539,7 @@ HRESULT VLCPlugin::onLoad(void)
return S_OK; return S_OK;
}; };
HRESULT VLCPlugin::onRun(void) HRESULT VLCPlugin::getVLCObject(int *i_vlc)
{ {
if( ! isRunning() ) if( ! isRunning() )
{ {
...@@ -613,11 +614,21 @@ HRESULT VLCPlugin::onRun(void) ...@@ -613,11 +614,21 @@ HRESULT VLCPlugin::onRun(void)
char *psz_mrl = CStrFromBSTR(CP_UTF8, _bstr_mrl); char *psz_mrl = CStrFromBSTR(CP_UTF8, _bstr_mrl);
if( NULL != psz_mrl ) if( NULL != psz_mrl )
{ {
char timeBuffer[32];
const char *options[1];
int cOptions = 0;
if( _i_time )
{
snprintf(timeBuffer, sizeof(timeBuffer), ":start-time=%d", _i_time);
options[cOptions++] = timeBuffer;
}
// add default target to playlist // add default target to playlist
VLC_AddTarget(_i_vlc, psz_mrl, NULL, 0, PLAYLIST_APPEND, PLAYLIST_END); VLC_AddTarget(_i_vlc, psz_mrl, options, cOptions, PLAYLIST_APPEND, PLAYLIST_END);
CoTaskMemFree(psz_mrl); CoTaskMemFree(psz_mrl);
} }
} }
*i_vlc = _i_vlc;
return S_OK; return S_OK;
}; };
...@@ -796,26 +807,27 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc ...@@ -796,26 +807,27 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
if( _b_usermode ) if( _b_usermode )
{ {
/* run vlc if not done already */ /* will run vlc if not done already */
HRESULT result = onRun(); int i_vlc;
HRESULT result = getVLCObject(&i_vlc);
if( FAILED(result) ) if( FAILED(result) )
return result; return result;
/* set internal video width and height */ /* set internal video width and height */
vlc_value_t val; vlc_value_t val;
val.i_int = posRect.right-posRect.left; val.i_int = posRect.right-posRect.left;
VLC_VariableSet(_i_vlc, "conf::width", val); VLC_VariableSet(i_vlc, "conf::width", val);
val.i_int = posRect.bottom-posRect.top; val.i_int = posRect.bottom-posRect.top;
VLC_VariableSet(_i_vlc, "conf::height", val); VLC_VariableSet(i_vlc, "conf::height", val);
/* set internal video parent window */ /* set internal video parent window */
/* horrible cast there */ /* horrible cast there */
val.i_int = reinterpret_cast<int>(_videownd); val.i_int = reinterpret_cast<int>(_videownd);
VLC_VariableSet(_i_vlc, "drawable", val); VLC_VariableSet(i_vlc, "drawable", val);
if( _b_autoplay & (VLC_PlaylistNumberOfItems(_i_vlc) > 0) ) if( _b_autoplay & (VLC_PlaylistNumberOfItems(i_vlc) > 0) )
{ {
VLC_Play(_i_vlc); VLC_Play(i_vlc);
fireOnPlayEvent(); fireOnPlayEvent();
} }
} }
...@@ -872,6 +884,22 @@ void VLCPlugin::setVolume(int volume) ...@@ -872,6 +884,22 @@ void VLCPlugin::setVolume(int volume)
} }
}; };
void VLCPlugin::setTime(int seconds)
{
if( seconds < 0 )
seconds = 0;
if( seconds != _i_time )
{
_i_time = seconds;
if( isRunning() )
{
VLC_TimeSet(_i_vlc, seconds, VLC_FALSE);
}
setDirty(TRUE);
}
};
void VLCPlugin::setFocus(BOOL fFocus) void VLCPlugin::setFocus(BOOL fFocus)
{ {
if( fFocus ) if( fFocus )
......
...@@ -115,6 +115,9 @@ public: ...@@ -115,6 +115,9 @@ public:
void setVisible(BOOL fVisible); void setVisible(BOOL fVisible);
BOOL getVisible(void) { return _b_visible; }; BOOL getVisible(void) { return _b_visible; };
void setTime(int time);
int getTime(void) { return _i_time; };
// control size in HIMETRIC // control size in HIMETRIC
inline void setExtent(const SIZEL& extent) inline void setExtent(const SIZEL& extent)
{ {
...@@ -162,20 +165,19 @@ public: ...@@ -162,20 +165,19 @@ public:
inline void setDirty(BOOL dirty) { _b_dirty = dirty; }; inline void setDirty(BOOL dirty) { _b_dirty = dirty; };
inline BOOL isRunning(void) { return 0 != _i_vlc; }; inline BOOL isRunning(void) { return 0 != _i_vlc; };
HRESULT getVLCObject(int *i_vlc);
// control geometry within container // control geometry within container
RECT getPosRect(void) { return _posRect; }; RECT getPosRect(void) { return _posRect; };
inline HWND getInPlaceWindow(void) const { return _inplacewnd; }; inline HWND getInPlaceWindow(void) const { return _inplacewnd; };
BOOL isInPlaceActive(void); BOOL isInPlaceActive(void);
inline int getVLCObject(void) const { return _i_vlc; };
/* /*
** container events ** container events
*/ */
HRESULT onInit(void); HRESULT onInit(void);
HRESULT onLoad(void); HRESULT onLoad(void);
HRESULT onRun(void);
HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect); HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);
HRESULT onInPlaceDeactivate(void); HRESULT onInPlaceDeactivate(void);
HRESULT onAmbientChanged(LPUNKNOWN pContainer, DISPID dispID); HRESULT onAmbientChanged(LPUNKNOWN pContainer, DISPID dispID);
...@@ -237,10 +239,12 @@ private: ...@@ -237,10 +239,12 @@ private:
BOOL _b_autoloop; BOOL _b_autoloop;
BOOL _b_visible; BOOL _b_visible;
BOOL _b_mute; BOOL _b_mute;
BOOL _b_dirty;
int _i_volume; int _i_volume;
int _i_time;
SIZEL _extent; SIZEL _extent;
LPPICTURE _p_pict; LPPICTURE _p_pict;
// indicates whether properties needs persisting
BOOL _b_dirty;
}; };
#endif #endif
......
...@@ -22,6 +22,7 @@ Insert VideoLAN.VLCPlugin.1 activex control ...@@ -22,6 +22,7 @@ Insert VideoLAN.VLCPlugin.1 activex control
<param name="AutoLoop" value="False" /> <param name="AutoLoop" value="False" />
<param name="AutoPlay" value="False" /> <param name="AutoPlay" value="False" />
<param name="Volume" value="50" /> <param name="Volume" value="50" />
<param name="StartTime" value="0" />
</OBJECT> </OBJECT>
</TD></TR> </TD></TR>
<TR><TD> <TR><TD>
......
...@@ -76,7 +76,7 @@ STDMETHODIMP VLCControl::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo ...@@ -76,7 +76,7 @@ STDMETHODIMP VLCControl::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo
{ {
_p_typeinfo->AddRef(); _p_typeinfo->AddRef();
*ppTInfo = _p_typeinfo; *ppTInfo = _p_typeinfo;
return NO_ERROR; return NOERROR;
} }
*ppTInfo = NULL; *ppTInfo = NULL;
return E_NOTIMPL; return E_NOTIMPL;
...@@ -123,38 +123,38 @@ STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible) ...@@ -123,38 +123,38 @@ STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible)
STDMETHODIMP VLCControl::play(void) STDMETHODIMP VLCControl::play(void)
{ {
int i_vlc = _p_instance->getVLCObject(); int i_vlc;
if( i_vlc ) HRESULT result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{ {
VLC_Play(i_vlc); VLC_Play(i_vlc);
_p_instance->fireOnPlayEvent(); _p_instance->fireOnPlayEvent();
return NOERROR;
} }
return E_UNEXPECTED; return result;
}; };
STDMETHODIMP VLCControl::pause(void) STDMETHODIMP VLCControl::pause(void)
{ {
int i_vlc = _p_instance->getVLCObject(); int i_vlc;
if( i_vlc ) HRESULT result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{ {
VLC_Pause(i_vlc); VLC_Pause(i_vlc);
_p_instance->fireOnPauseEvent(); _p_instance->fireOnPauseEvent();
return NOERROR;
} }
return E_UNEXPECTED; return result;
}; };
STDMETHODIMP VLCControl::stop(void) STDMETHODIMP VLCControl::stop(void)
{ {
int i_vlc = _p_instance->getVLCObject(); int i_vlc;
if( i_vlc ) HRESULT result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{ {
VLC_Stop(i_vlc); VLC_Stop(i_vlc);
_p_instance->fireOnStopEvent(); _p_instance->fireOnStopEvent();
return NOERROR;
} }
return E_UNEXPECTED; return result;
}; };
STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying) STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying)
...@@ -162,14 +162,19 @@ STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying) ...@@ -162,14 +162,19 @@ STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying)
if( NULL == isPlaying ) if( NULL == isPlaying )
return E_POINTER; return E_POINTER;
int i_vlc = _p_instance->getVLCObject(); HRESULT result = NOERROR;
if( i_vlc ) if( _p_instance->isRunning() )
{ {
*isPlaying = VLC_IsPlaying(i_vlc) ? VARIANT_TRUE : VARIANT_FALSE; int i_vlc;
return NOERROR; result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{
*isPlaying = VLC_IsPlaying(i_vlc) ? VARIANT_TRUE : VARIANT_FALSE;
return NOERROR;
}
} }
*isPlaying = VARIANT_FALSE; *isPlaying = VARIANT_FALSE;
return E_UNEXPECTED; return result;
}; };
STDMETHODIMP VLCControl::get_Position(float *position) STDMETHODIMP VLCControl::get_Position(float *position)
...@@ -177,25 +182,34 @@ STDMETHODIMP VLCControl::get_Position(float *position) ...@@ -177,25 +182,34 @@ STDMETHODIMP VLCControl::get_Position(float *position)
if( NULL == position ) if( NULL == position )
return E_POINTER; return E_POINTER;
int i_vlc = _p_instance->getVLCObject(); HRESULT result = E_UNEXPECTED;
if( i_vlc ) if( _p_instance->isRunning() )
{ {
*position = VLC_PositionGet(i_vlc); int i_vlc;
return NOERROR; HRESULT result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{
*position = VLC_PositionGet(i_vlc);
return NOERROR;
}
} }
*position = 0.0f; *position = 0.0f;
return E_UNEXPECTED; return result;
}; };
STDMETHODIMP VLCControl::put_Position(float position) STDMETHODIMP VLCControl::put_Position(float position)
{ {
int i_vlc = _p_instance->getVLCObject(); HRESULT result = E_UNEXPECTED;
if( i_vlc ) if( _p_instance->isRunning() )
{ {
VLC_PositionSet(i_vlc, position); int i_vlc;
return NOERROR; HRESULT result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{
VLC_PositionSet(i_vlc, position);
}
} }
return E_UNEXPECTED; return result;
}; };
STDMETHODIMP VLCControl::get_Time(int *seconds) STDMETHODIMP VLCControl::get_Time(int *seconds)
...@@ -203,47 +217,57 @@ STDMETHODIMP VLCControl::get_Time(int *seconds) ...@@ -203,47 +217,57 @@ STDMETHODIMP VLCControl::get_Time(int *seconds)
if( NULL == seconds ) if( NULL == seconds )
return E_POINTER; return E_POINTER;
int i_vlc = _p_instance->getVLCObject(); HRESULT result = NOERROR;
if( i_vlc ) if( _p_instance->isRunning() )
{ {
*seconds = VLC_TimeGet(i_vlc); int i_vlc;
return NOERROR; HRESULT result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{
*seconds = VLC_TimeGet(i_vlc);
}
} }
*seconds = 0; else
return E_UNEXPECTED; *seconds = _p_instance->getTime();
return result;
}; };
STDMETHODIMP VLCControl::put_Time(int seconds) STDMETHODIMP VLCControl::put_Time(int seconds)
{ {
int i_vlc = _p_instance->getVLCObject(); _p_instance->setTime(seconds);
if( i_vlc )
{ return NOERROR;
VLC_TimeSet(i_vlc, seconds, VLC_FALSE);
return NOERROR;
}
return E_UNEXPECTED;
}; };
STDMETHODIMP VLCControl::shuttle(int seconds) STDMETHODIMP VLCControl::shuttle(int seconds)
{ {
int i_vlc = _p_instance->getVLCObject(); HRESULT result = E_UNEXPECTED;
if( i_vlc ) if( _p_instance->isRunning() )
{ {
VLC_TimeSet(i_vlc, seconds, VLC_TRUE); int i_vlc;
return NOERROR; result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{
VLC_TimeSet(i_vlc, seconds, VLC_TRUE);
}
} }
return E_UNEXPECTED; return result;
}; };
STDMETHODIMP VLCControl::fullscreen(void) STDMETHODIMP VLCControl::fullscreen(void)
{ {
int i_vlc = _p_instance->getVLCObject(); HRESULT result = E_UNEXPECTED;
if( i_vlc ) if( _p_instance->isRunning() )
{ {
VLC_FullScreen(i_vlc); int i_vlc;
return NOERROR; result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{
VLC_FullScreen(i_vlc);
}
} }
return E_UNEXPECTED; return result;
}; };
STDMETHODIMP VLCControl::get_Length(int *seconds) STDMETHODIMP VLCControl::get_Length(int *seconds)
...@@ -251,36 +275,49 @@ STDMETHODIMP VLCControl::get_Length(int *seconds) ...@@ -251,36 +275,49 @@ STDMETHODIMP VLCControl::get_Length(int *seconds)
if( NULL == seconds ) if( NULL == seconds )
return E_POINTER; return E_POINTER;
int i_vlc = _p_instance->getVLCObject(); HRESULT result = NOERROR;
if( i_vlc ) if( _p_instance->isRunning() )
{ {
*seconds = VLC_LengthGet(i_vlc); int i_vlc;
return NOERROR; result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{
*seconds = VLC_LengthGet(i_vlc);
return NOERROR;
}
} }
*seconds = 0; *seconds = 0;
return E_UNEXPECTED; return result;
}; };
STDMETHODIMP VLCControl::playFaster(void) STDMETHODIMP VLCControl::playFaster(void)
{ {
int i_vlc = _p_instance->getVLCObject(); HRESULT result = E_UNEXPECTED;
if( i_vlc ) if( _p_instance->isRunning() )
{ {
VLC_SpeedFaster(i_vlc); int i_vlc;
return NOERROR; result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{
VLC_SpeedFaster(i_vlc);
}
} }
return E_UNEXPECTED; return result;
}; };
STDMETHODIMP VLCControl::playSlower(void) STDMETHODIMP VLCControl::playSlower(void)
{ {
int i_vlc = _p_instance->getVLCObject(); HRESULT result = E_UNEXPECTED;
if( i_vlc ) if( _p_instance->isRunning() )
{ {
VLC_SpeedSlower(i_vlc); int i_vlc;
return NOERROR; result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{
VLC_SpeedSlower(i_vlc);
}
} }
return E_UNEXPECTED; return result;
}; };
STDMETHODIMP VLCControl::get_Volume(int *volume) STDMETHODIMP VLCControl::get_Volume(int *volume)
...@@ -300,13 +337,13 @@ STDMETHODIMP VLCControl::put_Volume(int volume) ...@@ -300,13 +337,13 @@ STDMETHODIMP VLCControl::put_Volume(int volume)
STDMETHODIMP VLCControl::toggleMute(void) STDMETHODIMP VLCControl::toggleMute(void)
{ {
int i_vlc = _p_instance->getVLCObject(); int i_vlc;
if( i_vlc ) HRESULT result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{ {
VLC_VolumeMute(i_vlc); VLC_VolumeMute(i_vlc);
return NOERROR;
} }
return E_UNEXPECTED; return result;
}; };
STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value) STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value)
...@@ -314,15 +351,15 @@ STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value) ...@@ -314,15 +351,15 @@ STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value)
if( 0 == SysStringLen(name) ) if( 0 == SysStringLen(name) )
return E_INVALIDARG; return E_INVALIDARG;
int i_vlc = _p_instance->getVLCObject(); int i_vlc;
if( i_vlc ) HRESULT hr = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(hr) )
{ {
int codePage = _p_instance->getCodePage(); int codePage = _p_instance->getCodePage();
char *psz_varname = CStrFromBSTR(codePage, name); char *psz_varname = CStrFromBSTR(codePage, name);
if( NULL == psz_varname ) if( NULL == psz_varname )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
HRESULT hr = E_INVALIDARG;
int i_type; int i_type;
vlc_value_t val; vlc_value_t val;
...@@ -378,7 +415,7 @@ STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value) ...@@ -378,7 +415,7 @@ STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value)
} }
} }
else { else {
// no defined type, defaults to VARIANT type // no defined type, use type in VARIANT
hr = NO_ERROR; hr = NO_ERROR;
switch( V_VT(&value) ) switch( V_VT(&value) )
{ {
...@@ -415,10 +452,8 @@ STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value) ...@@ -415,10 +452,8 @@ STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value)
CoTaskMemFree(val.psz_string); CoTaskMemFree(val.psz_string);
} }
CoTaskMemFree(psz_varname); CoTaskMemFree(psz_varname);
return hr;
} }
return E_UNEXPECTED; return hr;
}; };
STDMETHODIMP VLCControl::getVariable( BSTR name, VARIANT *value) STDMETHODIMP VLCControl::getVariable( BSTR name, VARIANT *value)
...@@ -431,15 +466,16 @@ STDMETHODIMP VLCControl::getVariable( BSTR name, VARIANT *value) ...@@ -431,15 +466,16 @@ STDMETHODIMP VLCControl::getVariable( BSTR name, VARIANT *value)
if( 0 == SysStringLen(name) ) if( 0 == SysStringLen(name) )
return E_INVALIDARG; return E_INVALIDARG;
int i_vlc = _p_instance->getVLCObject(); int i_vlc;
if( i_vlc ) HRESULT hr = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(hr) )
{ {
UINT codePage = _p_instance->getCodePage(); UINT codePage = _p_instance->getCodePage();
char *psz_varname = CStrFromBSTR(codePage, name); char *psz_varname = CStrFromBSTR(codePage, name);
if( NULL == psz_varname ) if( NULL == psz_varname )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
HRESULT hr = E_INVALIDARG; hr = E_INVALIDARG;
vlc_value_t val; vlc_value_t val;
int i_type; int i_type;
...@@ -490,7 +526,7 @@ STDMETHODIMP VLCControl::getVariable( BSTR name, VARIANT *value) ...@@ -490,7 +526,7 @@ STDMETHODIMP VLCControl::getVariable( BSTR name, VARIANT *value)
CoTaskMemFree(psz_varname); CoTaskMemFree(psz_varname);
return hr; return hr;
} }
return E_UNEXPECTED; return hr;
}; };
static void freeTargetOptions(char **cOptions, int cOptionCount) static void freeTargetOptions(char **cOptions, int cOptionCount)
...@@ -703,10 +739,9 @@ STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistM ...@@ -703,10 +739,9 @@ STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistM
if( 0 == SysStringLen(uri) ) if( 0 == SysStringLen(uri) )
return E_INVALIDARG; return E_INVALIDARG;
HRESULT hr = E_UNEXPECTED; int i_vlc;
HRESULT hr = _p_instance->getVLCObject(&i_vlc);
int i_vlc = _p_instance->getVLCObject(); if( SUCCEEDED(hr) )
if( i_vlc )
{