Commit 64a70a8b authored by Damien Fouilleul's avatar Damien Fouilleul

- backport from trunk of all the plugins work and some other nice to have changes

parent 0d9b837c
......@@ -671,7 +671,6 @@ endif
if BUILD_MOZILLA
mkdir -p "$(top_builddir)/vlc-${VERSION}/mozilla"
cp $(top_builddir)/mozilla/*$(LIBEXT) $(top_builddir)/vlc-${VERSION}/mozilla/ ;
cp $(top_builddir)/mozilla/vlcintf.xpt $(top_builddir)/vlc-${VERSION}/mozilla/ ;
endif
if BUILD_ACTIVEX
......
......@@ -38,6 +38,8 @@ SOURCES_activex = \
viewobject.h \
vlccontrol.cpp \
vlccontrol.h \
vlccontrol2.cpp \
vlccontrol2.h \
plugin.cpp \
plugin.h \
axvlc_idl.c \
......@@ -60,7 +62,7 @@ DIST_misc = \
$(NULL)
if BUILD_SHARED
LIBRARIES_libvlc = $(top_builddir)/src/libvlc.dll.a
LIBRARIES_libvlc = $(top_builddir)/src/libvlc.dll
else
LIBRARIES_libvlc = $(top_builddir)/src/libvlc.a
endif
......@@ -76,10 +78,10 @@ LDFLAGS_activex = `$(VLC_CONFIG) --libs activex vlc builtin`
libaxvlc_a_SOURCES = $(SOURCES_activex) $(SOURCE_dll)
libaxvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags 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) \
$(libaxvlc_a_DEPENDENCIES) stamp-pic
$(libaxvlc_a_DEPENDENCIES) stamp-builtin
$(CXXLINK) $(libaxvlc_a_OBJECTS) $(DATA_axvlc_rc) \
$(srcdir)/axvlc.def \
$(LIBRARIES_libvlc) -shared $(LIBRARIES_libvlc) $(LDFLAGS_activex) \
......@@ -100,10 +102,20 @@ axvlc.tlb axvlc_idl.c axvlc_idl.h: axvlc.idl
clean-tlb:
rm -f axvlc.tlb axvlc_idl.c axvlc_idl.h
else
if HAS_WIDL_COMPILER
axvlc.tlb axvlc_idl.c axvlc_idl.h: axvlc.idl
$(WIDL) -I$(WINE_SDK_PATH)/include -tuh -T axvlc.tlb -U axvlc_idl.c -H axvlc_idl.h axvlc.idl
clean-tlb:
rm -f axvlc.tlb axvlc_idl.c axvlc_idl.h
else
clean-tlb:
endif
endif
DATA_axvlc_rc = $(noinst_axvlc_rc_DATA)
......@@ -123,16 +135,15 @@ endif
###############################################################################
clean-stamp:
rm -f stamp-pic
rm -f stamp-builtin
if BUILD_SHARED
stamp-builtin:
else
stamp-builtin: $(shell ${VLC_CONFIG} --target builtin)
endif
@touch $@
stamp-pic: FORCE
@for dep in "" `$(VLC_CONFIG) --target builtin`; do \
if test "$${dep}" -nt "$(LIBRARIES_activex)"; then \
rm -f $@; \
break; \
fi; \
done
@if test ! -f $@; then printf "" > $@; fi
###############################################################################
# Clean rules
......@@ -142,7 +153,6 @@ clean-local: clean-stamp clean-tlb
rm -f axvlc$(LIBEXT)
###############################################################################
# Force rule
# Force rules
###############################################################################
FORCE:
This diff is collapsed.
......@@ -10,7 +10,7 @@
[axvlc.dll]
FileVersion=@VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_REVISION@,0
clsid={E23FE9C6-778E-49d4-B537-38FCDE4887D8}
clsid={9BE31822-FDAD-461B-AD51-BE1D1C159921}
RegisterServer=no
Hook=runinstaller
......
No preview for this file type
/* this file contains the actual definitions of */
/* the IIDs and CLSIDs */
/*** Autogenerated by WIDL 0.9.20 from axvlc.idl - Do not edit ***/
/* link this file in with the server and any clients */
#include <rpc.h>
#include <rpcndr.h>
#define INITGUID
#include <guiddef.h>
/* File created by MIDL compiler version 5.01.0164 */
/* at Sun Apr 02 19:22:45 2006
*/
/* Compiler settings for axvlc.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: allocation ref bounds_check enum stub_data
*/
//@@MIDL_FILE_HEADING( )
#ifdef __cplusplus
extern "C"{
extern "C" {
#endif
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
const IID LIBID_AXVLC = {0xDF2BBE39,0x40A8,0x433b,{0xA2,0x79,0x07,0x3F,0x48,0xDA,0x94,0xB6}};
const IID IID_IVLCControl = {0xC2FA41D0,0xB113,0x476e,{0xAC,0x8C,0x9B,0xD1,0x49,0x99,0xC1,0xC1}};
const IID DIID_DVLCEvents = {0xDF48072F,0x5EF8,0x434e,{0x9B,0x40,0xE2,0xF3,0xAE,0x75,0x9B,0x5F}};
const CLSID CLSID_VLCPlugin = {0xE23FE9C6,0x778E,0x49D4,{0xB5,0x37,0x38,0xFC,0xDE,0x48,0x87,0xD8}};
DEFINE_GUID(LIBID_AXVLC, 0xdf2bbe39, 0x40a8, 0x433b, 0xa2,0x79, 0x07,0x3f,0x48,0xda,0x94,0xb6);
DEFINE_GUID(IID_IVLCControl, 0xc2fa41d0, 0xb113, 0x476e, 0xac,0x8c, 0x9b,0xd1,0x49,0x99,0xc1,0xc1);
DEFINE_GUID(DIID_DVLCEvents, 0xdf48072f, 0x5ef8, 0x434e, 0x9b,0x40, 0xe2,0xf3,0xae,0x75,0x9b,0x5f);
DEFINE_GUID(IID_IVLCAudio, 0x9e0bd17b, 0x2d3c, 0x4656, 0xb9,0x4d, 0x03,0x08,0x4f,0x3f,0xd9,0xd4);
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_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);
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);
#ifdef __cplusplus
}
#endif
This diff is collapsed.
......@@ -29,46 +29,62 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////
class VLCEnumConnections : public IEnumConnections
/* this function object is used to return the value from a map pair */
struct VLCEnumConnectionsDereference
{
public:
VLCEnumConnections(vector<CONNECTDATA> &v) :
e(VLCEnum<CONNECTDATA>(IID_IEnumConnections, v))
{ e.setRetainOperation((VLCEnum<CONNECTDATA>::retainer)&retain); };
VLCEnumConnections(const VLCEnumConnections &vlcEnum) : e(vlcEnum.e) {};
virtual ~VLCEnumConnections() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ return e.QueryInterface(riid, ppv); };
STDMETHODIMP_(ULONG) AddRef(void)
{ return e.AddRef(); };
STDMETHODIMP_(ULONG) Release(void)
{return e.Release(); };
//IEnumConnectionPoints
STDMETHODIMP Next(ULONG celt, LPCONNECTDATA rgelt, ULONG *pceltFetched)
{ return e.Next(celt, rgelt, pceltFetched); };
STDMETHODIMP Skip(ULONG celt)
{ return e.Skip(celt);};
STDMETHODIMP Reset(void)
{ return e.Reset();};
STDMETHODIMP Clone(LPENUMCONNECTIONS *ppenum)
{ if( NULL == ppenum ) return E_POINTER;
*ppenum = dynamic_cast<LPENUMCONNECTIONS>(new VLCEnumConnections(*this));
return (NULL != *ppenum) ? S_OK : E_OUTOFMEMORY;
CONNECTDATA operator()(const map<DWORD,LPUNKNOWN>::iterator& i)
{
CONNECTDATA cd;
cd.dwCookie = i->first;
cd.pUnk = i->second;
return cd;
};
};
class VLCEnumConnections : public VLCEnumIterator<IID_IEnumConnections,
IEnumConnections,
CONNECTDATA,
map<DWORD,LPUNKNOWN>::iterator,
VLCEnumConnectionsDereference>
{
public:
VLCEnumConnections(map<DWORD,LPUNKNOWN> &m) :
VLCEnumIterator<IID_IEnumConnections,
IEnumConnections,
CONNECTDATA,
map<DWORD,LPUNKNOWN>::iterator,
VLCEnumConnectionsDereference> (m.begin(), m.end())
{};
};
private:
////////////////////////////////////////////////////////////////////////////////////////////////
static void retain(CONNECTDATA cd)
/* this function object is used to retain the dereferenced iterator value */
struct VLCEnumConnectionPointsDereference
{
LPCONNECTIONPOINT operator()(const vector<LPCONNECTIONPOINT>::iterator& i)
{
cd.pUnk->AddRef();
};
LPCONNECTIONPOINT cp = *i;
cp->AddRef();
return cp;
}
};
VLCEnum<CONNECTDATA> e;
class VLCEnumConnectionPoints: public VLCEnumIterator<IID_IEnumConnectionPoints,
IEnumConnectionPoints,
LPCONNECTIONPOINT,
vector<LPCONNECTIONPOINT>::iterator,
VLCEnumConnectionPointsDereference>
{
public:
VLCEnumConnectionPoints(vector<LPCONNECTIONPOINT>& v) :
VLCEnumIterator<IID_IEnumConnectionPoints,
IEnumConnectionPoints,
LPCONNECTIONPOINT,
vector<LPCONNECTIONPOINT>::iterator,
VLCEnumConnectionPointsDereference> (v.begin(), v.end())
{};
};
////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -94,32 +110,29 @@ STDMETHODIMP VLCConnectionPoint::GetConnectionPointContainer(LPCONNECTIONPOINTCO
STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie)
{
static DWORD dwCookieCounter = 0;
if( (NULL == pUnk) || (NULL == pdwCookie) )
return E_POINTER;
CONNECTDATA cd;
pUnk->AddRef();
cd.pUnk = pUnk;
*pdwCookie = cd.dwCookie = _connections.size()+1;
_connections.push_back(cd);
*pdwCookie = ++dwCookieCounter;
_connections[*pdwCookie] = pUnk;
return S_OK;
};
STDMETHODIMP VLCConnectionPoint::Unadvise(DWORD pdwCookie)
{
if( (0 < pdwCookie) && (pdwCookie <= _connections.size()) )
{
CONNECTDATA cd = _connections[pdwCookie-1];
if( NULL != cd.pUnk )
map<DWORD,LPUNKNOWN>::iterator pcd = _connections.find((DWORD)pdwCookie);
if( pcd != _connections.end() )
{
cd.pUnk->Release();
cd.pUnk = NULL;
pcd->second->Release();
_connections.erase(pdwCookie);
return S_OK;
}
}
return CONNECT_E_NOCONNECTION;
};
......@@ -135,16 +148,16 @@ STDMETHODIMP VLCConnectionPoint::EnumConnections(IEnumConnections **ppEnum)
void VLCConnectionPoint::fireEvent(DISPID dispId, DISPPARAMS *pDispParams)
{
vector<CONNECTDATA>::iterator end = _connections.end();
vector<CONNECTDATA>::iterator iter = _connections.begin();
map<DWORD,LPUNKNOWN>::iterator end = _connections.end();
map<DWORD,LPUNKNOWN>::iterator iter = _connections.begin();
while( iter != end )
{
CONNECTDATA cd = *iter;
if( NULL != cd.pUnk )
LPUNKNOWN pUnk = iter->second;
if( NULL != pUnk )
{
IDispatch *pDisp;
if( SUCCEEDED(cd.pUnk->QueryInterface(IID_IDispatch, (LPVOID *)&pDisp)) )
if( SUCCEEDED(pUnk->QueryInterface(IID_IDispatch, (LPVOID *)&pDisp)) )
{
pDisp->Invoke(dispId, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, pDispParams, NULL, NULL, NULL);
pDisp->Release();
......@@ -156,16 +169,16 @@ void VLCConnectionPoint::fireEvent(DISPID dispId, DISPPARAMS *pDispParams)
void VLCConnectionPoint::firePropChangedEvent(DISPID dispId)
{
vector<CONNECTDATA>::iterator end = _connections.end();
vector<CONNECTDATA>::iterator iter = _connections.begin();
map<DWORD,LPUNKNOWN>::iterator end = _connections.end();
map<DWORD,LPUNKNOWN>::iterator iter = _connections.begin();
while( iter != end )
{
CONNECTDATA cd = *iter;
if( NULL != cd.pUnk )
LPUNKNOWN pUnk = iter->second;
if( NULL != pUnk )
{
IPropertyNotifySink *pPropSink;
if( SUCCEEDED(cd.pUnk->QueryInterface(IID_IPropertyNotifySink, (LPVOID *)&pPropSink)) )
if( SUCCEEDED(pUnk->QueryInterface(IID_IPropertyNotifySink, (LPVOID *)&pPropSink)) )
{
pPropSink->OnChanged(dispId);
pPropSink->Release();
......@@ -177,50 +190,6 @@ void VLCConnectionPoint::firePropChangedEvent(DISPID dispId)
////////////////////////////////////////////////////////////////////////////////////////////////
class VLCEnumConnectionPoints : public IEnumConnectionPoints
{
public:
VLCEnumConnectionPoints(vector<LPCONNECTIONPOINT> &v) :
e(VLCEnum<LPCONNECTIONPOINT>(IID_IEnumConnectionPoints, v))
{ e.setRetainOperation((VLCEnum<LPCONNECTIONPOINT>::retainer)&retain); };
VLCEnumConnectionPoints(const VLCEnumConnectionPoints &vlcEnum) : e(vlcEnum.e) {};
virtual ~VLCEnumConnectionPoints() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ return e.QueryInterface(riid, ppv); };
STDMETHODIMP_(ULONG) AddRef(void)
{ return e.AddRef(); };
STDMETHODIMP_(ULONG) Release(void)
{return e.Release(); };
//IEnumConnectionPoints
STDMETHODIMP Next(ULONG celt, LPCONNECTIONPOINT *rgelt, ULONG *pceltFetched)
{ return e.Next(celt, rgelt, pceltFetched); };
STDMETHODIMP Skip(ULONG celt)
{ return e.Skip(celt);};
STDMETHODIMP Reset(void)
{ return e.Reset();};
STDMETHODIMP Clone(LPENUMCONNECTIONPOINTS *ppenum)
{ if( NULL == ppenum ) return E_POINTER;
*ppenum = dynamic_cast<LPENUMCONNECTIONPOINTS>(new VLCEnumConnectionPoints(*this));
return (NULL != *ppenum) ? S_OK : E_OUTOFMEMORY;
};
private:
static void retain(LPCONNECTIONPOINT cp)
{
cp->AddRef();
};
VLCEnum<LPCONNECTIONPOINT> e;
};
////////////////////////////////////////////////////////////////////////////////////////////////
VLCDispatchEvent::~VLCDispatchEvent()
{
//clear event arguments
......
......@@ -26,6 +26,7 @@
#include <ocidl.h>
#include <vector>
#include <queue>
#include <map>
class VLCConnectionPoint : public IConnectionPoint
{
......@@ -69,7 +70,7 @@ private:
REFIID _iid;
IConnectionPointContainer *_p_cpc;
std::vector<CONNECTDATA> _connections;
std::map<DWORD, LPUNKNOWN> _connections;
};
//////////////////////////////////////////////////////////////////////////
......
......@@ -29,44 +29,6 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////
class VLCEnumFORMATETC : public IEnumFORMATETC
{
public:
VLCEnumFORMATETC(vector<FORMATETC> &v) :
e(VLCEnum<FORMATETC>(IID_IEnumFORMATETC, v)) {};
VLCEnumFORMATETC(const VLCEnumFORMATETC &vlcEnum) : e(vlcEnum.e) {};
virtual ~VLCEnumFORMATETC() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ return e.QueryInterface(riid, ppv); };
STDMETHODIMP_(ULONG) AddRef(void)
{ return e.AddRef(); };
STDMETHODIMP_(ULONG) Release(void)
{return e.Release(); };
//IEnumConnectionPoints
STDMETHODIMP Next(ULONG celt, LPFORMATETC rgelt, ULONG *pceltFetched)
{ return e.Next(celt, rgelt, pceltFetched); };
STDMETHODIMP Skip(ULONG celt)
{ return e.Skip(celt);};
STDMETHODIMP Reset(void)
{ return e.Reset();};
STDMETHODIMP Clone(LPENUMFORMATETC *ppenum)
{ if( NULL == ppenum ) return E_POINTER;
*ppenum = dynamic_cast<LPENUMFORMATETC>(new VLCEnumFORMATETC(*this));
return (NULL != *ppenum) ? S_OK : E_OUTOFMEMORY;
};
private:
VLCEnum<FORMATETC> e;
};
////////////////////////////////////////////////////////////////////////////////////////////////
static const FORMATETC _metaFileFormatEtc =
{
CF_METAFILEPICT,
......@@ -84,6 +46,22 @@ static const FORMATETC _enhMetaFileFormatEtc =
TYMED_ENHMF,
};
class VLCEnumFORMATETC : public VLCEnumIterator<IID_IEnumFORMATETC,
IEnumFORMATETC,
FORMATETC,
vector<FORMATETC>::iterator>
{
public:
VLCEnumFORMATETC(vector<FORMATETC> v) :
VLCEnumIterator<IID_IEnumFORMATETC,
IEnumFORMATETC,
FORMATETC,
vector<FORMATETC>::iterator>(v.begin(), v.end())
{};
};
////////////////////////////////////////////////////////////////////////////////////////////////
VLCDataObject::VLCDataObject(VLCPlugin *p_instance) : _p_instance(p_instance)
{
_v_formatEtc.push_back(_enhMetaFileFormatEtc);
......@@ -114,13 +92,14 @@ STDMETHODIMP VLCDataObject::EnumDAdvise(IEnumSTATDATA **ppenumAdvise)
return _p_adviseHolder->EnumAdvise(ppenumAdvise);
};
STDMETHODIMP VLCDataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppenumformatetc)
STDMETHODIMP VLCDataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnum)
{
if( NULL == ppenumformatetc )
if( NULL == ppEnum )
return E_POINTER;
*ppenumformatetc = new VLCEnumFORMATETC(_v_formatEtc);
return NOERROR;
*ppEnum = dynamic_cast<IEnumFORMATETC *>(new VLCEnumFORMATETC(_v_formatEtc));
return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY;
};
STDMETHODIMP VLCDataObject::GetCanonicalFormatEtc(LPFORMATETC pFormatEtcIn, LPFORMATETC pFormatEtcOut)
......
/*****************************************************************************
* guiddef.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2006 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 __GUIDDEF_H__
#define __GUIDDEF_H__
/*
** Widl generated code requires guiddef.h,
** which is not available under MinGW
*/
#undef GUID_EXT
#define GUID_EXT
#include <initguid.h>
#endif
This diff is collapsed.
......@@ -171,7 +171,14 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr
V_VT(&value) = VT_I4;
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);
}
......@@ -221,10 +228,16 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt
VariantClear(&value);
V_VT(&value) = VT_I4;
V_I4(&value) = _p_instance->getTime();
V_I4(&value) = _p_instance->getStartTime();
pPropBag->Write(OLESTR("StartTime"), &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 )
_p_instance->setDirty(FALSE);
......
This diff is collapsed.
......@@ -26,9 +26,10 @@
#include <ole2.h>
#include <olectl.h>
#include <vlc/vlc.h>
#include <vlc/libvlc.h>
extern const GUID CLSID_VLCPlugin;
extern const GUID CLSID_VLCPlugin2;
extern const GUID LIBID_AXVLC;
extern const GUID DIID_DVLCEvents;
......@@ -37,7 +38,7 @@ class VLCPluginClass : public IClassFactory
public:
VLCPluginClass(LONG *p_class_ref,HINSTANCE hInstance);
VLCPluginClass(LONG *p_class_ref, HINSTANCE hInstance, REFCLSID rclsid);
/* IUnknown methods */
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
......@@ -48,6 +49,8 @@ public:
STDMETHODIMP CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv);
STDMETHODIMP LockServer(BOOL fLock);
REFCLSID getClassID(void) { return (REFCLSID)_classid; };
LPCSTR getInPlaceWndClassName(void) const { return TEXT("VLC Plugin In-Place"); };
LPCSTR getVideoWndClassName(void) const { return TEXT("VLC Plugin Video"); };
HINSTANCE getHInstance(void) const { return _hinstance; };
......@@ -62,6 +65,7 @@ private:
LPLONG _p_class_ref;
HINSTANCE _hinstance;
CLSID _classid;
ATOM _inplace_wndclass_atom;
ATOM _video_wndclass_atom;
LPPICTURE _inplace_picture;
......@@ -81,7 +85,7 @@ public:
/* custom methods */
HRESULT getTypeLib(LCID lcid, ITypeLib **pTL) { return LoadRegTypeLib(LIBID_AXVLC, 1, 0, lcid, pTL); };
REFCLSID getClassID(void) { return (REFCLSID)CLSID_VLCPlugin; };
REFCLSID getClassID(void) { return _p_class->getClassID(); };
REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; };
/*
......@@ -116,9 +120,24 @@ public:
BOOL getVisible(void) { return _b_visible; };
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);
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
inline void setExtent(const SIZEL& extent)
{
......@@ -165,9 +184,9 @@ public:
inline BOOL isDirty(void) { return _b_dirty; };
inline void setDirty(BOOL dirty) { _b_dirty = dirty; };
inline BOOL isRunning(void) { return 0 != _i_vlc; };
inline BOOL isRunning(void) { return NULL != _p_libvlc; };
HRESULT getVLCObject(int *i_vlc);
HRESULT getVLC(libvlc_instance_t** p_vlc);
// control geometry within container
RECT getPosRect(void) { return _posRect; };
......@@ -218,6 +237,7 @@ private:
class VLCConnectionPointContainer *vlcConnectionPointContainer;
class VLCObjectSafety *vlcObjectSafety;
class VLCControl *vlcControl;
class VLCControl2 *vlcControl2;
class VLCViewObject *vlcViewObject;
class VLCDataObject *vlcDataObject;
......@@ -226,15 +246,16 @@ private:
// video window (Drawing window)
HWND _videownd;
VLCPluginClass *_p_class;
VLCPluginClass* _p_class;
ULONG _i_ref;
libvlc_instance_t* _p_libvlc;
UINT _i_codepage;
BOOL _b_usermode;
int _i_vlc;
RECT _posRect;
// persistable properties
BSTR _bstr_baseurl;
BSTR _bstr_mrl;
BOOL _b_autoplay;
BOOL _b_autoloop;
......
This diff is collapsed.
......@@ -70,6 +70,28 @@ BSTR BSTRFromCStr(UINT codePage, LPCSTR s)
return NULL;
};
char *CStrFromGUID(REFGUID clsid)
{
LPOLESTR oleStr;
if( FAILED(StringFromIID(clsid, &oleStr)) )
return NULL;
#ifdef OLE2ANSI
return (LPCSTR)oleStr;
#else
char *pct_CLSID = NULL;
size_t len = WideCharToMultiByte(CP_ACP, 0, oleStr, -1, NULL, 0, NULL, NULL);
if( len > 0 )
{
pct_CLSID = (char *)CoTaskMemAlloc(len);
WideCharToMultiByte(CP_ACP, 0, oleStr, -1, pct_CLSID, len, NULL, NULL);
}
CoTaskMemFree(oleStr);
return pct_CLSID;
#endif
};
/*
** properties
*/
......
......@@ -31,6 +31,8 @@
extern char *CStrFromBSTR(UINT codePage, BSTR bstr);
extern BSTR BSTRFromCStr(UINT codePage, LPCSTR s);
extern char *CStrFromGUID(REFGUID clsid);
// properties
extern HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v);
......@@ -39,79 +41,49 @@ extern HDC CreateDevDC(DVTARGETDEVICE *ptd);
extern void DPFromHimetric(HDC hdc, LPPOINT pt, int count);
extern void HimetricFromDP(HDC hdc, LPPOINT pt, int count);
/**************************************************************************************************/
// enumeration
template<class T> class VLCEnum : IUnknown
/* this function object is used to dereference the iterator into a value */
template <class T, class Iterator>
struct VLCDereference
{
public:
VLCEnum(REFIID riid, std::vector<T> &);
VLCEnum(const VLCEnum<T> &);
virtual ~VLCEnum() {};
VLCEnum<T>& operator=(const VLCEnum<T> &t);
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
// IEnumXXXX methods
STDMETHODIMP Next(ULONG, T *, ULONG *);
STDMETHODIMP Skip(ULONG);
STDMETHODIMP Reset(void);
// cloning is implemented by subclasses and must use copy constructor
//STDMETHODIMP Clone(VLCEnum<T> **);
typedef void (*retainer)(T);
void setRetainOperation(retainer retain) { _retain = retain; };
private:
LONG _refcount;
std::vector<T> _v;
typename std::vector<T>::iterator _i;
REFIID _riid;
retainer _retain;
T operator()(const Iterator& i) const
{
return *i;
};
};
template<class T>
VLCEnum<T>::VLCEnum(REFIID riid, std::vector<T> &v) :
_refcount(1),
_v(v),
_riid(riid),
_retain(NULL)
template<REFIID EnumeratorIID, class Enumerator, class T, class Iterator, typename Dereference = VLCDereference<T, Iterator> >
class VLCEnumIterator : public Enumerator
{
_i= v.begin();
};
template<class T>
VLCEnum<T>::VLCEnum(const VLCEnum<T> &e) :
_refcount(1),
_v(e._v),
_riid(e._riid)
{
};
public:
template<class T>
VLCEnum<T>& VLCEnum<T>::operator=(const VLCEnum<T> &e)
{
this->_refcount = 1;
this->_riid = e._riid;
this->_v = e._v;
this->_i = e._i;
return this;
};
VLCEnumIterator(const Iterator& from, const Iterator& to) :
_refcount(1),
_begin(from),
_curr(from),
_end(to)
{};
VLCEnumIterator(const VLCEnumIterator& e) :
Enumerator(),
_refcount(e._refcount),
_begin(e._begin),
_curr(e._curr),
_end(e._end)
{};
virtual ~VLCEnumIterator()
{};
template<class T>
STDMETHODIMP VLCEnum<T>::QueryInterface(REFIID riid, void **ppv)
{
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (_riid == riid) )
|| (EnumeratorIID == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
......@@ -119,17 +91,15 @@ STDMETHODIMP VLCEnum<T>::QueryInterface(REFIID riid, void **ppv)
}
// standalone object
return E_NOINTERFACE;
};
};
template<class T>
STDMETHODIMP_(ULONG) VLCEnum<T>::AddRef(void)
{
STDMETHODIMP_(ULONG) AddRef(void)
{
return InterlockedIncrement(&_refcount);
};
};
template<class T>
STDMETHODIMP_(ULONG) VLCEnum<T>::Release(void)
{
STDMETHODIMP_(ULONG) Release(void)
{
ULONG refcount = InterlockedDecrement(&_refcount);
if( 0 == refcount )
{
......@@ -137,11 +107,12 @@ STDMETHODIMP_(ULONG) VLCEnum<T>::Release(void)
return 0;
}
return refcount;
};
};
template<class T>
STDMETHODIMP VLCEnum<T>::Next(ULONG celt, T *rgelt, ULONG *pceltFetched)
{
// IEnumXXXX methods
STDMETHODIMP Next(ULONG celt, T *rgelt, ULONG *pceltFetched)
{
if( NULL == rgelt )
return E_POINTER;
......@@ -149,13 +120,11 @@ STDMETHODIMP VLCEnum<T>::Next(ULONG celt, T *rgelt, ULONG *pceltFetched)
return E_INVALIDARG;
ULONG c = 0;
typename std::vector<T>::iterator end = _v.end();
while( (c < celt) && (_i != end) )
while( (c < celt) && (_curr != _end) )
{
rgelt[c] = *_i;
if( NULL != _retain ) _retain(rgelt[c]);
++_i;
rgelt[c] = dereference(_curr);
++_curr;
++c;
}
......@@ -163,27 +132,41 @@ STDMETHODIMP VLCEnum<T>::Next(ULONG celt, T *rgelt, ULONG *pceltFetched)
*pceltFetched = c;
return (c == celt) ? S_OK : S_FALSE;
};
};
template<class T>
STDMETHODIMP VLCEnum<T>::Skip(ULONG celt)
{
STDMETHODIMP Skip(ULONG celt)
{
ULONG c = 0;
typename std::vector<T>::iterator end = _v.end();
while( (c < celt) && (_i != end) )
while( (c < celt) && (_curr != _end) )
{
++_i;
++_curr;
++c;
}
return (c == celt) ? S_OK : S_FALSE;
};
};
template<class T>
STDMETHODIMP VLCEnum<T>::Reset(void)
{
_i= _v.begin();
STDMETHODIMP Reset(void)
{
_curr = _begin;
return S_OK;
};
STDMETHODIMP Clone(Enumerator **ppEnum)
{
if( NULL == ppEnum )
return E_POINTER;
*ppEnum = dynamic_cast<Enumerator *>(new VLCEnumIterator(*this));
return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY;
};
private:
LONG _refcount;
Iterator _begin, _curr, _end;
Dereference dereference;
};
#endif
......
......@@ -529,7 +529,7 @@ STDMETHODIMP VLCControl::getVariable( BSTR name, VARIANT *value)
return hr;
};
static void freeTargetOptions(char **cOptions, int cOptionCount)
void VLCControl::FreeTargetOptions(char **cOptions, int cOptionCount)
{
// clean up
if( NULL != cOptions )
......@@ -546,7 +546,7 @@ static void freeTargetOptions(char **cOptions, int cOptionCount)
}
};
static HRESULT createTargetOptions(int codePage, VARIANT *options, char ***cOptions, int *cOptionCount)
HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char ***cOptions, int *cOptionCount)
{
HRESULT hr = E_INVALIDARG;
if( VT_ERROR == V_VT(options) )
......@@ -621,7 +621,7 @@ static HRESULT createTargetOptions(int codePage, VARIANT *options, char ***cOpti
if( FAILED(hr) )
{
// free already processed elements
freeTargetOptions(*cOptions, *cOptionCount);
FreeTargetOptions(*cOptions, *cOptionCount);
}
}
else
......@@ -715,7 +715,7 @@ static HRESULT createTargetOptions(int codePage, VARIANT *options, char ***cOpti
if( FAILED(hr) )
{
// free already processed elements
freeTargetOptions(*cOptions, *cOptionCount);
FreeTargetOptions(*cOptions, *cOptionCount);
}
}
else
......@@ -750,7 +750,7 @@ STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistM
int cOptionsCount;
char **cOptions;
if( FAILED(createTargetOptions(CP_UTF8, &options, &cOptions, &cOptionsCount)) )
if( FAILED(CreateTargetOptions(CP_UTF8, &options, &cOptions, &cOptionsCount)) )
return E_INVALIDARG;
if( VLC_SUCCESS <= VLC_AddTarget(i_vlc, cUri, (const char **)cOptions, cOptionsCount, mode, position) )
......@@ -766,7 +766,7 @@ STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistM
_p_instance->fireOnStopEvent();
}
freeTargetOptions(cOptions, cOptionsCount);
FreeTargetOptions(cOptions, cOptionsCount);
CoTaskMemFree(cUri);
}
return hr;
......
......@@ -23,7 +23,6 @@
#ifndef _VLCCONTROL_H_
#define _VLCCONTROL_H_
#include <oaidl.h>
#include "axvlc_idl.h"
class VLCControl : public IVLCControl
......@@ -94,6 +93,9 @@ public:
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);
private:
HRESULT getTypeInfo();
......
This diff is collapsed.
This diff is collapsed.
......@@ -468,7 +468,6 @@ ${automake} --add-missing --copy -Wall
##
rm -f vlc-config.in vlc-config
rm -f src/misc/modules_builtin.h
rm -f mozilla/vlcintf.h
# Shut up
set +x
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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