Commit 2fbbe6d5 authored by Damien Fouilleul's avatar Damien Fouilleul

plugin.cpp, plugin.h: delayed initialization of VLC until activation in place in user mode only

    this allows the persistable properties to be fully loaded before initialization and allow
    for control to initialize faster in design mode. AUTOLOOP property now works properly
persistpropbag.cpp, vlccontrol.h: decoupled volume property from VLC so that value can be used
    without having VLC initialized
test.html: added volume control
parent bb48220f
......@@ -161,11 +161,10 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr
}
}
int i_vlc = _p_instance->getVLCObject();
V_VT(&value) = VT_I4;
if( S_OK == pPropBag->Read(OLESTR("volume"), &value, pErrorLog) )
{
VLC_VolumeSet(i_vlc, V_I4(&value));
_p_instance->setVolume(V_I4(&value));
VariantClear(&value);
}
return _p_instance->onLoad();
......@@ -208,14 +207,10 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt
pPropBag->Write(OLESTR("Visible"), &value);
VariantClear(&value);
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
V_VT(&value) = VT_I4;
V_I4(&value) = VLC_VolumeGet(i_vlc);
pPropBag->Write(OLESTR("Volume"), &value);
VariantClear(&value);
}
V_VT(&value) = VT_I4;
V_I4(&value) = _p_instance->getVolume();
pPropBag->Write(OLESTR("Volume"), &value);
VariantClear(&value);
if( fClearDirty )
_p_instance->setDirty(FALSE);
......
This diff is collapsed.
......@@ -109,6 +109,9 @@ public:
};
inline BOOL getAutoLoop(void) { return _b_autoloop;};
void setVolume(int volume);
BOOL getVolume(void) { return _i_volume; };
void setVisible(BOOL fVisible);
BOOL getVisible(void) { return _b_visible; };
......@@ -172,6 +175,7 @@ public:
*/
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);
......@@ -222,19 +226,21 @@ private:
VLCPluginClass *_p_class;
ULONG _i_ref;
LPPICTURE _p_pict;
UINT _i_codepage;
BOOL _b_usermode;
int _i_vlc;
RECT _posRect;
// persistable properties
BSTR _bstr_mrl;
BOOL _b_autoplay;
BOOL _b_autoloop;
BOOL _b_visible;
BOOL _b_mute;
BOOL _b_dirty;
int _i_vlc;
int _i_volume;
SIZEL _extent;
RECT _posRect;
LPPICTURE _p_pict;
};
#endif
......
......@@ -11,12 +11,17 @@ MRL:
<!--
Insert VideoLAN.VLCPlugin.1 activex control
-->
<OBJECT classid="clsid:E23FE9C6-778E-49D4-B537-38FCDE4887D8" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,4,0"
width="640" height="480" id="vlc" events="True">
<OBJECT classid="clsid:E23FE9C6-778E-49D4-B537-38FCDE4887D8"
codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,4,0"
width="640"
height="480"
id="vlc"
events="True">
<param name="MRL" value="" />
<param name="ShowDisplay" value="True" />
<param name="AutoLoop" value="False" />
<param name="AutoPlay" value="False" />
<param name="Volume" value="50" />
</OBJECT>
</TD></TR>
<TR><TD>
......@@ -24,7 +29,10 @@ Insert VideoLAN.VLCPlugin.1 activex control
Insert MSComctlLib.Slider.2 activex control
-->
<OBJECT classid="clsid:F08DF954-8592-11D1-B16A-00C0F0283628"
width="540" height="20" id="slider" events="True">
width="540"
height="20"
id="slider"
events="True">
<param name="TickStyle" value="3" />
<param name="Min" value="0" />
<param name="Max" value="0" />
......@@ -37,19 +45,40 @@ Insert MSComctlLib.Slider.2 activex control
<TR><TD colspan="2">
<INPUT type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause()'>
<INPUT type=button value="Stop" onClick='document.vlc.stop();'>
&nbsp;
<INPUT type=button value=" << " onClick='document.vlc.playSlower();'>
<INPUT type=button value=" >> " onClick='document.vlc.playFaster();'>
<INPUT type=button value="Mute" onClick='document.vlc.toggleMute();'>
&nbsp;
<INPUT type=button value="Show" onClick='document.vlc.Visible = true;'>
<INPUT type=button value="Hide" onClick='document.vlc.Visible = false;'>
&nbsp;
<INPUT type=button value="Version" onClick='alert(document.vlc.VersionInfo);'>
</TD></TR>
<SPAN style="text-align:center">Volume:</SPAN>
<INPUT type=button value=" - " onClick='updateVolume(-10)'>
<SPAN id="volumeTextField" style="text-align: center">--</SPAN>
<INPUT type=button value=" + " onClick='updateVolume(+10)'>
<INPUT type=button value="Mute" onClick='document.vlc.toggleMute();'>
</TD>
</TR>
</TABLE>
<SCRIPT LANGUAGE="JScript">
<!--
var sliderTimerId = 0;
var sliderScrolling = false;
document.onreadystatechange=onVLCStateChange;
function onVLCStateChange()
{
if( document.readyState == 'complete' )
{
updateVolume(0);
}
};
function updateVolume(deltaVol)
{
vlc.Volume += deltaVol;
volumeTextField.innerText = vlc.Volume+"%";
};
function formatTime(timeVal)
{
var timeHour = timeVal;
......
......@@ -288,25 +288,14 @@ STDMETHODIMP VLCControl::get_Volume(int *volume)
if( NULL == volume )
return E_POINTER;
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
*volume = VLC_VolumeGet(i_vlc);
return NOERROR;
}
*volume = 0;
return E_UNEXPECTED;
*volume = _p_instance->getVolume();
return NOERROR;
};
STDMETHODIMP VLCControl::put_Volume(int volume)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_VolumeSet(i_vlc, volume);
return NOERROR;
}
return E_UNEXPECTED;
_p_instance->setVolume(volume);
return NOERROR;
};
STDMETHODIMP VLCControl::toggleMute(void)
......
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