Commit 727b4c33 authored by Damien Fouilleul's avatar Damien Fouilleul

- activex: cleanup, improved VB compatibility and new test.html file for new script APIs

parent f5bc599e
......@@ -34,8 +34,11 @@ library AXVLC
{
// Forward declare all types defined in this typelib
interface IVLCControl;
interface IVLCAudio;
interface IVLCInput;
interface IVLCPlaylist;
interface ILibVLCControl;
interface IVLCVideo;
interface IVLCControl2;
dispinterface DVLCEvents;
importlib("stdole2.tlb");
......@@ -246,7 +249,7 @@ library AXVLC
HRESULT isPlaying([out, retval] VARIANT_BOOL* playing);
[helpstring("Add a playlist item.")]
HRESULT add([in] BSTR uri, [in] BSTR name, [in, optional] VARIANT options, [out, retval] int* item);
HRESULT add([in] BSTR uri, [in, optional] VARIANT name, [in, optional] VARIANT options, [out, retval] int* item);
[helpstring("Play/Resume the playlist.")]
HRESULT play();
......
No preview for this file type
......@@ -16,14 +16,29 @@ DEFINE_GUID(LIBID_AXVLC, 0xdf2bbe39, 0x40a8, 0x433b, 0xa2,0x79, 0x07,0x3f,0x48,0
typedef interface IVLCControl IVLCControl;
#endif
#ifndef __IVLCAudio_FWD_DEFINED__
#define __IVLCAudio_FWD_DEFINED__
typedef interface IVLCAudio IVLCAudio;
#endif
#ifndef __IVLCInput_FWD_DEFINED__
#define __IVLCInput_FWD_DEFINED__
typedef interface IVLCInput IVLCInput;
#endif
#ifndef __IVLCPlaylist_FWD_DEFINED__
#define __IVLCPlaylist_FWD_DEFINED__
typedef interface IVLCPlaylist IVLCPlaylist;
#endif
#ifndef __ILibVLCControl_FWD_DEFINED__
#define __ILibVLCControl_FWD_DEFINED__
typedef interface ILibVLCControl ILibVLCControl;
#ifndef __IVLCVideo_FWD_DEFINED__
#define __IVLCVideo_FWD_DEFINED__
typedef interface IVLCVideo IVLCVideo;
#endif
#ifndef __IVLCControl2_FWD_DEFINED__
#define __IVLCControl2_FWD_DEFINED__
typedef interface IVLCControl2 IVLCControl2;
#endif
#ifndef __DVLCEvents_FWD_DEFINED__
......@@ -751,11 +766,6 @@ interface DVLCEvents {
#endif /* __DVLCEvents_DISPINTERFACE_DEFINED__ */
#ifndef __IVLCAudio_FWD_DEFINED__
#define __IVLCAudio_FWD_DEFINED__
typedef interface IVLCAudio IVLCAudio;
#endif
/*****************************************************************************
* IVLCAudio interface
*/
......@@ -916,11 +926,6 @@ void __RPC_STUB IVLCAudio_toggleMute_Stub(
#endif /* __IVLCAudio_INTERFACE_DEFINED__ */
#ifndef __IVLCInput_FWD_DEFINED__
#define __IVLCInput_FWD_DEFINED__
typedef interface IVLCInput IVLCInput;
#endif
/*****************************************************************************
* IVLCInput interface
*/
......@@ -1181,7 +1186,7 @@ interface IVLCPlaylist : public IDispatch
virtual HRESULT STDMETHODCALLTYPE add(
BSTR uri,
BSTR name,
VARIANT name,
VARIANT options,
int* item) = 0;
......@@ -1268,7 +1273,7 @@ typedef struct IVLCPlaylistVtbl {
HRESULT (STDMETHODCALLTYPE *add)(
IVLCPlaylist* This,
BSTR uri,
BSTR name,
VARIANT name,
VARIANT options,
int* item);
......@@ -1349,7 +1354,7 @@ void __RPC_STUB IVLCPlaylist_get_isPlaying_Stub(
HRESULT CALLBACK IVLCPlaylist_add_Proxy(
IVLCPlaylist* This,
BSTR uri,
BSTR name,
VARIANT name,
VARIANT options,
int* item);
void __RPC_STUB IVLCPlaylist_add_Stub(
......@@ -1418,11 +1423,6 @@ void __RPC_STUB IVLCPlaylist_removeItem_Stub(
#endif /* __IVLCPlaylist_INTERFACE_DEFINED__ */
#ifndef __IVLCVideo_FWD_DEFINED__
#define __IVLCVideo_FWD_DEFINED__
typedef interface IVLCVideo IVLCVideo;
#endif
/*****************************************************************************
* IVLCVideo interface
*/
......@@ -1569,11 +1569,6 @@ void __RPC_STUB IVLCVideo_get_height_Stub(
#endif /* __IVLCVideo_INTERFACE_DEFINED__ */
#ifndef __IVLCControl2_FWD_DEFINED__
#define __IVLCControl2_FWD_DEFINED__
typedef interface IVLCControl2 IVLCControl2;
#endif
/*****************************************************************************
* IVLCControl2 interface
*/
......
......@@ -36,7 +36,7 @@ public:
e(VLCEnum<CONNECTDATA>(IID_IEnumConnections, v))
{ e.setRetainOperation((VLCEnum<CONNECTDATA>::retainer)&retain); };
VLCEnumConnections(const VLCEnumConnections &vlcEnum) : e(vlcEnum.e) {};
VLCEnumConnections(const VLCEnumConnections &vlcEnum) : IEnumConnections(), e(vlcEnum.e) {};
virtual ~VLCEnumConnections() {};
......@@ -184,7 +184,7 @@ public:
e(VLCEnum<LPCONNECTIONPOINT>(IID_IEnumConnectionPoints, v))
{ e.setRetainOperation((VLCEnum<LPCONNECTIONPOINT>::retainer)&retain); };
VLCEnumConnectionPoints(const VLCEnumConnectionPoints &vlcEnum) : e(vlcEnum.e) {};
VLCEnumConnectionPoints(const VLCEnumConnectionPoints &vlcEnum) : IEnumConnectionPoints(), e(vlcEnum.e) {};
virtual ~VLCEnumConnectionPoints() {};
......
......@@ -36,7 +36,7 @@ public:
VLCEnumFORMATETC(vector<FORMATETC> &v) :
e(VLCEnum<FORMATETC>(IID_IEnumFORMATETC, v)) {};
VLCEnumFORMATETC(const VLCEnumFORMATETC &vlcEnum) : e(vlcEnum.e) {};
VLCEnumFORMATETC(const VLCEnumFORMATETC &vlcEnum) : IEnumFORMATETC(), e(vlcEnum.e) {};
virtual ~VLCEnumFORMATETC() {};
// IUnknown methods
......
......@@ -57,8 +57,7 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
*ppv = NULL;
if( (CLSID_VLCPlugin == rclsid)
|| (CLSID_VLCPlugin2 == rclsid) )
if( CLSID_VLCPlugin2 == rclsid )
{
VLCPluginClass *plugin = new VLCPluginClass(&i_class_ref, h_instance, rclsid);
hr = plugin->QueryInterface(riid, ppv);
......@@ -158,14 +157,20 @@ STDAPI DllUnregisterServer(VOID)
SHDeleteKey(HKEY_CLASSES_ROOT, TEXT(PROGID_STR));
UnregisterProgID(CLSID_VLCPlugin, 1);
UnregisterProgID(CLSID_VLCPlugin, 2);
UnregisterProgID(CLSID_VLCPlugin2, 1);
return S_OK;
};
static HRESULT RegisterClassID(HKEY hParent, REFCLSID rclsid, unsigned int version, const char *path, size_t pathLen)
static HRESULT RegisterClassID(HKEY hParent, REFCLSID rclsid, unsigned int version, BOOL isDefault, const char *path, size_t pathLen)
{
char progId[sizeof(PROGID_STR)+16];
sprintf(progId, "%s.%u", PROGID_STR, version);
char description[sizeof(DESCRIPTION)+16];
sprintf(description, "%s v%u", DESCRIPTION, version);
HKEY hClassKey;
{
LPCSTR psz_CLSID = CStrFromGUID(rclsid);
......@@ -173,13 +178,43 @@ static HRESULT RegisterClassID(HKEY hParent, REFCLSID rclsid, unsigned int versi
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
HKEY hProgKey = keyCreate(HKEY_CLASSES_ROOT, progId);
if( NULL != hProgKey )
{
// default key value
keySetDef(hProgKey, description);
keyClose(keySetDef(keyCreate(hProgKey, "CLSID"),
psz_CLSID,
GUID_STRLEN));
//hSubKey = keyClose(keyCreate(hBaseKey, "Insertable"));
RegCloseKey(hProgKey);
}
if( isDefault )
{
hProgKey = keyCreate(HKEY_CLASSES_ROOT, PROGID_STR);
if( NULL != hProgKey )
{
// default key value
keySetDef(hProgKey, description);
keyClose(keySetDef(keyCreate(hProgKey, "CLSID"),
psz_CLSID,
GUID_STRLEN));
keyClose(keySetDef(keyCreate(hProgKey, "CurVer"),
progId));
}
}
hClassKey = keyCreate(hParent, psz_CLSID);
CoTaskMemFree((void *)psz_CLSID);
}
if( NULL != hClassKey )
{
// default key value
keySetDef(hClassKey, DESCRIPTION, sizeof(DESCRIPTION));
keySetDef(hClassKey, description);
// Control key value
keyClose(keyCreate(hClassKey, "Control"));
......@@ -223,13 +258,9 @@ static HRESULT RegisterClassID(HKEY hParent, REFCLSID rclsid, unsigned int versi
keyClose(keyCreate(hClassKey, "Programmable"));
// ProgID key value
{
char progId[sizeof(PROGID_STR)+16];
sprintf(progId, "%s.%u", PROGID_STR, version);
keyClose(keySetDef(keyCreate(hClassKey,
TEXT("ProgID")),
progId));
}
keyClose(keySetDef(keyCreate(hClassKey,
TEXT("ProgID")),
progId));
// VersionIndependentProgID key value
keyClose(keySetDef(keyCreate(hClassKey,
......@@ -237,13 +268,9 @@ static HRESULT RegisterClassID(HKEY hParent, REFCLSID rclsid, unsigned int versi
PROGID_STR, sizeof(PROGID_STR)));
// Version key value
{
char ver[32];
sprintf(ver, "%u.0", version);
keyClose(keySetDef(keyCreate(hClassKey,
"Version"),
ver));
}
keyClose(keySetDef(keyCreate(hClassKey,
"Version"),
"1.0"));
// TypeLib key value
LPCSTR psz_LIBID = CStrFromGUID(LIBID_AXVLC);
......@@ -259,61 +286,6 @@ static HRESULT RegisterClassID(HKEY hParent, REFCLSID rclsid, unsigned int versi
return S_OK;
}
static HRESULT RegisterProgID(REFCLSID rclsid, unsigned int version)
{
LPCSTR psz_CLSID = CStrFromGUID(rclsid);
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
char progId[sizeof(PROGID_STR)+16];
sprintf(progId, "%s.%u", PROGID_STR, version);
HKEY hBaseKey = keyCreate(HKEY_CLASSES_ROOT, progId);
if( NULL != hBaseKey )
{
// default key value
keySetDef(hBaseKey, DESCRIPTION, sizeof(DESCRIPTION));
keyClose(keySetDef(keyCreate(hBaseKey, "CLSID"),
psz_CLSID,
GUID_STRLEN));
//hSubKey = keyClose(keyCreate(hBaseKey, "Insertable"));
RegCloseKey(hBaseKey);
}
CoTaskMemFree((void *)psz_CLSID);
return S_OK;
}
static HRESULT RegisterDefaultProgID(REFCLSID rclsid, unsigned int version)
{
LPCSTR psz_CLSID = CStrFromGUID(rclsid);
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
HKEY hBaseKey = keyCreate(HKEY_CLASSES_ROOT, PROGID_STR);
if( NULL != hBaseKey )
{
// default key value
keySetDef(hBaseKey, DESCRIPTION, sizeof(DESCRIPTION));
keyClose(keySetDef(keyCreate(hBaseKey, "CLSID"),
psz_CLSID,
GUID_STRLEN));
char progId[sizeof(PROGID_STR)+16];
sprintf(progId, "%s.%u", PROGID_STR, version);
keyClose(keySetDef(keyCreate(hBaseKey, "CurVer"),
progId));
}
CoTaskMemFree((void *)psz_CLSID);
}
STDAPI DllRegisterServer(VOID)
{
DllUnregisterServer();
......@@ -328,17 +300,11 @@ STDAPI DllRegisterServer(VOID)
if( ERROR_SUCCESS != RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_CREATE_SUB_KEY, &hBaseKey) )
return SELFREG_E_CLASS;
RegisterClassID(hBaseKey, CLSID_VLCPlugin, 1, DllPath, DllPathLen);
RegisterClassID(hBaseKey, CLSID_VLCPlugin2, 2, DllPath, DllPathLen);
RegisterClassID(hBaseKey, CLSID_VLCPlugin, 1, FALSE, DllPath, DllPathLen);
RegisterClassID(hBaseKey, CLSID_VLCPlugin2, 2, TRUE, DllPath, DllPathLen);
RegCloseKey(hBaseKey);
RegisterProgID(CLSID_VLCPlugin, 1);
RegisterProgID(CLSID_VLCPlugin2, 2);
/* default control */
RegisterDefaultProgID(CLSID_VLCPlugin2, 2);
// indicate which component categories we support
ICatRegister *pcr;
if( SUCCEEDED(CoCreateInstance(CLSID_StdComponentCategoriesMgr,
......
......@@ -51,10 +51,6 @@ using namespace std;
////////////////////////////////////////////////////////////////////////
//class factory
// {E23FE9C6-778E-49d4-B537-38FCDE4887D8}
//const GUID CLSID_VLCPlugin =
// { 0xe23fe9c6, 0x778e, 0x49d4, { 0xb5, 0x37, 0x38, 0xfc, 0xde, 0x48, 0x87, 0xd8 } };
static LRESULT CALLBACK VLCInPlaceClassWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch( uMsg )
{
......@@ -340,7 +336,9 @@ STDMETHODIMP VLCPlugin::QueryInterface(REFIID riid, void **ppv)
else if( IID_IObjectSafety == riid )
*ppv = reinterpret_cast<LPVOID>(vlcObjectSafety);
else if( IID_IDispatch == riid )
*ppv = reinterpret_cast<LPVOID>(vlcControl);
*ppv = (CLSID_VLCPlugin2 == getClassID()) ?
reinterpret_cast<LPVOID>(vlcControl2) :
reinterpret_cast<LPVOID>(vlcControl);
else if( IID_IVLCControl == riid )
*ppv = reinterpret_cast<LPVOID>(vlcControl);
else if( IID_IVLCControl2 == riid )
......@@ -590,7 +588,7 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
}
#if 0
ppsz_argv[0] = "C:\\cygwin\\home\\Damien_Fouilleul\\dev\\videolan\\vlc-trunk\\vlc";
ppsz_argv[0] = "C:\\cygwin\\home\\damienf\\vlc-trunk\\vlc";
#endif
// make sure plugin isn't affected with VLC single instance mode
......@@ -624,11 +622,11 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
{
/*
** VLC default threading mechanism is designed to be as compatible
** with POSIX as possible, however when debugged on win32, threads
** with POSIX as possible. However when debugged on win32, threads
** lose signals and eventually VLC get stuck during initialization.
** threading support can be configured to be more debugging friendly
** but it will be less compatible with POSIX.
** This is done by initializing with the following options
** This is done by initializing with the following options:
*/
ppsz_argv[ppsz_argc++] = "--fast-mutex";
ppsz_argv[ppsz_argc++] = "--win9x-cv-method=1";
......
<HTML>
<TITLE>VLC ActiveX plugin test page</TITLE>
<BODY>
<TABLE>
<TR><TD colspan="2">
MRL:
<INPUT size="90" name="targetTextField" value="">
<INPUT type=submit value="Go" onClick="doGo(targetTextField.value);">
</TD></TR>
<TR><TD colspan="2">
<!--
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">
<param name="MRL" value="" />
<param name="ShowDisplay" value="True" />
<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>
<!--
Insert MSComctlLib.Slider.2 activex control
-->
<OBJECT classid="clsid:F08DF954-8592-11D1-B16A-00C0F0283628"
width="540"
height="20"
id="slider"
events="True">
<param name="TickStyle" value="3" />
<param name="Min" value="0" />
<param name="Max" value="0" />
<param name="Value" value="0" />
<param name="Enabled" value="False" />
</OBJECT>
</TD><TD width="15%">
<DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV>
</TD></TR>
<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();'>
&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);'>
<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;
var timeSec = timeHour % 60;
if( timeSec < 10 )
timeSec = '0'+timeSec;
timeHour = (timeHour - timeSec)/60;
var timeMin = timeHour % 60;
if( timeMin < 10 )
timeMin = '0'+timeMin;
timeHour = (timeHour - timeMin)/60;
if( timeHour > 0 )
return timeHour+":"+timeMin+":"+timeSec;
else
return timeMin+":"+timeSec;
};
function onPlay()
{
document.getElementById("PlayOrPause").value = "Pause";
};
function onPause()
{
document.getElementById("PlayOrPause").value = " Play ";
};
function onStop()
{
if( slider.Enabled )
{
slider.Value = slider.Min;
slider.Enabled = false;
}
info.innerText = "-:--:--/-:--:--";
document.getElementById("PlayOrPause").value = " Play ";
};
var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "(( Live ))");
var liveFeedRoll = 0;
function doUpdate()
{
if( vlc.Playing )
{
if( ! sliderScrolling )
{
if( vlc.Length > 0 )
{
// seekable stream
slider.Enabled = true;
slider.Max = vlc.Length;
slider.Value = vlc.Time;
info.innerText = formatTime(vlc.Time)+"/"+formatTime(vlc.Length);
document.getElementById("PlayOrPause").Enabled = true;
}
else {
// non-seekable "live" stream
if( slider.Enabled )
{
slider.Value = slider.Min;
slider.Enabled = false;
}
liveFeedRoll = liveFeedRoll & 3;
info.innerText = liveFeedText[liveFeedRoll++];
}
}
sliderTimerId = setTimeout("doUpdate()", 1000);
}
else
{
onStop();
sliderTimerId = 0;
}
};
function doGo(targetURL)
{
var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear");
document.vlc.addTarget(targetURL, options, 4+8, -666);
};
function doPlayOrPause()
{
if( document.vlc.playing )
{
document.vlc.pause();
}
else
{
document.vlc.play();
}
};
function vlc::Play()
{
if( ! sliderTimerId )
{
sliderTimerId = setTimeout("doUpdate()", 1000);
}
onPlay();
};
function vlc::Pause()
{
if( sliderTimerId )
{
clearTimeout(sliderTimerId)
sliderTimerId = 0;
}
onPause();
};
function vlc::Stop()
{
if( sliderTimerId )
{
clearTimeout(sliderTimerId)
sliderTimerId = 0;
}
onStop();
};
function slider::Scroll()
{
slider.Text = formatTime(slider.Value);
info.innerText = slider.Text+"/"+formatTime(vlc.Length);
if( vlc.Time != slider.Value )
{
vlc.Time = slider.Value;
}
};
function slider::Change()
{
if( sliderScrolling )
{
sliderScrolling = false;
}
else if( vlc.Time != slider.Value )
{
vlc.Time = slider.Value;
}
};
//-->
</SCRIPT>
</BODY>
</HTML>
<HTML>
<TITLE>VLC ActiveX plugin test page</TITLE>
<BODY>
<TABLE>
<TR><TD colspan="2">
MRL:
<INPUT size="90" id="targetTextField" value="">
<INPUT type=submit value="Go" onClick="doGo(document.getElementById('targetTextField').value);">
</TD></TR>
<TR><TD colspan="2">
<!--
Insert VideoLAN.VLCPlugin.2 activex control
-->
<OBJECT classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"
codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,6,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" />
<param name="StartTime" value="0" />
</OBJECT>
</TD></TR>
<TR><TD>
<!--
Insert MSComctlLib.Slider.2 activex control
-->
<OBJECT classid="clsid:F08DF954-8592-11D1-B16A-00C0F0283628"
width="540"
height="20"
id="slider"
events="True">
<param name="TickStyle" value="3" />
<param name="Min" value="0" />
<param name="Max" value="0" />
<param name="Value" value="0" />
<param name="Enabled" value="False" />
</OBJECT>
</TD><TD width="15%">
<DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV>
</TD></TR>
<TR><TD colspan="2">
<INPUT type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause()'>
<INPUT type=button value="Stop" onClick='document.getElementById("vlc").playlist.stop();'>
&nbsp;
<INPUT type=button value=" << " onClick='doPlaySlower();'>
<INPUT type=button value=" >> " onClick='doPlayFaster();'>
&nbsp;
<INPUT type=button value="Show" onClick='document.getElementById("vlc").Visible = true;'>
<INPUT type=button value="Hide" onClick='document.getElementById("vlc").Visible = false;'>
&nbsp;
<INPUT type=button value="Version" onClick='alert(document.getElementById("vlc").VersionInfo);'>
<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.getElementById("vlc").audio.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)
{
var vlc = document.getElementById("vlc");
vlc.audio.volume += deltaVol;
document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";
};
function formatTime(timeVal)
{
var timeHour = timeVal;
var timeSec = timeHour % 60;
if( timeSec < 10 )
timeSec = '0'+timeSec;
timeHour = (timeHour - timeSec)/60;
var timeMin = timeHour % 60;
if( timeMin < 10 )
timeMin = '0'+timeMin;
timeHour = (timeHour - timeMin)/60;
if( timeHour > 0 )
return timeHour+":"+timeMin+":"+timeSec;
else
return timeMin+":"+timeSec;
};
function onPlay()
{
document.getElementById("PlayOrPause").value = "Pause";
};
function onPause()
{
document.getElementById("PlayOrPause").value = " Play ";
};
function onStop()
{
if( slider.Enabled )
{
slider.Value = slider.Min;
slider.Enabled = false;
}
info.innerText = "-:--:--/-:--:--";
document.getElementById("PlayOrPause").value = " Play ";
};
var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "(( Live ))");
var liveFeedRoll = 0;
function doUpdate()
{
var vlc = document.getElementById("vlc");
if( vlc.playlist.isPlaying )
{
if( ! sliderScrolling )
{
if( vlc.input.length > 0 )
{
// seekable stream
slider.Enabled = true;
slider.Max = vlc.input.length;
slider.Value = vlc.input.time;
info.innerText = formatTime(vlc.input.time)+"/"+formatTime(vlc.input.length);
document.getElementById("PlayOrPause").Enabled = true;
}
else {
// non-seekable "live" stream
if( slider.Enabled )
{
slider.Value = slider.Min;
slider.Enabled = false;
}
liveFeedRoll = liveFeedRoll & 3;
info.innerText = liveFeedText[liveFeedRoll++];
}
}
sliderTimerId = setTimeout("doUpdate()", 1000);
}
else
{
onStop();
sliderTimerId = 0;
}
};
function doGo(targetURL)
{
var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear");
document.getElementById("vlc").playlist.add(targetURL, null, options);
};
function doPlayOrPause()
{
var vlc = document.getElementById("vlc");
vlc.playlist.togglePause();
};
function doPlaySlower()
{
var vlc = document.getElementById("vlc");
vlc.input.rate = vlc.input.rate / 2;
};
function doPlayFaster()
{
var vlc = document.getElementById("vlc");
vlc.input.rate = vlc.input.rate * 2;
};
function vlc::Play()
{
if( ! sliderTimerId )
{
sliderTimerId = setTimeout("doUpdate()", 1000);
}
onPlay();
};
function vlc::Pause()
{
if( sliderTimerId )
{
clearTimeout(sliderTimerId)
sliderTimerId = 0;
}
onPause();
};
function vlc::Stop()
{
if( sliderTimerId )
{
clearTimeout(sliderTimerId)
sliderTimerId = 0;
}
onStop();
};
function slider::Scroll()
{
var vlc = document.getElementById("vlc");
slider.Text = formatTime(slider.Value);
info.innerText = slider.Text+"/"+formatTime(vlc.input.length);
if( vlc.Time != slider.Value )
{
vlc.Time = slider.Value;
}
};
function slider::Change()
{
if( sliderScrolling )
{
sliderScrolling = false;
}
else if( vlc.Time != slider.Value )
{
vlc.Time = slider.Value;
}
};
//-->
</SCRIPT>
</BODY>
</HTML>
......@@ -41,6 +41,7 @@ extern HDC CreateDevDC(DVTARGETDEVICE *ptd);
extern void DPFromHimetric(HDC hdc, LPPOINT pt, int count);
extern void HimetricFromDP(HDC hdc, LPPOINT pt, int count);
/**************************************************************************************************/
// enumeration
template<class T> class VLCEnum : IUnknown
......@@ -91,6 +92,7 @@ VLCEnum<T>::VLCEnum(REFIID riid, std::vector<T> &v) :
template<class T>
VLCEnum<T>::VLCEnum(const VLCEnum<T> &e) :
IUnknown(),
_refcount(1),
_v(e._v),
_riid(e._riid)
......
......@@ -34,7 +34,7 @@ VLCAudio::~VLCAudio()
_p_typeinfo->Release();
};
HRESULT VLCAudio::getTypeInfo(void)
HRESULT VLCAudio::loadTypeInfo(void)
{
HRESULT hr = NOERROR;
if( NULL == _p_typeinfo )
......@@ -60,7 +60,7 @@ STDMETHODIMP VLCAudio::GetTypeInfoCount(UINT* pctInfo)
if( NULL == pctInfo )
return E_INVALIDARG;
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
*pctInfo = 1;
else
*pctInfo = 0;
......@@ -73,7 +73,7 @@ STDMETHODIMP VLCAudio::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
if( NULL == ppTInfo )
return E_INVALIDARG;
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
_p_typeinfo->AddRef();
*ppTInfo = _p_typeinfo;
......@@ -86,7 +86,7 @@ STDMETHODIMP VLCAudio::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
STDMETHODIMP VLCAudio::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID)
{
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
}
......@@ -97,7 +97,7 @@ STDMETHODIMP VLCAudio::Invoke(DISPID dispIdMember, REFIID riid,
LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
pVarResult, pExcepInfo, puArgErr);
......@@ -219,7 +219,7 @@ VLCInput::~VLCInput()
_p_typeinfo->Release();
};
HRESULT VLCInput::getTypeInfo(void)
HRESULT VLCInput::loadTypeInfo(void)
{
HRESULT hr = NOERROR;
if( NULL == _p_typeinfo )
......@@ -245,7 +245,7 @@ STDMETHODIMP VLCInput::GetTypeInfoCount(UINT* pctInfo)
if( NULL == pctInfo )
return E_INVALIDARG;
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
*pctInfo = 1;
else
*pctInfo = 0;
......@@ -258,7 +258,7 @@ STDMETHODIMP VLCInput::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
if( NULL == ppTInfo )
return E_INVALIDARG;
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
_p_typeinfo->AddRef();
*ppTInfo = _p_typeinfo;
......@@ -271,7 +271,7 @@ STDMETHODIMP VLCInput::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
STDMETHODIMP VLCInput::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID)
{
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
}
......@@ -282,7 +282,7 @@ STDMETHODIMP VLCInput::Invoke(DISPID dispIdMember, REFIID riid,
LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
pVarResult, pExcepInfo, puArgErr);
......@@ -571,7 +571,7 @@ VLCPlaylist::~VLCPlaylist()
_p_typeinfo->Release();
};
HRESULT VLCPlaylist::getTypeInfo(void)
HRESULT VLCPlaylist::loadTypeInfo(void)
{
HRESULT hr = NOERROR;
if( NULL == _p_typeinfo )
......@@ -597,7 +597,7 @@ STDMETHODIMP VLCPlaylist::GetTypeInfoCount(UINT* pctInfo)
if( NULL == pctInfo )
return E_INVALIDARG;
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
*pctInfo = 1;
else
*pctInfo = 0;
......@@ -610,7 +610,7 @@ STDMETHODIMP VLCPlaylist::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInf
if( NULL == ppTInfo )
return E_INVALIDARG;
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
_p_typeinfo->AddRef();
*ppTInfo = _p_typeinfo;
......@@ -623,7 +623,7 @@ STDMETHODIMP VLCPlaylist::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInf
STDMETHODIMP VLCPlaylist::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID)
{
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
}
......@@ -634,7 +634,7 @@ STDMETHODIMP VLCPlaylist::Invoke(DISPID dispIdMember, REFIID riid,
LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
pVarResult, pExcepInfo, puArgErr);
......@@ -688,7 +688,7 @@ STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying)
return hr;
};
STDMETHODIMP VLCPlaylist::add(BSTR uri, BSTR name, VARIANT options, int* item)
STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, int* item)
{
if( NULL == item )
return E_POINTER;
......@@ -718,9 +718,14 @@ STDMETHODIMP VLCPlaylist::add(BSTR uri, BSTR name, VARIANT options, int* item)
}
char *psz_name = NULL;
if( SysStringLen(name) > 0 )
VARIANT v_name;
VariantInit(&v_name);
if( SUCCEEDED(VariantChangeType(&v_name, &name, 0, VT_BSTR)) )
{
psz_name = CStrFromBSTR(CP_UTF8, name);
if( SysStringLen(V_BSTR(&v_name)) > 0 )
psz_name = CStrFromBSTR(CP_UTF8, V_BSTR(&v_name));
VariantClear(&v_name);
}
*item = libvlc_playlist_add_extended(p_libvlc,
......@@ -912,7 +917,7 @@ VLCVideo::~VLCVideo()
_p_typeinfo->Release();
};
HRESULT VLCVideo::getTypeInfo(void)
HRESULT VLCVideo::loadTypeInfo(void)
{
HRESULT hr = NOERROR;
if( NULL == _p_typeinfo )
......@@ -938,7 +943,7 @@ STDMETHODIMP VLCVideo::GetTypeInfoCount(UINT* pctInfo)
if( NULL == pctInfo )
return E_INVALIDARG;
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
*pctInfo = 1;
else
*pctInfo = 0;
......@@ -951,7 +956,7 @@ STDMETHODIMP VLCVideo::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
if( NULL == ppTInfo )
return E_INVALIDARG;
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
_p_typeinfo->AddRef();
*ppTInfo = _p_typeinfo;
......@@ -964,7 +969,7 @@ STDMETHODIMP VLCVideo::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
STDMETHODIMP VLCVideo::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID)
{
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
}
......@@ -975,7 +980,7 @@ STDMETHODIMP VLCVideo::Invoke(DISPID dispIdMember, REFIID riid,
LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
pVarResult, pExcepInfo, puArgErr);
......@@ -1118,7 +1123,7 @@ VLCControl2::~VLCControl2()
_p_typeinfo->Release();
};
HRESULT VLCControl2::getTypeInfo(void)
HRESULT VLCControl2::loadTypeInfo(void)
{
HRESULT hr = NOERROR;
if( NULL == _p_typeinfo )
......@@ -1144,7 +1149,7 @@ STDMETHODIMP VLCControl2::GetTypeInfoCount(UINT* pctInfo)
if( NULL == pctInfo )
return E_INVALIDARG;
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
*pctInfo = 1;
else
*pctInfo = 0;
......@@ -1157,7 +1162,7 @@ STDMETHODIMP VLCControl2::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInf
if( NULL == ppTInfo )
return E_INVALIDARG;
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
_p_typeinfo->AddRef();
*ppTInfo = _p_typeinfo;
......@@ -1170,7 +1175,7 @@ STDMETHODIMP VLCControl2::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInf
STDMETHODIMP VLCControl2::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID)
{
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
}
......@@ -1181,7 +1186,7 @@ STDMETHODIMP VLCControl2::Invoke(DISPID dispIdMember, REFIID riid,
LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
if( SUCCEEDED(getTypeInfo()) )
if( SUCCEEDED(loadTypeInfo()) )
{
return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
pVarResult, pExcepInfo, puArgErr);
......
/*****************************************************************************
* vlccontrol.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* Copyright (C) 2006 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
......@@ -27,10 +27,9 @@
class VLCAudio : public IVLCAudio
{
public:
VLCAudio(VLCPlugin *p_instance) : _p_instance(p_instance), _p_typeinfo(NULL) {};
VLCAudio(VLCPlugin *p_instance) :
_p_instance(p_instance), _p_typeinfo(NULL) {};
virtual ~VLCAudio();
// IUnknown methods
......@@ -65,23 +64,21 @@ public:
STDMETHODIMP get_volume(int*);
STDMETHODIMP put_volume(int);
STDMETHODIMP toggleMute();
private:
HRESULT loadTypeInfo();
HRESULT getTypeInfo();
VLCPlugin *_p_instance;
ITypeInfo *_p_typeinfo;
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
};
class VLCInput : public IVLCInput
{
public:
VLCInput(VLCPlugin *p_instance) : _p_instance(p_instance), _p_typeinfo(NULL) {};
VLCInput(VLCPlugin *p_instance) :
_p_instance(p_instance), _p_typeinfo(NULL) {};
virtual ~VLCInput();
// IUnknown methods
......@@ -123,20 +120,18 @@ public:
STDMETHODIMP get_hasVout(VARIANT_BOOL*);
private:
HRESULT loadTypeInfo();
HRESULT getTypeInfo();
VLCPlugin *_p_instance;
ITypeInfo *_p_typeinfo;
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
};
class VLCPlaylist : public IVLCPlaylist
{
public:
VLCPlaylist(VLCPlugin *p_instance) : _p_instance(p_instance), _p_typeinfo(NULL) {};
VLCPlaylist(VLCPlugin *p_instance) :
_p_instance(p_instance), _p_typeinfo(NULL) {};
virtual ~VLCPlaylist();
// IUnknown methods
......@@ -168,7 +163,7 @@ public:
// IVLCPlaylist methods
STDMETHODIMP get_itemCount(int*);
STDMETHODIMP get_isPlaying(VARIANT_BOOL*);
STDMETHODIMP add(BSTR, BSTR, VARIANT, int*);
STDMETHODIMP add(BSTR, VARIANT, VARIANT, int*);
STDMETHODIMP play();
STDMETHODIMP playItem(int);
STDMETHODIMP togglePause();
......@@ -180,19 +175,18 @@ public:
private:
HRESULT getTypeInfo();
HRESULT loadTypeInfo();
VLCPlugin *_p_instance;
ITypeInfo *_p_typeinfo;
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
};
class VLCVideo : public IVLCVideo
{
public:
VLCVideo(VLCPlugin *p_instance) : _p_instance(p_instance), _p_typeinfo(NULL) {};
VLCVideo(VLCPlugin *p_instance) :
_p_instance(p_instance), _p_typeinfo(NULL) {};
virtual ~VLCVideo();
// IUnknown methods
......@@ -229,10 +223,10 @@ public:
private:
HRESULT getTypeInfo();
HRESULT loadTypeInfo();
VLCPlugin *_p_instance;
ITypeInfo *_p_typeinfo;
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
};
......@@ -277,7 +271,7 @@ public:
private:
HRESULT getTypeInfo();
HRESULT loadTypeInfo();
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
......
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