plugin.h \
axvlc_idl.c \
axvlc_idl.h \
+ guiddef.h \
$(NULL)
DIST_rsrc = \
###############################################################################
clean-stamp:
- rm -f stamp-pic
+ rm -f stamp-builtin
if BUILD_SHARED
stamp-builtin:
uuid(C2FA41D0-B113-476e-AC8C-9BD14999C1C1),\r
helpstring("VLC Control (deprecated)"),\r
dual,\r
- hidden,\r
oleautomation\r
]\r
interface IVLCControl : IDispatch\r
[\r
uuid(DF48072F-5EF8-434e-9B40-E2F3AE759B5F),\r
helpstring("Event interface for VLC control"),\r
- hidden\r
]\r
dispinterface DVLCEvents\r
{\r
odl,\r
uuid(9E0BD17B-2D3C-4656-B94D-03084F3FD9D4),\r
helpstring("VLC Audio APIs"),\r
- hidden,\r
dual,\r
- nonextensible,\r
oleautomation\r
]\r
interface IVLCAudio : IDispatch\r
odl,\r
uuid(49E0DBD1-9440-466C-9C97-95C67190C603),\r
helpstring("VLC Input APIs"),\r
- hidden,\r
dual,\r
- nonextensible,\r
oleautomation\r
]\r
interface IVLCInput : IDispatch\r
odl,\r
uuid(9ED00AFA-7BCD-4FFF-8D48-7DD4DB2C800D),\r
helpstring("VLC Log Message"),\r
- hidden,\r
dual,\r
- nonextensible,\r
oleautomation\r
]\r
interface IVLCMessage: IDispatch\r
odl,\r
uuid(15179CD8-CC12-4242-A58E-E412217FF343),\r
helpstring("VLC Log iterator"),\r
- hidden,\r
dual,\r
- nonextensible,\r
oleautomation\r
]\r
interface IVLCMessageIterator : IDispatch\r
[\r
odl,\r
uuid(6C5CE55D-2D6C-4AAD-8299-C62D2371F106),\r
- helpstring("VLC Log APIs"),\r
- hidden,\r
+ helpstring("VLC Log Messages Collection."),\r
dual,\r
- nonextensible,\r
oleautomation\r
]\r
interface IVLCMessages : IDispatch\r
odl,\r
uuid(8E3BC3D9-62E9-48FB-8A6D-993F9ABC4A0A),\r
helpstring("VLC Log APIs"),\r
- hidden,\r
dual,\r
- nonextensible,\r
oleautomation\r
]\r
interface IVLCLog : IDispatch\r
HRESULT verbosity([in] long level);\r
};\r
\r
+ [\r
+ odl,\r
+ uuid(FD37FE32-82BC-4A25-B056-315F4DBB194D),\r
+ helpstring("VLC Playlist Items collection"),\r
+ dual,\r
+ oleautomation\r
+ ]\r
+ interface IVLCPlaylistItems : IDispatch\r
+ {\r
+ [propget, helpstring("Returns number of items in playlist.")]\r
+ HRESULT count([out, retval] long* count);\r
+\r
+ [helpstring("Remove all items from playlist.")]\r
+ HRESULT clear();\r
+\r
+ [helpstring("remove item from playlist.")]\r
+ HRESULT remove([in] long itemId);\r
+ };\r
+\r
[\r
odl,\r
uuid(54613049-40BF-4035-9E70-0A9312C0188D),\r
helpstring("VLC Playlist APIs"),\r
- hidden,\r
dual,\r
- nonextensible,\r
oleautomation\r
]\r
interface IVLCPlaylist : IDispatch\r
{\r
- [propget, helpstring("Returns number of items in playlist.")]\r
+ [hidden, propget, helpstring("Returns number of items in playlist. (deprecated)")]\r
HRESULT itemCount([out, retval] long* count);\r
\r
[propget, helpstring("Returns whether playback displays video.")]\r
HRESULT isPlaying([out, retval] VARIANT_BOOL* playing);\r
\r
[helpstring("Add a playlist item.")]\r
- HRESULT add([in] BSTR uri, [in, optional] VARIANT name, [in, optional] VARIANT options, [out, retval] long* item);\r
+ HRESULT add([in] BSTR uri, [in, optional] VARIANT name, [in, optional] VARIANT options, [out, retval] long* itemId);\r
\r
[helpstring("Play/Resume the playlist.")]\r
HRESULT play();\r
\r
[helpstring("Play item in playlist.")]\r
- HRESULT playItem([in] long item);\r
+ HRESULT playItem([in] long itemId);\r
\r
[helpstring("Play/Pause current clip.")]\r
HRESULT togglePause();\r
[helpstring("Advance to previous item in playlist.")]\r
HRESULT prev();\r
\r
- [helpstring("Remove all items from playlist.")]\r
+ [hidden, helpstring("Remove all items from playlist. (deprecated)")]\r
HRESULT clear();\r
\r
- [helpstring("remove item from playlist.")]\r
+ [hidden, helpstring("Remove item from playlist. (deprecated)")]\r
HRESULT removeItem([in] long item);\r
+\r
+ [propget, helpstring("Returns the playlist items collection object.")]\r
+ HRESULT items([out, retval] IVLCPlaylistItems** obj);\r
};\r
\r
[\r
odl,\r
uuid(0AAEDF0B-D333-4B27-A0C6-BBF31413A42E),\r
helpstring("VLC Video APIs"),\r
- hidden,\r
dual,\r
- nonextensible,\r
oleautomation\r
]\r
interface IVLCVideo : IDispatch\r
HRESULT height([out, retval] long* height);\r
\r
[propget, helpstring("Returns video aspect ratio.")]\r
- HRESULT aspectRatio([out, retval] BSTR aspect);\r
+ HRESULT aspectRatio([out, retval] BSTR* aspect);\r
[propput, helpstring("Sets video aspect ratio.")]\r
HRESULT aspectRatio([in] BSTR aspect);\r
\r
odl,\r
uuid(2D719729-5333-406C-BF12-8DE787FD65E3),\r
helpstring("VLC Control"),\r
- hidden,\r
dual,\r
oleautomation\r
]\r
{\r
[default] interface IVLCControl2;\r
interface IVLCControl;\r
- [default, source] dispinterface DVLCEvents;\r
};\r
};\r
DEFINE_GUID(IID_IVLCMessageIterator, 0x15179cd8, 0xcc12, 0x4242, 0xa5,0x8e, 0xe4,0x12,0x21,0x7f,0xf3,0x43);
DEFINE_GUID(IID_IVLCMessages, 0x6c5ce55d, 0x2d6c, 0x4aad, 0x82,0x99, 0xc6,0x2d,0x23,0x71,0xf1,0x06);
DEFINE_GUID(IID_IVLCLog, 0x8e3bc3d9, 0x62e9, 0x48fb, 0x8a,0x6d, 0x99,0x3f,0x9a,0xbc,0x4a,0x0a);
+DEFINE_GUID(IID_IVLCPlaylistItems, 0xfd37fe32, 0x82bc, 0x4a25, 0xb0,0x56, 0x31,0x5f,0x4d,0xbb,0x19,0x4d);
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_IVLCControl2, 0x2d719729, 0x5333, 0x406c, 0xbf,0x12, 0x8d,0xe7,0x87,0xfd,0x65,0xe3);
#endif /* __IVLCLog_INTERFACE_DEFINED__ */
+#ifndef __IVLCPlaylistItems_FWD_DEFINED__
+#define __IVLCPlaylistItems_FWD_DEFINED__
+typedef interface IVLCPlaylistItems IVLCPlaylistItems;
+#endif
+
+/*****************************************************************************
+ * IVLCPlaylistItems interface
+ */
+#ifndef __IVLCPlaylistItems_INTERFACE_DEFINED__
+#define __IVLCPlaylistItems_INTERFACE_DEFINED__
+
+DEFINE_GUID(IID_IVLCPlaylistItems, 0xfd37fe32, 0x82bc, 0x4a25, 0xb0,0x56, 0x31,0x5f,0x4d,0xbb,0x19,0x4d);
+#if defined(__cplusplus) && !defined(CINTERFACE)
+interface IVLCPlaylistItems : public IDispatch
+{
+ virtual HRESULT STDMETHODCALLTYPE get_count(
+ long* count) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE clear(
+ ) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE remove(
+ long itemId) = 0;
+
+};
+#else
+typedef struct IVLCPlaylistItemsVtbl {
+ BEGIN_INTERFACE
+
+ /*** IUnknown methods ***/
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(
+ IVLCPlaylistItems* This,
+ REFIID riid,
+ void** ppvObject);
+
+ ULONG (STDMETHODCALLTYPE *AddRef)(
+ IVLCPlaylistItems* This);
+
+ ULONG (STDMETHODCALLTYPE *Release)(
+ IVLCPlaylistItems* This);
+
+ /*** IDispatch methods ***/
+ HRESULT (STDMETHODCALLTYPE *GetTypeInfoCount)(
+ IVLCPlaylistItems* This,
+ UINT* pctinfo);
+
+ HRESULT (STDMETHODCALLTYPE *GetTypeInfo)(
+ IVLCPlaylistItems* This,
+ UINT iTInfo,
+ LCID lcid,
+ ITypeInfo** ppTInfo);
+
+ HRESULT (STDMETHODCALLTYPE *GetIDsOfNames)(
+ IVLCPlaylistItems* This,
+ REFIID riid,
+ LPOLESTR* rgszNames,
+ UINT cNames,
+ LCID lcid,
+ DISPID* rgDispId);
+
+ HRESULT (STDMETHODCALLTYPE *Invoke)(
+ IVLCPlaylistItems* This,
+ DISPID dispIdMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ DISPPARAMS* pDispParams,
+ VARIANT* pVarResult,
+ EXCEPINFO* pExcepInfo,
+ UINT* puArgErr);
+
+ /*** IVLCPlaylistItems methods ***/
+ HRESULT (STDMETHODCALLTYPE *get_count)(
+ IVLCPlaylistItems* This,
+ long* count);
+
+ HRESULT (STDMETHODCALLTYPE *clear)(
+ IVLCPlaylistItems* This);
+
+ HRESULT (STDMETHODCALLTYPE *remove)(
+ IVLCPlaylistItems* This,
+ long itemId);
+
+ END_INTERFACE
+} IVLCPlaylistItemsVtbl;
+interface IVLCPlaylistItems {
+ const IVLCPlaylistItemsVtbl* lpVtbl;
+};
+
+#ifdef COBJMACROS
+/*** IUnknown methods ***/
+#define IVLCPlaylistItems_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IVLCPlaylistItems_AddRef(p) (p)->lpVtbl->AddRef(p)
+#define IVLCPlaylistItems_Release(p) (p)->lpVtbl->Release(p)
+/*** IDispatch methods ***/
+#define IVLCPlaylistItems_GetTypeInfoCount(p,a) (p)->lpVtbl->GetTypeInfoCount(p,a)
+#define IVLCPlaylistItems_GetTypeInfo(p,a,b,c) (p)->lpVtbl->GetTypeInfo(p,a,b,c)
+#define IVLCPlaylistItems_GetIDsOfNames(p,a,b,c,d,e) (p)->lpVtbl->GetIDsOfNames(p,a,b,c,d,e)
+#define IVLCPlaylistItems_Invoke(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->Invoke(p,a,b,c,d,e,f,g,h)
+/*** IVLCPlaylistItems methods ***/
+#define IVLCPlaylistItems_get_count(p,a) (p)->lpVtbl->get_count(p,a)
+#define IVLCPlaylistItems_clear(p) (p)->lpVtbl->clear(p)
+#define IVLCPlaylistItems_remove(p,a) (p)->lpVtbl->remove(p,a)
+#endif
+
+#endif
+
+HRESULT CALLBACK IVLCPlaylistItems_get_count_Proxy(
+ IVLCPlaylistItems* This,
+ long* count);
+void __RPC_STUB IVLCPlaylistItems_get_count_Stub(
+ IRpcStubBuffer* This,
+ IRpcChannelBuffer* pRpcChannelBuffer,
+ PRPC_MESSAGE pRpcMessage,
+ DWORD* pdwStubPhase);
+HRESULT CALLBACK IVLCPlaylistItems_clear_Proxy(
+ IVLCPlaylistItems* This);
+void __RPC_STUB IVLCPlaylistItems_clear_Stub(
+ IRpcStubBuffer* This,
+ IRpcChannelBuffer* pRpcChannelBuffer,
+ PRPC_MESSAGE pRpcMessage,
+ DWORD* pdwStubPhase);
+HRESULT CALLBACK IVLCPlaylistItems_remove_Proxy(
+ IVLCPlaylistItems* This,
+ long itemId);
+void __RPC_STUB IVLCPlaylistItems_remove_Stub(
+ IRpcStubBuffer* This,
+ IRpcChannelBuffer* pRpcChannelBuffer,
+ PRPC_MESSAGE pRpcMessage,
+ DWORD* pdwStubPhase);
+
+#endif /* __IVLCPlaylistItems_INTERFACE_DEFINED__ */
+
/*****************************************************************************
* IVLCPlaylist interface
*/
BSTR uri,
VARIANT name,
VARIANT options,
- long* item) = 0;
+ long* itemId) = 0;
virtual HRESULT STDMETHODCALLTYPE play(
) = 0;
virtual HRESULT STDMETHODCALLTYPE playItem(
- long item) = 0;
+ long itemId) = 0;
virtual HRESULT STDMETHODCALLTYPE togglePause(
) = 0;
virtual HRESULT STDMETHODCALLTYPE removeItem(
long item) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_items(
+ IVLCPlaylistItems** obj) = 0;
+
};
#else
typedef struct IVLCPlaylistVtbl {
BSTR uri,
VARIANT name,
VARIANT options,
- long* item);
+ long* itemId);
HRESULT (STDMETHODCALLTYPE *play)(
IVLCPlaylist* This);
HRESULT (STDMETHODCALLTYPE *playItem)(
IVLCPlaylist* This,
- long item);
+ long itemId);
HRESULT (STDMETHODCALLTYPE *togglePause)(
IVLCPlaylist* This);
IVLCPlaylist* This,
long item);
+ HRESULT (STDMETHODCALLTYPE *get_items)(
+ IVLCPlaylist* This,
+ IVLCPlaylistItems** obj);
+
END_INTERFACE
} IVLCPlaylistVtbl;
interface IVLCPlaylist {
#define IVLCPlaylist_prev(p) (p)->lpVtbl->prev(p)
#define IVLCPlaylist_clear(p) (p)->lpVtbl->clear(p)
#define IVLCPlaylist_removeItem(p,a) (p)->lpVtbl->removeItem(p,a)
+#define IVLCPlaylist_get_items(p,a) (p)->lpVtbl->get_items(p,a)
#endif
#endif
BSTR uri,
VARIANT name,
VARIANT options,
- long* item);
+ long* itemId);
void __RPC_STUB IVLCPlaylist_add_Stub(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
DWORD* pdwStubPhase);
HRESULT CALLBACK IVLCPlaylist_playItem_Proxy(
IVLCPlaylist* This,
- long item);
+ long itemId);
void __RPC_STUB IVLCPlaylist_playItem_Stub(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
+HRESULT CALLBACK IVLCPlaylist_get_items_Proxy(
+ IVLCPlaylist* This,
+ IVLCPlaylistItems** obj);
+void __RPC_STUB IVLCPlaylist_get_items_Stub(
+ IRpcStubBuffer* This,
+ IRpcChannelBuffer* pRpcChannelBuffer,
+ PRPC_MESSAGE pRpcMessage,
+ DWORD* pdwStubPhase);
#endif /* __IVLCPlaylist_INTERFACE_DEFINED__ */
long* height) = 0;
virtual HRESULT STDMETHODCALLTYPE get_aspectRatio(
- BSTR aspect) = 0;
+ BSTR* aspect) = 0;
virtual HRESULT STDMETHODCALLTYPE put_aspectRatio(
BSTR aspect) = 0;
HRESULT (STDMETHODCALLTYPE *get_aspectRatio)(
IVLCVideo* This,
- BSTR aspect);
+ BSTR* aspect);
HRESULT (STDMETHODCALLTYPE *put_aspectRatio)(
IVLCVideo* This,
DWORD* pdwStubPhase);
HRESULT CALLBACK IVLCVideo_get_aspectRatio_Proxy(
IVLCVideo* This,
- BSTR aspect);
+ BSTR* aspect);
void __RPC_STUB IVLCVideo_get_aspectRatio_Stub(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
CONNECTDATA operator()(const map<DWORD,LPUNKNOWN>::iterator& i)
{
CONNECTDATA cd;
-
+
cd.dwCookie = i->first;
cd.pUnk = i->second;
return cd;
struct IObjectSafety : public IUnknown
{
- virtual STDMETHODIMP GetInterfaceSafetyOptions(
+ virtual STDMETHODIMP GetInterfaceSafetyOptions(
REFIID riid,
DWORD __RPC_FAR *pdwSupportedOptions,
DWORD __RPC_FAR *pdwEnabledOptions
) = 0;
- virtual STDMETHODIMP SetInterfaceSafetyOptions(
+ virtual STDMETHODIMP SetInterfaceSafetyOptions(
REFIID riid,
DWORD dwSupportedOptions,
DWORD dwOptionSetMask
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// IUnknown methods
- STDMETHODIMP GetInterfaceSafetyOptions(
+ STDMETHODIMP GetInterfaceSafetyOptions(
REFIID riid,
DWORD *pdwSupportedOptions,
DWORD *pdwEnabledOptions
);
- STDMETHODIMP SetInterfaceSafetyOptions(
+ STDMETHODIMP SetInterfaceSafetyOptions(
REFIID riid,
DWORD dwOptionSetMask,
DWORD dwEnabledOptions
);
-private:
+private:
VLCPlugin *_p_instance;
};
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
- return E_POINTER;
+ return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IOleWindow == riid)
- || (IID_IOleInPlaceObject == riid) )
+ || (IID_IOleInPlaceObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
};
#endif
-
using namespace std;
VLCOleObject::VLCOleObject(VLCPlugin *p_instance) :
-_p_clientsite(NULL), _p_instance(p_instance)
+_p_clientsite(NULL), _p_instance(p_instance)
{
CreateOleAdviseHolder(&_p_advise_holder);
};
{
if( NULL == ppClientSite )
return E_POINTER;
-
+
if( NULL != _p_clientsite )
_p_clientsite->AddRef();
{
if( NULL != _p_clientsite )
return _p_clientsite->GetMoniker(dwAssign,dwWhichMoniker, ppMoniker);
-
+
return E_UNEXPECTED;
};
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
- || (IID_IOleObject == riid) )
+ || (IID_IOleObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
AxVLCVariant(VARIANTARG &v)
{
- //VariantInit(&_v);
- //VariantCopy(&_v, &v);
- _v = v;
+ VariantInit(&_v);
+ VariantCopy(&_v, &v);
};
AxVLCVariant(VARIANTARG *v)
(*p.first).second = val.second;
return S_OK;
};
-
+
// custom methods
HRESULT Load(LPSTREAM pStm)
{
if( (val->first == L"(Count)") && (VT_I4 == V_VT(val->second.variantArg())) )
{
- size_t count = V_I4(val->second.variantArg());
+ size_t count = V_I4(val->second.variantArg());
delete val;
while( count-- )
{
STDMETHODIMP VLCPersistStreamInit::GetSizeMax(ULARGE_INTEGER *pcbSize)
{
pcbSize->HighPart = 0UL;
- pcbSize->LowPart = 4096UL; // just a guess
+ pcbSize->LowPart = 16384UL; // just a guess
return S_OK;
};
wClass.hbrBackground = NULL;
wClass.lpszMenuName = NULL;
wClass.lpszClassName = getInPlaceWndClassName();
-
+
_inplace_wndclass_atom = RegisterClass(&wClass);
}
else
_p_pict->Release();
SysFreeString(_bstr_mrl);
+ SysFreeString(_bstr_baseurl);
_p_class->Release();
};
if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, "Software\\VideoLAN\\VLC",
0, KEY_READ, &h_key ) == ERROR_SUCCESS )
{
- if( RegQueryValueEx( h_key, "InstallDir", 0, &i_type,
- (LPBYTE)p_data, &i_data ) == ERROR_SUCCESS )
- {
- if( i_type == REG_SZ )
- {
- strcat( p_data, "\\plugins" );
- //ppsz_argv[ppsz_argc++] = "--plugin-path";
- //ppsz_argv[ppsz_argc++] = p_data;
- }
- }
- RegCloseKey( h_key );
+ if( RegQueryValueEx( h_key, "InstallDir", 0, &i_type,
+ (LPBYTE)p_data, &i_data ) == ERROR_SUCCESS )
+ {
+ if( i_type == REG_SZ )
+ {
+ strcat( p_data, "\\plugins" );
+ ppsz_argv[ppsz_argc++] = "--plugin-path";
+ ppsz_argv[ppsz_argc++] = p_data;
+ }
+ }
+ RegCloseKey( h_key );
}
char p_path[MAX_PATH+1];
{
libvlc_audio_set_mute(_p_libvlc, TRUE, NULL);
}
-
+
// initial playlist item
if( SysStringLen(_bstr_mrl) > 0 )
{
if( SysStringLen(_bstr_baseurl) > 0 )
{
- DWORD len = INTERNET_MAX_URL_LENGTH;
- LPOLESTR abs_url = (LPOLESTR)CoTaskMemAlloc(sizeof(OLECHAR)*len);
+ /*
+ ** if the MRL a relative URL, we should end up with an absolute URL
+ */
+ LPWSTR abs_url = CombineURL(_bstr_baseurl, _bstr_mrl);
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);
- }
+ psz_mrl = CStrFromWSTR(CP_UTF8, abs_url, wcslen(abs_url));
CoTaskMemFree(abs_url);
}
+ else
+ {
+ psz_mrl = CStrFromBSTR(CP_UTF8, _bstr_mrl);
+ }
}
else
{
{
libvlc_instance_t* p_libvlc = _p_libvlc;
+ IVLCLog *p_log;
+ if( SUCCEEDED(vlcControl2->get_log(&p_log)) )
+ {
+ // make sure the log is disabled
+ p_log->put_verbosity(-1);
+ p_log->Release();
+ }
+
_p_libvlc = NULL;
vlcDataObject->onClose();
DestroyWindow(_inplacewnd);
_inplacewnd = NULL;
-
+
return S_OK;
};
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
vlcConnectionPointContainer->fireEvent(DISPID_StopEvent, &dispparamsNoArgs);
};
-
_p_pict->AddRef();
return _p_pict;
};
-
+
BOOL hasFocus(void);
void setFocus(BOOL fFocus);
};
#endif
-
|| (riid == IID_IVLCMessageIterator)
|| (riid == IID_IVLCMessages)
|| (riid == IID_IVLCPlaylist)
+ || (riid == IID_IVLCPlaylistItems)
|| (riid == IID_IVLCVideo)
|| (riid == IID_IVLCControl2) )
{
#include "utils.h"
+#include <wchar.h>
+#include <wctype.h>
+
/*
** conversion facilities
*/
using namespace std;
-char *CStrFromBSTR(UINT codePage, BSTR bstr)
+char *CStrFromWSTR(UINT codePage, LPCWSTR wstr, UINT len)
{
- UINT len = SysStringLen(bstr);
if( len > 0 )
{
size_t mblen = WideCharToMultiByte(codePage,
- 0, bstr, len, NULL, 0, NULL, NULL);
+ 0, wstr, len, NULL, 0, NULL, NULL);
if( mblen > 0 )
{
char *buffer = (char *)CoTaskMemAlloc(mblen+1);
ZeroMemory(buffer, mblen+1);
- if( WideCharToMultiByte(codePage, 0, bstr, len, buffer, mblen, NULL, NULL) )
+ if( WideCharToMultiByte(codePage, 0, wstr, len, buffer, mblen, NULL, NULL) )
{
buffer[mblen] = '\0';
return buffer;
return NULL;
};
+char *CStrFromBSTR(UINT codePage, BSTR bstr)
+{
+ return CStrFromWSTR(codePage, bstr, SysStringLen(bstr));
+};
+
BSTR BSTRFromCStr(UINT codePage, LPCSTR s)
{
int wideLen = MultiByteToWideChar(codePage, 0, s, -1, NULL, 0);
ZeroMemory(wideStr, wideLen*sizeof(WCHAR));
MultiByteToWideChar(codePage, 0, s, -1, wideStr, wideLen);
- bstr = SysAllocStringLen(wideStr, wideLen);
+ bstr = SysAllocStringLen(wideStr, wideLen-1);
CoTaskMemFree(wideStr);
return bstr;
HDC CreateDevDC(DVTARGETDEVICE *ptd)
{
- HDC hdc=NULL;
- if( NULL == ptd )
+ HDC hdc=NULL;
+ if( NULL == ptd )
{
- hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
- }
+ hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
+ }
else
{
LPDEVNAMES lpDevNames;
hdc = CreateDC(lpszDriverName, lpszDeviceName, lpszPortName, lpDevMode);
}
- return hdc;
+ return hdc;
};
#define HIMETRIC_PER_INCH 2540
}
};
+
+LPWSTR CombineURL(LPCWSTR baseUrl, LPCWSTR url)
+{
+ if( NULL != url )
+ {
+ // check whether URL is already absolute
+ const wchar_t *end=wcschr(url, L':');
+ if( (NULL != end) && (end != url) )
+ {
+ // validate protocol header
+ const wchar_t *start = url;
+ while( start != end ) {
+ wchar_t c = towlower(*start);
+ if( (c < L'a') || (c > L'z') )
+ // not a valid protocol header, assume relative URL
+ goto relativeurl;
+ ++start;
+ }
+ /* we have a protocol header, therefore URL is absolute */
+ UINT len = wcslen(url);
+ wchar_t *href = (LPWSTR)CoTaskMemAlloc((len+1)*sizeof(wchar_t));
+ if( href )
+ {
+ memcpy(href, url, len*sizeof(wchar_t));
+ href[len] = L'\0';
+ }
+ return href;
+ }
+
+relativeurl:
+
+ if( baseUrl )
+ {
+ size_t baseLen = wcslen(baseUrl);
+ wchar_t *href = (LPWSTR)CoTaskMemAlloc((baseLen+wcslen(url)+1)*sizeof(wchar_t));
+ if( href )
+ {
+ /* prepend base URL */
+ wcscpy(href, baseUrl);
+
+ /*
+ ** relative url could be empty,
+ ** in which case return base URL
+ */
+ if( L'\0' == *url )
+ return href;
+
+ /*
+ ** locate pathname part of base URL
+ */
+
+ /* skip over protocol part */
+ wchar_t *pathstart = wcschr(href, L':');
+ wchar_t *pathend;
+ if( pathstart )
+ {
+ if( L'/' == *(++pathstart) )
+ {
+ if( L'/' == *(++pathstart) )
+ {
+ ++pathstart;
+ }
+ }
+ /* skip over host part */
+ pathstart = wcschr(pathstart, L'/');
+ pathend = href+baseLen;
+ if( ! pathstart )
+ {
+ // no path, add a / past end of url (over '\0')
+ pathstart = pathend;
+ *pathstart = L'/';
+ }
+ }
+ else
+ {
+ /* baseURL is just a UNIX file path */
+ if( L'/' != *href )
+ {
+ /* baseURL is not an absolute path */
+ return NULL;
+ }
+ pathstart = href;
+ pathend = href+baseLen;
+ }
+
+ /* relative URL made of an absolute path ? */
+ if( L'/' == *url )
+ {
+ /* replace path completely */
+ wcscpy(pathstart, url);
+ return href;
+ }
+
+ /* find last path component and replace it */
+ while( L'/' != *pathend )
+ --pathend;
+
+ /*
+ ** if relative url path starts with one or more './' or '../',
+ ** factor them out of href so that we return a
+ ** normalized URL
+ */
+ while( pathend > pathstart )
+ {
+ const wchar_t *p = url;
+ if( L'.' != *p )
+ break;
+ ++p;
+ if( L'\0' == *p )
+ {
+ /* relative url is just '.' */
+ url = p;
+ break;
+ }
+ if( L'/' == *p )
+ {
+ /* relative url starts with './' */
+ url = ++p;
+ continue;
+ }
+ if( L'.' != *p )
+ break;
+ ++p;
+ if( L'\0' == *p )
+ {
+ /* relative url is '..' */
+ }
+ else
+ {
+ if( L'/' != *p )
+ break;
+ /* relative url starts with '../' */
+ ++p;
+ }
+ url = p;
+ do
+ {
+ --pathend;
+ }
+ while( L'/' != *pathend );
+ }
+ /* skip over '/' separator */
+ ++pathend;
+ /* concatenate remaining base URL and relative URL */
+ wcscpy(pathend, url);
+ }
+ return href;
+ }
+ }
+ return NULL;
+}
+
#include <vector>
// utilities
+extern char *CStrFromWSTR(UINT codePage, LPCWSTR wstr, UINT len);
extern char *CStrFromBSTR(UINT codePage, BSTR bstr);
extern BSTR BSTRFromCStr(UINT codePage, LPCSTR s);
extern void DPFromHimetric(HDC hdc, LPPOINT pt, int count);
extern void HimetricFromDP(HDC hdc, LPPOINT pt, int count);
+// URL
+extern LPWSTR CombineURL(LPCWSTR baseUrl, LPCWSTR url);
+
/**************************************************************************************************/
/* this function object is used to dereference the iterator into a value */
}
return result;
};
-
+
STDMETHODIMP VLCControl::pause(void)
{
int i_vlc;
}
return result;
};
-
+
STDMETHODIMP VLCControl::stop(void)
{
int i_vlc;
}
return result;
};
-
+
STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying)
{
if( NULL == isPlaying )
*isPlaying = VARIANT_FALSE;
return result;
};
-
+
STDMETHODIMP VLCControl::get_Position(float *position)
{
if( NULL == position )
*position = 0.0f;
return result;
};
-
+
STDMETHODIMP VLCControl::put_Position(float position)
{
HRESULT result = E_UNEXPECTED;
}
return result;
};
-
+
STDMETHODIMP VLCControl::get_Time(int *seconds)
{
if( NULL == seconds )
return result;
};
-
+
STDMETHODIMP VLCControl::put_Time(int seconds)
{
_p_instance->setTime(seconds);
return NOERROR;
};
-
+
STDMETHODIMP VLCControl::shuttle(int seconds)
{
HRESULT result = E_UNEXPECTED;
}
return result;
};
-
+
STDMETHODIMP VLCControl::fullscreen(void)
{
HRESULT result = E_UNEXPECTED;
}
return result;
};
-
+
STDMETHODIMP VLCControl::get_Length(int *seconds)
{
if( NULL == seconds )
*seconds = 0;
return result;
};
-
+
STDMETHODIMP VLCControl::playFaster(void)
{
HRESULT result = E_UNEXPECTED;
}
return result;
};
-
+
STDMETHODIMP VLCControl::playSlower(void)
{
HRESULT result = E_UNEXPECTED;
}
return result;
};
-
+
STDMETHODIMP VLCControl::get_Volume(int *volume)
{
if( NULL == volume )
*volume = _p_instance->getVolume();
return NOERROR;
};
-
+
STDMETHODIMP VLCControl::put_Volume(int volume)
{
_p_instance->setVolume(volume);
return NOERROR;
};
-
+
STDMETHODIMP VLCControl::toggleMute(void)
{
int i_vlc;
int i_type;
vlc_value_t val;
-
+
if( VLC_SUCCESS == VLC_VariableType(i_vlc, psz_varname, &i_type) )
{
VARIANT arg;
}
return hr;
};
-
+
STDMETHODIMP VLCControl::get_PlaylistIndex(int *index)
{
if( NULL == index )
*index = 0;
return result;
};
-
+
STDMETHODIMP VLCControl::get_PlaylistCount(int *count)
{
int i_vlc;
*count = 0;
return result;
};
-
+
STDMETHODIMP VLCControl::playlistNext(void)
{
int i_vlc;
}
return result;
};
-
+
STDMETHODIMP VLCControl::playlistPrev(void)
{
int i_vlc;
}
return result;
};
-
+
STDMETHODIMP VLCControl::playlistClear(void)
{
int i_vlc;
}
return result;
};
-
+
STDMETHODIMP VLCControl::get_VersionInfo(BSTR *version)
{
if( NULL == version )
*version = NULL;
return E_FAIL;
};
-
+
STDMETHODIMP VLCControl::get_MRL(BSTR *mrl)
{
if( NULL == mrl )
_p_instance->setAutoLoop((VARIANT_FALSE != autoloop) ? TRUE: FALSE);
return S_OK;
};
-
class VLCControl : public IVLCControl
{
-
public:
VLCControl(VLCPlugin *p_instance) : _p_instance(p_instance), _p_typeinfo(NULL) {};
STDMETHODIMP put_AutoLoop(VARIANT_BOOL autoloop);
STDMETHODIMP get_AutoPlay(VARIANT_BOOL *autoplay);
STDMETHODIMP put_AutoPlay(VARIANT_BOOL autoplay);
-
+
static HRESULT CreateTargetOptions(int codePage, VARIANT *options, char ***cOptions, int *cOptionCount);
static void FreeTargetOptions(char **cOptions, int cOptionCount);
VLCPlugin *_p_instance;
ITypeInfo *_p_typeinfo;
-
};
-
-#endif
+#endif
#include "utils.h"
+#include <shlwapi.h>
+#include <wininet.h>
+
using namespace std;
VLCAudio::~VLCAudio()
VLCLog::~VLCLog()
{
+ delete _p_vlcmessages;
if( _p_log )
libvlc_log_close(_p_log, NULL);
/*******************************************************************************/
+VLCPlaylistItems::~VLCPlaylistItems()
+{
+ if( _p_typeinfo )
+ _p_typeinfo->Release();
+};
+
+HRESULT VLCPlaylistItems::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_IVLCPlaylistItems, &_p_typeinfo);
+ if( FAILED(hr) )
+ {
+ _p_typeinfo = NULL;
+ }
+ p_typelib->Release();
+ }
+ }
+ return hr;
+};
+
+STDMETHODIMP VLCPlaylistItems::GetTypeInfoCount(UINT* pctInfo)
+{
+ if( NULL == pctInfo )
+ return E_INVALIDARG;
+
+ if( SUCCEEDED(loadTypeInfo()) )
+ *pctInfo = 1;
+ else
+ *pctInfo = 0;
+
+ return NOERROR;
+};
+
+STDMETHODIMP VLCPlaylistItems::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 VLCPlaylistItems::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 VLCPlaylistItems::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 VLCPlaylistItems::get_count(long* count)
+{
+ if( NULL == count )
+ return E_POINTER;
+
+ libvlc_instance_t* p_libvlc;
+ HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(hr) )
+ {
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ *count = libvlc_playlist_items_count(p_libvlc, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCPlaylistItems,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
+ return NOERROR;
+ }
+ return hr;
+};
+
+STDMETHODIMP VLCPlaylistItems::clear()
+{
+ libvlc_instance_t* p_libvlc;
+ HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(hr) )
+ {
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_playlist_clear(p_libvlc, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCPlaylistItems,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
+ return NOERROR;
+ }
+ return hr;
+};
+
+STDMETHODIMP VLCPlaylistItems::remove(long item)
+{
+ libvlc_instance_t* p_libvlc;
+ HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(hr) )
+ {
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_playlist_delete_item(p_libvlc, item, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCPlaylistItems,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
+ return NOERROR;
+ }
+ return hr;
+};
+
+/*******************************************************************************/
+
VLCPlaylist::~VLCPlaylist()
{
+ delete _p_vlcplaylistitems;
if( _p_typeinfo )
_p_typeinfo->Release();
};
libvlc_exception_t ex;
libvlc_exception_init(&ex);
+ char *psz_uri = NULL;
+ if( SysStringLen(_p_instance->getBaseURL()) > 0 )
+ {
+ /*
+ ** if the MRL a relative URL, we should end up with an absolute URL
+ */
+ LPWSTR abs_url = CombineURL(_p_instance->getBaseURL(), uri);
+ if( NULL != abs_url )
+ {
+ psz_uri = CStrFromWSTR(CP_UTF8, abs_url, wcslen(abs_url));
+ CoTaskMemFree(abs_url);
+ }
+ else
+ {
+ psz_uri = CStrFromBSTR(CP_UTF8, uri);
+ }
+ }
+ else
+ {
+ /*
+ ** baseURL is empty, assume MRL is absolute
+ */
+ psz_uri = CStrFromBSTR(CP_UTF8, uri);
+ }
+
+ if( NULL == psz_uri )
+ {
+ return E_OUTOFMEMORY;
+ }
+
int i_options;
char **ppsz_options;
hr = VLCControl::CreateTargetOptions(CP_UTF8, &options, &ppsz_options, &i_options);
if( FAILED(hr) )
- return hr;
-
- char *psz_uri = CStrFromBSTR(CP_UTF8, uri);
- if( NULL == psz_uri )
{
- VLCControl::FreeTargetOptions(ppsz_options, i_options);
- return E_OUTOFMEMORY;
+ CoTaskMemFree(psz_uri);
+ return hr;
}
char *psz_name = NULL;
return hr;
};
+STDMETHODIMP VLCPlaylist::get_items(IVLCPlaylistItems** obj)
+{
+ if( NULL == obj )
+ return E_POINTER;
+
+ *obj = _p_vlcplaylistitems;
+ if( NULL != _p_vlcplaylistitems )
+ {
+ _p_vlcplaylistitems->AddRef();
+ return NOERROR;
+ }
+ return E_OUTOFMEMORY;
+};
+
/*******************************************************************************/
VLCVideo::~VLCVideo()
return hr;
};
-STDMETHODIMP VLCVideo::get_aspectRatio(BSTR aspect)
+STDMETHODIMP VLCVideo::get_aspectRatio(BSTR* aspect)
{
if( NULL == aspect )
return E_POINTER;
char *psz_aspect = libvlc_video_get_aspect_ratio(p_input, &ex);
libvlc_input_free(p_input);
- if( NULL == psz_aspect )
- return E_OUTOFMEMORY;
-
if( ! libvlc_exception_raised(&ex) )
{
- aspect = SysAllocStringByteLen(psz_aspect, strlen(psz_aspect));
+ if( NULL == psz_aspect )
+ return E_OUTOFMEMORY;
+
+ *aspect = SysAllocStringByteLen(psz_aspect, strlen(psz_aspect));
free( psz_aspect );
psz_aspect = NULL;
return NOERROR;
- }
- if( psz_aspect ) free( psz_aspect );
+ }
+ if( psz_aspect ) free( psz_aspect );
}
_p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) )
{
- _p_instance->setErrorInfo(IID_IVLCPlaylist,
+ _p_instance->setErrorInfo(IID_IVLCVideo,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
public:
VLCMessages(VLCPlugin *p_instance, VLCLog *p_vlclog) :
+ _p_vlclog(p_vlclog),
_p_instance(p_instance),
- _p_typeinfo(NULL),
- _p_vlclog(p_vlclog) {};
+ _p_typeinfo(NULL) {}
virtual ~VLCMessages();
// IUnknown methods
friend class VLCMessageIterator;
VLCLog(VLCPlugin *p_instance) :
+ _p_log(NULL),
_p_instance(p_instance),
_p_typeinfo(NULL),
- _p_log(NULL)
+ _p_vlcmessages(NULL)
{
_p_vlcmessages = new VLCMessages(p_instance, this);
};
VLCMessages* _p_vlcmessages;
};
+class VLCPlaylistItems : public IVLCPlaylistItems
+{
+public:
+ VLCPlaylistItems(VLCPlugin *p_instance) :
+ _p_instance(p_instance), _p_typeinfo(NULL) {};
+ virtual ~VLCPlaylistItems();
+
+ // IUnknown methods
+ STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
+ {
+ if( NULL == ppv )
+ return E_POINTER;
+ if( (IID_IUnknown == riid)
+ || (IID_IDispatch == riid)
+ || (IID_IVLCPlaylistItems == riid) )
+ {
+ AddRef();
+ *ppv = reinterpret_cast<LPVOID>(this);
+ return NOERROR;
+ }
+ // behaves as a standalone object
+ return E_NOINTERFACE;
+ };
+
+ 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*);
+
+ // IVLCPlaylistItems methods
+ STDMETHODIMP get_count(long*);
+ STDMETHODIMP clear();
+ STDMETHODIMP remove(long);
+
+protected:
+ HRESULT loadTypeInfo();
+
+private:
+ VLCPlugin* _p_instance;
+ ITypeInfo* _p_typeinfo;
+
+};
+
class VLCPlaylist : public IVLCPlaylist
{
public:
VLCPlaylist(VLCPlugin *p_instance) :
- _p_instance(p_instance), _p_typeinfo(NULL) {};
+ _p_instance(p_instance),
+ _p_typeinfo(NULL),
+ _p_vlcplaylistitems(NULL)
+ {
+ _p_vlcplaylistitems = new VLCPlaylistItems(p_instance);
+ };
virtual ~VLCPlaylist();
// IUnknown methods
STDMETHODIMP prev();
STDMETHODIMP clear();
STDMETHODIMP removeItem(long);
+ STDMETHODIMP get_items(IVLCPlaylistItems**);
protected:
HRESULT loadTypeInfo();
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
+ VLCPlaylistItems* _p_vlcplaylistitems;
};
class VLCVideo : public IVLCVideo
STDMETHODIMP put_fullscreen(VARIANT_BOOL);
STDMETHODIMP get_width(long*);
STDMETHODIMP get_height(long*);
- STDMETHODIMP get_aspectRatio(BSTR);
+ STDMETHODIMP get_aspectRatio(BSTR*);
STDMETHODIMP put_aspectRatio(BSTR);
STDMETHODIMP toggleFullscreen();