Avoid \r\n problems between platforms

This commit is contained in:
Steve Lhomme 2005-03-02 16:47:31 +00:00
parent cb1f06674f
commit 3d831e04ec
105 changed files with 10417 additions and 10417 deletions

View File

@ -1,53 +1,53 @@
/* this file contains the actual definitions of */
/* the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 5.01.0164 */
/* at Thu Feb 17 09:25:54 2005
*/
/* 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"{
#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}};
#ifdef __cplusplus
}
#endif
/* this file contains the actual definitions of */
/* the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 5.01.0164 */
/* at Thu Feb 17 09:25:54 2005
*/
/* 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"{
#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}};
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,287 +1,287 @@
/*****************************************************************************
* connectioncontainer.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "connectioncontainer.h"
#include "utils.h"
using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////
class VLCEnumConnections : public IEnumConnections
{
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;
};
private:
static void retain(CONNECTDATA cd)
{
cd.pUnk->AddRef();
};
VLCEnum<CONNECTDATA> e;
};
////////////////////////////////////////////////////////////////////////////////////////////////
STDMETHODIMP VLCConnectionPoint::GetConnectionInterface(IID *iid)
{
if( NULL == iid )
return E_POINTER;
*iid = _iid;
return S_OK;
};
STDMETHODIMP VLCConnectionPoint::GetConnectionPointContainer(LPCONNECTIONPOINTCONTAINER *ppCPC)
{
if( NULL == ppCPC )
return E_POINTER;
_p_cpc->AddRef();
*ppCPC = _p_cpc;
return S_OK;
};
STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie)
{
if( (NULL == pUnk) || (NULL == pdwCookie) )
return E_POINTER;
CONNECTDATA cd;
pUnk->AddRef();
cd.pUnk = pUnk;
*pdwCookie = cd.dwCookie = _connections.size();
_connections.push_back(cd);
return S_OK;
};
STDMETHODIMP VLCConnectionPoint::Unadvise(DWORD pdwCookie)
{
if( pdwCookie < _connections.size() )
{
CONNECTDATA cd = _connections[pdwCookie];
if( NULL != cd.pUnk )
{
cd.pUnk->Release();
cd.pUnk = NULL;
return S_OK;
}
}
return CONNECT_E_NOCONNECTION;
};
STDMETHODIMP VLCConnectionPoint::EnumConnections(IEnumConnections **ppEnum)
{
if( NULL == ppEnum )
return E_POINTER;
*ppEnum = dynamic_cast<LPENUMCONNECTIONS>(new VLCEnumConnections(_connections));
return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY;
};
void VLCConnectionPoint::fireEvent(DISPID dispId, DISPPARAMS* pDispParams)
{
vector<CONNECTDATA>::iterator end = _connections.end();
vector<CONNECTDATA>::iterator iter = _connections.begin();
while( iter != end )
{
CONNECTDATA cd = *iter;
if( NULL != cd.pUnk )
{
IDispatch *pDisp;
if( SUCCEEDED(cd.pUnk->QueryInterface(IID_IDispatch, (LPVOID *)&pDisp)) )
{
pDisp->Invoke(dispId, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, pDispParams, NULL, NULL, NULL);
pDisp->Release();
}
}
++iter;
}
};
void VLCConnectionPoint::firePropChangedEvent(DISPID dispId)
{
vector<CONNECTDATA>::iterator end = _connections.end();
vector<CONNECTDATA>::iterator iter = _connections.begin();
while( iter != end )
{
CONNECTDATA cd = *iter;
if( NULL != cd.pUnk )
{
IPropertyNotifySink *pPropSink;
if( SUCCEEDED(cd.pUnk->QueryInterface(IID_IPropertyNotifySink, (LPVOID *)&pPropSink)) )
{
pPropSink->OnChanged(dispId);
pPropSink->Release();
}
}
++iter;
}
};
////////////////////////////////////////////////////////////////////////////////////////////////
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;
};
////////////////////////////////////////////////////////////////////////////////////////////////
VLCConnectionPointContainer::VLCConnectionPointContainer(VLCPlugin *p_instance) :
_p_instance(p_instance)
{
_p_events = new VLCConnectionPoint(dynamic_cast<LPCONNECTIONPOINTCONTAINER>(this),
_p_instance->getDispEventID());
_v_cps.push_back(dynamic_cast<LPCONNECTIONPOINT>(_p_events));
_p_props = new VLCConnectionPoint(dynamic_cast<LPCONNECTIONPOINTCONTAINER>(this),
IID_IPropertyNotifySink);
_v_cps.push_back(dynamic_cast<LPCONNECTIONPOINT>(_p_props));
};
VLCConnectionPointContainer::~VLCConnectionPointContainer()
{
_v_cps.clear();
delete _p_props;
delete _p_events;
};
STDMETHODIMP VLCConnectionPointContainer::EnumConnectionPoints(LPENUMCONNECTIONPOINTS *ppEnum)
{
if( NULL == ppEnum )
return E_POINTER;
*ppEnum = dynamic_cast<LPENUMCONNECTIONPOINTS>(new VLCEnumConnectionPoints(_v_cps));
return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY;
};
STDMETHODIMP VLCConnectionPointContainer::FindConnectionPoint(REFIID riid, IConnectionPoint **ppCP)
{
if( NULL == ppCP )
return E_POINTER;
*ppCP = NULL;
if( IID_IPropertyNotifySink == riid )
{
_p_props->AddRef();
*ppCP = dynamic_cast<LPCONNECTIONPOINT>(_p_props);
}
else if( _p_instance->getDispEventID() == riid )
{
_p_events->AddRef();
*ppCP = dynamic_cast<LPCONNECTIONPOINT>(_p_events);
}
else
return CONNECT_E_NOCONNECTION;
return NOERROR;
};
void VLCConnectionPointContainer::fireEvent(DISPID dispId, DISPPARAMS* pDispParams)
{
_p_events->fireEvent(dispId, pDispParams);
};
void VLCConnectionPointContainer::firePropChangedEvent(DISPID dispId)
{
_p_props->firePropChangedEvent(dispId);
};
/*****************************************************************************
* connectioncontainer.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "connectioncontainer.h"
#include "utils.h"
using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////
class VLCEnumConnections : public IEnumConnections
{
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;
};
private:
static void retain(CONNECTDATA cd)
{
cd.pUnk->AddRef();
};
VLCEnum<CONNECTDATA> e;
};
////////////////////////////////////////////////////////////////////////////////////////////////
STDMETHODIMP VLCConnectionPoint::GetConnectionInterface(IID *iid)
{
if( NULL == iid )
return E_POINTER;
*iid = _iid;
return S_OK;
};
STDMETHODIMP VLCConnectionPoint::GetConnectionPointContainer(LPCONNECTIONPOINTCONTAINER *ppCPC)
{
if( NULL == ppCPC )
return E_POINTER;
_p_cpc->AddRef();
*ppCPC = _p_cpc;
return S_OK;
};
STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie)
{
if( (NULL == pUnk) || (NULL == pdwCookie) )
return E_POINTER;
CONNECTDATA cd;
pUnk->AddRef();
cd.pUnk = pUnk;
*pdwCookie = cd.dwCookie = _connections.size();
_connections.push_back(cd);
return S_OK;
};
STDMETHODIMP VLCConnectionPoint::Unadvise(DWORD pdwCookie)
{
if( pdwCookie < _connections.size() )
{
CONNECTDATA cd = _connections[pdwCookie];
if( NULL != cd.pUnk )
{
cd.pUnk->Release();
cd.pUnk = NULL;
return S_OK;
}
}
return CONNECT_E_NOCONNECTION;
};
STDMETHODIMP VLCConnectionPoint::EnumConnections(IEnumConnections **ppEnum)
{
if( NULL == ppEnum )
return E_POINTER;
*ppEnum = dynamic_cast<LPENUMCONNECTIONS>(new VLCEnumConnections(_connections));
return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY;
};
void VLCConnectionPoint::fireEvent(DISPID dispId, DISPPARAMS* pDispParams)
{
vector<CONNECTDATA>::iterator end = _connections.end();
vector<CONNECTDATA>::iterator iter = _connections.begin();
while( iter != end )
{
CONNECTDATA cd = *iter;
if( NULL != cd.pUnk )
{
IDispatch *pDisp;
if( SUCCEEDED(cd.pUnk->QueryInterface(IID_IDispatch, (LPVOID *)&pDisp)) )
{
pDisp->Invoke(dispId, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, pDispParams, NULL, NULL, NULL);
pDisp->Release();
}
}
++iter;
}
};
void VLCConnectionPoint::firePropChangedEvent(DISPID dispId)
{
vector<CONNECTDATA>::iterator end = _connections.end();
vector<CONNECTDATA>::iterator iter = _connections.begin();
while( iter != end )
{
CONNECTDATA cd = *iter;
if( NULL != cd.pUnk )
{
IPropertyNotifySink *pPropSink;
if( SUCCEEDED(cd.pUnk->QueryInterface(IID_IPropertyNotifySink, (LPVOID *)&pPropSink)) )
{
pPropSink->OnChanged(dispId);
pPropSink->Release();
}
}
++iter;
}
};
////////////////////////////////////////////////////////////////////////////////////////////////
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;
};
////////////////////////////////////////////////////////////////////////////////////////////////
VLCConnectionPointContainer::VLCConnectionPointContainer(VLCPlugin *p_instance) :
_p_instance(p_instance)
{
_p_events = new VLCConnectionPoint(dynamic_cast<LPCONNECTIONPOINTCONTAINER>(this),
_p_instance->getDispEventID());
_v_cps.push_back(dynamic_cast<LPCONNECTIONPOINT>(_p_events));
_p_props = new VLCConnectionPoint(dynamic_cast<LPCONNECTIONPOINTCONTAINER>(this),
IID_IPropertyNotifySink);
_v_cps.push_back(dynamic_cast<LPCONNECTIONPOINT>(_p_props));
};
VLCConnectionPointContainer::~VLCConnectionPointContainer()
{
_v_cps.clear();
delete _p_props;
delete _p_events;
};
STDMETHODIMP VLCConnectionPointContainer::EnumConnectionPoints(LPENUMCONNECTIONPOINTS *ppEnum)
{
if( NULL == ppEnum )
return E_POINTER;
*ppEnum = dynamic_cast<LPENUMCONNECTIONPOINTS>(new VLCEnumConnectionPoints(_v_cps));
return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY;
};
STDMETHODIMP VLCConnectionPointContainer::FindConnectionPoint(REFIID riid, IConnectionPoint **ppCP)
{
if( NULL == ppCP )
return E_POINTER;
*ppCP = NULL;
if( IID_IPropertyNotifySink == riid )
{
_p_props->AddRef();
*ppCP = dynamic_cast<LPCONNECTIONPOINT>(_p_props);
}
else if( _p_instance->getDispEventID() == riid )
{
_p_events->AddRef();
*ppCP = dynamic_cast<LPCONNECTIONPOINT>(_p_events);
}
else
return CONNECT_E_NOCONNECTION;
return NOERROR;
};
void VLCConnectionPointContainer::fireEvent(DISPID dispId, DISPPARAMS* pDispParams)
{
_p_events->fireEvent(dispId, pDispParams);
};
void VLCConnectionPointContainer::firePropChangedEvent(DISPID dispId)
{
_p_props->firePropChangedEvent(dispId);
};

View File

@ -1,116 +1,116 @@
/*****************************************************************************
* connectioncontainer.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __CONNECTIONCONTAINER_H__
#define __CONNECTIONCONTAINER_H__
#include <ocidl.h>
#include <vector>
using namespace std;
class VLCConnectionPoint : public IConnectionPoint
{
public:
VLCConnectionPoint(IConnectionPointContainer *p_cpc, REFIID iid) :
_iid(iid), _p_cpc(p_cpc) {};
virtual ~VLCConnectionPoint() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv ) return E_POINTER;
if( (IID_IUnknown == riid)
&& (IID_IConnectionPoint == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
// must be a standalone object
return E_NOINTERFACE;
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_cpc->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_cpc->Release(); };
// IConnectionPoint methods
STDMETHODIMP GetConnectionInterface(IID *);
STDMETHODIMP GetConnectionPointContainer(LPCONNECTIONPOINTCONTAINER *);
STDMETHODIMP Advise(IUnknown *, DWORD *);
STDMETHODIMP Unadvise(DWORD);
STDMETHODIMP EnumConnections(LPENUMCONNECTIONS *);
void fireEvent(DISPID dispIdMember, DISPPARAMS* pDispParams);
void firePropChangedEvent(DISPID dispId);
private:
REFIID _iid;
IConnectionPointContainer *_p_cpc;
vector<CONNECTDATA> _connections;
};
//////////////////////////////////////////////////////////////////////////
class VLCConnectionPointContainer : public IConnectionPointContainer
{
public:
VLCConnectionPointContainer(VLCPlugin *p_instance);
virtual ~VLCConnectionPointContainer();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IConnectionPointContainer == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IConnectionPointContainer methods
STDMETHODIMP EnumConnectionPoints(LPENUMCONNECTIONPOINTS *);
STDMETHODIMP FindConnectionPoint(REFIID, LPCONNECTIONPOINT *);
void fireEvent(DISPID, DISPPARAMS*);
void firePropChangedEvent(DISPID dispId);
private:
VLCPlugin *_p_instance;
VLCConnectionPoint *_p_events;
VLCConnectionPoint *_p_props;
vector<LPCONNECTIONPOINT> _v_cps;
};
#endif
/*****************************************************************************
* connectioncontainer.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __CONNECTIONCONTAINER_H__
#define __CONNECTIONCONTAINER_H__
#include <ocidl.h>
#include <vector>
using namespace std;
class VLCConnectionPoint : public IConnectionPoint
{
public:
VLCConnectionPoint(IConnectionPointContainer *p_cpc, REFIID iid) :
_iid(iid), _p_cpc(p_cpc) {};
virtual ~VLCConnectionPoint() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv ) return E_POINTER;
if( (IID_IUnknown == riid)
&& (IID_IConnectionPoint == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
// must be a standalone object
return E_NOINTERFACE;
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_cpc->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_cpc->Release(); };
// IConnectionPoint methods
STDMETHODIMP GetConnectionInterface(IID *);
STDMETHODIMP GetConnectionPointContainer(LPCONNECTIONPOINTCONTAINER *);
STDMETHODIMP Advise(IUnknown *, DWORD *);
STDMETHODIMP Unadvise(DWORD);
STDMETHODIMP EnumConnections(LPENUMCONNECTIONS *);
void fireEvent(DISPID dispIdMember, DISPPARAMS* pDispParams);
void firePropChangedEvent(DISPID dispId);
private:
REFIID _iid;
IConnectionPointContainer *_p_cpc;
vector<CONNECTDATA> _connections;
};
//////////////////////////////////////////////////////////////////////////
class VLCConnectionPointContainer : public IConnectionPointContainer
{
public:
VLCConnectionPointContainer(VLCPlugin *p_instance);
virtual ~VLCConnectionPointContainer();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IConnectionPointContainer == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IConnectionPointContainer methods
STDMETHODIMP EnumConnectionPoints(LPENUMCONNECTIONPOINTS *);
STDMETHODIMP FindConnectionPoint(REFIID, LPCONNECTIONPOINT *);
void fireEvent(DISPID, DISPPARAMS*);
void firePropChangedEvent(DISPID dispId);
private:
VLCPlugin *_p_instance;
VLCConnectionPoint *_p_events;
VLCConnectionPoint *_p_props;
vector<LPCONNECTIONPOINT> _v_cps;
};
#endif

View File

@ -1,403 +1,403 @@
/*****************************************************************************
* main.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include <comcat.h>
#include <windows.h>
#include <shlwapi.h>
using namespace std;
#define THREADING_MODEL "Both"
#define COMPANY_STR "VideoLAN"
#define PROGRAM_STR "VLCPlugin"
#define VERSION_MAJOR_STR "1"
#define VERSION_MINOR_STR "0"
#define DESCRIPTION "VideoLAN VLC ActiveX Plugin"
#define PROGID_STR COMPANY_STR"."PROGRAM_STR
#define VERS_PROGID_STR COMPANY_STR"."PROGRAM_STR"."VERSION_MAJOR_STR
#define VERSION_STR VERSION_MAJOR_STR"."VERSION_MINOR_STR
#define GUID_STRLEN 39
/*
** MingW headers do not declare those
*/
extern const CATID CATID_SafeForInitializing;
extern const CATID CATID_SafeForScripting;
static LONG i_class_ref= 0;
static HINSTANCE h_instance= 0;
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
*ppv = NULL;
if( CLSID_VLCPlugin == rclsid )
{
VLCPluginClass *plugin = new VLCPluginClass(&i_class_ref, h_instance);
hr = plugin->QueryInterface(riid, ppv);
plugin->Release();
}
return hr;
};
STDAPI DllCanUnloadNow(VOID)
{
return (0 == i_class_ref) ? S_OK: S_FALSE;
};
static LPCTSTR TStrFromGUID(REFGUID clsid) {
LPOLESTR oleStr;
if( FAILED(StringFromIID(clsid, &oleStr)) )
return NULL;
//check whether TCHAR and OLECHAR are both either ANSI or UNICODE
if( sizeof(TCHAR) == sizeof(OLECHAR) )
return (LPCTSTR)oleStr;
LPTSTR pct_CLSID = NULL;
#ifndef OLE2ANSI
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);
}
#else
size_t len = MutiByteToWideChar(CP_ACP, 0, oleStr, -1, NULL, 0);
if( len > 0 )
{
clsidStr = (wchar_t *)CoTaskMemAlloc(len*sizeof(wchar_t));
WideCharToMultiByte(CP_ACP, 0, oleStr, -1, pct_CLSID, len);
}
#endif
CoTaskMemFree(oleStr);
return pct_CLSID;
};
static HKEY keyCreate(HKEY parentKey, LPCTSTR keyName)
{
HKEY childKey;
if( ERROR_SUCCESS == RegCreateKeyEx(parentKey, keyName, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &childKey, NULL) )
{
return childKey;
}
return NULL;
};
STDAPI DllUnregisterServer(VOID)
{
// unregister type lib from the registry
UnRegisterTypeLib(LIBID_AXVLC, 1, 0, LOCALE_NEUTRAL, SYS_WIN32);
// remove component categories we supports
ICatRegister *pcr;
if( SUCCEEDED(CoCreateInstance(CLSID_StdComponentCategoriesMgr,
NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr)) ) {
CATID implCategories[] = {
CATID_Control,
CATID_PersistsToPropertyBag,
CATID_SafeForInitializing,
CATID_SafeForScripting,
};
pcr->UnRegisterClassImplCategories(CLSID_VLCPlugin,
sizeof(implCategories)/sizeof(CATID), implCategories);
pcr->Release();
}
SHDeleteKey(HKEY_CLASSES_ROOT, TEXT(VERS_PROGID_STR));
SHDeleteKey(HKEY_CLASSES_ROOT, TEXT(PROGID_STR));
LPCTSTR psz_CLSID = TStrFromGUID(CLSID_VLCPlugin);
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
HKEY hClsIDKey;
if( ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT("CLSID"), 0, KEY_WRITE, &hClsIDKey) )
{
SHDeleteKey(hClsIDKey, psz_CLSID);
RegCloseKey(hClsIDKey);
}
CoTaskMemFree((void *)psz_CLSID);
return S_OK;
};
STDAPI DllRegisterServer(VOID)
{
DllUnregisterServer();
char DllPath[MAX_PATH];
DWORD DllPathLen= GetModuleFileName(h_instance, DllPath, sizeof(DllPath)) ;
if( 0 == DllPathLen )
return E_FAIL;
LPCTSTR psz_CLSID = TStrFromGUID(CLSID_VLCPlugin);
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
HKEY hBaseKey;
if( ERROR_SUCCESS != RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT("CLSID"), 0, KEY_CREATE_SUB_KEY, &hBaseKey) )
return E_FAIL;
HKEY hClassKey = keyCreate(hBaseKey, psz_CLSID);
if( NULL != hClassKey )
{
HKEY hSubKey;
// default key value
RegSetValueEx(hClassKey, NULL, 0, REG_SZ,
(const BYTE*)DESCRIPTION, sizeof(DESCRIPTION));
// Control key value
hSubKey = keyCreate(hClassKey, TEXT("Control"));
RegCloseKey(hSubKey);
// InprocServer32 key value
hSubKey = keyCreate(hClassKey, TEXT("InprocServer32"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)DllPath, DllPathLen);
RegSetValueEx(hSubKey, TEXT("ThreadingModel"), 0, REG_SZ,
(const BYTE*)THREADING_MODEL, sizeof(THREADING_MODEL));
RegCloseKey(hSubKey);
// MiscStatus key value
hSubKey = keyCreate(hClassKey, TEXT("MiscStatus\\1"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ, (const BYTE*)"131473", sizeof("131473"));
RegCloseKey(hSubKey);
// Programmable key value
hSubKey = keyCreate(hClassKey, TEXT("Programmable"));
RegCloseKey(hSubKey);
// ProgID key value
hSubKey = keyCreate(hClassKey, TEXT("ProgID"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)VERS_PROGID_STR, sizeof(VERS_PROGID_STR));
RegCloseKey(hSubKey);
// VersionIndependentProgID key value
hSubKey = keyCreate(hClassKey, TEXT("VersionIndependentProgID"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)PROGID_STR, sizeof(PROGID_STR));
RegCloseKey(hSubKey);
// Version key value
hSubKey = keyCreate(hClassKey, TEXT("Version"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)VERSION_STR, sizeof(VERSION_STR));
RegCloseKey(hSubKey);
// TypeLib key value
LPCTSTR psz_LIBID = TStrFromGUID(LIBID_AXVLC);
if( NULL != psz_LIBID )
{
hSubKey = keyCreate(hClassKey, TEXT("TypeLib"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)psz_LIBID, sizeof(TCHAR)*GUID_STRLEN);
RegCloseKey(hSubKey);
}
RegCloseKey(hClassKey);
}
RegCloseKey(hBaseKey);
hBaseKey = keyCreate(HKEY_CLASSES_ROOT, TEXT(PROGID_STR));
if( NULL != hBaseKey )
{
// default key value
RegSetValueEx(hBaseKey, NULL, 0, REG_SZ,
(const BYTE*)DESCRIPTION, sizeof(DESCRIPTION));
HKEY hSubKey = keyCreate(hBaseKey, TEXT("CLSID"));
if( NULL != hSubKey )
{
// default key value
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)psz_CLSID, sizeof(TCHAR)*GUID_STRLEN);
RegCloseKey(hSubKey);
}
hSubKey = keyCreate(hBaseKey, TEXT("CurVer"));
if( NULL != hSubKey )
{
// default key value
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)VERS_PROGID_STR, sizeof(VERS_PROGID_STR));
RegCloseKey(hSubKey);
}
RegCloseKey(hBaseKey);
}
hBaseKey = keyCreate(HKEY_CLASSES_ROOT, TEXT(VERS_PROGID_STR));
if( NULL != hBaseKey )
{
// default key value
RegSetValueEx(hBaseKey, NULL, 0, REG_SZ,
(const BYTE*)DESCRIPTION, sizeof(DESCRIPTION));
HKEY hSubKey = keyCreate(hBaseKey, TEXT("CLSID"));
if( NULL != hSubKey )
{
// default key value
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)psz_CLSID, sizeof(TCHAR)*GUID_STRLEN);
RegCloseKey(hSubKey);
}
RegCloseKey(hBaseKey);
}
// indicate which component categories we support
ICatRegister *pcr;
if( SUCCEEDED(CoCreateInstance(CLSID_StdComponentCategoriesMgr,
NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr)) ) {
CATID implCategories[] = {
CATID_Control,
CATID_PersistsToPropertyBag,
CATID_SafeForInitializing,
CATID_SafeForScripting,
};
pcr->RegisterClassImplCategories(CLSID_VLCPlugin,
sizeof(implCategories)/sizeof(CATID), implCategories);
pcr->Release();
}
// register type lib into the registry
ITypeLib *typeLib;
#ifndef OLE2ANSI
size_t typeLibPathLen = MultiByteToWideChar(CP_ACP, 0, DllPath, DllPathLen, NULL, 0);
if( typeLibPathLen > 0 )
{
LPOLESTR typeLibPath = (LPOLESTR)CoTaskMemAlloc(typeLibPathLen*sizeof(wchar_t));
MultiByteToWideChar(CP_ACP, 0, DllPath, DllPathLen, typeLibPath, typeLibPathLen);
if( SUCCEEDED(LoadTypeLibEx(typeLibPath, REGKIND_REGISTER, &typeLib)) )
typeLib->Release();
CoTaskMemFree((void *)typeLibPath);
}
#else
if( SUCCEEDED(LoadTypeLibEx((LPOLESTR)DllPath, REGKIND_REGISTER, &typeLib)) )
typeLib->Release();
#endif
CoTaskMemFree((void *)psz_CLSID);
return S_OK;
};
#ifdef BUILD_LOCALSERVER
/*
** easier to debug an application than a DLL on cygwin GDB :)
*/
#include <iostream>
STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{
MSG msg;
if( FAILED(OleInitialize(NULL)) )
{
cerr << "cannot initialize OLE" << endl;
return 1;
}
IUnknown *classProc = NULL;
if( FAILED(DllGetClassObject(CLSID_VLCPlugin, IID_IUnknown, (LPVOID *)&classProc)) )
return 0;
DWORD dwRegisterClassObject;
if( FAILED(CoRegisterClassObject(CLSID_VLCPlugin, classProc,
CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &dwRegisterClassObject)) )
return 0;
DWORD dwRegisterActiveObject;
if( FAILED(RegisterActiveObject(classProc, CLSID_VLCPlugin,
ACTIVEOBJECT_WEAK, &dwRegisterActiveObject)) )
return 0;
classProc->Release();
/*
* Polling messages from event queue
*/
while( S_FALSE == DllCanUnloadNow() )
{
while( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) )
{
if( msg.message == WM_QUIT )
break; // Leave the PeekMessage while() loop
/*if(TranslateAccelerator(ghwndApp, ghAccel, &msg))
continue;*/
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if(msg.message == WM_QUIT)
break; // Leave the for() loop
WaitMessage();
}
if( SUCCEEDED(RevokeActiveObject(dwRegisterActiveObject, NULL)) )
CoRevokeClassObject(dwRegisterClassObject);
// Reached on WM_QUIT message
CoUninitialize();
return ((int) msg.wParam);
};
#else
STDAPI_(BOOL) DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpReserved )
{
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
h_instance = (HINSTANCE)hModule;
break;
default:
break;
}
return TRUE;
};
#endif
/*****************************************************************************
* main.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include <comcat.h>
#include <windows.h>
#include <shlwapi.h>
using namespace std;
#define THREADING_MODEL "Both"
#define COMPANY_STR "VideoLAN"
#define PROGRAM_STR "VLCPlugin"
#define VERSION_MAJOR_STR "1"
#define VERSION_MINOR_STR "0"
#define DESCRIPTION "VideoLAN VLC ActiveX Plugin"
#define PROGID_STR COMPANY_STR"."PROGRAM_STR
#define VERS_PROGID_STR COMPANY_STR"."PROGRAM_STR"."VERSION_MAJOR_STR
#define VERSION_STR VERSION_MAJOR_STR"."VERSION_MINOR_STR
#define GUID_STRLEN 39
/*
** MingW headers do not declare those
*/
extern const CATID CATID_SafeForInitializing;
extern const CATID CATID_SafeForScripting;
static LONG i_class_ref= 0;
static HINSTANCE h_instance= 0;
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
*ppv = NULL;
if( CLSID_VLCPlugin == rclsid )
{
VLCPluginClass *plugin = new VLCPluginClass(&i_class_ref, h_instance);
hr = plugin->QueryInterface(riid, ppv);
plugin->Release();
}
return hr;
};
STDAPI DllCanUnloadNow(VOID)
{
return (0 == i_class_ref) ? S_OK: S_FALSE;
};
static LPCTSTR TStrFromGUID(REFGUID clsid) {
LPOLESTR oleStr;
if( FAILED(StringFromIID(clsid, &oleStr)) )
return NULL;
//check whether TCHAR and OLECHAR are both either ANSI or UNICODE
if( sizeof(TCHAR) == sizeof(OLECHAR) )
return (LPCTSTR)oleStr;
LPTSTR pct_CLSID = NULL;
#ifndef OLE2ANSI
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);
}
#else
size_t len = MutiByteToWideChar(CP_ACP, 0, oleStr, -1, NULL, 0);
if( len > 0 )
{
clsidStr = (wchar_t *)CoTaskMemAlloc(len*sizeof(wchar_t));
WideCharToMultiByte(CP_ACP, 0, oleStr, -1, pct_CLSID, len);
}
#endif
CoTaskMemFree(oleStr);
return pct_CLSID;
};
static HKEY keyCreate(HKEY parentKey, LPCTSTR keyName)
{
HKEY childKey;
if( ERROR_SUCCESS == RegCreateKeyEx(parentKey, keyName, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &childKey, NULL) )
{
return childKey;
}
return NULL;
};
STDAPI DllUnregisterServer(VOID)
{
// unregister type lib from the registry
UnRegisterTypeLib(LIBID_AXVLC, 1, 0, LOCALE_NEUTRAL, SYS_WIN32);
// remove component categories we supports
ICatRegister *pcr;
if( SUCCEEDED(CoCreateInstance(CLSID_StdComponentCategoriesMgr,
NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr)) ) {
CATID implCategories[] = {
CATID_Control,
CATID_PersistsToPropertyBag,
CATID_SafeForInitializing,
CATID_SafeForScripting,
};
pcr->UnRegisterClassImplCategories(CLSID_VLCPlugin,
sizeof(implCategories)/sizeof(CATID), implCategories);
pcr->Release();
}
SHDeleteKey(HKEY_CLASSES_ROOT, TEXT(VERS_PROGID_STR));
SHDeleteKey(HKEY_CLASSES_ROOT, TEXT(PROGID_STR));
LPCTSTR psz_CLSID = TStrFromGUID(CLSID_VLCPlugin);
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
HKEY hClsIDKey;
if( ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT("CLSID"), 0, KEY_WRITE, &hClsIDKey) )
{
SHDeleteKey(hClsIDKey, psz_CLSID);
RegCloseKey(hClsIDKey);
}
CoTaskMemFree((void *)psz_CLSID);
return S_OK;
};
STDAPI DllRegisterServer(VOID)
{
DllUnregisterServer();
char DllPath[MAX_PATH];
DWORD DllPathLen= GetModuleFileName(h_instance, DllPath, sizeof(DllPath)) ;
if( 0 == DllPathLen )
return E_FAIL;
LPCTSTR psz_CLSID = TStrFromGUID(CLSID_VLCPlugin);
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
HKEY hBaseKey;
if( ERROR_SUCCESS != RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT("CLSID"), 0, KEY_CREATE_SUB_KEY, &hBaseKey) )
return E_FAIL;
HKEY hClassKey = keyCreate(hBaseKey, psz_CLSID);
if( NULL != hClassKey )
{
HKEY hSubKey;
// default key value
RegSetValueEx(hClassKey, NULL, 0, REG_SZ,
(const BYTE*)DESCRIPTION, sizeof(DESCRIPTION));
// Control key value
hSubKey = keyCreate(hClassKey, TEXT("Control"));
RegCloseKey(hSubKey);
// InprocServer32 key value
hSubKey = keyCreate(hClassKey, TEXT("InprocServer32"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)DllPath, DllPathLen);
RegSetValueEx(hSubKey, TEXT("ThreadingModel"), 0, REG_SZ,
(const BYTE*)THREADING_MODEL, sizeof(THREADING_MODEL));
RegCloseKey(hSubKey);
// MiscStatus key value
hSubKey = keyCreate(hClassKey, TEXT("MiscStatus\\1"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ, (const BYTE*)"131473", sizeof("131473"));
RegCloseKey(hSubKey);
// Programmable key value
hSubKey = keyCreate(hClassKey, TEXT("Programmable"));
RegCloseKey(hSubKey);
// ProgID key value
hSubKey = keyCreate(hClassKey, TEXT("ProgID"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)VERS_PROGID_STR, sizeof(VERS_PROGID_STR));
RegCloseKey(hSubKey);
// VersionIndependentProgID key value
hSubKey = keyCreate(hClassKey, TEXT("VersionIndependentProgID"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)PROGID_STR, sizeof(PROGID_STR));
RegCloseKey(hSubKey);
// Version key value
hSubKey = keyCreate(hClassKey, TEXT("Version"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)VERSION_STR, sizeof(VERSION_STR));
RegCloseKey(hSubKey);
// TypeLib key value
LPCTSTR psz_LIBID = TStrFromGUID(LIBID_AXVLC);
if( NULL != psz_LIBID )
{
hSubKey = keyCreate(hClassKey, TEXT("TypeLib"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)psz_LIBID, sizeof(TCHAR)*GUID_STRLEN);
RegCloseKey(hSubKey);
}
RegCloseKey(hClassKey);
}
RegCloseKey(hBaseKey);
hBaseKey = keyCreate(HKEY_CLASSES_ROOT, TEXT(PROGID_STR));
if( NULL != hBaseKey )
{
// default key value
RegSetValueEx(hBaseKey, NULL, 0, REG_SZ,
(const BYTE*)DESCRIPTION, sizeof(DESCRIPTION));
HKEY hSubKey = keyCreate(hBaseKey, TEXT("CLSID"));
if( NULL != hSubKey )
{
// default key value
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)psz_CLSID, sizeof(TCHAR)*GUID_STRLEN);
RegCloseKey(hSubKey);
}
hSubKey = keyCreate(hBaseKey, TEXT("CurVer"));
if( NULL != hSubKey )
{
// default key value
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)VERS_PROGID_STR, sizeof(VERS_PROGID_STR));
RegCloseKey(hSubKey);
}
RegCloseKey(hBaseKey);
}
hBaseKey = keyCreate(HKEY_CLASSES_ROOT, TEXT(VERS_PROGID_STR));
if( NULL != hBaseKey )
{
// default key value
RegSetValueEx(hBaseKey, NULL, 0, REG_SZ,
(const BYTE*)DESCRIPTION, sizeof(DESCRIPTION));
HKEY hSubKey = keyCreate(hBaseKey, TEXT("CLSID"));
if( NULL != hSubKey )
{
// default key value
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)psz_CLSID, sizeof(TCHAR)*GUID_STRLEN);
RegCloseKey(hSubKey);
}
RegCloseKey(hBaseKey);
}
// indicate which component categories we support
ICatRegister *pcr;
if( SUCCEEDED(CoCreateInstance(CLSID_StdComponentCategoriesMgr,
NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr)) ) {
CATID implCategories[] = {
CATID_Control,
CATID_PersistsToPropertyBag,
CATID_SafeForInitializing,
CATID_SafeForScripting,
};
pcr->RegisterClassImplCategories(CLSID_VLCPlugin,
sizeof(implCategories)/sizeof(CATID), implCategories);
pcr->Release();
}
// register type lib into the registry
ITypeLib *typeLib;
#ifndef OLE2ANSI
size_t typeLibPathLen = MultiByteToWideChar(CP_ACP, 0, DllPath, DllPathLen, NULL, 0);
if( typeLibPathLen > 0 )
{
LPOLESTR typeLibPath = (LPOLESTR)CoTaskMemAlloc(typeLibPathLen*sizeof(wchar_t));
MultiByteToWideChar(CP_ACP, 0, DllPath, DllPathLen, typeLibPath, typeLibPathLen);
if( SUCCEEDED(LoadTypeLibEx(typeLibPath, REGKIND_REGISTER, &typeLib)) )
typeLib->Release();
CoTaskMemFree((void *)typeLibPath);
}
#else
if( SUCCEEDED(LoadTypeLibEx((LPOLESTR)DllPath, REGKIND_REGISTER, &typeLib)) )
typeLib->Release();
#endif
CoTaskMemFree((void *)psz_CLSID);
return S_OK;
};
#ifdef BUILD_LOCALSERVER
/*
** easier to debug an application than a DLL on cygwin GDB :)
*/
#include <iostream>
STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{
MSG msg;
if( FAILED(OleInitialize(NULL)) )
{
cerr << "cannot initialize OLE" << endl;
return 1;
}
IUnknown *classProc = NULL;
if( FAILED(DllGetClassObject(CLSID_VLCPlugin, IID_IUnknown, (LPVOID *)&classProc)) )
return 0;
DWORD dwRegisterClassObject;
if( FAILED(CoRegisterClassObject(CLSID_VLCPlugin, classProc,
CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &dwRegisterClassObject)) )
return 0;
DWORD dwRegisterActiveObject;
if( FAILED(RegisterActiveObject(classProc, CLSID_VLCPlugin,
ACTIVEOBJECT_WEAK, &dwRegisterActiveObject)) )
return 0;
classProc->Release();
/*
* Polling messages from event queue
*/
while( S_FALSE == DllCanUnloadNow() )
{
while( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) )
{
if( msg.message == WM_QUIT )
break; // Leave the PeekMessage while() loop
/*if(TranslateAccelerator(ghwndApp, ghAccel, &msg))
continue;*/
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if(msg.message == WM_QUIT)
break; // Leave the for() loop
WaitMessage();
}
if( SUCCEEDED(RevokeActiveObject(dwRegisterActiveObject, NULL)) )
CoRevokeClassObject(dwRegisterClassObject);
// Reached on WM_QUIT message
CoUninitialize();
return ((int) msg.wParam);
};
#else
STDAPI_(BOOL) DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpReserved )
{
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
h_instance = (HINSTANCE)hModule;
break;
default:
break;
}
return TRUE;
};
#endif

View File

@ -1,92 +1,92 @@
/*****************************************************************************
* objectsafety.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "objectsafety.h"
#include "axvlc_idl.h"
#if 0
const GUID IID_IObjectSafety =
{0xCB5BDC81,0x93C1,0x11cf,{0x8F,0x20,0x00,0x80,0x5F,0x2C,0xD0,0x64}};
#endif
STDMETHODIMP VLCObjectSafety::GetInterfaceSafetyOptions(
REFIID riid,
DWORD *pdwSupportedOptions,
DWORD *pdwEnabledOptions
)
{
if( (NULL == pdwSupportedOptions) || (NULL == pdwEnabledOptions) )
return E_POINTER;
*pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACESAFE_FOR_UNTRUSTED_CALLER;
if( (IID_IDispatch == riid)
|| (IID_IVLCControl == riid) )
{
*pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER;
return NOERROR;
}
else if( (IID_IPersist == riid)
|| (IID_IPersistStreamInit == riid)
|| (IID_IPersistStorage == riid)
|| (IID_IPersistPropertyBag == riid) )
{
*pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA;
return NOERROR;
}
*pdwEnabledOptions = 0;
return E_NOINTERFACE;
};
STDMETHODIMP VLCObjectSafety::SetInterfaceSafetyOptions(
REFIID riid,
DWORD dwOptionSetMask,
DWORD dwEnabledOptions
)
{
if( (IID_IDispatch == riid)
|| (IID_IVLCControl == riid) )
{
if( (INTERFACESAFE_FOR_UNTRUSTED_CALLER == dwOptionSetMask)
&& (INTERFACESAFE_FOR_UNTRUSTED_CALLER == dwEnabledOptions) )
{
return NOERROR;
}
return E_FAIL;
}
else if( (IID_IPersist == riid)
|| (IID_IPersistStreamInit == riid)
|| (IID_IPersistStorage == riid)
|| (IID_IPersistPropertyBag == riid) )
{
if( (INTERFACESAFE_FOR_UNTRUSTED_DATA == dwOptionSetMask)
&& (INTERFACESAFE_FOR_UNTRUSTED_DATA == dwEnabledOptions) )
{
return NOERROR;
}
return E_FAIL;
}
return E_FAIL;
};
/*****************************************************************************
* objectsafety.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "objectsafety.h"
#include "axvlc_idl.h"
#if 0
const GUID IID_IObjectSafety =
{0xCB5BDC81,0x93C1,0x11cf,{0x8F,0x20,0x00,0x80,0x5F,0x2C,0xD0,0x64}};
#endif
STDMETHODIMP VLCObjectSafety::GetInterfaceSafetyOptions(
REFIID riid,
DWORD *pdwSupportedOptions,
DWORD *pdwEnabledOptions
)
{
if( (NULL == pdwSupportedOptions) || (NULL == pdwEnabledOptions) )
return E_POINTER;
*pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACESAFE_FOR_UNTRUSTED_CALLER;
if( (IID_IDispatch == riid)
|| (IID_IVLCControl == riid) )
{
*pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER;
return NOERROR;
}
else if( (IID_IPersist == riid)
|| (IID_IPersistStreamInit == riid)
|| (IID_IPersistStorage == riid)
|| (IID_IPersistPropertyBag == riid) )
{
*pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA;
return NOERROR;
}
*pdwEnabledOptions = 0;
return E_NOINTERFACE;
};
STDMETHODIMP VLCObjectSafety::SetInterfaceSafetyOptions(
REFIID riid,
DWORD dwOptionSetMask,
DWORD dwEnabledOptions
)
{
if( (IID_IDispatch == riid)
|| (IID_IVLCControl == riid) )
{
if( (INTERFACESAFE_FOR_UNTRUSTED_CALLER == dwOptionSetMask)
&& (INTERFACESAFE_FOR_UNTRUSTED_CALLER == dwEnabledOptions) )
{
return NOERROR;
}
return E_FAIL;
}
else if( (IID_IPersist == riid)
|| (IID_IPersistStreamInit == riid)
|| (IID_IPersistStorage == riid)
|| (IID_IPersistPropertyBag == riid) )
{
if( (INTERFACESAFE_FOR_UNTRUSTED_DATA == dwOptionSetMask)
&& (INTERFACESAFE_FOR_UNTRUSTED_DATA == dwEnabledOptions) )
{
return NOERROR;
}
return E_FAIL;
}
return E_FAIL;
};

View File

@ -1,99 +1,99 @@
/*****************************************************************************
* objectsafety.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OBJECTSAFETY_H__
#define __OBJECTSAFETY_H__
#if HAVE_OBJSAFE_HEADER
/*
** at last, a version of mingw that supports this header
*/
#include <objsafe.h>
#else
// {CB5BDC81-93C1-11cf-8F20-00805F2CD064}
extern "C" const IID IID_IObjectSafety;
#define INTERFACESAFE_FOR_UNTRUSTED_CALLER 1L
#define INTERFACESAFE_FOR_UNTRUSTED_DATA 2L
struct IObjectSafety : public IUnknown
{
virtual STDMETHODIMP GetInterfaceSafetyOptions(
REFIID riid,
DWORD __RPC_FAR *pdwSupportedOptions,
DWORD __RPC_FAR *pdwEnabledOptions
) = 0;
virtual STDMETHODIMP SetInterfaceSafetyOptions(
REFIID riid,
DWORD dwSupportedOptions,
DWORD dwOptionSetMask
) = 0;
};
#endif
class VLCObjectSafety : public IObjectSafety
{
public:
VLCObjectSafety(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCObjectSafety() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IObjectSafety == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IUnknown methods
STDMETHODIMP GetInterfaceSafetyOptions(
REFIID riid,
DWORD *pdwSupportedOptions,
DWORD *pdwEnabledOptions
);
STDMETHODIMP SetInterfaceSafetyOptions(
REFIID riid,
DWORD dwOptionSetMask,
DWORD dwEnabledOptions
);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* objectsafety.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OBJECTSAFETY_H__
#define __OBJECTSAFETY_H__
#if HAVE_OBJSAFE_HEADER
/*
** at last, a version of mingw that supports this header
*/
#include <objsafe.h>
#else
// {CB5BDC81-93C1-11cf-8F20-00805F2CD064}
extern "C" const IID IID_IObjectSafety;
#define INTERFACESAFE_FOR_UNTRUSTED_CALLER 1L
#define INTERFACESAFE_FOR_UNTRUSTED_DATA 2L
struct IObjectSafety : public IUnknown
{
virtual STDMETHODIMP GetInterfaceSafetyOptions(
REFIID riid,
DWORD __RPC_FAR *pdwSupportedOptions,
DWORD __RPC_FAR *pdwEnabledOptions
) = 0;
virtual STDMETHODIMP SetInterfaceSafetyOptions(
REFIID riid,
DWORD dwSupportedOptions,
DWORD dwOptionSetMask
) = 0;
};
#endif
class VLCObjectSafety : public IObjectSafety
{
public:
VLCObjectSafety(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCObjectSafety() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IObjectSafety == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IUnknown methods
STDMETHODIMP GetInterfaceSafetyOptions(
REFIID riid,
DWORD *pdwSupportedOptions,
DWORD *pdwEnabledOptions
);
STDMETHODIMP SetInterfaceSafetyOptions(
REFIID riid,
DWORD dwOptionSetMask,
DWORD dwEnabledOptions
);
private:
VLCPlugin *_p_instance;
};
#endif

View File

@ -1,133 +1,133 @@
/*****************************************************************************
* olecontrol.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "olecontrol.h"
#include "utils.h"
using namespace std;
STDMETHODIMP VLCOleControl::GetControlInfo(CONTROLINFO *pCI)
{
if( NULL == pCI )
return E_POINTER;
pCI->cb = sizeof(CONTROLINFO);
pCI->hAccel = NULL;
pCI->cAccel = 0;
pCI->dwFlags = 0;
return S_OK;
};
STDMETHODIMP VLCOleControl::OnMnemonic(LPMSG pMsg)
{
return E_NOTIMPL;
};
static HRESULT getAmbientProperty(VLCPlugin& instance, DISPID dispID, VARIANT& v)
{
HRESULT hr;
IOleObject *oleObj;
hr = instance.QueryInterface(IID_IOleObject, (LPVOID *)&oleObj);
if( SUCCEEDED(hr) )
{
IOleClientSite *clientSite;
hr = oleObj->GetClientSite(&clientSite);
if( SUCCEEDED(hr) && (NULL != clientSite) )
{
hr = GetObjectProperty(clientSite, dispID, v);
clientSite->Release();
}
oleObj->Release();
}
return hr;
};
STDMETHODIMP VLCOleControl::OnAmbientPropertyChange(DISPID dispID)
{
switch( dispID )
{
case DISPID_AMBIENT_BACKCOLOR:
break;
case DISPID_AMBIENT_DISPLAYNAME:
break;
case DISPID_AMBIENT_FONT:
break;
case DISPID_AMBIENT_FORECOLOR:
break;
case DISPID_AMBIENT_LOCALEID:
break;
case DISPID_AMBIENT_MESSAGEREFLECT:
break;
case DISPID_AMBIENT_SCALEUNITS:
break;
case DISPID_AMBIENT_TEXTALIGN:
break;
case DISPID_AMBIENT_USERMODE:
break;
case DISPID_AMBIENT_UIDEAD:
break;
case DISPID_AMBIENT_SHOWGRABHANDLES:
break;
case DISPID_AMBIENT_SHOWHATCHING:
break;
case DISPID_AMBIENT_DISPLAYASDEFAULT:
break;
case DISPID_AMBIENT_SUPPORTSMNEMONICS:
break;
case DISPID_AMBIENT_AUTOCLIP:
break;
case DISPID_AMBIENT_APPEARANCE:
break;
case DISPID_AMBIENT_CODEPAGE:
VARIANT v;
VariantInit(&v);
V_VT(&v) = VT_I4;
if( SUCCEEDED(getAmbientProperty(*_p_instance, dispID, v)) )
{
_p_instance->setCodePage(V_I4(&v));
}
break;
case DISPID_AMBIENT_PALETTE:
break;
case DISPID_AMBIENT_CHARSET:
break;
case DISPID_AMBIENT_RIGHTTOLEFT:
break;
case DISPID_AMBIENT_TOPTOBOTTOM:
break;
default:
break;
}
return S_OK;
};
STDMETHODIMP VLCOleControl::FreezeEvents(BOOL bFreeze)
{
_p_instance->setSendEvents(! bFreeze);
return S_OK;
};
/*****************************************************************************
* olecontrol.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "olecontrol.h"
#include "utils.h"
using namespace std;
STDMETHODIMP VLCOleControl::GetControlInfo(CONTROLINFO *pCI)
{
if( NULL == pCI )
return E_POINTER;
pCI->cb = sizeof(CONTROLINFO);
pCI->hAccel = NULL;
pCI->cAccel = 0;
pCI->dwFlags = 0;
return S_OK;
};
STDMETHODIMP VLCOleControl::OnMnemonic(LPMSG pMsg)
{
return E_NOTIMPL;
};
static HRESULT getAmbientProperty(VLCPlugin& instance, DISPID dispID, VARIANT& v)
{
HRESULT hr;
IOleObject *oleObj;
hr = instance.QueryInterface(IID_IOleObject, (LPVOID *)&oleObj);
if( SUCCEEDED(hr) )
{
IOleClientSite *clientSite;
hr = oleObj->GetClientSite(&clientSite);
if( SUCCEEDED(hr) && (NULL != clientSite) )
{
hr = GetObjectProperty(clientSite, dispID, v);
clientSite->Release();
}
oleObj->Release();
}
return hr;
};
STDMETHODIMP VLCOleControl::OnAmbientPropertyChange(DISPID dispID)
{
switch( dispID )
{
case DISPID_AMBIENT_BACKCOLOR:
break;
case DISPID_AMBIENT_DISPLAYNAME:
break;
case DISPID_AMBIENT_FONT:
break;
case DISPID_AMBIENT_FORECOLOR:
break;
case DISPID_AMBIENT_LOCALEID:
break;
case DISPID_AMBIENT_MESSAGEREFLECT:
break;
case DISPID_AMBIENT_SCALEUNITS:
break;
case DISPID_AMBIENT_TEXTALIGN:
break;
case DISPID_AMBIENT_USERMODE:
break;
case DISPID_AMBIENT_UIDEAD:
break;
case DISPID_AMBIENT_SHOWGRABHANDLES:
break;
case DISPID_AMBIENT_SHOWHATCHING:
break;
case DISPID_AMBIENT_DISPLAYASDEFAULT:
break;
case DISPID_AMBIENT_SUPPORTSMNEMONICS:
break;
case DISPID_AMBIENT_AUTOCLIP:
break;
case DISPID_AMBIENT_APPEARANCE:
break;
case DISPID_AMBIENT_CODEPAGE:
VARIANT v;
VariantInit(&v);
V_VT(&v) = VT_I4;
if( SUCCEEDED(getAmbientProperty(*_p_instance, dispID, v)) )
{
_p_instance->setCodePage(V_I4(&v));
}
break;
case DISPID_AMBIENT_PALETTE:
break;
case DISPID_AMBIENT_CHARSET:
break;
case DISPID_AMBIENT_RIGHTTOLEFT:
break;
case DISPID_AMBIENT_TOPTOBOTTOM:
break;
default:
break;
}
return S_OK;
};
STDMETHODIMP VLCOleControl::FreezeEvents(BOOL bFreeze)
{
_p_instance->setSendEvents(! bFreeze);
return S_OK;
};

View File

@ -1,65 +1,65 @@
/*****************************************************************************
* olecontrol.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OLECONTROL_H__
#define __OLECONTROL_H__
#include <olectl.h>
class VLCOleControl : public IOleControl
{
public:
VLCOleControl(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCOleControl() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleControl == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IOleControl methods
STDMETHODIMP GetControlInfo(CONTROLINFO *pCI);
STDMETHODIMP OnMnemonic(LPMSG pMsg);
STDMETHODIMP OnAmbientPropertyChange(DISPID dispID);
STDMETHODIMP FreezeEvents(BOOL bFreeze);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* olecontrol.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OLECONTROL_H__
#define __OLECONTROL_H__
#include <olectl.h>
class VLCOleControl : public IOleControl
{
public:
VLCOleControl(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCOleControl() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleControl == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IOleControl methods
STDMETHODIMP GetControlInfo(CONTROLINFO *pCI);
STDMETHODIMP OnMnemonic(LPMSG pMsg);
STDMETHODIMP OnAmbientPropertyChange(DISPID dispID);
STDMETHODIMP FreezeEvents(BOOL bFreeze);
private:
VLCPlugin *_p_instance;
};
#endif

View File

@ -1,74 +1,74 @@
/*****************************************************************************
* oleinplaceactiveobject.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "oleinplaceactiveobject.h"
using namespace std;
STDMETHODIMP VLCOleInPlaceActiveObject::GetWindow(HWND *pHwnd)
{
if( NULL == pHwnd )
return E_INVALIDARG;
if( _p_instance->isInPlaceActive() )
{
if( NULL != (*pHwnd = _p_instance->getInPlaceWindow()) )
return S_OK;
return E_FAIL;
}
*pHwnd = NULL;
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceActiveObject::EnableModeless(BOOL fEnable)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::ContextSensitiveHelp(BOOL fEnterMode)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::TranslateAccelerator(LPMSG lpmsg)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::OnFrameWindowActivate(BOOL fActivate)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::OnDocWindowActivate(BOOL fActivate)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::ResizeBorder(LPCRECT prcBorder, LPOLEINPLACEUIWINDOW pUIWindow, BOOL fFrameWindow)
{
return E_NOTIMPL;
};
/*****************************************************************************
* oleinplaceactiveobject.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "oleinplaceactiveobject.h"
using namespace std;
STDMETHODIMP VLCOleInPlaceActiveObject::GetWindow(HWND *pHwnd)
{
if( NULL == pHwnd )
return E_INVALIDARG;
if( _p_instance->isInPlaceActive() )
{
if( NULL != (*pHwnd = _p_instance->getInPlaceWindow()) )
return S_OK;
return E_FAIL;
}
*pHwnd = NULL;
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceActiveObject::EnableModeless(BOOL fEnable)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::ContextSensitiveHelp(BOOL fEnterMode)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::TranslateAccelerator(LPMSG lpmsg)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::OnFrameWindowActivate(BOOL fActivate)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::OnDocWindowActivate(BOOL fActivate)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::ResizeBorder(LPCRECT prcBorder, LPOLEINPLACEUIWINDOW pUIWindow, BOOL fFrameWindow)
{
return E_NOTIMPL;
};

View File

@ -1,71 +1,71 @@
/*****************************************************************************
* oleinplaceactiveobject.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OLEINPLACEACTIVEOBJECT_H__
#define __OLEINPLACEACTIVEOBJECT_H__
#include "oleidl.h"
class VLCOleInPlaceActiveObject : public IOleInPlaceActiveObject
{
public:
VLCOleInPlaceActiveObject(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCOleInPlaceActiveObject() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleWindow == riid)
&& (IID_IOleInPlaceActiveObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IOleWindow methods
STDMETHODIMP GetWindow(HWND *);
STDMETHODIMP ContextSensitiveHelp(BOOL);
// IOleInPlaceActiveObject methods
STDMETHODIMP EnableModeless(BOOL);
STDMETHODIMP TranslateAccelerator(LPMSG);
STDMETHODIMP OnFrameWindowActivate(BOOL);
STDMETHODIMP OnDocWindowActivate(BOOL);
STDMETHODIMP ResizeBorder(LPCRECT, LPOLEINPLACEUIWINDOW, BOOL);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* oleinplaceactiveobject.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OLEINPLACEACTIVEOBJECT_H__
#define __OLEINPLACEACTIVEOBJECT_H__
#include "oleidl.h"
class VLCOleInPlaceActiveObject : public IOleInPlaceActiveObject
{
public:
VLCOleInPlaceActiveObject(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCOleInPlaceActiveObject() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleWindow == riid)
&& (IID_IOleInPlaceActiveObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IOleWindow methods
STDMETHODIMP GetWindow(HWND *);
STDMETHODIMP ContextSensitiveHelp(BOOL);
// IOleInPlaceActiveObject methods
STDMETHODIMP EnableModeless(BOOL);
STDMETHODIMP TranslateAccelerator(LPMSG);
STDMETHODIMP OnFrameWindowActivate(BOOL);
STDMETHODIMP OnDocWindowActivate(BOOL);
STDMETHODIMP ResizeBorder(LPCRECT, LPOLEINPLACEUIWINDOW, BOOL);
private:
VLCPlugin *_p_instance;
};
#endif

View File

@ -1,126 +1,126 @@
/*****************************************************************************
* oleinplaceobject.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "oleinplaceobject.h"
#include <docobj.h>
using namespace std;
STDMETHODIMP VLCOleInPlaceObject::GetWindow(HWND *pHwnd)
{
if( NULL == pHwnd )
return E_INVALIDARG;
if( _p_instance->isInPlaceActive() )
{
if( NULL != (*pHwnd = _p_instance->getInPlaceWindow()) )
return S_OK;
return E_FAIL;
}
*pHwnd = NULL;
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceObject::ContextSensitiveHelp(BOOL fEnterMode)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceObject::InPlaceDeactivate(void)
{
if( _p_instance->isInPlaceActive() )
{
UIDeactivate();
_p_instance->onInPlaceDeactivate();
LPOLEOBJECT p_oleObject;
if( SUCCEEDED(QueryInterface(IID_IOleObject, (void**)&p_oleObject)) )
{
LPOLECLIENTSITE p_clientSite;
if( SUCCEEDED(p_oleObject->GetClientSite(&p_clientSite)) )
{
LPOLEINPLACESITE p_inPlaceSite;
if( SUCCEEDED(p_clientSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
p_inPlaceSite->OnInPlaceDeactivate();
p_inPlaceSite->Release();
}
p_clientSite->Release();
}
p_oleObject->Release();
}
return S_OK;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceObject::UIDeactivate(void)
{
if( _p_instance->isInPlaceActive() )
{
if( _p_instance->hasFocus() )
{
_p_instance->setFocus(FALSE);
LPOLEOBJECT p_oleObject;
if( SUCCEEDED(QueryInterface(IID_IOleObject, (void**)&p_oleObject)) )
{
LPOLECLIENTSITE p_clientSite;
if( SUCCEEDED(p_oleObject->GetClientSite(&p_clientSite)) )
{
LPOLEINPLACESITE p_inPlaceSite;
if( SUCCEEDED(p_clientSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
p_inPlaceSite->OnUIDeactivate(FALSE);
p_inPlaceSite->Release();
}
p_clientSite->Release();
}
p_oleObject->Release();
}
return S_OK;
}
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceObject::SetObjectRects(LPCRECT lprcPosRect, LPCRECT lprcClipRect)
{
if( _p_instance->isInPlaceActive() )
{
_p_instance->onPositionChange(lprcPosRect, lprcClipRect);
return S_OK;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceObject::ReactivateAndUndo(void)
{
return INPLACE_E_NOTUNDOABLE;
};
/*****************************************************************************
* oleinplaceobject.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "oleinplaceobject.h"
#include <docobj.h>
using namespace std;
STDMETHODIMP VLCOleInPlaceObject::GetWindow(HWND *pHwnd)
{
if( NULL == pHwnd )
return E_INVALIDARG;
if( _p_instance->isInPlaceActive() )
{
if( NULL != (*pHwnd = _p_instance->getInPlaceWindow()) )
return S_OK;
return E_FAIL;
}
*pHwnd = NULL;
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceObject::ContextSensitiveHelp(BOOL fEnterMode)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceObject::InPlaceDeactivate(void)
{
if( _p_instance->isInPlaceActive() )
{
UIDeactivate();
_p_instance->onInPlaceDeactivate();
LPOLEOBJECT p_oleObject;
if( SUCCEEDED(QueryInterface(IID_IOleObject, (void**)&p_oleObject)) )
{
LPOLECLIENTSITE p_clientSite;
if( SUCCEEDED(p_oleObject->GetClientSite(&p_clientSite)) )
{
LPOLEINPLACESITE p_inPlaceSite;
if( SUCCEEDED(p_clientSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
p_inPlaceSite->OnInPlaceDeactivate();
p_inPlaceSite->Release();
}
p_clientSite->Release();
}
p_oleObject->Release();
}
return S_OK;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceObject::UIDeactivate(void)
{
if( _p_instance->isInPlaceActive() )
{
if( _p_instance->hasFocus() )
{
_p_instance->setFocus(FALSE);
LPOLEOBJECT p_oleObject;
if( SUCCEEDED(QueryInterface(IID_IOleObject, (void**)&p_oleObject)) )
{
LPOLECLIENTSITE p_clientSite;
if( SUCCEEDED(p_oleObject->GetClientSite(&p_clientSite)) )
{
LPOLEINPLACESITE p_inPlaceSite;
if( SUCCEEDED(p_clientSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
p_inPlaceSite->OnUIDeactivate(FALSE);
p_inPlaceSite->Release();
}
p_clientSite->Release();
}
p_oleObject->Release();
}
return S_OK;
}
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceObject::SetObjectRects(LPCRECT lprcPosRect, LPCRECT lprcClipRect)
{
if( _p_instance->isInPlaceActive() )
{
_p_instance->onPositionChange(lprcPosRect, lprcClipRect);
return S_OK;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceObject::ReactivateAndUndo(void)
{
return INPLACE_E_NOTUNDOABLE;
};

View File

@ -1,68 +1,68 @@
/*****************************************************************************
* oleinplaceobject.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OLEINPLACEOBJECT_H__
#define __OLEINPLACEOBJECT_H__
class VLCOleInPlaceObject : public IOleInPlaceObject
{
public:
VLCOleInPlaceObject(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCOleInPlaceObject() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleWindow == riid)
&& (IID_IOleInPlaceObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IOleWindow methods
STDMETHODIMP GetWindow(HWND *);
STDMETHODIMP ContextSensitiveHelp(BOOL);
// IOleInPlaceObject methods
STDMETHODIMP InPlaceDeactivate(void);
STDMETHODIMP UIDeactivate(void);
STDMETHODIMP SetObjectRects(LPCRECT, LPCRECT);
STDMETHODIMP ReactivateAndUndo(void);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* oleinplaceobject.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OLEINPLACEOBJECT_H__
#define __OLEINPLACEOBJECT_H__
class VLCOleInPlaceObject : public IOleInPlaceObject
{
public:
VLCOleInPlaceObject(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCOleInPlaceObject() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleWindow == riid)
&& (IID_IOleInPlaceObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IOleWindow methods
STDMETHODIMP GetWindow(HWND *);
STDMETHODIMP ContextSensitiveHelp(BOOL);
// IOleInPlaceObject methods
STDMETHODIMP InPlaceDeactivate(void);
STDMETHODIMP UIDeactivate(void);
STDMETHODIMP SetObjectRects(LPCRECT, LPCRECT);
STDMETHODIMP ReactivateAndUndo(void);
private:
VLCPlugin *_p_instance;
};
#endif

View File

@ -1,339 +1,339 @@
/*****************************************************************************
* oleobject.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "oleobject.h"
#include "utils.h"
#include <docobj.h>
using namespace std;
VLCOleObject::VLCOleObject(VLCPlugin *p_instance) :
_p_clientsite(NULL), _p_instance(p_instance)
{
CreateOleAdviseHolder(&_p_advise_holder);
};
VLCOleObject::~VLCOleObject()
{
_p_advise_holder->Release();
SetClientSite(NULL);
};
STDMETHODIMP VLCOleObject::Advise(IAdviseSink *pAdvSink, DWORD *dwConnection)
{
return _p_advise_holder->Advise(pAdvSink, dwConnection);
};
STDMETHODIMP VLCOleObject::Close(DWORD dwSaveOption)
{
_p_advise_holder->SendOnClose();
OleFlushClipboard();
return _p_instance->onClose(dwSaveOption);
};
STDMETHODIMP VLCOleObject::DoVerb(LONG iVerb, LPMSG lpMsg, LPOLECLIENTSITE pActiveSite,
LONG lIndex, HWND hwndParent, LPCRECT lprcPosRect)
{
if( 0 != lIndex )
return DV_E_LINDEX;
switch( iVerb )
{
case OLEIVERB_PRIMARY:
case OLEIVERB_SHOW:
case OLEIVERB_OPEN:
case OLEIVERB_INPLACEACTIVATE:
if( NULL == hwndParent )
return OLEOBJ_S_INVALIDHWND;
if( SUCCEEDED(doInPlaceActivate(lpMsg, pActiveSite, hwndParent, lprcPosRect)) )
return S_OK;
return OLEOBJ_S_CANNOT_DOVERB_NOW;
case OLEIVERB_HIDE:
_p_instance->setVisible(FALSE);
return S_OK;
case OLEIVERB_UIACTIVATE:
return doUIActivate(lpMsg, pActiveSite, hwndParent, lprcPosRect);
case OLEIVERB_DISCARDUNDOSTATE:
return S_OK;
default:
if( NULL == hwndParent )
return OLEOBJ_S_INVALIDHWND;
if( SUCCEEDED(doInPlaceActivate(lpMsg, pActiveSite, hwndParent, lprcPosRect)) )
return OLEOBJ_S_INVALIDVERB;
return OLEOBJ_S_CANNOT_DOVERB_NOW;
}
};
HRESULT VLCOleObject::doInPlaceActivate(LPMSG lpMsg, LPOLECLIENTSITE pActiveSite, HWND hwndParent, LPCRECT lprcPosRect)
{
RECT posRect;
RECT clipRect;
LPCRECT lprcClipRect = lprcPosRect;
if( NULL != pActiveSite )
{
// check if already activated
if( _p_instance->isInPlaceActive() )
{
// just attempt to show object then
pActiveSite->ShowObject();
_p_instance->setVisible(TRUE);
return S_OK;
}
LPOLEINPLACESITE p_inPlaceSite;
if( SUCCEEDED(pActiveSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
if( S_OK != p_inPlaceSite->CanInPlaceActivate() )
return E_FAIL;
LPOLEINPLACEFRAME p_inPlaceFrame;
LPOLEINPLACEUIWINDOW p_inPlaceUIWindow;
OLEINPLACEFRAMEINFO oleFrameInfo;
if( SUCCEEDED(p_inPlaceSite->GetWindowContext(&p_inPlaceFrame, &p_inPlaceUIWindow, &posRect, &clipRect, &oleFrameInfo)) )
{
lprcPosRect = &posRect;
lprcClipRect = &clipRect;
if( NULL != p_inPlaceFrame )
p_inPlaceFrame->Release();
if( NULL != p_inPlaceUIWindow )
p_inPlaceUIWindow->Release();
}
}
if( FAILED(_p_instance->onActivateInPlace(lpMsg, hwndParent, lprcPosRect, lprcClipRect)) )
return E_FAIL;
if( NULL != p_inPlaceSite )
p_inPlaceSite->OnPosRectChange(lprcPosRect);
pActiveSite->ShowObject();
_p_instance->setVisible(TRUE);
if( NULL != p_inPlaceSite )
{
p_inPlaceSite->OnInPlaceActivate();
p_inPlaceSite->Release();
}
if( NULL != lpMsg )
{
switch( lpMsg->message )
{
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
doUIActivate(lpMsg, pActiveSite, hwndParent, lprcPosRect);
break;
default:
break;
}
}
return S_OK;
}
return E_FAIL;
};
HRESULT VLCOleObject::doUIActivate(LPMSG lpMsg, LPOLECLIENTSITE pActiveSite, HWND hwndParent, LPCRECT lprcPosRect)
{
if( NULL != pActiveSite )
{
// check if already activated
if( ! _p_instance->isInPlaceActive() )
return OLE_E_NOT_INPLACEACTIVE;
LPOLEINPLACESITE p_inPlaceSite;
if( SUCCEEDED(pActiveSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
p_inPlaceSite->OnUIActivate();
if( NULL != lprcPosRect )
{
p_inPlaceSite->OnPosRectChange(lprcPosRect);
}
p_inPlaceSite->Release();
}
pActiveSite->ShowObject();
_p_instance->setVisible(TRUE);
_p_instance->setFocus(TRUE);
return S_OK;
}
return E_FAIL;
};
STDMETHODIMP VLCOleObject::EnumAdvise(IEnumSTATDATA **ppEnumAdvise)
{
return _p_advise_holder->EnumAdvise(ppEnumAdvise);
};
STDMETHODIMP VLCOleObject::EnumVerbs(IEnumOleVerb **ppEnumOleVerb)
{
return OLE_S_USEREG;
};
STDMETHODIMP VLCOleObject::GetClientSite(LPOLECLIENTSITE *ppClientSite)
{
if( NULL == ppClientSite )
return E_POINTER;
if( NULL != _p_clientsite )
_p_clientsite->AddRef();
*ppClientSite= _p_clientsite;
return S_OK;
};
STDMETHODIMP VLCOleObject::GetClipboardData(DWORD dwReserved, LPDATAOBJECT *ppDataObject)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::GetExtent(DWORD dwDrawAspect, SIZEL *pSizel)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::GetMiscStatus(DWORD dwAspect, DWORD *pdwStatus)
{
if( NULL != pdwStatus )
return E_POINTER;
switch( dwAspect )
{
case DVASPECT_CONTENT:
*pdwStatus = OLEMISC_RECOMPOSEONRESIZE
| OLEMISC_CANTLINKINSIDE
| OLEMISC_INSIDEOUT
| OLEMISC_ACTIVATEWHENVISIBLE
| OLEMISC_SETCLIENTSITEFIRST;
break;
default:
*pdwStatus = 0;
}
return S_OK;
};
STDMETHODIMP VLCOleObject::GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker, LPMONIKER *ppMoniker)
{
if( NULL != _p_clientsite )
return _p_clientsite->GetMoniker(dwAssign,dwWhichMoniker, ppMoniker);
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleObject::GetUserClassID(LPCLSID pClsid)
{
if( NULL == pClsid )
return E_POINTER;
pClsid = const_cast<LPCLSID>(&_p_instance->getClassID());
return S_OK;
};
STDMETHODIMP VLCOleObject::GetUserType(DWORD dwFormOfType, LPOLESTR *pszUserType)
{
return OLE_S_USEREG;
};
STDMETHODIMP VLCOleObject::InitFromData(LPDATAOBJECT pDataObject, BOOL fCreation, DWORD dwReserved)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::IsUpToDate(void)
{
return S_OK;
};
STDMETHODIMP VLCOleObject::SetClientSite(LPOLECLIENTSITE pClientSite)
{
if( NULL != _p_clientsite )
_p_clientsite->Release();
if( NULL != pClientSite )
{
pClientSite->AddRef();
/*
** retrieve container ambient properties
*/
VARIANT v;
VariantInit(&v);
V_VT(&v) = VT_I4;
if( SUCCEEDED(GetObjectProperty(pClientSite, DISPID_AMBIENT_CODEPAGE, v)) )
{
_p_instance->setCodePage(V_I4(&v));
VariantClear(&v);
}
}
_p_clientsite = pClientSite;
return S_OK;
};
STDMETHODIMP VLCOleObject::SetColorScheme(LOGPALETTE *pLogpal)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::SetExtent(DWORD dwDrawAspect, SIZEL *pSizel)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::SetHostNames(LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
{
return S_OK;
};
STDMETHODIMP VLCOleObject::SetMoniker(DWORD dwWhichMoniker, LPMONIKER pMoniker)
{
return _p_advise_holder->SendOnRename(pMoniker);
};
STDMETHODIMP VLCOleObject::Unadvise(DWORD dwConnection)
{
return _p_advise_holder->Unadvise(dwConnection);
};
STDMETHODIMP VLCOleObject::Update(void)
{
return S_OK;
};
/*****************************************************************************
* oleobject.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "oleobject.h"
#include "utils.h"
#include <docobj.h>
using namespace std;
VLCOleObject::VLCOleObject(VLCPlugin *p_instance) :
_p_clientsite(NULL), _p_instance(p_instance)
{
CreateOleAdviseHolder(&_p_advise_holder);
};
VLCOleObject::~VLCOleObject()
{
_p_advise_holder->Release();
SetClientSite(NULL);
};
STDMETHODIMP VLCOleObject::Advise(IAdviseSink *pAdvSink, DWORD *dwConnection)
{
return _p_advise_holder->Advise(pAdvSink, dwConnection);
};
STDMETHODIMP VLCOleObject::Close(DWORD dwSaveOption)
{
_p_advise_holder->SendOnClose();
OleFlushClipboard();
return _p_instance->onClose(dwSaveOption);
};
STDMETHODIMP VLCOleObject::DoVerb(LONG iVerb, LPMSG lpMsg, LPOLECLIENTSITE pActiveSite,
LONG lIndex, HWND hwndParent, LPCRECT lprcPosRect)
{
if( 0 != lIndex )
return DV_E_LINDEX;
switch( iVerb )
{
case OLEIVERB_PRIMARY:
case OLEIVERB_SHOW:
case OLEIVERB_OPEN:
case OLEIVERB_INPLACEACTIVATE:
if( NULL == hwndParent )
return OLEOBJ_S_INVALIDHWND;
if( SUCCEEDED(doInPlaceActivate(lpMsg, pActiveSite, hwndParent, lprcPosRect)) )
return S_OK;
return OLEOBJ_S_CANNOT_DOVERB_NOW;
case OLEIVERB_HIDE:
_p_instance->setVisible(FALSE);
return S_OK;
case OLEIVERB_UIACTIVATE:
return doUIActivate(lpMsg, pActiveSite, hwndParent, lprcPosRect);
case OLEIVERB_DISCARDUNDOSTATE:
return S_OK;
default:
if( NULL == hwndParent )
return OLEOBJ_S_INVALIDHWND;
if( SUCCEEDED(doInPlaceActivate(lpMsg, pActiveSite, hwndParent, lprcPosRect)) )
return OLEOBJ_S_INVALIDVERB;
return OLEOBJ_S_CANNOT_DOVERB_NOW;
}
};
HRESULT VLCOleObject::doInPlaceActivate(LPMSG lpMsg, LPOLECLIENTSITE pActiveSite, HWND hwndParent, LPCRECT lprcPosRect)
{
RECT posRect;
RECT clipRect;
LPCRECT lprcClipRect = lprcPosRect;
if( NULL != pActiveSite )
{
// check if already activated
if( _p_instance->isInPlaceActive() )
{
// just attempt to show object then
pActiveSite->ShowObject();
_p_instance->setVisible(TRUE);
return S_OK;
}
LPOLEINPLACESITE p_inPlaceSite;
if( SUCCEEDED(pActiveSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
if( S_OK != p_inPlaceSite->CanInPlaceActivate() )
return E_FAIL;
LPOLEINPLACEFRAME p_inPlaceFrame;
LPOLEINPLACEUIWINDOW p_inPlaceUIWindow;
OLEINPLACEFRAMEINFO oleFrameInfo;
if( SUCCEEDED(p_inPlaceSite->GetWindowContext(&p_inPlaceFrame, &p_inPlaceUIWindow, &posRect, &clipRect, &oleFrameInfo)) )
{
lprcPosRect = &posRect;
lprcClipRect = &clipRect;
if( NULL != p_inPlaceFrame )
p_inPlaceFrame->Release();
if( NULL != p_inPlaceUIWindow )
p_inPlaceUIWindow->Release();
}
}
if( FAILED(_p_instance->onActivateInPlace(lpMsg, hwndParent, lprcPosRect, lprcClipRect)) )
return E_FAIL;
if( NULL != p_inPlaceSite )
p_inPlaceSite->OnPosRectChange(lprcPosRect);
pActiveSite->ShowObject();
_p_instance->setVisible(TRUE);
if( NULL != p_inPlaceSite )
{
p_inPlaceSite->OnInPlaceActivate();
p_inPlaceSite->Release();
}
if( NULL != lpMsg )
{
switch( lpMsg->message )
{
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
doUIActivate(lpMsg, pActiveSite, hwndParent, lprcPosRect);
break;
default:
break;
}
}
return S_OK;
}
return E_FAIL;
};
HRESULT VLCOleObject::doUIActivate(LPMSG lpMsg, LPOLECLIENTSITE pActiveSite, HWND hwndParent, LPCRECT lprcPosRect)
{
if( NULL != pActiveSite )
{
// check if already activated
if( ! _p_instance->isInPlaceActive() )
return OLE_E_NOT_INPLACEACTIVE;
LPOLEINPLACESITE p_inPlaceSite;
if( SUCCEEDED(pActiveSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
p_inPlaceSite->OnUIActivate();
if( NULL != lprcPosRect )
{
p_inPlaceSite->OnPosRectChange(lprcPosRect);
}
p_inPlaceSite->Release();
}
pActiveSite->ShowObject();
_p_instance->setVisible(TRUE);
_p_instance->setFocus(TRUE);
return S_OK;
}
return E_FAIL;
};
STDMETHODIMP VLCOleObject::EnumAdvise(IEnumSTATDATA **ppEnumAdvise)
{
return _p_advise_holder->EnumAdvise(ppEnumAdvise);
};
STDMETHODIMP VLCOleObject::EnumVerbs(IEnumOleVerb **ppEnumOleVerb)
{
return OLE_S_USEREG;
};
STDMETHODIMP VLCOleObject::GetClientSite(LPOLECLIENTSITE *ppClientSite)
{
if( NULL == ppClientSite )
return E_POINTER;
if( NULL != _p_clientsite )
_p_clientsite->AddRef();
*ppClientSite= _p_clientsite;
return S_OK;
};
STDMETHODIMP VLCOleObject::GetClipboardData(DWORD dwReserved, LPDATAOBJECT *ppDataObject)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::GetExtent(DWORD dwDrawAspect, SIZEL *pSizel)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::GetMiscStatus(DWORD dwAspect, DWORD *pdwStatus)
{
if( NULL != pdwStatus )
return E_POINTER;
switch( dwAspect )
{
case DVASPECT_CONTENT:
*pdwStatus = OLEMISC_RECOMPOSEONRESIZE
| OLEMISC_CANTLINKINSIDE
| OLEMISC_INSIDEOUT
| OLEMISC_ACTIVATEWHENVISIBLE
| OLEMISC_SETCLIENTSITEFIRST;
break;
default:
*pdwStatus = 0;
}
return S_OK;
};
STDMETHODIMP VLCOleObject::GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker, LPMONIKER *ppMoniker)
{
if( NULL != _p_clientsite )
return _p_clientsite->GetMoniker(dwAssign,dwWhichMoniker, ppMoniker);
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleObject::GetUserClassID(LPCLSID pClsid)
{
if( NULL == pClsid )
return E_POINTER;
pClsid = const_cast<LPCLSID>(&_p_instance->getClassID());
return S_OK;
};
STDMETHODIMP VLCOleObject::GetUserType(DWORD dwFormOfType, LPOLESTR *pszUserType)
{
return OLE_S_USEREG;
};
STDMETHODIMP VLCOleObject::InitFromData(LPDATAOBJECT pDataObject, BOOL fCreation, DWORD dwReserved)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::IsUpToDate(void)
{
return S_OK;
};
STDMETHODIMP VLCOleObject::SetClientSite(LPOLECLIENTSITE pClientSite)
{
if( NULL != _p_clientsite )
_p_clientsite->Release();
if( NULL != pClientSite )
{
pClientSite->AddRef();
/*
** retrieve container ambient properties
*/
VARIANT v;
VariantInit(&v);
V_VT(&v) = VT_I4;
if( SUCCEEDED(GetObjectProperty(pClientSite, DISPID_AMBIENT_CODEPAGE, v)) )
{
_p_instance->setCodePage(V_I4(&v));
VariantClear(&v);
}
}
_p_clientsite = pClientSite;
return S_OK;
};
STDMETHODIMP VLCOleObject::SetColorScheme(LOGPALETTE *pLogpal)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::SetExtent(DWORD dwDrawAspect, SIZEL *pSizel)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::SetHostNames(LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
{
return S_OK;
};
STDMETHODIMP VLCOleObject::SetMoniker(DWORD dwWhichMoniker, LPMONIKER pMoniker)
{
return _p_advise_holder->SendOnRename(pMoniker);
};
STDMETHODIMP VLCOleObject::Unadvise(DWORD dwConnection)
{
return _p_advise_holder->Unadvise(dwConnection);
};
STDMETHODIMP VLCOleObject::Update(void)
{
return S_OK;
};

View File

@ -1,86 +1,86 @@
/*****************************************************************************
* oleobject.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OLEOBJECT_H__
#define __OLEOBJECT_H__
class VLCOleObject : public IOleObject
{
public:
VLCOleObject(VLCPlugin *p_instance);
virtual ~VLCOleObject();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IOleObject methods
STDMETHODIMP Advise(IAdviseSink *, LPDWORD);
STDMETHODIMP Close(DWORD);
STDMETHODIMP DoVerb(LONG, LPMSG, LPOLECLIENTSITE, LONG, HWND, LPCRECT);
STDMETHODIMP EnumAdvise(IEnumSTATDATA **);
STDMETHODIMP EnumVerbs(IEnumOleVerb **);
STDMETHODIMP GetClientSite(LPOLECLIENTSITE *);
STDMETHODIMP GetClipboardData(DWORD, LPDATAOBJECT *);
STDMETHODIMP GetExtent(DWORD, SIZEL *);
STDMETHODIMP GetMiscStatus(DWORD, DWORD *);
STDMETHODIMP GetMoniker(DWORD, DWORD, LPMONIKER *);
STDMETHODIMP GetUserClassID(CLSID *);
STDMETHODIMP GetUserType(DWORD, LPOLESTR *);
STDMETHODIMP InitFromData(IDataObject *, BOOL, DWORD);
STDMETHODIMP IsUpToDate(void);
STDMETHODIMP SetClientSite(LPOLECLIENTSITE);
STDMETHODIMP SetColorScheme(LOGPALETTE *);
STDMETHODIMP SetExtent(DWORD, SIZEL *);
STDMETHODIMP SetHostNames(LPCOLESTR, LPCOLESTR) ;
STDMETHODIMP SetMoniker(DWORD, LPMONIKER);
STDMETHODIMP Unadvise(DWORD);
STDMETHODIMP Update(void);
private:
HRESULT doInPlaceActivate(LPMSG lpMsg, LPOLECLIENTSITE pActiveSite, HWND hwndParent, LPCRECT lprcPosRect);
HRESULT doUIActivate(LPMSG lpMsg, LPOLECLIENTSITE pActiveSite, HWND hwndParent, LPCRECT lprcPosRect);
IOleAdviseHolder *_p_advise_holder;
IOleClientSite *_p_clientsite;
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* oleobject.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OLEOBJECT_H__
#define __OLEOBJECT_H__
class VLCOleObject : public IOleObject
{
public:
VLCOleObject(VLCPlugin *p_instance);
virtual ~VLCOleObject();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IOleObject methods
STDMETHODIMP Advise(IAdviseSink *, LPDWORD);
STDMETHODIMP Close(DWORD);
STDMETHODIMP DoVerb(LONG, LPMSG, LPOLECLIENTSITE, LONG, HWND, LPCRECT);
STDMETHODIMP EnumAdvise(IEnumSTATDATA **);
STDMETHODIMP EnumVerbs(IEnumOleVerb **);
STDMETHODIMP GetClientSite(LPOLECLIENTSITE *);
STDMETHODIMP GetClipboardData(DWORD, LPDATAOBJECT *);
STDMETHODIMP GetExtent(DWORD, SIZEL *);
STDMETHODIMP GetMiscStatus(DWORD, DWORD *);
STDMETHODIMP GetMoniker(DWORD, DWORD, LPMONIKER *);
STDMETHODIMP GetUserClassID(CLSID *);
STDMETHODIMP GetUserType(DWORD, LPOLESTR *);
STDMETHODIMP InitFromData(IDataObject *, BOOL, DWORD);
STDMETHODIMP IsUpToDate(void);
STDMETHODIMP SetClientSite(LPOLECLIENTSITE);
STDMETHODIMP SetColorScheme(LOGPALETTE *);
STDMETHODIMP SetExtent(DWORD, SIZEL *);
STDMETHODIMP SetHostNames(LPCOLESTR, LPCOLESTR) ;
STDMETHODIMP SetMoniker(DWORD, LPMONIKER);
STDMETHODIMP Unadvise(DWORD);
STDMETHODIMP Update(void);
private:
HRESULT doInPlaceActivate(LPMSG lpMsg, LPOLECLIENTSITE pActiveSite, HWND hwndParent, LPCRECT lprcPosRect);
HRESULT doUIActivate(LPMSG lpMsg, LPOLECLIENTSITE pActiveSite, HWND hwndParent, LPCRECT lprcPosRect);
IOleAdviseHolder *_p_advise_holder;
IOleClientSite *_p_clientsite;
VLCPlugin *_p_instance;
};
#endif

View File

@ -1,125 +1,125 @@
/*****************************************************************************
* persistpropbag.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "persistpropbag.h"
#include "utils.h"
using namespace std;
STDMETHODIMP VLCPersistPropertyBag::GetClassID(LPCLSID pClsID)
{
if( NULL == pClsID )
return E_POINTER;
*pClsID = _p_instance->getClassID();
return S_OK;
};
STDMETHODIMP VLCPersistPropertyBag::InitNew(void)
{
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog)
{
if( NULL == pPropBag )
return E_POINTER;
HRESULT hr = _p_instance->onInitNew();
if( FAILED(hr) )
return hr;
VARIANT value;
V_VT(&value) = VT_BSTR;
if( S_OK == pPropBag->Read(OLESTR("filename"), &value, pErrorLog) )
{
char *src = CStrFromBSTR(_p_instance->getCodePage(), V_BSTR(&value));
if( NULL != src )
{
_p_instance->setSourceURL(src);
free(src);
}
VariantClear(&value);
}
V_VT(&value) = VT_BSTR;
if( S_OK == pPropBag->Read(OLESTR("src"), &value, pErrorLog) )
{
char *src = CStrFromBSTR(_p_instance->getCodePage(), V_BSTR(&value));
if( NULL != src )
{
_p_instance->setSourceURL(src);
free(src);
}
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("autoplay"), &value, pErrorLog) )
{
_p_instance->setAutoStart(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("autostart"), &value, pErrorLog) )
{
_p_instance->setAutoStart(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("loop"), &value, pErrorLog) )
{
_p_instance->setLoopMode(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("mute"), &value, pErrorLog) )
{
_p_instance->setMute(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("showdisplay"), &value, pErrorLog) )
{
_p_instance->setVisible(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
return S_OK;
};
STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDiry, BOOL fSaveAllProperties)
{
if( NULL == pPropBag )
return E_POINTER;
return S_OK;
};
/*****************************************************************************
* persistpropbag.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "persistpropbag.h"
#include "utils.h"
using namespace std;
STDMETHODIMP VLCPersistPropertyBag::GetClassID(LPCLSID pClsID)
{
if( NULL == pClsID )
return E_POINTER;
*pClsID = _p_instance->getClassID();
return S_OK;
};
STDMETHODIMP VLCPersistPropertyBag::InitNew(void)
{
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog)
{
if( NULL == pPropBag )
return E_POINTER;
HRESULT hr = _p_instance->onInitNew();
if( FAILED(hr) )
return hr;
VARIANT value;
V_VT(&value) = VT_BSTR;
if( S_OK == pPropBag->Read(OLESTR("filename"), &value, pErrorLog) )
{
char *src = CStrFromBSTR(_p_instance->getCodePage(), V_BSTR(&value));
if( NULL != src )
{
_p_instance->setSourceURL(src);
free(src);
}
VariantClear(&value);
}
V_VT(&value) = VT_BSTR;
if( S_OK == pPropBag->Read(OLESTR("src"), &value, pErrorLog) )
{
char *src = CStrFromBSTR(_p_instance->getCodePage(), V_BSTR(&value));
if( NULL != src )
{
_p_instance->setSourceURL(src);
free(src);
}
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("autoplay"), &value, pErrorLog) )
{
_p_instance->setAutoStart(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("autostart"), &value, pErrorLog) )
{
_p_instance->setAutoStart(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("loop"), &value, pErrorLog) )
{
_p_instance->setLoopMode(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("mute"), &value, pErrorLog) )
{
_p_instance->setMute(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("showdisplay"), &value, pErrorLog) )
{
_p_instance->setVisible(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
return S_OK;
};
STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDiry, BOOL fSaveAllProperties)
{
if( NULL == pPropBag )
return E_POINTER;
return S_OK;
};

View File

@ -1,67 +1,67 @@
/*****************************************************************************
* persistpropbag.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PERSISTPROPBAG_H__
#define __PERSISTPROPBAG_H__
#include <ocidl.h>
class VLCPersistPropertyBag : public IPersistPropertyBag
{
public:
VLCPersistPropertyBag(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCPersistPropertyBag() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IPersist == riid)
&& (IID_IPersistPropertyBag == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IPersist methods
STDMETHODIMP GetClassID(LPCLSID);
// IPersistPropertyBag methods
STDMETHODIMP InitNew(void);
STDMETHODIMP Load(LPPROPERTYBAG, LPERRORLOG);
STDMETHODIMP Save(LPPROPERTYBAG, BOOL, BOOL);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* persistpropbag.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PERSISTPROPBAG_H__
#define __PERSISTPROPBAG_H__
#include <ocidl.h>
class VLCPersistPropertyBag : public IPersistPropertyBag
{
public:
VLCPersistPropertyBag(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCPersistPropertyBag() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IPersist == riid)
&& (IID_IPersistPropertyBag == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IPersist methods
STDMETHODIMP GetClassID(LPCLSID);
// IPersistPropertyBag methods
STDMETHODIMP InitNew(void);
STDMETHODIMP Load(LPPROPERTYBAG, LPERRORLOG);
STDMETHODIMP Save(LPPROPERTYBAG, BOOL, BOOL);
private:
VLCPlugin *_p_instance;
};
#endif

View File

@ -1,79 +1,79 @@
/*****************************************************************************
* persiststorage.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "persiststorage.h"
using namespace std;
STDMETHODIMP VLCPersistStorage::GetClassID(LPCLSID pClsID)
{
if( NULL == pClsID )
return E_POINTER;
*pClsID = _p_instance->getClassID();
return S_OK;
};
STDMETHODIMP VLCPersistStorage::IsDirty(void)
{
return S_FALSE;
};
STDMETHODIMP VLCPersistStorage::InitNew(IStorage *pStg)
{
if( NULL == pStg )
return E_POINTER;
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistStorage::Load(IStorage *pStg)
{
if( NULL == pStg )
return E_POINTER;
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistStorage::Save(IStorage *pStg, BOOL fSameAsLoad)
{
if( NULL == pStg )
return E_POINTER;
return S_OK;
};
STDMETHODIMP VLCPersistStorage::SaveCompleted(IStorage *pStg)
{
if( NULL == pStg )
return E_POINTER;
return S_OK;
};
STDMETHODIMP VLCPersistStorage::HandsOffStorage(void)
{
return S_OK;
};
/*****************************************************************************
* persiststorage.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "persiststorage.h"
using namespace std;
STDMETHODIMP VLCPersistStorage::GetClassID(LPCLSID pClsID)
{
if( NULL == pClsID )
return E_POINTER;
*pClsID = _p_instance->getClassID();
return S_OK;
};
STDMETHODIMP VLCPersistStorage::IsDirty(void)
{
return S_FALSE;
};
STDMETHODIMP VLCPersistStorage::InitNew(IStorage *pStg)
{
if( NULL == pStg )
return E_POINTER;
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistStorage::Load(IStorage *pStg)
{
if( NULL == pStg )
return E_POINTER;
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistStorage::Save(IStorage *pStg, BOOL fSameAsLoad)
{
if( NULL == pStg )
return E_POINTER;
return S_OK;
};
STDMETHODIMP VLCPersistStorage::SaveCompleted(IStorage *pStg)
{
if( NULL == pStg )
return E_POINTER;
return S_OK;
};
STDMETHODIMP VLCPersistStorage::HandsOffStorage(void)
{
return S_OK;
};

View File

@ -1,70 +1,70 @@
/*****************************************************************************
* persiststorage.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PERSISTSTORAGE_H__
#define __PERSISTSTORAGE_H__
#include <ocidl.h>
class VLCPersistStorage : public IPersistStorage
{
public:
VLCPersistStorage(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCPersistStorage() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IPersist == riid)
&& (IID_IPersistStorage == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IPersist methods
STDMETHODIMP GetClassID(LPCLSID);
// IPersistStorage methods
STDMETHODIMP IsDirty(void);
STDMETHODIMP InitNew(IStorage *);
STDMETHODIMP Load(IStorage *);
STDMETHODIMP Save(IStorage *, BOOL);
STDMETHODIMP SaveCompleted(IStorage *);
STDMETHODIMP HandsOffStorage(void);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* persiststorage.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PERSISTSTORAGE_H__
#define __PERSISTSTORAGE_H__
#include <ocidl.h>
class VLCPersistStorage : public IPersistStorage
{
public:
VLCPersistStorage(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCPersistStorage() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IPersist == riid)
&& (IID_IPersistStorage == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IPersist methods
STDMETHODIMP GetClassID(LPCLSID);
// IPersistStorage methods
STDMETHODIMP IsDirty(void);
STDMETHODIMP InitNew(IStorage *);
STDMETHODIMP Load(IStorage *);
STDMETHODIMP Save(IStorage *, BOOL);
STDMETHODIMP SaveCompleted(IStorage *);
STDMETHODIMP HandsOffStorage(void);
private:
VLCPlugin *_p_instance;
};
#endif

View File

@ -1,70 +1,70 @@
/*****************************************************************************
* persiststreaminit.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "persiststreaminit.h"
using namespace std;
STDMETHODIMP VLCPersistStreamInit::GetClassID(LPCLSID pClsID)
{
if( NULL == pClsID )
return E_POINTER;
*pClsID = _p_instance->getClassID();
return S_OK;
};
STDMETHODIMP VLCPersistStreamInit::InitNew(void)
{
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistStreamInit::Load(LPSTREAM pStm)
{
if( NULL == pStm )
return E_POINTER;
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistStreamInit::Save(LPSTREAM pStm, BOOL fClearDirty)
{
if( NULL == pStm )
return E_POINTER;
return S_OK;
};
STDMETHODIMP VLCPersistStreamInit::IsDirty(void)
{
return S_FALSE;
};
STDMETHODIMP VLCPersistStreamInit::GetSizeMax(ULARGE_INTEGER *pcbSize)
{
pcbSize->QuadPart = 0ULL;
return S_OK;
};
/*****************************************************************************
* persiststreaminit.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "persiststreaminit.h"
using namespace std;
STDMETHODIMP VLCPersistStreamInit::GetClassID(LPCLSID pClsID)
{
if( NULL == pClsID )
return E_POINTER;
*pClsID = _p_instance->getClassID();
return S_OK;
};
STDMETHODIMP VLCPersistStreamInit::InitNew(void)
{
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistStreamInit::Load(LPSTREAM pStm)
{
if( NULL == pStm )
return E_POINTER;
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistStreamInit::Save(LPSTREAM pStm, BOOL fClearDirty)
{
if( NULL == pStm )
return E_POINTER;
return S_OK;
};
STDMETHODIMP VLCPersistStreamInit::IsDirty(void)
{
return S_FALSE;
};
STDMETHODIMP VLCPersistStreamInit::GetSizeMax(ULARGE_INTEGER *pcbSize)
{
pcbSize->QuadPart = 0ULL;
return S_OK;
};

View File

@ -1,69 +1,69 @@
/*****************************************************************************
* persiststreaminit.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PERSISTSTREAMINIT_H__
#define __PERSISTSTREAMINIT_H__
#include <ocidl.h>
class VLCPersistStreamInit : public IPersistStreamInit
{
public:
VLCPersistStreamInit(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCPersistStreamInit() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IPersist == riid)
&& (IID_IPersistStreamInit == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IPersist methods
STDMETHODIMP GetClassID(LPCLSID);
// IPersistStreamInit methods
STDMETHODIMP IsDirty(void);
STDMETHODIMP InitNew(void);
STDMETHODIMP Load(LPSTREAM);
STDMETHODIMP Save(LPSTREAM, BOOL);
STDMETHODIMP GetSizeMax(ULARGE_INTEGER *);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* persiststreaminit.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PERSISTSTREAMINIT_H__
#define __PERSISTSTREAMINIT_H__
#include <ocidl.h>
class VLCPersistStreamInit : public IPersistStreamInit
{
public:
VLCPersistStreamInit(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCPersistStreamInit() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IPersist == riid)
&& (IID_IPersistStreamInit == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IPersist methods
STDMETHODIMP GetClassID(LPCLSID);
// IPersistStreamInit methods
STDMETHODIMP IsDirty(void);
STDMETHODIMP InitNew(void);
STDMETHODIMP Load(LPSTREAM);
STDMETHODIMP Save(LPSTREAM, BOOL);
STDMETHODIMP GetSizeMax(ULARGE_INTEGER *);
private:
VLCPlugin *_p_instance;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,167 +1,167 @@
/*****************************************************************************
* plugin.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PLUGIN_H__
#define __PLUGIN_H__
#include <ole2.h>
#include <olectl.h>
#include <vlc/vlc.h>
extern const GUID CLSID_VLCPlugin;
extern const GUID LIBID_AXVLC;
extern const GUID DIID_DVLCEvents;
class VLCPluginClass : public IClassFactory
{
public:
VLCPluginClass(LONG *p_class_ref,HINSTANCE hInstance);
/* IUnknown methods */
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
/* IClassFactory methods */
STDMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
STDMETHODIMP LockServer(BOOL fLock);
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; };
HBITMAP getInPlacePict(void) const { return _inplace_hbitmap; };
protected:
virtual ~VLCPluginClass();
private:
LPLONG _p_class_ref;
HINSTANCE _hinstance;
ATOM _inplace_wndclass_atom;
ATOM _video_wndclass_atom;
HBITMAP _inplace_hbitmap;
};
class VLCPlugin : public IUnknown
{
public:
VLCPlugin(VLCPluginClass *p_class);
/* IUnknown methods */
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
/* custom methods */
HRESULT getTypeLib(LCID lcid, ITypeLib **pTL)
{ return LoadRegTypeLib(LIBID_AXVLC, 1, 0, lcid, pTL); };
REFCLSID getClassID(void) { return (REFCLSID)CLSID_VLCPlugin; };
REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; };
HRESULT onInitNew(void);
HRESULT onClose(DWORD dwSaveOption);
BOOL isInPlaceActive(void);
HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);
HRESULT onInPlaceDeactivate(void);
HWND getInPlaceWindow(void) const { return _inplacewnd; };
BOOL hasFocus(void);
void setFocus(BOOL fFocus);
UINT getCodePage(void) { return _codepage; };
void setCodePage(UINT cp) { _codepage = cp; };
int getVLCObject(void) { return _i_vlc; };
// control properties
void setSourceURL(const char *url) { _psz_src = strdup(url); };
void setAutoStart(BOOL autostart) { _b_autostart = autostart; };
void setLoopMode(BOOL loopmode) { _b_loopmode = loopmode; };
void setMute(BOOL mute) {
if( mute && _i_vlc )
{
VLC_VolumeMute(_i_vlc);
}
};
void setSendEvents(BOOL sendevents) { _b_sendevents = sendevents; };
void setVisible(BOOL fVisible);
BOOL getVisible(void) { return _b_visible; };
// container events
void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect);
void onPaint(PAINTSTRUCT &ps, RECT &pr);
// control events
void firePropChangedEvent(DISPID dispid);
void fireOnPlayEvent(void);
void fireOnPauseEvent(void);
void fireOnStopEvent(void);
protected:
virtual ~VLCPlugin();
private:
void calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect);
//implemented interfaces
class VLCOleObject *vlcOleObject;
class VLCOleControl *vlcOleControl;
class VLCOleInPlaceObject *vlcOleInPlaceObject;
class VLCOleInPlaceActiveObject *vlcOleInPlaceActiveObject;
class VLCPersistStreamInit *vlcPersistStreamInit;
class VLCPersistStorage *vlcPersistStorage;
class VLCPersistPropertyBag *vlcPersistPropertyBag;
class VLCProvideClassInfo *vlcProvideClassInfo;
class VLCConnectionPointContainer *vlcConnectionPointContainer;
class VLCObjectSafety *vlcObjectSafety;
class VLCControl *vlcControl;
// in place activated window (Clipping window)
HWND _inplacewnd;
// video window (Drawing window)
HWND _videownd;
RECT _bounds;
VLCPluginClass *_p_class;
ULONG _i_ref;
UINT _codepage;
char *_psz_src;
BOOL _b_autostart;
BOOL _b_loopmode;
BOOL _b_visible;
BOOL _b_sendevents;
int _i_vlc;
};
#endif
/*****************************************************************************
* plugin.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PLUGIN_H__
#define __PLUGIN_H__
#include <ole2.h>
#include <olectl.h>
#include <vlc/vlc.h>
extern const GUID CLSID_VLCPlugin;
extern const GUID LIBID_AXVLC;
extern const GUID DIID_DVLCEvents;
class VLCPluginClass : public IClassFactory
{
public:
VLCPluginClass(LONG *p_class_ref,HINSTANCE hInstance);
/* IUnknown methods */
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
/* IClassFactory methods */
STDMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
STDMETHODIMP LockServer(BOOL fLock);
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; };
HBITMAP getInPlacePict(void) const { return _inplace_hbitmap; };
protected:
virtual ~VLCPluginClass();
private:
LPLONG _p_class_ref;
HINSTANCE _hinstance;
ATOM _inplace_wndclass_atom;
ATOM _video_wndclass_atom;
HBITMAP _inplace_hbitmap;
};
class VLCPlugin : public IUnknown
{
public:
VLCPlugin(VLCPluginClass *p_class);
/* IUnknown methods */
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
/* custom methods */
HRESULT getTypeLib(LCID lcid, ITypeLib **pTL)
{ return LoadRegTypeLib(LIBID_AXVLC, 1, 0, lcid, pTL); };
REFCLSID getClassID(void) { return (REFCLSID)CLSID_VLCPlugin; };
REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; };
HRESULT onInitNew(void);
HRESULT onClose(DWORD dwSaveOption);
BOOL isInPlaceActive(void);
HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);
HRESULT onInPlaceDeactivate(void);
HWND getInPlaceWindow(void) const { return _inplacewnd; };
BOOL hasFocus(void);
void setFocus(BOOL fFocus);
UINT getCodePage(void) { return _codepage; };
void setCodePage(UINT cp) { _codepage = cp; };
int getVLCObject(void) { return _i_vlc; };
// control properties
void setSourceURL(const char *url) { _psz_src = strdup(url); };
void setAutoStart(BOOL autostart) { _b_autostart = autostart; };
void setLoopMode(BOOL loopmode) { _b_loopmode = loopmode; };
void setMute(BOOL mute) {
if( mute && _i_vlc )
{
VLC_VolumeMute(_i_vlc);
}
};
void setSendEvents(BOOL sendevents) { _b_sendevents = sendevents; };
void setVisible(BOOL fVisible);
BOOL getVisible(void) { return _b_visible; };
// container events
void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect);
void onPaint(PAINTSTRUCT &ps, RECT &pr);
// control events
void firePropChangedEvent(DISPID dispid);
void fireOnPlayEvent(void);
void fireOnPauseEvent(void);
void fireOnStopEvent(void);
protected:
virtual ~VLCPlugin();
private:
void calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect);
//implemented interfaces
class VLCOleObject *vlcOleObject;
class VLCOleControl *vlcOleControl;
class VLCOleInPlaceObject *vlcOleInPlaceObject;
class VLCOleInPlaceActiveObject *vlcOleInPlaceActiveObject;
class VLCPersistStreamInit *vlcPersistStreamInit;
class VLCPersistStorage *vlcPersistStorage;
class VLCPersistPropertyBag *vlcPersistPropertyBag;
class VLCProvideClassInfo *vlcProvideClassInfo;
class VLCConnectionPointContainer *vlcConnectionPointContainer;
class VLCObjectSafety *vlcObjectSafety;
class VLCControl *vlcControl;
// in place activated window (Clipping window)
HWND _inplacewnd;
// video window (Drawing window)
HWND _videownd;
RECT _bounds;
VLCPluginClass *_p_class;
ULONG _i_ref;
UINT _codepage;
char *_psz_src;
BOOL _b_autostart;
BOOL _b_loopmode;
BOOL _b_visible;
BOOL _b_sendevents;
int _i_vlc;
};
#endif

View File

@ -1,60 +1,60 @@
/*****************************************************************************
* provideclassinfo.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "provideclassinfo.h"
using namespace std;
STDMETHODIMP VLCProvideClassInfo::GetClassInfo(ITypeInfo **ppTI)
{
ITypeLib *p_typelib;
if( NULL == ppTI )
return E_POINTER;
HRESULT hr = _p_instance->getTypeLib(LOCALE_NEUTRAL, &p_typelib);
if( SUCCEEDED(hr) )
{
hr = p_typelib->GetTypeInfoOfGuid(_p_instance->getClassID(), ppTI);
if( FAILED(hr) )
{
*ppTI = NULL;
}
p_typelib->Release();
}
return hr;
};
STDMETHODIMP VLCProvideClassInfo::GetGUID(DWORD dwGuidKind, GUID *pGUID)
{
if( GUIDKIND_DEFAULT_SOURCE_DISP_IID != dwGuidKind )
return E_INVALIDARG;
if( NULL == pGUID )
return E_POINTER;
*pGUID = _p_instance->getDispEventID();
return S_OK;
};
/*****************************************************************************
* provideclassinfo.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "provideclassinfo.h"
using namespace std;
STDMETHODIMP VLCProvideClassInfo::GetClassInfo(ITypeInfo **ppTI)
{
ITypeLib *p_typelib;
if( NULL == ppTI )
return E_POINTER;
HRESULT hr = _p_instance->getTypeLib(LOCALE_NEUTRAL, &p_typelib);
if( SUCCEEDED(hr) )
{
hr = p_typelib->GetTypeInfoOfGuid(_p_instance->getClassID(), ppTI);
if( FAILED(hr) )
{
*ppTI = NULL;
}
p_typelib->Release();
}
return hr;
};
STDMETHODIMP VLCProvideClassInfo::GetGUID(DWORD dwGuidKind, GUID *pGUID)
{
if( GUIDKIND_DEFAULT_SOURCE_DISP_IID != dwGuidKind )
return E_INVALIDARG;
if( NULL == pGUID )
return E_POINTER;
*pGUID = _p_instance->getDispEventID();
return S_OK;
};

View File

@ -1,65 +1,65 @@
/*****************************************************************************
* provideclassinfo.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PROVIDECLASSINFO_H__
#define __PROVIDECLASSINFO_H__
#include <ocidl.h>
class VLCProvideClassInfo : public IProvideClassInfo2
{
public:
VLCProvideClassInfo(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCProvideClassInfo() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IProvideClassInfo == riid)
&& (IID_IProvideClassInfo2 == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IProvideClassInfo methods
STDMETHODIMP GetClassInfo(ITypeInfo **);
// IProvideClassInfo2 methods
STDMETHODIMP GetGUID(DWORD, GUID *);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* provideclassinfo.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PROVIDECLASSINFO_H__
#define __PROVIDECLASSINFO_H__
#include <ocidl.h>
class VLCProvideClassInfo : public IProvideClassInfo2
{
public:
VLCProvideClassInfo(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCProvideClassInfo() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IProvideClassInfo == riid)
&& (IID_IProvideClassInfo2 == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IProvideClassInfo methods
STDMETHODIMP GetClassInfo(ITypeInfo **);
// IProvideClassInfo2 methods
STDMETHODIMP GetGUID(DWORD, GUID *);
private:
VLCPlugin *_p_instance;
};
#endif

View File

@ -1,101 +1,101 @@
/*****************************************************************************
* utils.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "utils.h"
/*
** conversion facilities
*/
using namespace std;
char *CStrFromBSTR(int codePage, BSTR bstr)
{
UINT len = SysStringLen(bstr);
if( len > 0 )
{
size_t mblen = WideCharToMultiByte(codePage,
0, bstr, len, NULL, 0, NULL, NULL);
if( mblen > 0 )
{
char *buffer = (char *)malloc(mblen+1);
ZeroMemory(buffer, mblen+1);
if( WideCharToMultiByte(codePage, 0, bstr, len, buffer, mblen, NULL, NULL) )
return buffer;
}
}
return NULL;
};
BSTR BSTRFromCStr(int codePage, const char *s)
{
int wideLen = MultiByteToWideChar(codePage, 0, s, -1, NULL, 0);
if( wideLen )
{
WCHAR* wideStr = (WCHAR*)malloc(wideLen*sizeof(WCHAR));
if( NULL != wideStr )
{
BSTR bstr;
ZeroMemory(wideStr, wideLen*sizeof(WCHAR));
MultiByteToWideChar(codePage, 0, s, -1, wideStr, wideLen);
bstr = SysAllocString(wideStr);
free(wideStr);
return bstr;
}
}
return NULL;
};
/*
** properties
*/
HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v)
{
IDispatch *pDisp;
HRESULT hr = object->QueryInterface(IID_IDispatch, (LPVOID *)&pDisp);
if( SUCCEEDED(hr) )
{
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
VARIANT vres;
hr = pDisp->Invoke(dispID, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET, &dispparamsNoArgs, &vres, NULL, NULL);
if( SUCCEEDED(hr) )
{
if( V_VT(&v) != V_VT(&vres) )
{
hr = VariantChangeType(&v, &vres, 0, V_VT(&v));
VariantClear(&vres);
}
else
{
v = vres;
}
}
pDisp->Release();
}
return hr;
};
/*****************************************************************************
* utils.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "utils.h"
/*
** conversion facilities
*/
using namespace std;
char *CStrFromBSTR(int codePage, BSTR bstr)
{
UINT len = SysStringLen(bstr);
if( len > 0 )
{
size_t mblen = WideCharToMultiByte(codePage,
0, bstr, len, NULL, 0, NULL, NULL);
if( mblen > 0 )
{
char *buffer = (char *)malloc(mblen+1);
ZeroMemory(buffer, mblen+1);
if( WideCharToMultiByte(codePage, 0, bstr, len, buffer, mblen, NULL, NULL) )
return buffer;
}
}
return NULL;
};
BSTR BSTRFromCStr(int codePage, const char *s)
{
int wideLen = MultiByteToWideChar(codePage, 0, s, -1, NULL, 0);
if( wideLen )
{
WCHAR* wideStr = (WCHAR*)malloc(wideLen*sizeof(WCHAR));
if( NULL != wideStr )
{
BSTR bstr;
ZeroMemory(wideStr, wideLen*sizeof(WCHAR));
MultiByteToWideChar(codePage, 0, s, -1, wideStr, wideLen);
bstr = SysAllocString(wideStr);
free(wideStr);
return bstr;
}
}
return NULL;
};
/*
** properties
*/
HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v)
{
IDispatch *pDisp;
HRESULT hr = object->QueryInterface(IID_IDispatch, (LPVOID *)&pDisp);
if( SUCCEEDED(hr) )
{
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
VARIANT vres;
hr = pDisp->Invoke(dispID, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET, &dispparamsNoArgs, &vres, NULL, NULL);
if( SUCCEEDED(hr) )
{
if( V_VT(&v) != V_VT(&vres) )
{
hr = VariantChangeType(&v, &vres, 0, V_VT(&v));
VariantClear(&vres);
}
else
{
v = vres;
}
}
pDisp->Release();
}
return hr;
};

View File

@ -1,181 +1,181 @@
/*****************************************************************************
* utils.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __UTILS_H__
#define __UTILS_H__
#include <ole2.h>
#include <vector>
// utilities
extern char *CStrFromBSTR(int codePage, BSTR bstr);
extern BSTR BSTRFromCStr(int codePage, const char *s);
// properties
extern HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v);
// enumeration
template<class T> class VLCEnum : IUnknown
{
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> **);
// cloning is implemented by subclasses and must use copy constructor
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;
};
template<class T>
VLCEnum<T>::VLCEnum(REFIID riid, std::vector<T> &v) :
_refcount(1),
_v(v),
_riid(riid),
_retain(NULL)
{
_i= v.begin();
};
template<class T>
VLCEnum<T>::VLCEnum(const VLCEnum<T> &e) :
_refcount(1),
_v(e._v),
_riid(e._riid)
{
};
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;
};
template<class T>
STDMETHODIMP VLCEnum<T>::QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv ) return E_POINTER;
if( (IID_IUnknown == riid)
&& ( _riid == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return E_NOINTERFACE;
};
template<class T>
STDMETHODIMP_(ULONG) VLCEnum<T>::AddRef(void)
{
return InterlockedIncrement(&_refcount);
};
template<class T>
STDMETHODIMP_(ULONG) VLCEnum<T>::Release(void)
{
ULONG refcount = InterlockedDecrement(&_refcount);
if( 0 == refcount )
{
delete this;
return 0;
}
return refcount;
};
template<class T>
STDMETHODIMP VLCEnum<T>::Next(ULONG celt, T *rgelt, ULONG *pceltFetched)
{
if( NULL == rgelt )
return E_POINTER;
if( (celt > 1) && (NULL == pceltFetched) )
return E_INVALIDARG;
ULONG c = 0;
typename std::vector<T>::iterator end = _v.end();
while( (c < celt) && (_i != end) )
{
rgelt[c] = *_i;
if( NULL != _retain ) _retain(rgelt[c]);
++_i;
++c;
}
if( NULL != pceltFetched )
*pceltFetched = c;
return (c == celt) ? S_OK : S_FALSE;
};
template<class T>
STDMETHODIMP VLCEnum<T>::Skip(ULONG celt)
{
ULONG c = 0;
typename std::vector<T>::iterator end = _v.end();
while( (c < celt) && (_i != end) )
{
++_i;
++c;
}
return (c == celt) ? S_OK : S_FALSE;
};
template<class T>
STDMETHODIMP VLCEnum<T>::Reset(void)
{
_i= _v.begin();
return S_OK;
};
#endif
/*****************************************************************************
* utils.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __UTILS_H__
#define __UTILS_H__
#include <ole2.h>
#include <vector>
// utilities
extern char *CStrFromBSTR(int codePage, BSTR bstr);
extern BSTR BSTRFromCStr(int codePage, const char *s);
// properties
extern HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v);
// enumeration
template<class T> class VLCEnum : IUnknown
{
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> **);
// cloning is implemented by subclasses and must use copy constructor
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;
};
template<class T>
VLCEnum<T>::VLCEnum(REFIID riid, std::vector<T> &v) :
_refcount(1),
_v(v),
_riid(riid),
_retain(NULL)
{
_i= v.begin();
};
template<class T>
VLCEnum<T>::VLCEnum(const VLCEnum<T> &e) :
_refcount(1),
_v(e._v),
_riid(e._riid)
{
};
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;
};
template<class T>
STDMETHODIMP VLCEnum<T>::QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv ) return E_POINTER;
if( (IID_IUnknown == riid)
&& ( _riid == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return E_NOINTERFACE;
};
template<class T>
STDMETHODIMP_(ULONG) VLCEnum<T>::AddRef(void)
{
return InterlockedIncrement(&_refcount);
};
template<class T>
STDMETHODIMP_(ULONG) VLCEnum<T>::Release(void)
{
ULONG refcount = InterlockedDecrement(&_refcount);
if( 0 == refcount )
{
delete this;
return 0;
}
return refcount;
};
template<class T>
STDMETHODIMP VLCEnum<T>::Next(ULONG celt, T *rgelt, ULONG *pceltFetched)
{
if( NULL == rgelt )
return E_POINTER;
if( (celt > 1) && (NULL == pceltFetched) )
return E_INVALIDARG;
ULONG c = 0;
typename std::vector<T>::iterator end = _v.end();
while( (c < celt) && (_i != end) )
{
rgelt[c] = *_i;
if( NULL != _retain ) _retain(rgelt[c]);
++_i;
++c;
}
if( NULL != pceltFetched )
*pceltFetched = c;
return (c == celt) ? S_OK : S_FALSE;
};
template<class T>
STDMETHODIMP VLCEnum<T>::Skip(ULONG celt)
{
ULONG c = 0;
typename std::vector<T>::iterator end = _v.end();
while( (c < celt) && (_i != end) )
{
++_i;
++c;
}
return (c == celt) ? S_OK : S_FALSE;
};
template<class T>
STDMETHODIMP VLCEnum<T>::Reset(void)
{
_i= _v.begin();
return S_OK;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,100 +1,100 @@
/*****************************************************************************
* vlccontrol.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef _VLCCONTROL_H_
#define _VLCCONTROL_H_
#include <oaidl.h>
#include "axvlc_idl.h"
class VLCControl : public IVLCControl
{
public:
VLCControl(VLCPlugin *p_instance) : _p_instance(p_instance), _p_typeinfo(NULL) {};
virtual ~VLCControl();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IDispatch == riid)
&& (IID_IVLCControl == riid) ) {
AddRef();
*ppv = dynamic_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->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*);
// IVLCControl methods
STDMETHODIMP get_Value(VARIANT *pvarValue);
STDMETHODIMP put_Value(VARIANT pvarValue);
STDMETHODIMP play(void);
STDMETHODIMP get_Visible(VARIANT_BOOL *visible);
STDMETHODIMP put_Visible(VARIANT_BOOL visible);
STDMETHODIMP pause(void);
STDMETHODIMP stop(void);
STDMETHODIMP get_Playing(VARIANT_BOOL *isPlaying);
STDMETHODIMP put_Playing(VARIANT_BOOL isPlaying);
STDMETHODIMP get_Position(float *position);
STDMETHODIMP put_Position(float position);
STDMETHODIMP get_Time(int *seconds);
STDMETHODIMP put_Time(int seconds);
STDMETHODIMP shuttle(int seconds);
STDMETHODIMP fullscreen();
STDMETHODIMP get_Length(int *seconds);
STDMETHODIMP playFaster(void);
STDMETHODIMP playSlower(void);
STDMETHODIMP get_Volume(int *volume);
STDMETHODIMP put_Volume(int volume);
STDMETHODIMP toggleMute(void);
STDMETHODIMP addTarget( BSTR uri, VARIANT options, enum VLCPlaylistMode mode, int position);
STDMETHODIMP get_PlaylistIndex(int *index);
STDMETHODIMP get_PlaylistCount(int *count);
STDMETHODIMP playlistNext(void);
STDMETHODIMP playlistPrev(void);
STDMETHODIMP playlistClear(void);
STDMETHODIMP get_VersionInfo(BSTR *version);
private:
HRESULT getTypeInfo();
VLCPlugin *_p_instance;
ITypeInfo *_p_typeinfo;
};
#endif
/*****************************************************************************
* vlccontrol.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef _VLCCONTROL_H_
#define _VLCCONTROL_H_
#include <oaidl.h>
#include "axvlc_idl.h"
class VLCControl : public IVLCControl
{
public:
VLCControl(VLCPlugin *p_instance) : _p_instance(p_instance), _p_typeinfo(NULL) {};
virtual ~VLCControl();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IDispatch == riid)
&& (IID_IVLCControl == riid) ) {
AddRef();
*ppv = dynamic_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->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*);
// IVLCControl methods
STDMETHODIMP get_Value(VARIANT *pvarValue);
STDMETHODIMP put_Value(VARIANT pvarValue);
STDMETHODIMP play(void);
STDMETHODIMP get_Visible(VARIANT_BOOL *visible);
STDMETHODIMP put_Visible(VARIANT_BOOL visible);
STDMETHODIMP pause(void);
STDMETHODIMP stop(void);
STDMETHODIMP get_Playing(VARIANT_BOOL *isPlaying);
STDMETHODIMP put_Playing(VARIANT_BOOL isPlaying);
STDMETHODIMP get_Position(float *position);
STDMETHODIMP put_Position(float position);
STDMETHODIMP get_Time(int *seconds);
STDMETHODIMP put_Time(int seconds);
STDMETHODIMP shuttle(int seconds);
STDMETHODIMP fullscreen();
STDMETHODIMP get_Length(int *seconds);
STDMETHODIMP playFaster(void);
STDMETHODIMP playSlower(void);
STDMETHODIMP get_Volume(int *volume);
STDMETHODIMP put_Volume(int volume);
STDMETHODIMP toggleMute(void);
STDMETHODIMP addTarget( BSTR uri, VARIANT options, enum VLCPlaylistMode mode, int position);
STDMETHODIMP get_PlaylistIndex(int *index);
STDMETHODIMP get_PlaylistCount(int *count);
STDMETHODIMP playlistNext(void);
STDMETHODIMP playlistPrev(void);
STDMETHODIMP playlistClear(void);
STDMETHODIMP get_VersionInfo(BSTR *version);
private:
HRESULT getTypeInfo();
VLCPlugin *_p_instance;
ITypeInfo *_p_typeinfo;
};
#endif

View File

@ -2,7 +2,7 @@
* beos_specific.h: BeOS specific features
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: beos_specific.h,v 1.9 2004/01/25 18:17:08 zorglub Exp $
* $Id$
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
*

View File

@ -2,7 +2,7 @@
* charset.h: Determine a canonical name for the current locale's character encoding.
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: charset.h,v 1.3 2004/02/21 23:15:52 gbazin Exp $
* $Id$
*
* Author: Derk-Jan Hartman <thedj at users.sourceforge.net>
*

View File

@ -2,7 +2,7 @@
* intf_eject.h: CD/DVD-ROM ejection handling functions
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: intf_eject.h,v 1.6 2004/01/25 18:17:08 zorglub Exp $
* $Id$
*
* Author: Julien Blache <jb@technologeek.org>
*

View File

@ -2,7 +2,7 @@
* iso_lang.h: function to decode language code (in dvd or a52 for instance).
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: iso_lang.h,v 1.9 2003/10/24 17:41:58 sam Exp $
* $Id$
*
* Author: Stéphane Borel <stef@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>

View File

@ -2,7 +2,7 @@
* os_specific.h: OS specific features
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: os_specific.h,v 1.13 2004/01/25 18:17:08 zorglub Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Gildas Bazin <gbazin@netcourrier.com>

View File

@ -2,7 +2,7 @@
* aout.h: audio output header for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aout.h,v 1.2 2004/01/25 18:17:08 zorglub Exp $
* $Id$
*
* 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

View File

@ -2,7 +2,7 @@
* sout.h: video output header for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: sout.h,v 1.4 2004/01/25 18:17:08 zorglub Exp $
* $Id$
*
* 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

View File

@ -2,7 +2,7 @@
* bits.h :
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: vlc_bits.h,v 1.1 2003/11/18 20:15:38 fenrir Exp $
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*

View File

@ -2,7 +2,7 @@
* cpu.h: CPU type detection
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlc_cpu.h,v 1.6 2004/01/25 18:17:08 zorglub Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*

View File

@ -2,7 +2,7 @@
* vlc_error.h: error handling routine
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlc_error.h,v 1.1 2003/07/01 12:56:47 sam Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*

View File

@ -4,7 +4,7 @@
* interface, such as message output.
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: vlc_messages.h,v 1.11 2004/01/25 18:17:08 zorglub Exp $
* $Id$
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>

View File

@ -2,7 +2,7 @@
* win32_specific.h: Win32 specific features
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: win32_specific.h,v 1.5 2004/01/25 18:17:08 zorglub Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Gildas Bazin <gbazin@netcourrier.com>

View File

@ -2,7 +2,7 @@
* beos.cpp: Screen capture module.
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: screen.c 8284 2004-07-26 10:27:55Z gbazin $
* $Id$
*
* Authors: Eric Petit <titer@m0k.org>
*

View File

@ -2,7 +2,7 @@
* Copyright (C) lavrec (see http://mjpeg.sourceforge.net)
* ( XXX This file was get from the driver-zoran package and it is under GPL)
*
* $Id: videodev_mjpeg.h,v 1.2 2003/12/22 14:32:55 sam Exp $
* $Id$
*
* 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

View File

@ -2,7 +2,7 @@
* cdrom.c: cdrom tools
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: cdrom.c,v 1.14 2003/08/09 19:14:16 gbazin Exp $
* $Id$
*
* Authors: Johan Bilien <jobi@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>

View File

@ -2,7 +2,7 @@
* cdrom.h: cdrom tools header
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: cdrom.h,v 1.6 2003/05/18 15:44:03 gbazin Exp $
* $Id$
*
* Authors: Johan Bilien <jobi@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>

View File

@ -2,7 +2,7 @@
* cdrom_internals.h: cdrom tools private header
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: cdrom_internals.h,v 1.2 2003/05/18 15:44:03 gbazin Exp $
* $Id$
*
* Authors: Johan Bilien <jobi@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>

View File

@ -2,7 +2,7 @@
* equalizer_presets.h:
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id:$
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*

View File

@ -2,7 +2,7 @@
* bandlimited.h : bandlimited interpolation resampler
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: bandlimited.h,v 1.1 2003/03/04 03:27:40 gbazin Exp $
* $Id$
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
* libavi.c : LibAVI
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libavi.c,v 1.30 2004/01/25 20:05:28 hartman Exp $
* $Id$
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify

View File

@ -2,7 +2,7 @@
* AudioOutput.cpp: BeOS audio output
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: AudioOutput.cpp,v 1.30 2004/01/26 16:52:31 zorglub Exp $
* $Id$
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>

View File

@ -2,7 +2,7 @@
* Bitmaps.h
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: Bitmaps.h,v 1.3 2004/01/26 16:52:31 zorglub Exp $
* $Id$
*
* Authors: Tony Castley <tcastley@mail.powerup.com.au>
* Stephan Aßmus <stippi@yellowbites.com>

View File

@ -2,7 +2,7 @@
* DrawingTidbits.cpp
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: DrawingTidbits.cpp,v 1.4 2004/01/26 16:52:31 zorglub Exp $
* $Id$
*
* Authors: Tony Castley <tcastley@mail.powerup.com.au>
* Stephan Aßmus <stippi@yellowbites.com>

View File

@ -2,7 +2,7 @@
* DrawingTidbits.h
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: DrawingTidbits.h,v 1.3 2004/01/26 16:52:31 zorglub Exp $
* $Id$
*
* Authors: Tony Castley <tcastley@mail.powerup.com.au>
* Stephan Aßmus <stippi@yellowbites.com>

View File

@ -2,7 +2,7 @@
* PreferencesWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.cpp,v 1.27 2003/12/22 00:06:05 titer Exp $
* $Id$
*
* Authors: Eric Petit <titer@videolan.org>
*

View File

@ -2,7 +2,7 @@
* PreferencesWindow.h
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.h,v 1.18 2003/12/21 21:30:43 titer Exp $
* $Id$
*
* Authors: Eric Petit <titer@videolan.org>
*

View File

@ -2,7 +2,7 @@
* TransportButton.cpp
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: TransportButton.cpp,v 1.4 2004/01/26 16:52:31 zorglub Exp $
* $Id$
*
* Authors: Tony Castley <tcastley@mail.powerup.com.au>
* Stephan Aßmus <stippi@yellowbites.com>

View File

@ -2,7 +2,7 @@
* TransportButton.h
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: TransportButton.h,v 1.3 2004/01/26 16:52:31 zorglub Exp $
* $Id$
*
* Authors: Tony Castley <tcastley@mail.powerup.com.au>
*

View File

@ -2,7 +2,7 @@
* gtk_common.h: private Gtk+ interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: common.h,v 1.7 2003/01/26 14:49:09 fenrir Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*

View File

@ -2,7 +2,7 @@
* gtk_control.h: prototypes for control functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: control.h,v 1.1 2002/08/04 17:23:43 sam Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>

View File

@ -2,7 +2,7 @@
* display.h: Gtk+ tools for main interface.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: display.h,v 1.3 2003/08/03 23:11:21 gbazin Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>

View File

@ -2,7 +2,7 @@
* gtk_callbacks.h : Callbacks for the gtk plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_callbacks.h,v 1.6 2003/05/05 16:09:39 gbazin Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>

View File

@ -2,7 +2,7 @@
* gtk_menu.h: prototypes for menu functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: menu.h,v 1.1 2002/08/04 17:23:43 sam Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>

View File

@ -2,7 +2,7 @@
* gtk_modules.c : functions to build modules configuration boxes.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: modules.c,v 1.2 2002/08/08 22:28:22 sam Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>

View File

@ -2,7 +2,7 @@
* gtk_modules.h: prototypes for modules functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: modules.h,v 1.1 2002/08/04 17:23:43 sam Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>

View File

@ -2,7 +2,7 @@
* gtk_open.h: prototypes for open functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: open.h,v 1.2 2003/12/12 03:01:13 rocky Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>

View File

@ -2,7 +2,7 @@
* gtk_playlist.h : Playlist functions for the Gtk plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: playlist.h,v 1.1 2002/08/04 17:23:43 sam Exp $
* $Id$
*
* Authors: Pierre Baillet <oct@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>

View File

@ -2,7 +2,7 @@
* gtk_preferences.c: functions to handle the preferences dialog box.
*****************************************************************************
* Copyright (C) 2001-2004 VideoLAN
* $Id: preferences.c,v 1.11 2004/01/25 18:34:55 gbazin Exp $
* $Id$
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Loïc Minier <lool@via.ecp.fr>

View File

@ -2,7 +2,7 @@
* gtk_control.h: prototypes for control functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: preferences.h,v 1.1 2002/08/04 17:23:43 sam Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>

View File

@ -2,7 +2,7 @@
* sout.c :
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: sout.c,v 1.2 2003/05/05 16:09:39 gbazin Exp $
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*

View File

@ -2,7 +2,7 @@
* QConfigItem.cpp: The QConfigItem class
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: QConfigItem.cpp,v 1.3 2002/10/13 14:26:47 sigmunau Exp $
* $Id$
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon 12.08.2002
*

View File

@ -2,7 +2,7 @@
* QConfigItem.h : includes for the QConfigItem class
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: QConfigItem.h,v 1.3 2002/10/13 14:26:47 sigmunau Exp $
* $Id$
*
* Authors: Andres Krapf <dae@chez.com> Sun Mar 25 2001
*

View File

@ -2,7 +2,7 @@
* info.h: the KInfoWindow class
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: info.h,v 1.2 2003/12/22 14:23:14 sam Exp $
* $Id$
*
* Author: Sigmund Augdal <sigmunau@idi.ntnu.no>
*

View File

@ -2,7 +2,7 @@
* languagemenu.cpp: the KLanguageMenuAction class
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: languagemenu.cpp,v 1.2 2003/12/22 14:23:14 sam Exp $
* $Id$
*
* Author: Sigmund Augdal <sigmunau@idi.ntnu.no>
*

View File

@ -2,7 +2,7 @@
* languagemenu.h: the KLanguageMenuAction class
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: languagemenu.h,v 1.2 2003/12/22 14:23:14 sam Exp $
* $Id$
*
* Author: Sigmund Augdal <sigmunau@idi.ntnu.no>
*

View File

@ -2,7 +2,7 @@
* messages.cpp: the KMessagesWindow class
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: messages.cpp,v 1.5 2003/12/22 14:23:14 sam Exp $
* $Id$
*
* Author: Sigmund Augdal <sigmunau@idi.ntnu.no>
*

View File

@ -2,7 +2,7 @@
* messages.h: the KMessagesWindow class
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: messages.h,v 1.2 2003/12/22 14:23:14 sam Exp $
* $Id$
*
* Author: Sigmund Augdal <sigmunau@idi.ntnu.no>
*

View File

@ -2,7 +2,7 @@
* pluginbox.cpp: the pluginbox class
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: pluginsbox.cpp,v 1.3 2003/03/29 14:30:55 sigmunau Exp $
* $Id$
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002
*

View File

@ -2,7 +2,7 @@
* pluginbox.h: includes for the pluginbox class
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: pluginsbox.h,v 1.3 2003/03/29 14:30:55 sigmunau Exp $
* $Id$
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002
*

View File

@ -2,7 +2,7 @@
* preferences.cpp: preferences window for the kde gui
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: preferences.cpp,v 1.18 2004/01/25 15:42:57 kuehne Exp $
* $Id$
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002
*

View File

@ -2,7 +2,7 @@
* preferences.h: includes for the preferences window
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: preferences.h,v 1.2 2002/08/12 17:38:10 sigmunau Exp $
* $Id$
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002
*

View File

@ -2,7 +2,7 @@
* pda.h: private Gtk+ interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: pda.h,v 1.5 2003/11/18 20:36:40 jpsaman Exp $
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*

View File

@ -2,7 +2,7 @@
* callbacks.h : pda plugin for vlc
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: pda_callbacks.h,v 1.12 2003/12/07 18:58:38 jpsaman Exp $
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*

View File

@ -2,7 +2,7 @@
* intf.h: Qt interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: intf.h,v 1.1 2002/09/30 11:05:39 sam Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
* aout_dummy.c : dummy audio output plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aout.c,v 1.10 2002/09/30 21:32:33 massiot Exp $
* $Id$
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*

View File

@ -2,7 +2,7 @@
* dummy.h : dummy plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001, 2002 VideoLAN
* $Id: dummy.h,v 1.3 2003/11/16 21:07:31 gbazin Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*

View File

@ -2,7 +2,7 @@
* encoder.c: dummy encoder plugin for vlc.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: encoder.c,v 1.1 2003/11/16 21:28:26 gbazin Exp $
* $Id$
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*

View File

@ -2,7 +2,7 @@
* intf_dummy.c: dummy interface plugin
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: interface.c,v 1.4 2004/01/25 17:20:19 kuehne Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*

View File

@ -2,7 +2,7 @@
* gtk_main.c : Gtk+ wrapper for gtk_main
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: gtk_main.c,v 1.15 2003/03/30 18:14:38 gbazin Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*

View File

@ -1,7 +1,7 @@
/*****************************************************************************
* fastmemcpy.h : fast memcpy routines
*****************************************************************************
* $Id: fastmemcpy.h,v 1.2 2002/08/08 00:35:11 sam Exp $
* $Id$
*
* Authors: various Linux kernel hackers
* various MPlayer hackers

View File

@ -2,7 +2,7 @@
* test1.c : Empty C module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: test1.c,v 1.1 2002/10/04 13:13:54 sam Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*

View File

@ -2,7 +2,7 @@
* test2.cpp : Empty C++ module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: test2.cpp,v 1.2 2002/10/22 21:10:27 sam Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*

View File

@ -2,7 +2,7 @@
* test4.c : Miscellaneous stress tests module for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: test4.c,v 1.7 2003/05/04 22:42:17 gbazin Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*

View File

@ -2,7 +2,7 @@
* bits.h
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: bits.h,v 1.4 2003/05/05 15:52:13 fenrir Exp $
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>

View File

@ -2,7 +2,7 @@
* csa.h
*****************************************************************************
* Copyright (C) 2004 Laurent Aimar
* $Id: csa.h,v 1.1 2004/01/25 02:26:04 fenrir Exp $
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*

View File

@ -5,7 +5,7 @@
* Copyright (C) 2003 Antoine Missout
* Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
* $Id: frame.c,v 1.2 2004/03/03 11:39:06 massiot Exp $
* $Id$
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Laurent Aimar <fenrir@via.ecp.fr>

View File

@ -5,7 +5,7 @@
* case by optimized functions.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: i420_rgb_c.h,v 1.2 2003/10/01 03:38:23 sam Exp $
* $Id$
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*

View File

@ -1,329 +1,329 @@
/*****************************************************************************
* marq.c : marquee display video plugin for vlc
*****************************************************************************
* Copyright (C) 2003-2005 VideoLAN
* $Id: time.c 8751 2004-09-20 21:51:41Z gbazin $
*
* Authors: Mark Moriarty
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <string.h>
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include "vlc_filter.h"
#include "vlc_block.h"
#include "osd.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int CreateFilter ( vlc_object_t * );
static void DestroyFilter( vlc_object_t * );
static subpicture_t *Filter( filter_t *, mtime_t );
static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval,
void *p_data );
static int pi_color_values[] = { 0xf0000000, 0x00000000, 0x00808080, 0x00C0C0C0,
0x00FFFFFF, 0x00800000, 0x00FF0000, 0x00FF00FF, 0x00FFFF00,
0x00808000, 0x00008000, 0x00008080, 0x0000FF00, 0x00800080,
0x00000080, 0x000000FF, 0x0000FFFF};
static char *ppsz_color_descriptions[] = { N_("Default"), N_("Black"),
N_("Gray"), N_("Silver"), N_("White"), N_("Maroon"), N_("Red"),
N_("Fuchsia"), N_("Yellow"), N_("Olive"), N_("Green"),
N_("Teal"), N_("Lime"), N_("Purple"), N_("Navy"), N_("Blue"),
N_("Aqua") };
/*****************************************************************************
* filter_sys_t: marquee filter descriptor
*****************************************************************************/
struct filter_sys_t
{
int i_xoff, i_yoff; /* offsets for the display string in the video window */
int i_pos; /* permit relative positioning (top, bottom, left, right, center) */
int i_timeout;
char *psz_marquee; /* marquee string */
int i_font_color, i_font_opacity, i_font_size; /* font control */
time_t last_time;
vlc_bool_t b_absolute; /* position control, relative vs. absolute */
vlc_bool_t b_need_update;
};
#define MSG_TEXT N_("Marquee text")
#define MSG_LONGTEXT N_("Marquee text to display")
#define POSX_TEXT N_("X offset, from left")
#define POSX_LONGTEXT N_("X offset, from the left screen edge" )
#define POSY_TEXT N_("Y offset, from the top")
#define POSY_LONGTEXT N_("Y offset, down from the top" )
#define TIMEOUT_TEXT N_("Marquee timeout")
#define TIMEOUT_LONGTEXT N_("Defines the time the marquee must remain " \
"displayed, in milliseconds. Default value is " \
"0 (remain forever).")
#define OPACITY_TEXT N_("Opacity, -1..255")
#define OPACITY_LONGTEXT N_("The opacity (inverse of transparency) of overlay text. " \
"-1 = use freetype-opacity, 0 = transparent, 255 = totally opaque. " )
#define SIZE_TEXT N_("Font size, pixels")
#define SIZE_LONGTEXT N_("Specify the font size, in pixels, " \
"with -1 = use freetype-fontsize" )
#define COLOR_TEXT N_("Text Default Color")
#define COLOR_LONGTEXT N_("The color of overlay text. 1 byte for each color, hexadecimal." \
"-1 = use freetype-color, #000000 = all colors off, " \
"0xFF0000 = just Red, 0xFFFFFF = all color on [White]" )
#define POS_TEXT N_("Marquee position")
#define POS_LONGTEXT N_( \
"You can enforce the marquee position on the video " \
"(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
"also use combinations of these values by adding them).")
static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
static char *ppsz_pos_descriptions[] =
{ N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_capability( "sub filter", 0 );
set_shortname( N_("Marquee" ));
set_callbacks( CreateFilter, DestroyFilter );
set_category( CAT_VIDEO );
set_subcategory( SUBCAT_VIDEO_SUBPIC );
add_string( "marq-marquee", "Marquee", NULL, MSG_TEXT, MSG_LONGTEXT, VLC_FALSE );
add_integer( "marq-x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_FALSE );
add_integer( "marq-y", 0, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_FALSE );
add_integer( "marq-timeout", 0, NULL, TIMEOUT_TEXT, TIMEOUT_LONGTEXT,
VLC_FALSE );
add_integer( "marq-position", 5, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE );
/* 5 sets the default to top [1] left [4] */
change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
add_integer_with_range( "marq-opacity", -1, -1, 255, NULL,
OPACITY_TEXT, OPACITY_LONGTEXT, VLC_FALSE );
add_integer( "marq-color", -1, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );
change_integer_list( pi_color_values, ppsz_color_descriptions, 0 );
add_integer( "marq-size", -1, NULL, SIZE_TEXT, SIZE_LONGTEXT, VLC_FALSE );
set_description( _("Marquee display sub filter") );
add_shortcut( "marq" );
vlc_module_end();
/*****************************************************************************
* CreateFilter: allocates marquee video filter
*****************************************************************************/
static int CreateFilter( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys;
vlc_object_t *p_input;
/* Allocate structure */
p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
if( p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
}
/* Hook used for callback variables */
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( !p_input )
{
return VLC_ENOOBJ;
}
p_sys->i_xoff = var_CreateGetInteger( p_input->p_libvlc , "marq-x" );
p_sys->i_yoff = var_CreateGetInteger( p_input->p_libvlc , "marq-y" );
p_sys->i_timeout = var_CreateGetInteger( p_input->p_libvlc , "marq-timeout" );
p_sys->i_pos = var_CreateGetInteger( p_input->p_libvlc , "marq-position" );
p_sys->psz_marquee = var_CreateGetString( p_input->p_libvlc, "marq-marquee" );
var_Create( p_input->p_libvlc, "marq-opacity", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
p_sys->i_font_opacity = var_CreateGetInteger( p_input->p_libvlc , "marq-opacity" );
p_sys->i_font_color = var_CreateGetInteger( p_input->p_libvlc , "marq-color" );
p_sys->i_font_size = var_CreateGetInteger( p_input->p_libvlc , "marq-size" );
var_AddCallback( p_input->p_libvlc, "marq-x", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-y", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-marquee", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-timeout", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-position", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-color", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-opacity", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-size", MarqueeCallback, p_sys );
vlc_object_release( p_input );
/* Misc init */
p_filter->pf_sub_filter = Filter;
p_sys->last_time = ((time_t)-1);
p_sys->b_need_update = VLC_TRUE;
return VLC_SUCCESS;
}
/*****************************************************************************
* DestroyFilter: destroy marquee video filter
*****************************************************************************/
static void DestroyFilter( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
vlc_object_t *p_input;
if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
free( p_sys );
/* Delete the marquee variables */
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( !p_input )
{
return;
}
var_Destroy( p_input->p_libvlc , "marq-marquee" );
var_Destroy( p_input->p_libvlc , "marq-x" );
var_Destroy( p_input->p_libvlc , "marq-y" );
var_Destroy( p_input->p_libvlc , "marq-timeout" );
var_Destroy( p_input->p_libvlc , "marq-position" );
var_Destroy( p_input->p_libvlc , "marq-color");
var_Destroy( p_input->p_libvlc , "marq-opacity");
var_Destroy( p_input->p_libvlc , "marq-size");
vlc_object_release( p_input );
}
/****************************************************************************
* Filter: the whole thing
****************************************************************************
* This function outputs subpictures at regular time intervals.
****************************************************************************/
static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
{
filter_sys_t *p_sys = p_filter->p_sys;
subpicture_t *p_spu;
video_format_t fmt;
time_t t;
if( p_sys->last_time == time( NULL ) )
{
return NULL;
}
if( p_sys->b_need_update == VLC_FALSE )
{
return NULL;
}
p_sys->b_absolute = VLC_TRUE;
if( p_sys->i_xoff < 0 || p_sys->i_yoff < 0 )
{
p_sys->b_absolute = VLC_FALSE;
}
p_spu = p_filter->pf_sub_buffer_new( p_filter );
if( !p_spu ) return NULL;
p_spu->b_absolute = p_sys->b_absolute;
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_FOURCC('T','E','X','T');
fmt.i_aspect = 0;
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = 0;
fmt.i_y_offset = 0;
p_spu->p_region = p_spu->pf_create_region( VLC_OBJECT(p_filter), &fmt );
if( !p_spu->p_region )
{
p_filter->pf_sub_buffer_del( p_filter, p_spu );
return NULL;
}
t = p_sys->last_time = time( NULL );
p_spu->p_region->psz_text = strdup(p_sys->psz_marquee);
p_spu->i_start = date;
p_spu->i_stop = p_sys->i_timeout == 0 ? 0 : date + p_sys->i_timeout * 1000;
p_spu->b_ephemer = VLC_TRUE;
p_spu->i_x = p_sys->i_xoff;
p_spu->i_y = p_sys->i_yoff;
p_spu->p_region->i_font_color = p_sys->i_font_color;
p_spu->p_region->i_font_opacity = p_sys->i_font_opacity;
p_spu->p_region->i_font_size = p_sys->i_font_size;
p_spu->i_flags = p_sys->i_pos;
p_sys->b_need_update = VLC_FALSE;
return p_spu;
}
/**********************************************************************
* Callback to update params on the fly
**********************************************************************/
static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval,
void *p_data )
{
filter_sys_t *p_sys = (filter_sys_t *) p_data;
if( !strncmp( psz_var, "marq-marquee", 7 ) )
{
if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
p_sys->psz_marquee = strdup( newval.psz_string );
}
else if ( !strncmp( psz_var, "marq-x", 6 ) )
{
p_sys->i_xoff = newval.i_int;
}
else if ( !strncmp( psz_var, "marq-y", 6 ) )
{
p_sys->i_yoff = newval.i_int;
}
else if ( !strncmp( psz_var, "marq-color", 8 ) ) /* "marq-col" */
{
p_sys->i_font_color = newval.i_int;
}
else if ( !strncmp( psz_var, "marq-opacity", 8 ) ) /* "marq-opa" */
{
p_sys->i_font_opacity = newval.i_int;
}
else if ( !strncmp( psz_var, "marq-size", 6 ) )
{
p_sys->i_font_size = newval.i_int;
}
else if ( !strncmp( psz_var, "marq-timeout", 12 ) )
{
p_sys->i_timeout = newval.i_int;
}
else if ( !strncmp( psz_var, "marq-position", 8 ) )
/* willing to accept a match against marq-pos */
{
p_sys->i_pos = newval.i_int;
p_sys->i_xoff = -1; /* force to relative positioning */
}
p_sys->b_need_update = VLC_TRUE;
return VLC_SUCCESS;
}
/*****************************************************************************
* marq.c : marquee display video plugin for vlc
*****************************************************************************
* Copyright (C) 2003-2005 VideoLAN
* $Id: time.c 8751 2004-09-20 21:51:41Z gbazin $
*
* Authors: Mark Moriarty
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <string.h>
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include "vlc_filter.h"
#include "vlc_block.h"
#include "osd.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int CreateFilter ( vlc_object_t * );
static void DestroyFilter( vlc_object_t * );
static subpicture_t *Filter( filter_t *, mtime_t );
static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval,
void *p_data );
static int pi_color_values[] = { 0xf0000000, 0x00000000, 0x00808080, 0x00C0C0C0,
0x00FFFFFF, 0x00800000, 0x00FF0000, 0x00FF00FF, 0x00FFFF00,
0x00808000, 0x00008000, 0x00008080, 0x0000FF00, 0x00800080,
0x00000080, 0x000000FF, 0x0000FFFF};
static char *ppsz_color_descriptions[] = { N_("Default"), N_("Black"),
N_("Gray"), N_("Silver"), N_("White"), N_("Maroon"), N_("Red"),
N_("Fuchsia"), N_("Yellow"), N_("Olive"), N_("Green"),
N_("Teal"), N_("Lime"), N_("Purple"), N_("Navy"), N_("Blue"),
N_("Aqua") };
/*****************************************************************************
* filter_sys_t: marquee filter descriptor
*****************************************************************************/
struct filter_sys_t
{
int i_xoff, i_yoff; /* offsets for the display string in the video window */
int i_pos; /* permit relative positioning (top, bottom, left, right, center) */
int i_timeout;
char *psz_marquee; /* marquee string */
int i_font_color, i_font_opacity, i_font_size; /* font control */
time_t last_time;
vlc_bool_t b_absolute; /* position control, relative vs. absolute */
vlc_bool_t b_need_update;
};
#define MSG_TEXT N_("Marquee text")
#define MSG_LONGTEXT N_("Marquee text to display")
#define POSX_TEXT N_("X offset, from left")
#define POSX_LONGTEXT N_("X offset, from the left screen edge" )
#define POSY_TEXT N_("Y offset, from the top")
#define POSY_LONGTEXT N_("Y offset, down from the top" )
#define TIMEOUT_TEXT N_("Marquee timeout")
#define TIMEOUT_LONGTEXT N_("Defines the time the marquee must remain " \
"displayed, in milliseconds. Default value is " \
"0 (remain forever).")
#define OPACITY_TEXT N_("Opacity, -1..255")
#define OPACITY_LONGTEXT N_("The opacity (inverse of transparency) of overlay text. " \
"-1 = use freetype-opacity, 0 = transparent, 255 = totally opaque. " )
#define SIZE_TEXT N_("Font size, pixels")
#define SIZE_LONGTEXT N_("Specify the font size, in pixels, " \
"with -1 = use freetype-fontsize" )
#define COLOR_TEXT N_("Text Default Color")
#define COLOR_LONGTEXT N_("The color of overlay text. 1 byte for each color, hexadecimal." \
"-1 = use freetype-color, #000000 = all colors off, " \
"0xFF0000 = just Red, 0xFFFFFF = all color on [White]" )
#define POS_TEXT N_("Marquee position")
#define POS_LONGTEXT N_( \
"You can enforce the marquee position on the video " \
"(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
"also use combinations of these values by adding them).")
static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
static char *ppsz_pos_descriptions[] =
{ N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_capability( "sub filter", 0 );
set_shortname( N_("Marquee" ));
set_callbacks( CreateFilter, DestroyFilter );
set_category( CAT_VIDEO );
set_subcategory( SUBCAT_VIDEO_SUBPIC );
add_string( "marq-marquee", "Marquee", NULL, MSG_TEXT, MSG_LONGTEXT, VLC_FALSE );
add_integer( "marq-x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_FALSE );
add_integer( "marq-y", 0, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_FALSE );
add_integer( "marq-timeout", 0, NULL, TIMEOUT_TEXT, TIMEOUT_LONGTEXT,
VLC_FALSE );
add_integer( "marq-position", 5, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE );
/* 5 sets the default to top [1] left [4] */
change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
add_integer_with_range( "marq-opacity", -1, -1, 255, NULL,
OPACITY_TEXT, OPACITY_LONGTEXT, VLC_FALSE );
add_integer( "marq-color", -1, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );
change_integer_list( pi_color_values, ppsz_color_descriptions, 0 );
add_integer( "marq-size", -1, NULL, SIZE_TEXT, SIZE_LONGTEXT, VLC_FALSE );
set_description( _("Marquee display sub filter") );
add_shortcut( "marq" );
vlc_module_end();
/*****************************************************************************
* CreateFilter: allocates marquee video filter
*****************************************************************************/
static int CreateFilter( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys;
vlc_object_t *p_input;
/* Allocate structure */
p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
if( p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
}
/* Hook used for callback variables */
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( !p_input )
{
return VLC_ENOOBJ;
}
p_sys->i_xoff = var_CreateGetInteger( p_input->p_libvlc , "marq-x" );
p_sys->i_yoff = var_CreateGetInteger( p_input->p_libvlc , "marq-y" );
p_sys->i_timeout = var_CreateGetInteger( p_input->p_libvlc , "marq-timeout" );
p_sys->i_pos = var_CreateGetInteger( p_input->p_libvlc , "marq-position" );
p_sys->psz_marquee = var_CreateGetString( p_input->p_libvlc, "marq-marquee" );
var_Create( p_input->p_libvlc, "marq-opacity", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
p_sys->i_font_opacity = var_CreateGetInteger( p_input->p_libvlc , "marq-opacity" );
p_sys->i_font_color = var_CreateGetInteger( p_input->p_libvlc , "marq-color" );
p_sys->i_font_size = var_CreateGetInteger( p_input->p_libvlc , "marq-size" );
var_AddCallback( p_input->p_libvlc, "marq-x", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-y", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-marquee", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-timeout", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-position", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-color", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-opacity", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-size", MarqueeCallback, p_sys );
vlc_object_release( p_input );
/* Misc init */
p_filter->pf_sub_filter = Filter;
p_sys->last_time = ((time_t)-1);
p_sys->b_need_update = VLC_TRUE;
return VLC_SUCCESS;
}
/*****************************************************************************
* DestroyFilter: destroy marquee video filter
*****************************************************************************/
static void DestroyFilter( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
vlc_object_t *p_input;
if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
free( p_sys );
/* Delete the marquee variables */
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( !p_input )
{
return;
}
var_Destroy( p_input->p_libvlc , "marq-marquee" );
var_Destroy( p_input->p_libvlc , "marq-x" );
var_Destroy( p_input->p_libvlc , "marq-y" );
var_Destroy( p_input->p_libvlc , "marq-timeout" );
var_Destroy( p_input->p_libvlc , "marq-position" );
var_Destroy( p_input->p_libvlc , "marq-color");
var_Destroy( p_input->p_libvlc , "marq-opacity");
var_Destroy( p_input->p_libvlc , "marq-size");
vlc_object_release( p_input );
}
/****************************************************************************
* Filter: the whole thing
****************************************************************************
* This function outputs subpictures at regular time intervals.
****************************************************************************/
static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
{
filter_sys_t *p_sys = p_filter->p_sys;
subpicture_t *p_spu;
video_format_t fmt;
time_t t;
if( p_sys->last_time == time( NULL ) )
{
return NULL;
}
if( p_sys->b_need_update == VLC_FALSE )
{
return NULL;
}
p_sys->b_absolute = VLC_TRUE;
if( p_sys->i_xoff < 0 || p_sys->i_yoff < 0 )
{
p_sys->b_absolute = VLC_FALSE;
}
p_spu = p_filter->pf_sub_buffer_new( p_filter );
if( !p_spu ) return NULL;
p_spu->b_absolute = p_sys->b_absolute;
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_FOURCC('T','E','X','T');
fmt.i_aspect = 0;
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = 0;
fmt.i_y_offset = 0;
p_spu->p_region = p_spu->pf_create_region( VLC_OBJECT(p_filter), &fmt );
if( !p_spu->p_region )
{
p_filter->pf_sub_buffer_del( p_filter, p_spu );
return NULL;
}
t = p_sys->last_time = time( NULL );
p_spu->p_region->psz_text = strdup(p_sys->psz_marquee);
p_spu->i_start = date;
p_spu->i_stop = p_sys->i_timeout == 0 ? 0 : date + p_sys->i_timeout * 1000;
p_spu->b_ephemer = VLC_TRUE;
p_spu->i_x = p_sys->i_xoff;
p_spu->i_y = p_sys->i_yoff;
p_spu->p_region->i_font_color = p_sys->i_font_color;
p_spu->p_region->i_font_opacity = p_sys->i_font_opacity;
p_spu->p_region->i_font_size = p_sys->i_font_size;
p_spu->i_flags = p_sys->i_pos;
p_sys->b_need_update = VLC_FALSE;
return p_spu;
}
/**********************************************************************
* Callback to update params on the fly
**********************************************************************/
static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval,
void *p_data )
{
filter_sys_t *p_sys = (filter_sys_t *) p_data;
if( !strncmp( psz_var, "marq-marquee", 7 ) )
{
if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
p_sys->psz_marquee = strdup( newval.psz_string );
}
else if ( !strncmp( psz_var, "marq-x", 6 ) )
{
p_sys->i_xoff = newval.i_int;
}
else if ( !strncmp( psz_var, "marq-y", 6 ) )
{
p_sys->i_yoff = newval.i_int;
}
else if ( !strncmp( psz_var, "marq-color", 8 ) ) /* "marq-col" */
{
p_sys->i_font_color = newval.i_int;
}
else if ( !strncmp( psz_var, "marq-opacity", 8 ) ) /* "marq-opa" */
{
p_sys->i_font_opacity = newval.i_int;
}
else if ( !strncmp( psz_var, "marq-size", 6 ) )
{
p_sys->i_font_size = newval.i_int;
}
else if ( !strncmp( psz_var, "marq-timeout", 12 ) )
{
p_sys->i_timeout = newval.i_int;
}
else if ( !strncmp( psz_var, "marq-position", 8 ) )
/* willing to accept a match against marq-pos */
{
p_sys->i_pos = newval.i_int;
p_sys->i_xoff = -1; /* force to relative positioning */
}
p_sys->b_need_update = VLC_TRUE;
return VLC_SUCCESS;
}

View File

@ -1,473 +1,473 @@
/*****************************************************************************
* glwin32.c: Windows OpenGL provider
*****************************************************************************
* Copyright (C) 2001-2004 VideoLAN
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/vout.h>
#include <windows.h>
#include <ddraw.h>
#include <commctrl.h>
#include <multimon.h>
#undef GetSystemMetrics
#ifndef MONITOR_DEFAULTTONEAREST
# define MONITOR_DEFAULTTONEAREST 2
#endif
#include <GL/gl.h>
#include "vout.h"
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int OpenVideo ( vlc_object_t * );
static void CloseVideo ( vlc_object_t * );
static int Init ( vout_thread_t * );
static void End ( vout_thread_t * );
static int Manage ( vout_thread_t * );
static void GLSwapBuffers( vout_thread_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_category( CAT_VIDEO );
set_subcategory( SUBCAT_VIDEO_VOUT );
set_description( _("Win32 OpenGL provider") );
set_capability( "opengl provider", 100 );
add_shortcut( "glwin32" );
set_callbacks( OpenVideo, CloseVideo );
/* FIXME: Hack to avoid unregistering our window class */
linked_with_a_crap_library_which_uses_atexit( );
vlc_module_end();
#if 0 /* FIXME */
/* check if we registered a window class because we need to
* unregister it */
WNDCLASS wndclass;
if( GetClassInfo( GetModuleHandle(NULL), "VLC DirectX", &wndclass ) )
UnregisterClass( "VLC DirectX", GetModuleHandle(NULL) );
#endif
/*****************************************************************************
* OpenVideo: allocate OpenGL provider
*****************************************************************************
* This function creates and initializes a video window.
*****************************************************************************/
static int OpenVideo( vlc_object_t *p_this )
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
vlc_value_t val;
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
return VLC_ENOMEM;
}
memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
/* Initialisations */
p_vout->pf_init = Init;
p_vout->pf_end = End;
p_vout->pf_manage = Manage;
p_vout->pf_swap = GLSwapBuffers;
p_vout->p_sys->p_ddobject = NULL;
p_vout->p_sys->p_display = NULL;
p_vout->p_sys->p_current_surface = NULL;
p_vout->p_sys->p_clipper = NULL;
p_vout->p_sys->hwnd = p_vout->p_sys->hvideownd = NULL;
p_vout->p_sys->hparent = p_vout->p_sys->hfswnd = NULL;
p_vout->p_sys->i_changes = 0;
p_vout->p_sys->b_wallpaper = 0;
vlc_mutex_init( p_vout, &p_vout->p_sys->lock );
SetRectEmpty( &p_vout->p_sys->rect_display );
SetRectEmpty( &p_vout->p_sys->rect_parent );
var_Create( p_vout, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
p_vout->p_sys->b_cursor_hidden = 0;
p_vout->p_sys->i_lastmoved = mdate();
/* Set main window's size */
p_vout->p_sys->i_window_width = p_vout->i_window_width;
p_vout->p_sys->i_window_height = p_vout->i_window_height;
/* Create the DirectXEventThread, this thread is created by us to isolate
* the Win32 PeekMessage function calls. We want to do this because
* Windows can stay blocked inside this call for a long time, and when
* this happens it thus blocks vlc's video_output thread.
* DirectXEventThread will take care of the creation of the video
* window (because PeekMessage has to be called from the same thread which
* created the window). */
msg_Dbg( p_vout, "creating DirectXEventThread" );
p_vout->p_sys->p_event =
vlc_object_create( p_vout, sizeof(event_thread_t) );
p_vout->p_sys->p_event->p_vout = p_vout;
if( vlc_thread_create( p_vout->p_sys->p_event, "DirectX Events Thread",
E_(DirectXEventThread), 0, 1 ) )
{
msg_Err( p_vout, "cannot create DirectXEventThread" );
vlc_object_destroy( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
goto error;
}
if( p_vout->p_sys->p_event->b_error )
{
msg_Err( p_vout, "DirectXEventThread failed" );
goto error;
}
vlc_object_attach( p_vout->p_sys->p_event, p_vout );
msg_Dbg( p_vout, "DirectXEventThread running" );
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
var_Get( p_vout, "video-on-top", &val );
var_Set( p_vout, "video-on-top", val );
return VLC_SUCCESS;
error:
CloseVideo( VLC_OBJECT(p_vout) );
return VLC_EGENERIC;
}
/*****************************************************************************
* Init: initialize video thread output method
*****************************************************************************/
static int Init( vout_thread_t *p_vout )
{
PIXELFORMATDESCRIPTOR pfd;
int iFormat;
/* Change the window title bar text */
PostMessage( p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );
p_vout->p_sys->hGLDC = GetDC( p_vout->p_sys->hvideownd );
/* Set the pixel format for the DC */
memset( &pfd, 0, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
iFormat = ChoosePixelFormat( p_vout->p_sys->hGLDC, &pfd );
SetPixelFormat( p_vout->p_sys->hGLDC, iFormat, &pfd );
/* Create and enable the render context */
p_vout->p_sys->hGLRC = wglCreateContext( p_vout->p_sys->hGLDC );
wglMakeCurrent( p_vout->p_sys->hGLDC, p_vout->p_sys->hGLRC );
return VLC_SUCCESS;
}
/*****************************************************************************
* End: terminate Sys video thread output method
*****************************************************************************
* Terminate an output method created by Create.
* It is called at the end of the thread.
*****************************************************************************/
static void End( vout_thread_t *p_vout )
{
wglMakeCurrent( NULL, NULL );
wglDeleteContext( p_vout->p_sys->hGLRC );
ReleaseDC( p_vout->p_sys->hvideownd, p_vout->p_sys->hGLDC );
return;
}
/*****************************************************************************
* CloseVideo: destroy Sys video thread output method
*****************************************************************************
* Terminate an output method created by Create
*****************************************************************************/
static void CloseVideo( vlc_object_t *p_this )
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
msg_Dbg( p_vout, "CloseVideo" );
if( p_vout->p_sys->p_event )
{
vlc_object_detach( p_vout->p_sys->p_event );
/* Kill DirectXEventThread */
p_vout->p_sys->p_event->b_die = VLC_TRUE;
/* we need to be sure DirectXEventThread won't stay stuck in
* GetMessage, so we send a fake message */
if( p_vout->p_sys->hwnd )
{
PostMessage( p_vout->p_sys->hwnd, WM_NULL, 0, 0);
}
vlc_thread_join( p_vout->p_sys->p_event );
vlc_object_destroy( p_vout->p_sys->p_event );
}
vlc_mutex_destroy( &p_vout->p_sys->lock );
if( p_vout->p_sys )
{
free( p_vout->p_sys );
p_vout->p_sys = NULL;
}
}
/*****************************************************************************
* Manage: handle Sys events
*****************************************************************************
* This function should be called regularly by the video output thread.
* It returns a non null value if an error occurred.
*****************************************************************************/
static int Manage( vout_thread_t *p_vout )
{
WINDOWPLACEMENT window_placement;
int i_width = p_vout->p_sys->rect_dest.right -
p_vout->p_sys->rect_dest.left;
int i_height = p_vout->p_sys->rect_dest.bottom -
p_vout->p_sys->rect_dest.top;
glViewport( 0, 0, i_width, i_height );
/* If we do not control our window, we check for geometry changes
* ourselves because the parent might not send us its events. */
vlc_mutex_lock( &p_vout->p_sys->lock );
if( p_vout->p_sys->hparent && !p_vout->b_fullscreen )
{
RECT rect_parent;
POINT point;
vlc_mutex_unlock( &p_vout->p_sys->lock );
GetClientRect( p_vout->p_sys->hparent, &rect_parent );
point.x = point.y = 0;
ClientToScreen( p_vout->p_sys->hparent, &point );
OffsetRect( &rect_parent, point.x, point.y );
if( !EqualRect( &rect_parent, &p_vout->p_sys->rect_parent ) )
{
p_vout->p_sys->rect_parent = rect_parent;
/* This one is to force the update even if only
* the position has changed */
SetWindowPos( p_vout->p_sys->hwnd, 0, 1, 1,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top, 0 );
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top, 0 );
}
}
else
{
vlc_mutex_unlock( &p_vout->p_sys->lock );
}
/* We used to call the Win32 PeekMessage function here to read the window
* messages. But since window can stay blocked into this function for a
* long time (for example when you move your window on the screen), I
* decided to isolate PeekMessage in another thread. */
/*
* Fullscreen change
*/
if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
|| p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
{
vlc_value_t val;
HWND hwnd = (p_vout->p_sys->hparent && p_vout->p_sys->hfswnd) ?
p_vout->p_sys->hfswnd : p_vout->p_sys->hwnd;
p_vout->b_fullscreen = ! p_vout->b_fullscreen;
/* We need to switch between Maximized and Normal sized window */
window_placement.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement( hwnd, &window_placement );
if( p_vout->b_fullscreen )
{
/* Change window style, no borders and no title bar */
int i_style = WS_CLIPCHILDREN | WS_VISIBLE;
SetWindowLong( hwnd, GWL_STYLE, i_style );
if( p_vout->p_sys->hparent )
{
/* Retrieve current window position so fullscreen will happen
* on the right screen */
POINT point = {0,0};
RECT rect;
ClientToScreen( p_vout->p_sys->hwnd, &point );
GetClientRect( p_vout->p_sys->hwnd, &rect );
SetWindowPos( hwnd, 0, point.x, point.y,
rect.right, rect.bottom,
SWP_NOZORDER|SWP_FRAMECHANGED );
GetWindowPlacement( hwnd, &window_placement );
}
/* Maximize window */
window_placement.showCmd = SW_SHOWMAXIMIZED;
SetWindowPlacement( hwnd, &window_placement );
SetWindowPos( hwnd, 0, 0, 0, 0, 0,
SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
if( p_vout->p_sys->hparent )
{
RECT rect;
GetClientRect( hwnd, &rect );
SetParent( p_vout->p_sys->hwnd, hwnd );
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
rect.right, rect.bottom,
SWP_NOZORDER|SWP_FRAMECHANGED );
}
SetForegroundWindow( hwnd );
}
else
{
/* Change window style, no borders and no title bar */
SetWindowLong( hwnd, GWL_STYLE, p_vout->p_sys->i_window_style );
/* Normal window */
window_placement.showCmd = SW_SHOWNORMAL;
SetWindowPlacement( hwnd, &window_placement );
SetWindowPos( hwnd, 0, 0, 0, 0, 0,
SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
if( p_vout->p_sys->hparent )
{
RECT rect;
GetClientRect( p_vout->p_sys->hparent, &rect );
SetParent( p_vout->p_sys->hwnd, p_vout->p_sys->hparent );
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
rect.right, rect.bottom,
SWP_NOZORDER|SWP_FRAMECHANGED );
ShowWindow( hwnd, SW_HIDE );
SetForegroundWindow( p_vout->p_sys->hparent );
}
/* Make sure the mouse cursor is displayed */
PostMessage( p_vout->p_sys->hwnd, WM_VLC_SHOW_MOUSE, 0, 0 );
}
/* Update the object variable and trigger callback */
val.b_bool = p_vout->b_fullscreen;
var_Set( p_vout, "fullscreen", val );
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
/*
* Pointer change
*/
if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&
(mdate() - p_vout->p_sys->i_lastmoved) > 5000000 )
{
POINT point;
HWND hwnd;
/* Hide the cursor only if it is inside our window */
GetCursorPos( &point );
hwnd = WindowFromPoint(point);
if( hwnd == p_vout->p_sys->hwnd || hwnd == p_vout->p_sys->hvideownd )
{
PostMessage( p_vout->p_sys->hwnd, WM_VLC_HIDE_MOUSE, 0, 0 );
}
else
{
p_vout->p_sys->i_lastmoved = mdate();
}
}
/*
* "Always on top" status change
*/
if( p_vout->p_sys->b_on_top_change )
{
vlc_value_t val;
HMENU hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );
var_Get( p_vout, "video-on-top", &val );
/* Set the window on top if necessary */
if( val.b_bool && !( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_CHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
else
/* The window shouldn't be on top */
if( !val.b_bool && ( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_UNCHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
p_vout->p_sys->b_on_top_change = VLC_FALSE;
}
/* Check if the event thread is still running */
if( p_vout->p_sys->p_event->b_die )
{
return VLC_EGENERIC; /* exit */
}
return VLC_SUCCESS;
}
/*****************************************************************************
* GLSwapBuffers: swap front/back buffers
*****************************************************************************/
static void GLSwapBuffers( vout_thread_t *p_vout )
{
SwapBuffers( p_vout->p_sys->hGLDC );
}
int E_(DirectXUpdateOverlay)( vout_thread_t *p_vout )
{
return 1;
}
/*****************************************************************************
* glwin32.c: Windows OpenGL provider
*****************************************************************************
* Copyright (C) 2001-2004 VideoLAN
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/vout.h>
#include <windows.h>
#include <ddraw.h>
#include <commctrl.h>
#include <multimon.h>
#undef GetSystemMetrics
#ifndef MONITOR_DEFAULTTONEAREST
# define MONITOR_DEFAULTTONEAREST 2
#endif
#include <GL/gl.h>
#include "vout.h"
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int OpenVideo ( vlc_object_t * );
static void CloseVideo ( vlc_object_t * );
static int Init ( vout_thread_t * );
static void End ( vout_thread_t * );
static int Manage ( vout_thread_t * );
static void GLSwapBuffers( vout_thread_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_category( CAT_VIDEO );
set_subcategory( SUBCAT_VIDEO_VOUT );
set_description( _("Win32 OpenGL provider") );
set_capability( "opengl provider", 100 );
add_shortcut( "glwin32" );
set_callbacks( OpenVideo, CloseVideo );
/* FIXME: Hack to avoid unregistering our window class */
linked_with_a_crap_library_which_uses_atexit( );
vlc_module_end();
#if 0 /* FIXME */
/* check if we registered a window class because we need to
* unregister it */
WNDCLASS wndclass;
if( GetClassInfo( GetModuleHandle(NULL), "VLC DirectX", &wndclass ) )
UnregisterClass( "VLC DirectX", GetModuleHandle(NULL) );
#endif
/*****************************************************************************
* OpenVideo: allocate OpenGL provider
*****************************************************************************
* This function creates and initializes a video window.
*****************************************************************************/
static int OpenVideo( vlc_object_t *p_this )
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
vlc_value_t val;
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
return VLC_ENOMEM;
}
memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
/* Initialisations */
p_vout->pf_init = Init;
p_vout->pf_end = End;
p_vout->pf_manage = Manage;
p_vout->pf_swap = GLSwapBuffers;
p_vout->p_sys->p_ddobject = NULL;
p_vout->p_sys->p_display = NULL;
p_vout->p_sys->p_current_surface = NULL;
p_vout->p_sys->p_clipper = NULL;
p_vout->p_sys->hwnd = p_vout->p_sys->hvideownd = NULL;
p_vout->p_sys->hparent = p_vout->p_sys->hfswnd = NULL;
p_vout->p_sys->i_changes = 0;
p_vout->p_sys->b_wallpaper = 0;
vlc_mutex_init( p_vout, &p_vout->p_sys->lock );
SetRectEmpty( &p_vout->p_sys->rect_display );
SetRectEmpty( &p_vout->p_sys->rect_parent );
var_Create( p_vout, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
p_vout->p_sys->b_cursor_hidden = 0;
p_vout->p_sys->i_lastmoved = mdate();
/* Set main window's size */
p_vout->p_sys->i_window_width = p_vout->i_window_width;
p_vout->p_sys->i_window_height = p_vout->i_window_height;
/* Create the DirectXEventThread, this thread is created by us to isolate
* the Win32 PeekMessage function calls. We want to do this because
* Windows can stay blocked inside this call for a long time, and when
* this happens it thus blocks vlc's video_output thread.
* DirectXEventThread will take care of the creation of the video
* window (because PeekMessage has to be called from the same thread which
* created the window). */
msg_Dbg( p_vout, "creating DirectXEventThread" );
p_vout->p_sys->p_event =
vlc_object_create( p_vout, sizeof(event_thread_t) );
p_vout->p_sys->p_event->p_vout = p_vout;
if( vlc_thread_create( p_vout->p_sys->p_event, "DirectX Events Thread",
E_(DirectXEventThread), 0, 1 ) )
{
msg_Err( p_vout, "cannot create DirectXEventThread" );
vlc_object_destroy( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
goto error;
}
if( p_vout->p_sys->p_event->b_error )
{
msg_Err( p_vout, "DirectXEventThread failed" );
goto error;
}
vlc_object_attach( p_vout->p_sys->p_event, p_vout );
msg_Dbg( p_vout, "DirectXEventThread running" );
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
var_Get( p_vout, "video-on-top", &val );
var_Set( p_vout, "video-on-top", val );
return VLC_SUCCESS;
error:
CloseVideo( VLC_OBJECT(p_vout) );
return VLC_EGENERIC;
}
/*****************************************************************************
* Init: initialize video thread output method
*****************************************************************************/
static int Init( vout_thread_t *p_vout )
{
PIXELFORMATDESCRIPTOR pfd;
int iFormat;
/* Change the window title bar text */
PostMessage( p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );
p_vout->p_sys->hGLDC = GetDC( p_vout->p_sys->hvideownd );
/* Set the pixel format for the DC */
memset( &pfd, 0, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
iFormat = ChoosePixelFormat( p_vout->p_sys->hGLDC, &pfd );
SetPixelFormat( p_vout->p_sys->hGLDC, iFormat, &pfd );
/* Create and enable the render context */
p_vout->p_sys->hGLRC = wglCreateContext( p_vout->p_sys->hGLDC );
wglMakeCurrent( p_vout->p_sys->hGLDC, p_vout->p_sys->hGLRC );
return VLC_SUCCESS;
}
/*****************************************************************************
* End: terminate Sys video thread output method
*****************************************************************************
* Terminate an output method created by Create.
* It is called at the end of the thread.
*****************************************************************************/
static void End( vout_thread_t *p_vout )
{
wglMakeCurrent( NULL, NULL );
wglDeleteContext( p_vout->p_sys->hGLRC );
ReleaseDC( p_vout->p_sys->hvideownd, p_vout->p_sys->hGLDC );
return;
}
/*****************************************************************************
* CloseVideo: destroy Sys video thread output method
*****************************************************************************
* Terminate an output method created by Create
*****************************************************************************/
static void CloseVideo( vlc_object_t *p_this )
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
msg_Dbg( p_vout, "CloseVideo" );
if( p_vout->p_sys->p_event )
{
vlc_object_detach( p_vout->p_sys->p_event );
/* Kill DirectXEventThread */
p_vout->p_sys->p_event->b_die = VLC_TRUE;
/* we need to be sure DirectXEventThread won't stay stuck in
* GetMessage, so we send a fake message */
if( p_vout->p_sys->hwnd )
{
PostMessage( p_vout->p_sys->hwnd, WM_NULL, 0, 0);
}
vlc_thread_join( p_vout->p_sys->p_event );
vlc_object_destroy( p_vout->p_sys->p_event );
}
vlc_mutex_destroy( &p_vout->p_sys->lock );
if( p_vout->p_sys )
{
free( p_vout->p_sys );
p_vout->p_sys = NULL;
}
}
/*****************************************************************************
* Manage: handle Sys events
*****************************************************************************
* This function should be called regularly by the video output thread.
* It returns a non null value if an error occurred.
*****************************************************************************/
static int Manage( vout_thread_t *p_vout )
{
WINDOWPLACEMENT window_placement;
int i_width = p_vout->p_sys->rect_dest.right -
p_vout->p_sys->rect_dest.left;
int i_height = p_vout->p_sys->rect_dest.bottom -
p_vout->p_sys->rect_dest.top;
glViewport( 0, 0, i_width, i_height );
/* If we do not control our window, we check for geometry changes
* ourselves because the parent might not send us its events. */
vlc_mutex_lock( &p_vout->p_sys->lock );
if( p_vout->p_sys->hparent && !p_vout->b_fullscreen )
{
RECT rect_parent;
POINT point;
vlc_mutex_unlock( &p_vout->p_sys->lock );
GetClientRect( p_vout->p_sys->hparent, &rect_parent );
point.x = point.y = 0;
ClientToScreen( p_vout->p_sys->hparent, &point );
OffsetRect( &rect_parent, point.x, point.y );
if( !EqualRect( &rect_parent, &p_vout->p_sys->rect_parent ) )
{
p_vout->p_sys->rect_parent = rect_parent;
/* This one is to force the update even if only
* the position has changed */
SetWindowPos( p_vout->p_sys->hwnd, 0, 1, 1,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top, 0 );
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top, 0 );
}
}
else
{
vlc_mutex_unlock( &p_vout->p_sys->lock );
}
/* We used to call the Win32 PeekMessage function here to read the window
* messages. But since window can stay blocked into this function for a
* long time (for example when you move your window on the screen), I
* decided to isolate PeekMessage in another thread. */
/*
* Fullscreen change
*/
if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
|| p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
{
vlc_value_t val;
HWND hwnd = (p_vout->p_sys->hparent && p_vout->p_sys->hfswnd) ?
p_vout->p_sys->hfswnd : p_vout->p_sys->hwnd;
p_vout->b_fullscreen = ! p_vout->b_fullscreen;
/* We need to switch between Maximized and Normal sized window */
window_placement.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement( hwnd, &window_placement );
if( p_vout->b_fullscreen )
{
/* Change window style, no borders and no title bar */
int i_style = WS_CLIPCHILDREN | WS_VISIBLE;
SetWindowLong( hwnd, GWL_STYLE, i_style );
if( p_vout->p_sys->hparent )
{
/* Retrieve current window position so fullscreen will happen
* on the right screen */
POINT point = {0,0};
RECT rect;
ClientToScreen( p_vout->p_sys->hwnd, &point );
GetClientRect( p_vout->p_sys->hwnd, &rect );
SetWindowPos( hwnd, 0, point.x, point.y,
rect.right, rect.bottom,
SWP_NOZORDER|SWP_FRAMECHANGED );
GetWindowPlacement( hwnd, &window_placement );
}
/* Maximize window */
window_placement.showCmd = SW_SHOWMAXIMIZED;
SetWindowPlacement( hwnd, &window_placement );
SetWindowPos( hwnd, 0, 0, 0, 0, 0,
SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
if( p_vout->p_sys->hparent )
{
RECT rect;
GetClientRect( hwnd, &rect );
SetParent( p_vout->p_sys->hwnd, hwnd );
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
rect.right, rect.bottom,
SWP_NOZORDER|SWP_FRAMECHANGED );
}
SetForegroundWindow( hwnd );
}
else
{
/* Change window style, no borders and no title bar */
SetWindowLong( hwnd, GWL_STYLE, p_vout->p_sys->i_window_style );
/* Normal window */
window_placement.showCmd = SW_SHOWNORMAL;
SetWindowPlacement( hwnd, &window_placement );
SetWindowPos( hwnd, 0, 0, 0, 0, 0,
SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
if( p_vout->p_sys->hparent )
{
RECT rect;
GetClientRect( p_vout->p_sys->hparent, &rect );
SetParent( p_vout->p_sys->hwnd, p_vout->p_sys->hparent );
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
rect.right, rect.bottom,
SWP_NOZORDER|SWP_FRAMECHANGED );
ShowWindow( hwnd, SW_HIDE );
SetForegroundWindow( p_vout->p_sys->hparent );
}
/* Make sure the mouse cursor is displayed */
PostMessage( p_vout->p_sys->hwnd, WM_VLC_SHOW_MOUSE, 0, 0 );
}
/* Update the object variable and trigger callback */
val.b_bool = p_vout->b_fullscreen;
var_Set( p_vout, "fullscreen", val );
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
/*
* Pointer change
*/
if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&
(mdate() - p_vout->p_sys->i_lastmoved) > 5000000 )
{
POINT point;
HWND hwnd;
/* Hide the cursor only if it is inside our window */
GetCursorPos( &point );
hwnd = WindowFromPoint(point);
if( hwnd == p_vout->p_sys->hwnd || hwnd == p_vout->p_sys->hvideownd )
{
PostMessage( p_vout->p_sys->hwnd, WM_VLC_HIDE_MOUSE, 0, 0 );
}
else
{
p_vout->p_sys->i_lastmoved = mdate();
}
}
/*
* "Always on top" status change
*/
if( p_vout->p_sys->b_on_top_change )
{
vlc_value_t val;
HMENU hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );
var_Get( p_vout, "video-on-top", &val );
/* Set the window on top if necessary */
if( val.b_bool && !( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_CHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
else
/* The window shouldn't be on top */
if( !val.b_bool && ( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_UNCHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
p_vout->p_sys->b_on_top_change = VLC_FALSE;
}
/* Check if the event thread is still running */
if( p_vout->p_sys->p_event->b_die )
{
return VLC_EGENERIC; /* exit */
}
return VLC_SUCCESS;
}
/*****************************************************************************
* GLSwapBuffers: swap front/back buffers
*****************************************************************************/
static void GLSwapBuffers( vout_thread_t *p_vout )
{
SwapBuffers( p_vout->p_sys->hGLDC );
}
int E_(DirectXUpdateOverlay)( vout_thread_t *p_vout )
{
return 1;
}

Some files were not shown because too many files have changed in this diff Show More