Commit 97823006 authored by Damien Fouilleul's avatar Damien Fouilleul

- activex: more features and fully updated test.html for new APIs

parent 6ff95ea3
...@@ -38,8 +38,6 @@ SOURCES_activex = \ ...@@ -38,8 +38,6 @@ SOURCES_activex = \
viewobject.h \ viewobject.h \
vlccontrol.cpp \ vlccontrol.cpp \
vlccontrol.h \ vlccontrol.h \
vlcconfiguration.cpp \
vlcconfiguration.h \
vlccontrol2.cpp \ vlccontrol2.cpp \
vlccontrol2.h \ vlccontrol2.h \
plugin.cpp \ plugin.cpp \
...@@ -80,10 +78,10 @@ LDFLAGS_activex = `$(VLC_CONFIG) --libs activex vlc builtin` ...@@ -80,10 +78,10 @@ LDFLAGS_activex = `$(VLC_CONFIG) --libs activex vlc builtin`
libaxvlc_a_SOURCES = $(SOURCES_activex) $(SOURCE_dll) libaxvlc_a_SOURCES = $(SOURCES_activex) $(SOURCE_dll)
libaxvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags activex` libaxvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags activex`
libaxvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags activex` libaxvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags activex`
libaxvlc_a_DEPENDENCIES = axvlc.def $(DATA_axvlc_rc) libaxvlc_a_DEPENDENCIES = axvlc.def $(DATA_axvlc_rc) $(LIBRARIES_libvlc)
axvlc$(LIBEXT): $(libaxvlc_a_OBJECTS) \ axvlc$(LIBEXT): $(libaxvlc_a_OBJECTS) \
$(libaxvlc_a_DEPENDENCIES) stamp-pic $(libaxvlc_a_DEPENDENCIES) stamp-builtin
$(CXXLINK) $(libaxvlc_a_OBJECTS) $(DATA_axvlc_rc) \ $(CXXLINK) $(libaxvlc_a_OBJECTS) $(DATA_axvlc_rc) \
$(srcdir)/axvlc.def \ $(srcdir)/axvlc.def \
$(LIBRARIES_libvlc) -shared $(LIBRARIES_libvlc) $(LDFLAGS_activex) \ $(LIBRARIES_libvlc) -shared $(LIBRARIES_libvlc) $(LDFLAGS_activex) \
...@@ -140,9 +138,9 @@ clean-stamp: ...@@ -140,9 +138,9 @@ clean-stamp:
rm -f stamp-pic rm -f stamp-pic
if BUILD_SHARED if BUILD_SHARED
stamp-pic: stamp-builtin:
else else
stamp-pic: $(shell ${VLC_CONFIG} --target builtin) stamp-builtin: $(shell ${VLC_CONFIG} --target builtin)
endif endif
@touch $@ @touch $@
......
...@@ -208,7 +208,7 @@ library AXVLC ...@@ -208,7 +208,7 @@ library AXVLC
interface IVLCInput : IDispatch interface IVLCInput : IDispatch
{ {
[propget, helpstring("Returns the clip length, in milliseconds.")] [propget, helpstring("Returns the clip length, in milliseconds.")]
HRESULT length([out, retval] __int64* length); HRESULT length([out, retval] double* length);
[propget, helpstring("Returns/sets playback position in current clip. Position is ranging from 0.0 to 1.0.")] [propget, helpstring("Returns/sets playback position in current clip. Position is ranging from 0.0 to 1.0.")]
HRESULT position([out, retval] float* position); HRESULT position([out, retval] float* position);
...@@ -216,9 +216,9 @@ library AXVLC ...@@ -216,9 +216,9 @@ library AXVLC
HRESULT position([in] float position); HRESULT position([in] float position);
[propget, helpstring("Returns/sets playback time in current clip, in milliseconds.")] [propget, helpstring("Returns/sets playback time in current clip, in milliseconds.")]
HRESULT time([out, retval] __int64* time); HRESULT time([out, retval] double* time);
[propput, helpstring("Returns/sets playback time in the current clip, in milliseconds.")] [propput, helpstring("Returns/sets playback time in the current clip, in milliseconds.")]
HRESULT time([in] __int64 time); HRESULT time([in] double time);
[propget, helpstring("Returns current playback state.")] [propget, helpstring("Returns current playback state.")]
HRESULT state([out, retval] int* state); HRESULT state([out, retval] int* state);
...@@ -301,12 +301,12 @@ library AXVLC ...@@ -301,12 +301,12 @@ library AXVLC
[ [
odl, odl,
uuid(15179CD8-CC12-4242-A58E-E412217FF343), uuid(2D719729-5333-406C-BF12-8DE787FD65E3),
helpstring("VLC Configuration options"), helpstring("VLC Control"),
dual, dual,
oleautomation oleautomation
] ]
interface IVLCConfiguration : IDispatch interface IVLCControl2 : IDispatch
{ {
[id(DISPID_AutoLoop), propget, helpstring("Returns/sets a value that determines whether the playlist is looped")] [id(DISPID_AutoLoop), propget, helpstring("Returns/sets a value that determines whether the playlist is looped")]
HRESULT AutoLoop([out, retval] VARIANT_BOOL* autoloop); HRESULT AutoLoop([out, retval] VARIANT_BOOL* autoloop);
...@@ -345,17 +345,7 @@ library AXVLC ...@@ -345,17 +345,7 @@ library AXVLC
HRESULT Volume([out, retval] int* volume); HRESULT Volume([out, retval] int* volume);
[id(DISPID_Volume), propput, helpstring("Returns/sets default audio volume.")] [id(DISPID_Volume), propput, helpstring("Returns/sets default audio volume.")]
HRESULT Volume([in] int volume); HRESULT Volume([in] int volume);
};
[
odl,
uuid(2D719729-5333-406C-BF12-8DE787FD65E3),
helpstring("VLC Control"),
dual,
oleautomation
]
interface IVLCControl2 : IVLCConfiguration
{
[propget, helpstring("Returns the audio object.")] [propget, helpstring("Returns the audio object.")]
HRESULT audio([out, retval] IVLCAudio** obj); HRESULT audio([out, retval] IVLCAudio** obj);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
[axvlc.dll] [axvlc.dll]
FileVersion=@VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_REVISION@,0 FileVersion=@VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_REVISION@,0
clsid={E23FE9C6-778E-49d4-B537-38FCDE4887D8} clsid={9BE31822-FDAD-461B-AD51-BE1D1C159921}
RegisterServer=no RegisterServer=no
Hook=runinstaller Hook=runinstaller
......
No preview for this file type
...@@ -17,7 +17,6 @@ DEFINE_GUID(IID_IVLCAudio, 0x9e0bd17b, 0x2d3c, 0x4656, 0xb9,0x4d, 0x03,0x08,0x4f ...@@ -17,7 +17,6 @@ DEFINE_GUID(IID_IVLCAudio, 0x9e0bd17b, 0x2d3c, 0x4656, 0xb9,0x4d, 0x03,0x08,0x4f
DEFINE_GUID(IID_IVLCInput, 0x49e0dbd1, 0x9440, 0x466c, 0x9c,0x97, 0x95,0xc6,0x71,0x90,0xc6,0x03); DEFINE_GUID(IID_IVLCInput, 0x49e0dbd1, 0x9440, 0x466c, 0x9c,0x97, 0x95,0xc6,0x71,0x90,0xc6,0x03);
DEFINE_GUID(IID_IVLCPlaylist, 0x54613049, 0x40bf, 0x4035, 0x9e,0x70, 0x0a,0x93,0x12,0xc0,0x18,0x8d); DEFINE_GUID(IID_IVLCPlaylist, 0x54613049, 0x40bf, 0x4035, 0x9e,0x70, 0x0a,0x93,0x12,0xc0,0x18,0x8d);
DEFINE_GUID(IID_IVLCVideo, 0x0aaedf0b, 0xd333, 0x4b27, 0xa0,0xc6, 0xbb,0xf3,0x14,0x13,0xa4,0x2e); DEFINE_GUID(IID_IVLCVideo, 0x0aaedf0b, 0xd333, 0x4b27, 0xa0,0xc6, 0xbb,0xf3,0x14,0x13,0xa4,0x2e);
DEFINE_GUID(IID_IVLCConfiguration, 0x15179cd8, 0xcc12, 0x4242, 0xa5,0x8e, 0xe4,0x12,0x21,0x7f,0xf3,0x43);
DEFINE_GUID(IID_IVLCControl2, 0x2d719729, 0x5333, 0x406c, 0xbf,0x12, 0x8d,0xe7,0x87,0xfd,0x65,0xe3); DEFINE_GUID(IID_IVLCControl2, 0x2d719729, 0x5333, 0x406c, 0xbf,0x12, 0x8d,0xe7,0x87,0xfd,0x65,0xe3);
DEFINE_GUID(CLSID_VLCPlugin, 0xe23fe9c6, 0x778e, 0x49d4, 0xb5,0x37, 0x38,0xfc,0xde,0x48,0x87,0xd8); DEFINE_GUID(CLSID_VLCPlugin, 0xe23fe9c6, 0x778e, 0x49d4, 0xb5,0x37, 0x38,0xfc,0xde,0x48,0x87,0xd8);
DEFINE_GUID(CLSID_VLCPlugin2, 0x9be31822, 0xfdad, 0x461b, 0xad,0x51, 0xbe,0x1d,0x1c,0x15,0x99,0x21); DEFINE_GUID(CLSID_VLCPlugin2, 0x9be31822, 0xfdad, 0x461b, 0xad,0x51, 0xbe,0x1d,0x1c,0x15,0x99,0x21);
......
This diff is collapsed.
...@@ -520,7 +520,7 @@ HRESULT VLCPlugin::onLoad(void) ...@@ -520,7 +520,7 @@ HRESULT VLCPlugin::onLoad(void)
if( UrlIsW(base_url, URLIS_URL) ) if( UrlIsW(base_url, URLIS_URL) )
{ {
/* copy base URL */ /* copy base URL */
_bstr_mrl = SysAllocString(base_url); _bstr_baseurl = SysAllocString(base_url);
} }
CoTaskMemFree(base_url); CoTaskMemFree(base_url);
} }
...@@ -630,23 +630,34 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc) ...@@ -630,23 +630,34 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
if( SysStringLen(_bstr_mrl) > 0 ) if( SysStringLen(_bstr_mrl) > 0 )
{ {
char *psz_mrl = NULL; char *psz_mrl = NULL;
DWORD len = INTERNET_MAX_URL_LENGTH;
LPOLESTR abs_url = (LPOLESTR)CoTaskMemAlloc(sizeof(OLECHAR)*len); if( SysStringLen(_bstr_baseurl) > 0 )
if( NULL != abs_url )
{ {
/* DWORD len = INTERNET_MAX_URL_LENGTH;
** if the MRL a relative URL, we should end up with an absolute URL LPOLESTR abs_url = (LPOLESTR)CoTaskMemAlloc(sizeof(OLECHAR)*len);
*/ if( NULL != abs_url )
if( SUCCEEDED(UrlCombineW(_bstr_baseurl, _bstr_mrl, abs_url, &len,
URL_ESCAPE_UNSAFE|URL_PLUGGABLE_PROTOCOL)) )
{ {
psz_mrl = CStrFromBSTR(CP_UTF8, abs_url); /*
} ** if the MRL a relative URL, we should end up with an absolute URL
else */
{ if( SUCCEEDED(UrlCombineW(_bstr_baseurl, _bstr_mrl, abs_url, &len,
psz_mrl = CStrFromBSTR(CP_UTF8, _bstr_mrl); URL_ESCAPE_UNSAFE|URL_PLUGGABLE_PROTOCOL)) )
{
psz_mrl = CStrFromBSTR(CP_UTF8, abs_url);
}
else
{
psz_mrl = CStrFromBSTR(CP_UTF8, _bstr_mrl);
}
CoTaskMemFree(abs_url);
} }
CoTaskMemFree(abs_url); }
else
{
/*
** baseURL is empty, assume MRL is absolute
*/
psz_mrl = CStrFromBSTR(CP_UTF8, _bstr_mrl);
} }
if( NULL != psz_mrl ) if( NULL != psz_mrl )
{ {
......
...@@ -44,8 +44,8 @@ Insert MSComctlLib.Slider.2 activex control ...@@ -44,8 +44,8 @@ Insert MSComctlLib.Slider.2 activex control
<DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV> <DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV>
</TD></TR> </TD></TR>
<TR><TD colspan="2"> <TR><TD colspan="2">
<INPUT type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause()'> <INPUT type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause();'>
<INPUT type=button value="Stop" onClick='document.getElementById("vlc").playlist.stop();'> <INPUT type=button value="Stop" onClick='doStop();'>
&nbsp; &nbsp;
<INPUT type=button value=" << " onClick='doPlaySlower();'> <INPUT type=button value=" << " onClick='doPlaySlower();'>
<INPUT type=button value=" >> " onClick='doPlayFaster();'> <INPUT type=button value=" >> " onClick='doPlayFaster();'>
...@@ -53,7 +53,7 @@ Insert MSComctlLib.Slider.2 activex control ...@@ -53,7 +53,7 @@ Insert MSComctlLib.Slider.2 activex control
<INPUT type=button value="Show" onClick='document.getElementById("vlc").Visible = true;'> <INPUT type=button value="Show" onClick='document.getElementById("vlc").Visible = true;'>
<INPUT type=button value="Hide" onClick='document.getElementById("vlc").Visible = false;'> <INPUT type=button value="Hide" onClick='document.getElementById("vlc").Visible = false;'>
&nbsp; &nbsp;
<INPUT type=button value="Version" onClick='alert(document.getElementById("vlc").VersionInfo);'> <INPUT type=button id="VersionBut" value="Version" onClick='alert(document.getElementById("vlc").VersionInfo);'>
<SPAN style="text-align:center">Volume:</SPAN> <SPAN style="text-align:center">Volume:</SPAN>
<INPUT type=button value=" - " onClick='updateVolume(-10)'> <INPUT type=button value=" - " onClick='updateVolume(-10)'>
<SPAN id="volumeTextField" style="text-align: center">--</SPAN> <SPAN id="volumeTextField" style="text-align: center">--</SPAN>
...@@ -62,108 +62,115 @@ Insert MSComctlLib.Slider.2 activex control ...@@ -62,108 +62,115 @@ Insert MSComctlLib.Slider.2 activex control
</TD> </TD>
</TR> </TR>
</TABLE> </TABLE>
<SCRIPT LANGUAGE="JScript"> <SCRIPT language="javascript">
<!-- <!--
var sliderTimerId = 0;
var prevState = 0;
var monitorTimerId = 0;
var sliderScrolling = false; var sliderScrolling = false;
document.onreadystatechange=onVLCStateChange;
function onVLCStateChange()
{
if( document.readyState == 'complete' )
{
updateVolume(0);
}
};
function updateVolume(deltaVol) function updateVolume(deltaVol)
{ {
var vlc = document.getElementById("vlc"); var vlc = document.getElementById("vlc");
vlc.audio.volume += deltaVol; vlc.audio.volume += deltaVol;
document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%"; document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";
}; };
function formatTime(timeVal) function formatTime(timeVal)
{ {
var timeHour = timeVal; var timeHour = Math.round(timeVal / 1000);
var timeSec = timeHour % 60; var timeSec = timeHour % 60;
if( timeSec < 10 ) if( timeSec < 10 )
timeSec = '0'+timeSec; timeSec = '0'+timeSec;
timeHour = (timeHour - timeSec)/60; timeHour = (timeHour - timeSec)/60;
var timeMin = timeHour % 60; var timeMin = timeHour % 60;
if( timeMin < 10 ) if( timeMin < 10 )
timeMin = '0'+timeMin; timeMin = '0'+timeMin;
timeHour = (timeHour - timeMin)/60; timeHour = (timeHour - timeMin)/60;
if( timeHour > 0 ) if( timeHour > 0 )
return timeHour+":"+timeMin+":"+timeSec; return timeHour+":"+timeMin+":"+timeSec;
else else
return timeMin+":"+timeSec; return timeMin+":"+timeSec;
}; };
function onPlay() function monitor()
{
document.getElementById("PlayOrPause").value = "Pause";
};
function onPause()
{
document.getElementById("PlayOrPause").value = " Play ";
};
function onStop()
{ {
if( slider.Enabled ) var vlc = document.getElementById("vlc");
var newState = vlc.input.state;
if( prevState != newState )
{ {
slider.Value = slider.Min; if( newState == 0 )
slider.Enabled = false; {
// current media has stopped
onStop();
}
else if( newState == 1 )
{
// current media is openning/connecting
onOpen();
}
else if( newState == 2 )
{
// current media is buffering data
onBuffer();
}
else if( newState == 3 )
{
// current media is now playing
onPlay();
}
else if( vlc.input.state == 4 )
{
// current media is now paused
onPause();
}
prevState = newState;
} }
info.innerText = "-:--:--/-:--:--"; else if( newState == 3 )
document.getElementById("PlayOrPause").value = " Play "; {
// current media is playing
onPlaying();
}
monitorTimerId = setTimeout("monitor()", 1000);
}; };
var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "(( Live ))"); /* actions */
var liveFeedRoll = 0;
function doUpdate() function doGo(targetURL)
{
var vlc = document.getElementById("vlc");
var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear");
vlc.playlist.clear();
vlc.playlist.add(targetURL, null, options);
vlc.playlist.play();
if( monitorTimerId == 0 )
{
monitor();
}
};
function doPlayOrPause()
{ {
var vlc = document.getElementById("vlc"); var vlc = document.getElementById("vlc");
if( vlc.playlist.isPlaying ) if( vlc.playlist.isPlaying )
{ {
if( ! sliderScrolling ) vlc.playlist.togglePause();
{
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 else
{ {
onStop(); vlc.playlist.play();
sliderTimerId = 0; if( monitorTimerId == 0 )
{
monitor();
}
} }
}; };
function doGo(targetURL) function doStop()
{ {
var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear"); document.getElementById("vlc").playlist.stop();
document.getElementById("vlc").playlist.add(targetURL, null, options); if( monitorTimerId != 0 )
}; {
function doPlayOrPause() clearTimeout(monitorTimerId);
{ monitorTimerId = 0;
var vlc = document.getElementById("vlc"); }
vlc.playlist.togglePause(); onStop();
}; };
function doPlaySlower() function doPlaySlower()
{ {
...@@ -175,51 +182,101 @@ function doPlayFaster() ...@@ -175,51 +182,101 @@ function doPlayFaster()
var vlc = document.getElementById("vlc"); var vlc = document.getElementById("vlc");
vlc.input.rate = vlc.input.rate * 2; vlc.input.rate = vlc.input.rate * 2;
}; };
function vlc::Play()
/* events */
function onOpen()
{
document.getElementById("info").innerHTML = "Opening...";
document.getElementById("PlayOrPause").value = "Pause";
};
function onBuffer()
{
document.getElementById("info").innerHTML = "Buffering...";
document.getElementById("PlayOrPause").value = "Pause";
};
function onPlay()
{
onPlaying();
document.getElementById("PlayOrPause").value = "Pause";
};
var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "(( Live ))");
var liveFeedRoll = 0;
function onPlaying()
{ {
if( ! sliderTimerId ) if( ! sliderScrolling )
{ {
sliderTimerId = setTimeout("doUpdate()", 1000); var slider = document.getElementById("slider");
if( vlc.input.length > 0 )
{
// seekable media
slider.Enabled = true;
slider.Max = vlc.input.length/1000;
slider.Value = vlc.input.time/1000;
info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(vlc.input.length);
}
else
{
// non-seekable "live" media
if( slider.Enabled )
{
slider.Value = slider.Min;
slider.Enabled = false;
}
liveFeedRoll = liveFeedRoll & 3;
info.innerHTML = liveFeedText[liveFeedRoll++];
}
} }
onPlay();
}; };
function vlc::Pause() function onPause()
{
document.getElementById("PlayOrPause").value = " Play ";
};
function onStop()
{ {
if( sliderTimerId ) if( slider.Enabled )
{ {
clearTimeout(sliderTimerId) slider.Value = slider.Min;
sliderTimerId = 0; slider.Enabled = false;
} }
onPause(); document.getElementById("info").innerHTML = "-:--:--/-:--:--";
document.getElementById("PlayOrPause").value = " Play ";
}; };
function vlc::Stop() //-->
</SCRIPT>
<SCRIPT language="JScript">
<!--
document.onreadystatechange=onVLCStateChange;
function onVLCStateChange()
{ {
if( sliderTimerId ) if( document.readyState == 'complete' )
{ {
clearTimeout(sliderTimerId) updateVolume(0);
sliderTimerId = 0;
} }
onStop();
}; };
function slider::Scroll() function slider::Scroll()
{ {
var newPos = slider.Value * 1000;
var vlc = document.getElementById("vlc"); var vlc = document.getElementById("vlc");
slider.Text = formatTime(slider.Value); slider.Text = formatTime(newPos);
info.innerText = slider.Text+"/"+formatTime(vlc.input.length); info.innerHTML = slider.Text+"/"+formatTime(vlc.input.length);
if( vlc.Time != slider.Value ) if( (vlc.input.state == 3) && (vlc.input.time != newPos) )
{ {
vlc.Time = slider.Value; vlc.input.time = newPos;
} }
sliderScrolling = true;
}; };
function slider::Change() function slider::Change()
{ {
var newPos = slider.Value * 1000;
if( sliderScrolling ) if( sliderScrolling )
{ {
sliderScrolling = false; sliderScrolling = false;
} }
else if( vlc.Time != slider.Value ) else if( (vlc.input.state == 3) && (vlc.input.time != newPos) )
{ {
vlc.Time = slider.Value; vlc.input.time = newPos;
} }
}; };
//--> //-->
......
/*****************************************************************************
* VLCConfiguration.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "plugin.h"
#include "vlcconfiguration.h"
#include "utils.h"
using namespace std;
VLCConfiguration::~VLCConfiguration()
{
if( _p_typeinfo )
_p_typeinfo->Release();
};
HRESULT VLCConfiguration::loadTypeInfo(void)
{
HRESULT hr = NOERROR;
if( NULL == _p_typeinfo )
{
ITypeLib *p_typelib;
hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
if( SUCCEEDED(hr) )
{
hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCConfiguration, &_p_typeinfo);
if( FAILED(hr) )
{
_p_typeinfo = NULL;
}
p_typelib->Release();
}
}
return hr;
};
STDMETHODIMP VLCConfiguration::GetTypeInfoCount(UINT* pctInfo)
{
if( NULL == pctInfo )
return E_INVALIDARG;
if( SUCCEEDED(loadTypeInfo()) )
*pctInfo = 1;
else
*pctInfo = 0;
return NOERROR;
};
STDMETHODIMP VLCConfiguration::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
{
if( NULL == ppTInfo )
return E_INVALIDARG;
if( SUCCEEDED(loadTypeInfo()) )
{
_p_typeinfo->AddRef();
*ppTInfo = _p_typeinfo;
return NOERROR;
}
*ppTInfo = NULL;
return E_NOTIMPL;
};
STDMETHODIMP VLCConfiguration::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID)
{
if( SUCCEEDED(loadTypeInfo()) )
{
return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
}
return E_NOTIMPL;
};
STDMETHODIMP VLCConfiguration::Invoke(DISPID dispIdMember, REFIID riid,
LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
if( SUCCEEDED(loadTypeInfo()) )
{
return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
pVarResult, pExcepInfo, puArgErr);
}
return E_NOTIMPL;
};
STDMETHODIMP VLCConfiguration::get_AutoLoop(VARIANT_BOOL *autoloop)
{
if( NULL == autoloop )
return E_POINTER;
*autoloop = _p_instance->getAutoLoop() ? VARIANT_TRUE: VARIANT_FALSE;
return S_OK;
};
STDMETHODIMP VLCConfiguration::put_AutoLoop(VARIANT_BOOL autoloop)
{
_p_instance->setAutoLoop((VARIANT_FALSE != autoloop) ? TRUE: FALSE);
return S_OK;
};
STDMETHODIMP VLCConfiguration::get_AutoPlay(VARIANT_BOOL *autoplay)
{
if( NULL == autoplay )
return E_POINTER;
*autoplay = _p_instance->getAutoPlay() ? VARIANT_TRUE: VARIANT_FALSE;
return S_OK;
};
STDMETHODIMP VLCConfiguration::put_AutoPlay(VARIANT_BOOL autoplay)
{
_p_instance->setAutoPlay((VARIANT_FALSE != autoplay) ? TRUE: FALSE);
return S_OK;
};
STDMETHODIMP VLCConfiguration::get_BaseURL(BSTR *url)
{
if( NULL == url )
return E_POINTER;
*url = SysAllocStringLen(_p_instance->getBaseURL(),
SysStringLen(_p_instance->getBaseURL()));
return NOERROR;
};
STDMETHODIMP VLCConfiguration::put_BaseURL(BSTR mrl)
{
_p_instance->setBaseURL(mrl);
return S_OK;
};
STDMETHODIMP VLCConfiguration::get_MRL(BSTR *mrl)
{
if( NULL == mrl )
return E_POINTER;
*mrl = SysAllocStringLen(_p_instance->getMRL(),
SysStringLen(_p_instance->getMRL()));
return NOERROR;
};
STDMETHODIMP VLCConfiguration::put_MRL(BSTR mrl)
{
_p_instance->setMRL(mrl);
return S_OK;
};
STDMETHODIMP VLCConfiguration::get_StartTime(int *seconds)
{
if( NULL == seconds )
return E_POINTER;
*seconds = _p_instance->getStartTime();
return S_OK;
};
STDMETHODIMP VLCConfiguration::put_StartTime(int seconds)
{
_p_instance->setStartTime(seconds);
return NOERROR;
};
STDMETHODIMP VLCConfiguration::get_VersionInfo(BSTR *version)
{
if( NULL == version )
return E_POINTER;
const char *versionStr = VLC_Version();
if( NULL != versionStr )
{
*version = BSTRFromCStr(_p_instance->getCodePage(), versionStr);
return NULL == *version ? E_OUTOFMEMORY : NOERROR;
}
*version = NULL;
return E_FAIL;
};
STDMETHODIMP VLCConfiguration::get_Visible(VARIANT_BOOL *isVisible)
{
if( NULL == isVisible )
return E_POINTER;
*isVisible = _p_instance->getVisible() ? VARIANT_TRUE : VARIANT_FALSE;
return NOERROR;
};
STDMETHODIMP VLCConfiguration::put_Visible(VARIANT_BOOL isVisible)
{
_p_instance->setVisible(isVisible != VARIANT_FALSE);
return NOERROR;
};
STDMETHODIMP VLCConfiguration::get_Volume(int *volume)
{
if( NULL == volume )
return E_POINTER;
*volume = _p_instance->getVolume();
return NOERROR;
};
STDMETHODIMP VLCConfiguration::put_Volume(int volume)
{
_p_instance->setVolume(volume);
return NOERROR;
};
/*****************************************************************************
* VLCConfiguration.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _VLCCONFIGURATION_H_
#define _VLCCONFIGURATION_H_
#include "axvlc_idl.h"
class VLCConfiguration : public IVLCConfiguration
{
public:
VLCConfiguration(VLCPlugin *p_instance) : _p_instance(p_instance), _p_typeinfo(NULL) {};
virtual ~VLCConfiguration();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDispatch == riid)
|| (IID_IVLCConfiguration == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// IDispatch methods
STDMETHODIMP GetTypeInfoCount(UINT*);
STDMETHODIMP GetTypeInfo(UINT, LCID, LPTYPEINFO*);
STDMETHODIMP GetIDsOfNames(REFIID,LPOLESTR*,UINT,LCID,DISPID*);
STDMETHODIMP Invoke(DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
/* IVLCConfiguration methods */
STDMETHODIMP get_AutoLoop(VARIANT_BOOL *autoloop);
STDMETHODIMP put_AutoLoop(VARIANT_BOOL autoloop);
STDMETHODIMP get_AutoPlay(VARIANT_BOOL *autoplay);
STDMETHODIMP put_AutoPlay(VARIANT_BOOL autoplay);
STDMETHODIMP get_BaseURL(BSTR *url);
STDMETHODIMP put_BaseURL(BSTR url);
STDMETHODIMP get_MRL(BSTR *mrl);
STDMETHODIMP put_MRL(BSTR mrl);
STDMETHODIMP get_StartTime(int *seconds);
STDMETHODIMP put_StartTime(int seconds);
STDMETHODIMP get_VersionInfo(BSTR *version);
STDMETHODIMP get_Visible(VARIANT_BOOL *visible);
STDMETHODIMP put_Visible(VARIANT_BOOL visible);
STDMETHODIMP get_Volume(int *volume);
STDMETHODIMP put_Volume(int volume);
protected:
virtual HRESULT loadTypeInfo();
private:
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
};
#endif
...@@ -148,8 +148,6 @@ STDMETHODIMP VLCAudio::put_mute(VARIANT_BOOL mute) ...@@ -148,8 +148,6 @@ STDMETHODIMP VLCAudio::put_mute(VARIANT_BOOL mute)
return hr; return hr;
}; };
#include <iostream>
STDMETHODIMP VLCAudio::get_volume(int* volume) STDMETHODIMP VLCAudio::get_volume(int* volume)
{ {
if( NULL == volume ) if( NULL == volume )
...@@ -163,7 +161,6 @@ STDMETHODIMP VLCAudio::get_volume(int* volume) ...@@ -163,7 +161,6 @@ STDMETHODIMP VLCAudio::get_volume(int* volume)
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
*volume = libvlc_audio_get_volume(p_libvlc, &ex); *volume = libvlc_audio_get_volume(p_libvlc, &ex);
cerr << "volume is " << *volume;
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
{ {
libvlc_exception_clear(&ex); libvlc_exception_clear(&ex);
...@@ -293,7 +290,7 @@ STDMETHODIMP VLCInput::Invoke(DISPID dispIdMember, REFIID riid, ...@@ -293,7 +290,7 @@ STDMETHODIMP VLCInput::Invoke(DISPID dispIdMember, REFIID riid,
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCInput::get_length(__int64* length) STDMETHODIMP VLCInput::get_length(double* length)
{ {
if( NULL == length ) if( NULL == length )
return E_POINTER; return E_POINTER;
...@@ -308,7 +305,7 @@ STDMETHODIMP VLCInput::get_length(__int64* length) ...@@ -308,7 +305,7 @@ STDMETHODIMP VLCInput::get_length(__int64* length)
libvlc_input_t *p_input = libvlc_playlist_get_input(p_libvlc, &ex); libvlc_input_t *p_input = libvlc_playlist_get_input(p_libvlc, &ex);
if( ! libvlc_exception_raised(&ex) ) if( ! libvlc_exception_raised(&ex) )
{ {
*length = (__int64)libvlc_input_get_length(p_input, &ex); *length = (double)libvlc_input_get_length(p_input, &ex);
libvlc_input_free(p_input); libvlc_input_free(p_input);
if( ! libvlc_exception_raised(&ex) ) if( ! libvlc_exception_raised(&ex) )
{ {
...@@ -374,7 +371,7 @@ STDMETHODIMP VLCInput::put_position(float position) ...@@ -374,7 +371,7 @@ STDMETHODIMP VLCInput::put_position(float position)
return hr; return hr;
}; };
STDMETHODIMP VLCInput::get_time(__int64* time) STDMETHODIMP VLCInput::get_time(double* time)
{ {
if( NULL == time ) if( NULL == time )
return E_POINTER; return E_POINTER;
...@@ -389,7 +386,7 @@ STDMETHODIMP VLCInput::get_time(__int64* time) ...@@ -389,7 +386,7 @@ STDMETHODIMP VLCInput::get_time(__int64* time)
libvlc_input_t *p_input = libvlc_playlist_get_input(p_libvlc, &ex); libvlc_input_t *p_input = libvlc_playlist_get_input(p_libvlc, &ex);
if( ! libvlc_exception_raised(&ex) ) if( ! libvlc_exception_raised(&ex) )
{ {
*time = libvlc_input_get_time(p_input, &ex); *time = (double)libvlc_input_get_time(p_input, &ex);
libvlc_input_free(p_input); libvlc_input_free(p_input);
if( ! libvlc_exception_raised(&ex) ) if( ! libvlc_exception_raised(&ex) )
{ {
...@@ -402,7 +399,7 @@ STDMETHODIMP VLCInput::get_time(__int64* time) ...@@ -402,7 +399,7 @@ STDMETHODIMP VLCInput::get_time(__int64* time)
return hr; return hr;
}; };
STDMETHODIMP VLCInput::put_time(__int64 time) STDMETHODIMP VLCInput::put_time(double time)
{ {
libvlc_instance_t* p_libvlc; libvlc_instance_t* p_libvlc;
HRESULT hr = _p_instance->getVLC(&p_libvlc); HRESULT hr = _p_instance->getVLC(&p_libvlc);
...@@ -414,7 +411,7 @@ STDMETHODIMP VLCInput::put_time(__int64 time) ...@@ -414,7 +411,7 @@ STDMETHODIMP VLCInput::put_time(__int64 time)
libvlc_input_t *p_input = libvlc_playlist_get_input(p_libvlc, &ex); libvlc_input_t *p_input = libvlc_playlist_get_input(p_libvlc, &ex);
if( ! libvlc_exception_raised(&ex) ) if( ! libvlc_exception_raised(&ex) )
{ {
libvlc_input_set_time(p_input, time, &ex); libvlc_input_set_time(p_input, (vlc_int64_t)time, &ex);
libvlc_input_free(p_input); libvlc_input_free(p_input);
if( ! libvlc_exception_raised(&ex) ) if( ! libvlc_exception_raised(&ex) )
{ {
...@@ -1103,7 +1100,6 @@ STDMETHODIMP VLCVideo::get_height(int* height) ...@@ -1103,7 +1100,6 @@ STDMETHODIMP VLCVideo::get_height(int* height)
/*******************************************************************************/ /*******************************************************************************/
VLCControl2::VLCControl2(VLCPlugin *p_instance) : VLCControl2::VLCControl2(VLCPlugin *p_instance) :
VLCConfiguration(p_instance),
_p_instance(p_instance), _p_instance(p_instance),
_p_typeinfo(NULL), _p_typeinfo(NULL),
_p_vlcaudio(NULL), _p_vlcaudio(NULL),
...@@ -1198,6 +1194,135 @@ STDMETHODIMP VLCControl2::Invoke(DISPID dispIdMember, REFIID riid, ...@@ -1198,6 +1194,135 @@ STDMETHODIMP VLCControl2::Invoke(DISPID dispIdMember, REFIID riid,
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCControl2::get_AutoLoop(VARIANT_BOOL *autoloop)
{
if( NULL == autoloop )
return E_POINTER;
*autoloop = _p_instance->getAutoLoop() ? VARIANT_TRUE: VARIANT_FALSE;
return S_OK;
};
STDMETHODIMP VLCControl2::put_AutoLoop(VARIANT_BOOL autoloop)
{
_p_instance->setAutoLoop((VARIANT_FALSE != autoloop) ? TRUE: FALSE);
return S_OK;
};
STDMETHODIMP VLCControl2::get_AutoPlay(VARIANT_BOOL *autoplay)
{
if( NULL == autoplay )
return E_POINTER;
*autoplay = _p_instance->getAutoPlay() ? VARIANT_TRUE: VARIANT_FALSE;
return S_OK;
};
STDMETHODIMP VLCControl2::put_AutoPlay(VARIANT_BOOL autoplay)
{
_p_instance->setAutoPlay((VARIANT_FALSE != autoplay) ? TRUE: FALSE);
return S_OK;
};
STDMETHODIMP VLCControl2::get_BaseURL(BSTR *url)
{
if( NULL == url )
return E_POINTER;
*url = SysAllocStringLen(_p_instance->getBaseURL(),
SysStringLen(_p_instance->getBaseURL()));
return NOERROR;
};
STDMETHODIMP VLCControl2::put_BaseURL(BSTR mrl)
{
_p_instance->setBaseURL(mrl);
return S_OK;
};
STDMETHODIMP VLCControl2::get_MRL(BSTR *mrl)
{
if( NULL == mrl )
return E_POINTER;
*mrl = SysAllocStringLen(_p_instance->getMRL(),
SysStringLen(_p_instance->getMRL()));
return NOERROR;
};
STDMETHODIMP VLCControl2::put_MRL(BSTR mrl)
{
_p_instance->setMRL(mrl);
return S_OK;
};
STDMETHODIMP VLCControl2::get_StartTime(int *seconds)
{
if( NULL == seconds )
return E_POINTER;
*seconds = _p_instance->getStartTime();
return S_OK;
};
STDMETHODIMP VLCControl2::put_StartTime(int seconds)
{
_p_instance->setStartTime(seconds);
return NOERROR;
};
STDMETHODIMP VLCControl2::get_VersionInfo(BSTR *version)
{
if( NULL == version )
return E_POINTER;
const char *versionStr = VLC_Version();
if( NULL != versionStr )
{
*version = BSTRFromCStr(_p_instance->getCodePage(), versionStr);
return NULL == *version ? E_OUTOFMEMORY : NOERROR;
}
*version = NULL;
return E_FAIL;
};
STDMETHODIMP VLCControl2::get_Visible(VARIANT_BOOL *isVisible)
{
if( NULL == isVisible )
return E_POINTER;
*isVisible = _p_instance->getVisible() ? VARIANT_TRUE : VARIANT_FALSE;
return NOERROR;
};
STDMETHODIMP VLCControl2::put_Visible(VARIANT_BOOL isVisible)
{
_p_instance->setVisible(isVisible != VARIANT_FALSE);
return NOERROR;
};
STDMETHODIMP VLCControl2::get_Volume(int *volume)
{
if( NULL == volume )
return E_POINTER;
*volume = _p_instance->getVolume();
return NOERROR;
};
STDMETHODIMP VLCControl2::put_Volume(int volume)
{
_p_instance->setVolume(volume);
return NOERROR;
};
STDMETHODIMP VLCControl2::get_audio(IVLCAudio** obj) STDMETHODIMP VLCControl2::get_audio(IVLCAudio** obj)
{ {
if( NULL == obj ) if( NULL == obj )
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#define _VLCCONTROL2_H_ #define _VLCCONTROL2_H_
#include "axvlc_idl.h" #include "axvlc_idl.h"
#include "vlcconfiguration.h"
class VLCAudio : public IVLCAudio class VLCAudio : public IVLCAudio
{ {
...@@ -67,7 +66,7 @@ public: ...@@ -67,7 +66,7 @@ public:
STDMETHODIMP toggleMute(); STDMETHODIMP toggleMute();
protected: protected:
virtual HRESULT loadTypeInfo(); HRESULT loadTypeInfo();
private: private:
VLCPlugin* _p_instance; VLCPlugin* _p_instance;
...@@ -110,11 +109,11 @@ public: ...@@ -110,11 +109,11 @@ public:
STDMETHODIMP Invoke(DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); STDMETHODIMP Invoke(DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
// IVLCInput methods // IVLCInput methods
STDMETHODIMP get_length(__int64*); STDMETHODIMP get_length(double*);
STDMETHODIMP get_position(float*); STDMETHODIMP get_position(float*);
STDMETHODIMP put_position(float); STDMETHODIMP put_position(float);
STDMETHODIMP get_time(__int64*); STDMETHODIMP get_time(double*);
STDMETHODIMP put_time(__int64); STDMETHODIMP put_time(double);
STDMETHODIMP get_state(int*); STDMETHODIMP get_state(int*);
STDMETHODIMP get_rate(float*); STDMETHODIMP get_rate(float*);
STDMETHODIMP put_rate(float); STDMETHODIMP put_rate(float);
...@@ -122,7 +121,7 @@ public: ...@@ -122,7 +121,7 @@ public:
STDMETHODIMP get_hasVout(VARIANT_BOOL*); STDMETHODIMP get_hasVout(VARIANT_BOOL*);
protected: protected:
virtual HRESULT loadTypeInfo(); HRESULT loadTypeInfo();
private: private:
VLCPlugin* _p_instance; VLCPlugin* _p_instance;
...@@ -177,7 +176,7 @@ public: ...@@ -177,7 +176,7 @@ public:
STDMETHODIMP removeItem(int); STDMETHODIMP removeItem(int);
protected: protected:
virtual HRESULT loadTypeInfo(); HRESULT loadTypeInfo();
private: private:
VLCPlugin* _p_instance; VLCPlugin* _p_instance;
...@@ -225,7 +224,7 @@ public: ...@@ -225,7 +224,7 @@ public:
STDMETHODIMP get_height(int*); STDMETHODIMP get_height(int*);
protected: protected:
virtual HRESULT loadTypeInfo(); HRESULT loadTypeInfo();
private: private:
VLCPlugin* _p_instance; VLCPlugin* _p_instance;
...@@ -233,7 +232,7 @@ private: ...@@ -233,7 +232,7 @@ private:
}; };
class VLCControl2 : public VLCConfiguration class VLCControl2 : public IVLCControl2
{ {
public: public:
...@@ -248,7 +247,6 @@ public: ...@@ -248,7 +247,6 @@ public:
return E_POINTER; return E_POINTER;
if( (IID_IUnknown == riid) if( (IID_IUnknown == riid)
|| (IID_IDispatch == riid) || (IID_IDispatch == riid)
|| (IID_IVLCConfiguration == riid)
|| (IID_IVLCControl2 == riid) ) || (IID_IVLCControl2 == riid) )
{ {
AddRef(); AddRef();
...@@ -268,13 +266,29 @@ public: ...@@ -268,13 +266,29 @@ public:
STDMETHODIMP Invoke(DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); STDMETHODIMP Invoke(DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
// IVLCControl2 methods // IVLCControl2 methods
STDMETHODIMP get_AutoLoop(VARIANT_BOOL *autoloop);
STDMETHODIMP put_AutoLoop(VARIANT_BOOL autoloop);
STDMETHODIMP get_AutoPlay(VARIANT_BOOL *autoplay);
STDMETHODIMP put_AutoPlay(VARIANT_BOOL autoplay);
STDMETHODIMP get_BaseURL(BSTR *url);
STDMETHODIMP put_BaseURL(BSTR url);
STDMETHODIMP get_MRL(BSTR *mrl);
STDMETHODIMP put_MRL(BSTR mrl);
STDMETHODIMP get_StartTime(int *seconds);
STDMETHODIMP put_StartTime(int seconds);
STDMETHODIMP get_VersionInfo(BSTR *version);
STDMETHODIMP get_Visible(VARIANT_BOOL *visible);
STDMETHODIMP put_Visible(VARIANT_BOOL visible);
STDMETHODIMP get_Volume(int *volume);
STDMETHODIMP put_Volume(int volume);
STDMETHODIMP get_audio(IVLCAudio**); STDMETHODIMP get_audio(IVLCAudio**);
STDMETHODIMP get_input(IVLCInput**); STDMETHODIMP get_input(IVLCInput**);
STDMETHODIMP get_playlist(IVLCPlaylist**); STDMETHODIMP get_playlist(IVLCPlaylist**);
STDMETHODIMP get_video(IVLCVideo**); STDMETHODIMP get_video(IVLCVideo**);
protected: protected:
virtual HRESULT loadTypeInfo(); HRESULT loadTypeInfo();
private: private:
VLCPlugin* _p_instance; VLCPlugin* _p_instance;
......
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