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

- activex: added configuration interface

parent cf23322c
...@@ -38,6 +38,8 @@ SOURCES_activex = \ ...@@ -38,6 +38,8 @@ 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 \
......
...@@ -43,7 +43,7 @@ library AXVLC ...@@ -43,7 +43,7 @@ library AXVLC
importlib("stdole2.tlb"); importlib("stdole2.tlb");
enum VLCPlaylistMode typedef [public] enum VLCPlaylistMode
{ {
VLCPlayListInsert = 1, VLCPlayListInsert = 1,
VLCPlayListInsertAndGo = 9, VLCPlayListInsertAndGo = 9,
...@@ -52,7 +52,7 @@ library AXVLC ...@@ -52,7 +52,7 @@ library AXVLC
VLCPlayListAppend = 4, VLCPlayListAppend = 4,
VLCPlayListAppendAndGo = 12, VLCPlayListAppendAndGo = 12,
VLCPlayListCheckInsert = 16 VLCPlayListCheckInsert = 16
}; } eVLCPlaylistMode;
// playlist target position // playlist target position
const int VLCPlayListEnd = -666; const int VLCPlayListEnd = -666;
...@@ -67,6 +67,8 @@ library AXVLC ...@@ -67,6 +67,8 @@ library AXVLC
const int DISPID_MRL = 106; const int DISPID_MRL = 106;
const int DISPID_AutoPlay = 107; const int DISPID_AutoPlay = 107;
const int DISPID_AutoLoop = 108; const int DISPID_AutoLoop = 108;
const int DISPID_StartTime = 109;
const int DISPID_BaseURL = 110;
[ [
odl, odl,
...@@ -297,6 +299,54 @@ library AXVLC ...@@ -297,6 +299,54 @@ library AXVLC
HRESULT height([out, retval] int* height); HRESULT height([out, retval] int* height);
}; };
[
odl,
uuid(15179CD8-CC12-4242-A58E-E412217FF343),
helpstring("VLC Configuration options"),
dual,
oleautomation
]
interface IVLCConfiguration : IDispatch
{
[id(DISPID_AutoLoop), propget, helpstring("Returns/sets a value that determines whether the playlist is looped")]
HRESULT AutoLoop([out, retval] VARIANT_BOOL* autoloop);
[id(DISPID_AutoLoop), propput, helpstring("Returns/sets a value that determines whether the playlist is looped")]
HRESULT AutoLoop([in] VARIANT_BOOL autoloop);
[id(DISPID_AutoPlay), propget, helpstring("Returns/sets a value that determines whether the playlist is played on startup")]
HRESULT AutoPlay([out, retval] VARIANT_BOOL* autoplay);
[id(DISPID_AutoPlay), propput, helpstring("Returns/Sets a value that determines whether the playlist is played on startup")]
HRESULT AutoPlay([in] VARIANT_BOOL autoplay);
[id(DISPID_BaseURL), propget, helpstring("Returns/sets the base URL for relative paths")]
HRESULT BaseURL([out, retval] BSTR* url);
[id(DISPID_BaseURL), propput, helpstring("Returns/sets the base URL for relative paths")]
HRESULT BaseURL([in] BSTR url);
[id(DISPID_StartTime), propget, helpstring("Returns/sets playback start time of URL.")]
HRESULT StartTime([out, retval] int* seconds);
[id(DISPID_StartTime), propput, helpstring("Returns/sets playback start time of URL.")]
HRESULT StartTime([in] int seconds);
[id(DISPID_MRL), propget, helpstring("Returns/sets the default MRL in playlist")]
HRESULT MRL([out, retval] BSTR* mrl);
[id(DISPID_MRL), propput, helpstring("Returns/sets the default MRL in playlist")]
HRESULT MRL([in] BSTR mrl);
[propget, helpstring("Returns VLC Version.")]
HRESULT VersionInfo([out, retval] BSTR* version);
[id(DISPID_Visible), propget, helpstring("Returns/sets a value that determines whether viewing area is visible or hidden.")]
HRESULT Visible([out, retval] VARIANT_BOOL* visible);
[id(DISPID_Visible), propput, helpstring("Returns/sets a value that determines whether viewing area is visible or hidden.")]
HRESULT Visible([in] VARIANT_BOOL visible);
[id(DISPID_Volume), propget, helpstring("Returns/sets default audio volume.")]
HRESULT Volume([out, retval] int* volume);
[id(DISPID_Volume), propput, helpstring("Returns/sets default audio volume.")]
HRESULT Volume([in] int volume);
};
[ [
odl, odl,
uuid(2D719729-5333-406C-BF12-8DE787FD65E3), uuid(2D719729-5333-406C-BF12-8DE787FD65E3),
...@@ -304,7 +354,7 @@ library AXVLC ...@@ -304,7 +354,7 @@ library AXVLC
dual, dual,
oleautomation oleautomation
] ]
interface IVLCControl2 : IDispatch 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);
......
No preview for this file type
...@@ -17,6 +17,7 @@ DEFINE_GUID(IID_IVLCAudio, 0x9e0bd17b, 0x2d3c, 0x4656, 0xb9,0x4d, 0x03,0x08,0x4f ...@@ -17,6 +17,7 @@ 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.
...@@ -384,6 +384,7 @@ STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) ...@@ -384,6 +384,7 @@ STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
return 0; return 0;
DWORD dwRegisterClassObject; DWORD dwRegisterClassObject;
DWORD dwRegisterClassObject2;
if( FAILED(CoRegisterClassObject(CLSID_VLCPlugin, classProc, if( FAILED(CoRegisterClassObject(CLSID_VLCPlugin, classProc,
CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &dwRegisterClassObject)) ) CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &dwRegisterClassObject)) )
...@@ -395,6 +396,10 @@ STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) ...@@ -395,6 +396,10 @@ STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
ACTIVEOBJECT_WEAK, &dwRegisterActiveObject)) ) ACTIVEOBJECT_WEAK, &dwRegisterActiveObject)) )
return 0; return 0;
if( FAILED(RegisterActiveObject(classProc, CLSID_VLCPlugin2,
ACTIVEOBJECT_WEAK, &dwRegisterActiveObject2)) )
return 0;
classProc->Release(); classProc->Release();
/* /*
...@@ -405,7 +410,7 @@ STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) ...@@ -405,7 +410,7 @@ STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
while( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) while( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) )
{ {
if( msg.message == WM_QUIT ) if( msg.message == WM_QUIT )
break; // Leave the PeekMessage while() loop break; // break out PeekMessage loop
/*if(TranslateAccelerator(ghwndApp, ghAccel, &msg)) /*if(TranslateAccelerator(ghwndApp, ghAccel, &msg))
continue;*/ continue;*/
...@@ -415,7 +420,7 @@ STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) ...@@ -415,7 +420,7 @@ STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
} }
if(msg.message == WM_QUIT) if(msg.message == WM_QUIT)
break; // Leave the for() loop break; // break out main loop
WaitMessage(); WaitMessage();
} }
...@@ -423,8 +428,11 @@ STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) ...@@ -423,8 +428,11 @@ STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
if( SUCCEEDED(RevokeActiveObject(dwRegisterActiveObject, NULL)) ) if( SUCCEEDED(RevokeActiveObject(dwRegisterActiveObject, NULL)) )
CoRevokeClassObject(dwRegisterClassObject); CoRevokeClassObject(dwRegisterClassObject);
if( SUCCEEDED(RevokeActiveObject(dwRegisterActiveObject2, NULL)) )
CoRevokeClassObject(dwRegisterClassObject2);
// Reached on WM_QUIT message // Reached on WM_QUIT message
CoUninitialize(); OleUninitialize();
return ((int) msg.wParam); return ((int) msg.wParam);
}; };
......
...@@ -171,7 +171,14 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr ...@@ -171,7 +171,14 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr
V_VT(&value) = VT_I4; V_VT(&value) = VT_I4;
if( S_OK == pPropBag->Read(OLESTR("starttime"), &value, pErrorLog) ) if( S_OK == pPropBag->Read(OLESTR("starttime"), &value, pErrorLog) )
{ {
_p_instance->setTime(V_I4(&value)); _p_instance->setStartTime(V_I4(&value));
VariantClear(&value);
}
V_VT(&value) = VT_BSTR;
if( S_OK == pPropBag->Read(OLESTR("baseurl"), &value, pErrorLog) )
{
_p_instance->setBaseURL(V_BSTR(&value));
VariantClear(&value); VariantClear(&value);
} }
...@@ -221,10 +228,16 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt ...@@ -221,10 +228,16 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt
VariantClear(&value); VariantClear(&value);
V_VT(&value) = VT_I4; V_VT(&value) = VT_I4;
V_I4(&value) = _p_instance->getTime(); V_I4(&value) = _p_instance->getStartTime();
pPropBag->Write(OLESTR("StartTime"), &value); pPropBag->Write(OLESTR("StartTime"), &value);
VariantClear(&value); VariantClear(&value);
V_VT(&value) = VT_BSTR;
V_BSTR(&value) = SysAllocStringLen(_p_instance->getBaseURL(),
SysStringLen(_p_instance->getBaseURL()));
pPropBag->Write(OLESTR("BaseURL"), &value);
VariantClear(&value);
if( fClearDirty ) if( fClearDirty )
_p_instance->setDirty(FALSE); _p_instance->setDirty(FALSE);
......
...@@ -223,6 +223,7 @@ STDMETHODIMP VLCPluginClass::CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, vo ...@@ -223,6 +223,7 @@ STDMETHODIMP VLCPluginClass::CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, vo
if( NULL != plugin ) if( NULL != plugin )
{ {
HRESULT hr = plugin->QueryInterface(riid, ppv); HRESULT hr = plugin->QueryInterface(riid, ppv);
// the following will destroy the object if QueryInterface() failed
plugin->Release(); plugin->Release();
return hr; return hr;
} }
...@@ -472,9 +473,10 @@ HRESULT VLCPlugin::onInit(void) ...@@ -472,9 +473,10 @@ HRESULT VLCPlugin::onInit(void)
if( NULL == _p_libvlc ) if( NULL == _p_libvlc )
{ {
// initialize persistable properties // initialize persistable properties
_bstr_mrl = NULL;
_b_autoplay = TRUE; _b_autoplay = TRUE;
_b_autoloop = FALSE; _b_autoloop = FALSE;
_bstr_baseurl = NULL;
_bstr_mrl = NULL;
_b_visible = TRUE; _b_visible = TRUE;
_b_mute = FALSE; _b_mute = FALSE;
_i_volume = 50; _i_volume = 50;
...@@ -493,12 +495,11 @@ HRESULT VLCPlugin::onInit(void) ...@@ -493,12 +495,11 @@ HRESULT VLCPlugin::onInit(void)
HRESULT VLCPlugin::onLoad(void) HRESULT VLCPlugin::onLoad(void)
{ {
if( SysStringLen(_bstr_mrl) > 0 ) if( SysStringLen(_bstr_baseurl) == 0 )
{ {
/* /*
** try to combine MRL with client site moniker, which for Internet Explorer ** try to retreive the base URL using the client site moniker, which for Internet Explorer
** is the URL of the page the plugin is embedded into. Hence, if the MRL ** is the URL of the page the plugin is embedded into.
** is a relative URL, we should end up with an absolute URL
*/ */
LPOLECLIENTSITE pClientSite; LPOLECLIENTSITE pClientSite;
if( SUCCEEDED(vlcOleObject->GetClientSite(&pClientSite)) && (NULL != pClientSite) ) if( SUCCEEDED(vlcOleObject->GetClientSite(&pClientSite)) && (NULL != pClientSite) )
...@@ -518,26 +519,13 @@ HRESULT VLCPlugin::onLoad(void) ...@@ -518,26 +519,13 @@ HRESULT VLCPlugin::onLoad(void)
*/ */
if( UrlIsW(base_url, URLIS_URL) ) if( UrlIsW(base_url, URLIS_URL) )
{ {
DWORD len = INTERNET_MAX_URL_LENGTH; /* copy base URL */
LPOLESTR abs_url = (LPOLESTR)CoTaskMemAlloc(sizeof(OLECHAR)*len); _bstr_mrl = SysAllocString(base_url);
if( NULL != abs_url )
{
if( SUCCEEDED(UrlCombineW(base_url, _bstr_mrl, abs_url, &len,
URL_ESCAPE_UNSAFE|URL_PLUGGABLE_PROTOCOL)) )
{
SysFreeString(_bstr_mrl);
_bstr_mrl = SysAllocStringLen(abs_url, len);
}
CoTaskMemFree(abs_url);
}
} }
CoTaskMemFree(base_url); CoTaskMemFree(base_url);
} }
pContMoniker->Release();
} }
pBC->Release();
} }
pClientSite->Release();
} }
} }
setDirty(FALSE); setDirty(FALSE);
...@@ -639,7 +627,27 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc) ...@@ -639,7 +627,27 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
return E_FAIL; return E_FAIL;
} }
char *psz_mrl = CStrFromBSTR(CP_UTF8, _bstr_mrl); if( SysStringLen(_bstr_mrl) > 0 )
{
char *psz_mrl = NULL;
DWORD len = INTERNET_MAX_URL_LENGTH;
LPOLESTR abs_url = (LPOLESTR)CoTaskMemAlloc(sizeof(OLECHAR)*len);
if( NULL != abs_url )
{
/*
** if the MRL a relative URL, we should end up with an absolute URL
*/
if( SUCCEEDED(UrlCombineW(_bstr_baseurl, _bstr_mrl, abs_url, &len,
URL_ESCAPE_UNSAFE|URL_PLUGGABLE_PROTOCOL)) )
{
psz_mrl = CStrFromBSTR(CP_UTF8, abs_url);
}
else
{
psz_mrl = CStrFromBSTR(CP_UTF8, _bstr_mrl);
}
CoTaskMemFree(abs_url);
}
if( NULL != psz_mrl ) if( NULL != psz_mrl )
{ {
const char *options[1]; const char *options[1];
...@@ -656,6 +664,7 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc) ...@@ -656,6 +664,7 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
CoTaskMemFree(psz_mrl); CoTaskMemFree(psz_mrl);
} }
} }
}
*pp_libvlc = _p_libvlc; *pp_libvlc = _p_libvlc;
return S_OK; return S_OK;
}; };
...@@ -917,7 +926,7 @@ void VLCPlugin::setTime(int seconds) ...@@ -917,7 +926,7 @@ void VLCPlugin::setTime(int seconds)
if( seconds != _i_time ) if( seconds != _i_time )
{ {
_i_time = seconds; setStartTime(_i_time);
if( isRunning() ) if( isRunning() )
{ {
libvlc_input_t *p_input = libvlc_playlist_get_input(_p_libvlc, NULL); libvlc_input_t *p_input = libvlc_playlist_get_input(_p_libvlc, NULL);
...@@ -927,7 +936,6 @@ void VLCPlugin::setTime(int seconds) ...@@ -927,7 +936,6 @@ void VLCPlugin::setTime(int seconds)
libvlc_input_free(p_input); libvlc_input_free(p_input);
} }
} }
setDirty(TRUE);
} }
}; };
......
...@@ -120,9 +120,24 @@ public: ...@@ -120,9 +120,24 @@ public:
BOOL getVisible(void) { return _b_visible; }; BOOL getVisible(void) { return _b_visible; };
BOOL isVisible(void) { return _b_visible || (! _b_usermode); }; BOOL isVisible(void) { return _b_visible || (! _b_usermode); };
inline void setStartTime(int time)
{
_i_time = time;
setDirty(TRUE);
};
inline int getStartTime(void) { return _i_time; };
void setTime(int time); void setTime(int time);
int getTime(void) { return _i_time; }; int getTime(void) { return _i_time; };
void setBaseURL(BSTR url)
{
SysFreeString(_bstr_baseurl);
_bstr_baseurl = SysAllocStringLen(url, SysStringLen(url));
setDirty(TRUE);
};
const BSTR getBaseURL(void) { return _bstr_baseurl; };
// control size in HIMETRIC // control size in HIMETRIC
inline void setExtent(const SIZEL& extent) inline void setExtent(const SIZEL& extent)
{ {
...@@ -240,6 +255,7 @@ private: ...@@ -240,6 +255,7 @@ private:
RECT _posRect; RECT _posRect;
// persistable properties // persistable properties
BSTR _bstr_baseurl;
BSTR _bstr_mrl; BSTR _bstr_mrl;
BOOL _b_autoplay; BOOL _b_autoplay;
BOOL _b_autoloop; BOOL _b_autoloop;
......
/*****************************************************************************
* 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,6 +148,8 @@ STDMETHODIMP VLCAudio::put_mute(VARIANT_BOOL mute) ...@@ -148,6 +148,8 @@ 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 )
...@@ -161,6 +163,7 @@ STDMETHODIMP VLCAudio::get_volume(int* volume) ...@@ -161,6 +163,7 @@ 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);
...@@ -1100,6 +1103,7 @@ STDMETHODIMP VLCVideo::get_height(int* height) ...@@ -1100,6 +1103,7 @@ 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),
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#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
{ {
...@@ -65,9 +66,10 @@ public: ...@@ -65,9 +66,10 @@ public:
STDMETHODIMP put_volume(int); STDMETHODIMP put_volume(int);
STDMETHODIMP toggleMute(); STDMETHODIMP toggleMute();
private: protected:
HRESULT loadTypeInfo(); virtual HRESULT loadTypeInfo();
private:
VLCPlugin* _p_instance; VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo; ITypeInfo* _p_typeinfo;
...@@ -119,9 +121,10 @@ public: ...@@ -119,9 +121,10 @@ public:
STDMETHODIMP get_fps(float*); STDMETHODIMP get_fps(float*);
STDMETHODIMP get_hasVout(VARIANT_BOOL*); STDMETHODIMP get_hasVout(VARIANT_BOOL*);
private: protected:
HRESULT loadTypeInfo(); virtual HRESULT loadTypeInfo();
private:
VLCPlugin* _p_instance; VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo; ITypeInfo* _p_typeinfo;
...@@ -173,10 +176,10 @@ public: ...@@ -173,10 +176,10 @@ public:
STDMETHODIMP clear(); STDMETHODIMP clear();
STDMETHODIMP removeItem(int); STDMETHODIMP removeItem(int);
private: protected:
virtual HRESULT loadTypeInfo();
HRESULT loadTypeInfo();
private:
VLCPlugin* _p_instance; VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo; ITypeInfo* _p_typeinfo;
...@@ -221,16 +224,16 @@ public: ...@@ -221,16 +224,16 @@ public:
STDMETHODIMP get_width(int*); STDMETHODIMP get_width(int*);
STDMETHODIMP get_height(int*); STDMETHODIMP get_height(int*);
private: protected:
virtual HRESULT loadTypeInfo();
HRESULT loadTypeInfo();
private:
VLCPlugin* _p_instance; VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo; ITypeInfo* _p_typeinfo;
}; };
class VLCControl2 : public IVLCControl2 class VLCControl2 : public VLCConfiguration
{ {
public: public:
...@@ -245,6 +248,7 @@ public: ...@@ -245,6 +248,7 @@ 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();
...@@ -269,10 +273,10 @@ public: ...@@ -269,10 +273,10 @@ public:
STDMETHODIMP get_playlist(IVLCPlaylist**); STDMETHODIMP get_playlist(IVLCPlaylist**);
STDMETHODIMP get_video(IVLCVideo**); STDMETHODIMP get_video(IVLCVideo**);
private: protected:
virtual HRESULT loadTypeInfo();
HRESULT loadTypeInfo();
private:
VLCPlugin* _p_instance; VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo; 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