Commit 181f3d45 authored by Damien Fouilleul's avatar Damien Fouilleul

- activex: future proofing the APIs and some misc fixes

parent bbf771f9
......@@ -284,7 +284,7 @@ library AXVLC
[
odl,
uuid(6C5CE55D-2D6C-4AAD-8299-C62D2371F106),
helpstring("VLC Log APIs"),
helpstring("VLC Log Messages Collection."),
dual,
oleautomation
]
......@@ -321,6 +321,25 @@ library AXVLC
HRESULT verbosity([in] long level);
};
[
odl,
uuid(FD37FE32-82BC-4A25-B056-315F4DBB194D),
helpstring("VLC Playlist Items collection"),
dual,
oleautomation
]
interface IVLCPlaylistItems : IDispatch
{
[propget, helpstring("Returns number of items in playlist.")]
HRESULT count([out, retval] long* count);
[helpstring("Remove all items from playlist.")]
HRESULT clear();
[helpstring("remove item from playlist.")]
HRESULT remove([in] long itemId);
};
[
odl,
uuid(54613049-40BF-4035-9E70-0A9312C0188D),
......@@ -330,20 +349,20 @@ library AXVLC
]
interface IVLCPlaylist : IDispatch
{
[propget, helpstring("Returns number of items in playlist.")]
[hidden, propget, helpstring("Returns number of items in playlist. (deprecated)")]
HRESULT itemCount([out, retval] long* count);
[propget, helpstring("Returns whether playback displays video.")]
HRESULT isPlaying([out, retval] VARIANT_BOOL* playing);
[helpstring("Add a playlist item.")]
HRESULT add([in] BSTR uri, [in, optional] VARIANT name, [in, optional] VARIANT options, [out, retval] long* item);
HRESULT add([in] BSTR uri, [in, optional] VARIANT name, [in, optional] VARIANT options, [out, retval] long* itemId);
[helpstring("Play/Resume the playlist.")]
HRESULT play();
[helpstring("Play item in playlist.")]
HRESULT playItem([in] long item);
HRESULT playItem([in] long itemId);
[helpstring("Play/Pause current clip.")]
HRESULT togglePause();
......@@ -357,11 +376,14 @@ library AXVLC
[helpstring("Advance to previous item in playlist.")]
HRESULT prev();
[helpstring("Remove all items from playlist.")]
[hidden, helpstring("Remove all items from playlist. (deprecated)")]
HRESULT clear();
[helpstring("remove item from playlist.")]
[hidden, helpstring("Remove item from playlist. (deprecated)")]
HRESULT removeItem([in] long item);
[propget, helpstring("Returns the playlist items collection object.")]
HRESULT items([out, retval] IVLCPlaylistItems** obj);
};
[
......
No preview for this file type
......@@ -6,7 +6,7 @@
/* File created by MIDL compiler version 6.00.0361 */
/* at Thu Nov 16 09:55:42 2006
/* at Mon Nov 27 17:47:26 2006
*/
/* Compiler settings for axvlc.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
......@@ -106,6 +106,9 @@ MIDL_DEFINE_GUID(IID, IID_IVLCControl2,0x2D719729,0x5333,0x406C,0xBF,0x12,0x8D,0
MIDL_DEFINE_GUID(IID, DIID_DVLCEvents,0xDF48072F,0x5EF8,0x434e,0x9B,0x40,0xE2,0xF3,0xAE,0x75,0x9B,0x5F);
MIDL_DEFINE_GUID(IID, IID_IVLCPlaylistItems,0xFD37FE32,0x82BC,0x4A25,0xB0,0x56,0x31,0x5F,0x4D,0xBB,0x19,0x4D);
MIDL_DEFINE_GUID(CLSID, CLSID_VLCPlugin,0xE23FE9C6,0x778E,0x49D4,0xB5,0x37,0x38,0xFC,0xDE,0x48,0x87,0xD8);
......
......@@ -4,7 +4,7 @@
/* File created by MIDL compiler version 6.00.0361 */
/* at Thu Nov 16 09:55:42 2006
/* at Mon Nov 27 17:47:26 2006
*/
/* Compiler settings for axvlc.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
......@@ -107,6 +107,12 @@ typedef interface DVLCEvents DVLCEvents;
#endif /* __DVLCEvents_FWD_DEFINED__ */
#ifndef __IVLCPlaylistItems_FWD_DEFINED__
#define __IVLCPlaylistItems_FWD_DEFINED__
typedef interface IVLCPlaylistItems IVLCPlaylistItems;
#endif /* __IVLCPlaylistItems_FWD_DEFINED__ */
#ifndef __VLCPlugin_FWD_DEFINED__
#define __VLCPlugin_FWD_DEFINED__
......@@ -2353,7 +2359,7 @@ EXTERN_C const IID IID_IVLCPlaylist;
IVLCPlaylist : public IDispatch
{
public:
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_itemCount(
virtual /* [helpstring][propget][hidden] */ HRESULT STDMETHODCALLTYPE get_itemCount(
/* [retval][out] */ long *count) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_isPlaying(
......@@ -2363,12 +2369,12 @@ EXTERN_C const IID IID_IVLCPlaylist;
/* [in] */ BSTR uri,
/* [optional][in] */ VARIANT name,
/* [optional][in] */ VARIANT options,
/* [retval][out] */ long *item) = 0;
/* [retval][out] */ long *itemId) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE play( void) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE playItem(
/* [in] */ long item) = 0;
/* [in] */ long itemId) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE togglePause( void) = 0;
......@@ -2378,11 +2384,14 @@ EXTERN_C const IID IID_IVLCPlaylist;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE prev( void) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE clear( void) = 0;
virtual /* [helpstring][hidden] */ HRESULT STDMETHODCALLTYPE clear( void) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE removeItem(
virtual /* [helpstring][hidden] */ HRESULT STDMETHODCALLTYPE removeItem(
/* [in] */ long item) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_items(
/* [retval][out] */ IVLCPlaylistItems **obj) = 0;
};
#else /* C style interface */
......@@ -2431,7 +2440,7 @@ EXTERN_C const IID IID_IVLCPlaylist;
/* [out] */ EXCEPINFO *pExcepInfo,
/* [out] */ UINT *puArgErr);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_itemCount )(
/* [helpstring][propget][hidden] */ HRESULT ( STDMETHODCALLTYPE *get_itemCount )(
IVLCPlaylist * This,
/* [retval][out] */ long *count);
......@@ -2444,14 +2453,14 @@ EXTERN_C const IID IID_IVLCPlaylist;
/* [in] */ BSTR uri,
/* [optional][in] */ VARIANT name,
/* [optional][in] */ VARIANT options,
/* [retval][out] */ long *item);
/* [retval][out] */ long *itemId);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *play )(
IVLCPlaylist * This);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *playItem )(
IVLCPlaylist * This,
/* [in] */ long item);
/* [in] */ long itemId);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *togglePause )(
IVLCPlaylist * This);
......@@ -2465,13 +2474,17 @@ EXTERN_C const IID IID_IVLCPlaylist;
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *prev )(
IVLCPlaylist * This);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *clear )(
/* [helpstring][hidden] */ HRESULT ( STDMETHODCALLTYPE *clear )(
IVLCPlaylist * This);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *removeItem )(
/* [helpstring][hidden] */ HRESULT ( STDMETHODCALLTYPE *removeItem )(
IVLCPlaylist * This,
/* [in] */ long item);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_items )(
IVLCPlaylist * This,
/* [retval][out] */ IVLCPlaylistItems **obj);
END_INTERFACE
} IVLCPlaylistVtbl;
......@@ -2514,14 +2527,14 @@ EXTERN_C const IID IID_IVLCPlaylist;
#define IVLCPlaylist_get_isPlaying(This,playing) \
(This)->lpVtbl -> get_isPlaying(This,playing)
#define IVLCPlaylist_add(This,uri,name,options,item) \
(This)->lpVtbl -> add(This,uri,name,options,item)
#define IVLCPlaylist_add(This,uri,name,options,itemId) \
(This)->lpVtbl -> add(This,uri,name,options,itemId)
#define IVLCPlaylist_play(This) \
(This)->lpVtbl -> play(This)
#define IVLCPlaylist_playItem(This,item) \
(This)->lpVtbl -> playItem(This,item)
#define IVLCPlaylist_playItem(This,itemId) \
(This)->lpVtbl -> playItem(This,itemId)
#define IVLCPlaylist_togglePause(This) \
(This)->lpVtbl -> togglePause(This)
......@@ -2541,6 +2554,9 @@ EXTERN_C const IID IID_IVLCPlaylist;
#define IVLCPlaylist_removeItem(This,item) \
(This)->lpVtbl -> removeItem(This,item)
#define IVLCPlaylist_get_items(This,obj) \
(This)->lpVtbl -> get_items(This,obj)
#endif /* COBJMACROS */
......@@ -2548,7 +2564,7 @@ EXTERN_C const IID IID_IVLCPlaylist;
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCPlaylist_get_itemCount_Proxy(
/* [helpstring][propget][hidden] */ HRESULT STDMETHODCALLTYPE IVLCPlaylist_get_itemCount_Proxy(
IVLCPlaylist * This,
/* [retval][out] */ long *count);
......@@ -2577,7 +2593,7 @@ void __RPC_STUB IVLCPlaylist_get_isPlaying_Stub(
/* [in] */ BSTR uri,
/* [optional][in] */ VARIANT name,
/* [optional][in] */ VARIANT options,
/* [retval][out] */ long *item);
/* [retval][out] */ long *itemId);
void __RPC_STUB IVLCPlaylist_add_Stub(
......@@ -2600,7 +2616,7 @@ void __RPC_STUB IVLCPlaylist_play_Stub(
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCPlaylist_playItem_Proxy(
IVLCPlaylist * This,
/* [in] */ long item);
/* [in] */ long itemId);
void __RPC_STUB IVLCPlaylist_playItem_Stub(
......@@ -2654,7 +2670,7 @@ void __RPC_STUB IVLCPlaylist_prev_Stub(
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCPlaylist_clear_Proxy(
/* [helpstring][hidden] */ HRESULT STDMETHODCALLTYPE IVLCPlaylist_clear_Proxy(
IVLCPlaylist * This);
......@@ -2665,7 +2681,7 @@ void __RPC_STUB IVLCPlaylist_clear_Stub(
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCPlaylist_removeItem_Proxy(
/* [helpstring][hidden] */ HRESULT STDMETHODCALLTYPE IVLCPlaylist_removeItem_Proxy(
IVLCPlaylist * This,
/* [in] */ long item);
......@@ -2677,6 +2693,18 @@ void __RPC_STUB IVLCPlaylist_removeItem_Stub(
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCPlaylist_get_items_Proxy(
IVLCPlaylist * This,
/* [retval][out] */ IVLCPlaylistItems **obj);
void __RPC_STUB IVLCPlaylist_get_items_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IVLCPlaylist_INTERFACE_DEFINED__ */
......@@ -3598,6 +3626,179 @@ EXTERN_C const IID DIID_DVLCEvents;
#endif /* __DVLCEvents_DISPINTERFACE_DEFINED__ */
#ifndef __IVLCPlaylistItems_INTERFACE_DEFINED__
#define __IVLCPlaylistItems_INTERFACE_DEFINED__
/* interface IVLCPlaylistItems */
/* [object][oleautomation][dual][helpstring][uuid] */
EXTERN_C const IID IID_IVLCPlaylistItems;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("FD37FE32-82BC-4A25-B056-315F4DBB194D")
IVLCPlaylistItems : public IDispatch
{
public:
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_count(
/* [retval][out] */ long *count) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE clear( void) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE remove(
/* [in] */ long itemId) = 0;
};
#else /* C style interface */
typedef struct IVLCPlaylistItemsVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IVLCPlaylistItems * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IVLCPlaylistItems * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IVLCPlaylistItems * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
IVLCPlaylistItems * This,
/* [out] */ UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
IVLCPlaylistItems * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
IVLCPlaylistItems * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
IVLCPlaylistItems * This,
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS *pDispParams,
/* [out] */ VARIANT *pVarResult,
/* [out] */ EXCEPINFO *pExcepInfo,
/* [out] */ UINT *puArgErr);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_count )(
IVLCPlaylistItems * This,
/* [retval][out] */ long *count);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *clear )(
IVLCPlaylistItems * This);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *remove )(
IVLCPlaylistItems * This,
/* [in] */ long itemId);
END_INTERFACE
} IVLCPlaylistItemsVtbl;
interface IVLCPlaylistItems
{
CONST_VTBL struct IVLCPlaylistItemsVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IVLCPlaylistItems_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IVLCPlaylistItems_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IVLCPlaylistItems_Release(This) \
(This)->lpVtbl -> Release(This)
#define IVLCPlaylistItems_GetTypeInfoCount(This,pctinfo) \
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
#define IVLCPlaylistItems_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
#define IVLCPlaylistItems_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
#define IVLCPlaylistItems_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
#define IVLCPlaylistItems_get_count(This,count) \
(This)->lpVtbl -> get_count(This,count)
#define IVLCPlaylistItems_clear(This) \
(This)->lpVtbl -> clear(This)
#define IVLCPlaylistItems_remove(This,itemId) \
(This)->lpVtbl -> remove(This,itemId)
#endif /* COBJMACROS */
#endif /* C style interface */
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCPlaylistItems_get_count_Proxy(
IVLCPlaylistItems * This,
/* [retval][out] */ long *count);
void __RPC_STUB IVLCPlaylistItems_get_count_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCPlaylistItems_clear_Proxy(
IVLCPlaylistItems * This);
void __RPC_STUB IVLCPlaylistItems_clear_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCPlaylistItems_remove_Proxy(
IVLCPlaylistItems * This,
/* [in] */ long itemId);
void __RPC_STUB IVLCPlaylistItems_remove_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IVLCPlaylistItems_INTERFACE_DEFINED__ */
EXTERN_C const CLSID CLSID_VLCPlugin;
#ifdef __cplusplus
......
......@@ -29,6 +29,8 @@
#include <windows.h>
#include <shlwapi.h>
#include <guiddef.h>
using namespace std;
#define COMPANY_STR "VideoLAN"
......@@ -43,10 +45,11 @@ using namespace std;
#define GUID_STRLEN 39
/*
** MingW headers do not declare those
** MingW headers & libs do not declare those
*/
extern const CATID CATID_SafeForInitializing;
extern const CATID CATID_SafeForScripting;
static DEFINE_GUID(_CATID_InternetAware, 0x0DE86A58, 0x2BAA, 0x11CF, 0xA2, 0x29, 0x00,0xAA,0x00,0x3D,0x73,0x52);
static DEFINE_GUID(_CATID_SafeForInitializing, 0x7DD95802, 0x9882, 0x11CF, 0x9F, 0xA9, 0x00,0xAA,0x00,0x6C,0x42,0xC4);
static DEFINE_GUID(_CATID_SafeForScripting, 0x7DD95801, 0x9882, 0x11CF, 0x9F, 0xA9, 0x00,0xAA,0x00,0x6C,0x42,0xC4);
static LONG i_class_ref= 0;
static HINSTANCE h_instance= 0;
......@@ -150,8 +153,9 @@ STDAPI DllUnregisterServer(VOID)
CATID implCategories[] = {
CATID_Control,
CATID_PersistsToPropertyBag,
CATID_SafeForInitializing,
CATID_SafeForScripting,
_CATID_InternetAware,
_CATID_SafeForInitializing,
_CATID_SafeForScripting,
};
pcr->UnRegisterClassImplCategories(CLSID_VLCPlugin,
......@@ -193,9 +197,9 @@ static HRESULT RegisterClassID(HKEY hParent, REFCLSID rclsid, unsigned int versi
keyClose(keySetDef(keyCreate(hProgKey, "CLSID"),
psz_CLSID,
GUID_STRLEN));
//hSubKey = keyClose(keyCreate(hBaseKey, "Insertable"));
//hSubKey = keyClose(keyCreate(hBaseKey, "Insertable"));
RegCloseKey(hProgKey);
}
if( isDefault )
......@@ -318,8 +322,9 @@ STDAPI DllRegisterServer(VOID)
CATID implCategories[] = {
CATID_Control,
CATID_PersistsToPropertyBag,
CATID_SafeForInitializing,
CATID_SafeForScripting,
_CATID_InternetAware,
_CATID_SafeForInitializing,
_CATID_SafeForScripting,
};
pcr->RegisterClassImplCategories(CLSID_VLCPlugin,
......@@ -336,7 +341,7 @@ STDAPI DllRegisterServer(VOID)
// replace .exe by .tlb
strcpy(DllPath+DllPathLen-4, ".tlb");
#endif
#ifndef OLE2ANSI
size_t typeLibPathLen = MultiByteToWideChar(CP_ACP, 0, DllPath, -1, NULL, 0);
if( typeLibPathLen > 0 )
......@@ -459,3 +464,4 @@ STDAPI_(BOOL) DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpReserved )
};
#endif
......@@ -37,6 +37,7 @@ STDMETHODIMP VLCSupportErrorInfo::InterfaceSupportsErrorInfo(REFIID riid)
|| (riid == IID_IVLCMessageIterator)
|| (riid == IID_IVLCMessages)
|| (riid == IID_IVLCPlaylist)
|| (riid == IID_IVLCPlaylistItems)
|| (riid == IID_IVLCVideo)
|| (riid == IID_IVLCControl2) )
{
......
......@@ -26,6 +26,9 @@
#include "utils.h"
#include <shlwapi.h>
#include <wininet.h>
using namespace std;
VLCAudio::~VLCAudio()
......@@ -581,6 +584,7 @@ STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout)
VLCLog::~VLCLog()
{
delete _p_vlcmessages;
if( _p_log )
libvlc_log_close(_p_log, NULL);
......@@ -1202,8 +1206,157 @@ STDMETHODIMP VLCMessage::get_message(BSTR* message)
/*******************************************************************************/
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();
};
......@@ -1344,18 +1497,49 @@ STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* ite
libvlc_exception_t ex;
libvlc_exception_init(&ex);
char *psz_uri = NULL;
if( SysStringLen(_p_instance->getBaseURL()) > 0 )
{
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(_p_instance->getBaseURL(), uri, abs_url, &len,
URL_ESCAPE_UNSAFE|URL_PLUGGABLE_PROTOCOL)) )
{
psz_uri = CStrFromBSTR(CP_UTF8, abs_url);
}
else
{
psz_uri = CStrFromBSTR(CP_UTF8, uri);
}
CoTaskMemFree(abs_url);
}
}
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;
......@@ -1566,6 +1750,20 @@ STDMETHODIMP VLCPlaylist::removeItem(long item)
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()
......@@ -1826,7 +2024,7 @@ STDMETHODIMP VLCVideo::put_aspectRatio(BSTR aspect)
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;
......
......@@ -318,7 +318,8 @@ public:
VLCLog(VLCPlugin *p_instance) :
_p_log(NULL),
_p_instance(p_instance),
_p_typeinfo(NULL)
_p_typeinfo(NULL),
_p_vlcmessages(NULL)
{
_p_vlcmessages = new VLCMessages(p_instance, this);
};
......@@ -367,11 +368,63 @@ private:
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
......@@ -412,6 +465,7 @@ public:
STDMETHODIMP prev();
STDMETHODIMP clear();
STDMETHODIMP removeItem(long);
STDMETHODIMP get_items(IVLCPlaylistItems**);
protected:
HRESULT loadTypeInfo();
......@@ -420,6 +474,7 @@ private:
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
VLCPlaylistItems* _p_vlcplaylistitems;
};
class VLCVideo : public IVLCVideo
......
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