Commit 57dd32ab 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 dfdcf7e9
......@@ -81,7 +81,7 @@ libaxvlc_a_DEPENDENCIES = axvlc.def $(DATA_axvlc_rc)
axvlc$(LIBEXT): $(libaxvlc_a_OBJECTS) \
$(libaxvlc_a_DEPENDENCIES) stamp-pic
$(CXXLINK) $(libaxvlc_a_OBJECTS) $(DATA_axvlc_rc) \
-Wl,--enable-stdcall-fixup $(srcdir)/axvlc.def \
$(srcdir)/axvlc.def \
$(LIBRARIES_libvlc) -shared $(LIBRARIES_libvlc) $(LDFLAGS_activex) \
$(INCLUDED_LIBINTL)
# Cygwin work-around
......
LIBRARY AXVLC.DLL
EXPORTS
CLSID_VLCPlugin data
DllMain DllMain@12
DllCanUnloadNow DllCanUnloadNow@0
DllGetClassObject DllGetClassObject@12
DllRegisterServer DllRegisterServer@0
DllUnregisterServer DllUnregisterServer@0
DllMain = DllMain@12
DllCanUnloadNow = DllCanUnloadNow@0
DllGetClassObject = DllGetClassObject@12
DllRegisterServer = DllRegisterServer@0
DllUnregisterServer = DllUnregisterServer@0
......@@ -167,6 +167,14 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr
_p_instance->setVolume(V_I4(&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();
};
......@@ -212,6 +220,11 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt
pPropBag->Write(OLESTR("Volume"), &value);
VariantClear(&value);
V_VT(&value) = VT_I4;
V_I4(&value) = _p_instance->getTime();
pPropBag->Write(OLESTR("StartTime"), &value);
VariantClear(&value);
if( fClearDirty )
_p_instance->setDirty(FALSE);
......
......@@ -473,6 +473,7 @@ HRESULT VLCPlugin::onInit(void)
_b_visible = TRUE;
_b_mute = FALSE;
_i_volume = 50;
_i_time = 0;
// set default/preferred size (320x240) pixels in HIMETRIC
HDC hDC = CreateDevDC(NULL);
_extent.cx = 320;
......@@ -538,7 +539,7 @@ HRESULT VLCPlugin::onLoad(void)
return S_OK;
};
HRESULT VLCPlugin::onRun(void)
HRESULT VLCPlugin::getVLCObject(int *i_vlc)
{
if( ! isRunning() )
{
......@@ -613,11 +614,21 @@ HRESULT VLCPlugin::onRun(void)
char *psz_mrl = CStrFromBSTR(CP_UTF8, _bstr_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
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);
}
}
*i_vlc = _i_vlc;
return S_OK;
};
......@@ -796,26 +807,27 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
if( _b_usermode )
{
/* run vlc if not done already */
HRESULT result = onRun();
/* will run vlc if not done already */
int i_vlc;
HRESULT result = getVLCObject(&i_vlc);
if( FAILED(result) )
return result;
/* set internal video width and height */
vlc_value_t val;
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;
VLC_VariableSet(_i_vlc, "conf::height", val);
VLC_VariableSet(i_vlc, "conf::height", val);
/* set internal video parent window */
/* horrible cast there */
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();
}
}
......@@ -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)
{
if( fFocus )
......
......@@ -115,6 +115,9 @@ public:
void setVisible(BOOL fVisible);
BOOL getVisible(void) { return _b_visible; };
void setTime(int time);
int getTime(void) { return _i_time; };
// control size in HIMETRIC
inline void setExtent(const SIZEL& extent)
{
......@@ -162,20 +165,19 @@ public:
inline void setDirty(BOOL dirty) { _b_dirty = dirty; };
inline BOOL isRunning(void) { return 0 != _i_vlc; };
HRESULT getVLCObject(int *i_vlc);
// control geometry within container
RECT getPosRect(void) { return _posRect; };
inline HWND getInPlaceWindow(void) const { return _inplacewnd; };
BOOL isInPlaceActive(void);
inline int getVLCObject(void) const { return _i_vlc; };
/*
** container events
*/
HRESULT onInit(void);
HRESULT onLoad(void);
HRESULT onRun(void);
HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);
HRESULT onInPlaceDeactivate(void);
HRESULT onAmbientChanged(LPUNKNOWN pContainer, DISPID dispID);
......@@ -237,10 +239,12 @@ private:
BOOL _b_autoloop;
BOOL _b_visible;
BOOL _b_mute;
BOOL _b_dirty;
int _i_volume;
int _i_time;
SIZEL _extent;
LPPICTURE _p_pict;
// indicates whether properties needs persisting
BOOL _b_dirty;
};
#endif
......
......@@ -22,6 +22,7 @@ Insert VideoLAN.VLCPlugin.1 activex control
<param name="AutoLoop" value="False" />
<param name="AutoPlay" value="False" />
<param name="Volume" value="50" />
<param name="StartTime" value="0" />
</OBJECT>
</TD></TR>
<TR><TD>
......
This diff is collapsed.
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