Commit 1b75d79e authored by Damien Fouilleul's avatar Damien Fouilleul

- source cleanup

- few bugs fixed
- added suport to Ole Extent measurments to improve compatibilty
parent ad67acad
...@@ -344,3 +344,9 @@ D: SSL/TLS support (core, HTTP server, HTTP input) ...@@ -344,3 +344,9 @@ D: SSL/TLS support (core, HTTP server, HTTP input)
D: VOC files demultiplexer D: VOC files demultiplexer
S: France S: France
N: Damien Fouilleul
E: Damien.Fouilleul@laposte.net
C: Quovodis
D: ActiveX control
S: Germany
...@@ -67,7 +67,7 @@ make sure that the plugin path is set in the registry as per following example: ...@@ -67,7 +67,7 @@ make sure that the plugin path is set in the registry as per following example:
[HKEY_LOCAL_MACHINE\Software\VideoLAN\VLC] [HKEY_LOCAL_MACHINE\Software\VideoLAN\VLC]
InstallDir="C:\Program Files\VideoLAN\VLC" InstallDir="C:\Program Files\VideoLAN\VLC"
The InstallDir must contain the 'plugins' directory. The InstallDir must be the parent directory of the 'plugins' directory.
WARNING: Both control and plugins must come from the same build source tree. WARNING: Both control and plugins must come from the same build source tree.
Otherwise, at best, the control will not play any content, at worse Otherwise, at best, the control will not play any content, at worse
......
...@@ -225,6 +225,16 @@ STDMETHODIMP VLCOleObject::GetClipboardData(DWORD dwReserved, LPDATAOBJECT *ppDa ...@@ -225,6 +225,16 @@ STDMETHODIMP VLCOleObject::GetClipboardData(DWORD dwReserved, LPDATAOBJECT *ppDa
STDMETHODIMP VLCOleObject::GetExtent(DWORD dwDrawAspect, SIZEL *pSizel) STDMETHODIMP VLCOleObject::GetExtent(DWORD dwDrawAspect, SIZEL *pSizel)
{ {
if( NULL == pSizel )
return E_POINTER;
if( dwDrawAspect & DVASPECT_CONTENT )
{
*pSizel = _p_instance->getExtent();
return S_OK;
}
pSizel->cx= 0L;
pSizel->cy= 0L;
return E_NOTIMPL; return E_NOTIMPL;
}; };
...@@ -314,6 +324,48 @@ STDMETHODIMP VLCOleObject::SetColorScheme(LOGPALETTE *pLogpal) ...@@ -314,6 +324,48 @@ STDMETHODIMP VLCOleObject::SetColorScheme(LOGPALETTE *pLogpal)
STDMETHODIMP VLCOleObject::SetExtent(DWORD dwDrawAspect, SIZEL *pSizel) STDMETHODIMP VLCOleObject::SetExtent(DWORD dwDrawAspect, SIZEL *pSizel)
{ {
if( NULL == pSizel )
return E_POINTER;
if( dwDrawAspect & DVASPECT_CONTENT )
{
_p_instance->setExtent(*pSizel);
if( _p_instance->isInPlaceActive() )
{
LPOLEINPLACESITE p_inPlaceSite;
if( SUCCEEDED(_p_clientsite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
LPOLECONTROLSITE p_controlSite;
RECT posRect = _p_instance->getPosRect();
if( SUCCEEDED(_p_clientsite->QueryInterface(IID_IOleControlSite, (void**)&p_controlSite)) )
{
// use HIMETRIC to container transform
POINTL extent = { pSizel->cx, pSizel->cy };
POINTF container;
if( SUCCEEDED(p_controlSite->TransformCoords(&extent,
&container, XFORMCOORDS_SIZE|XFORMCOORDS_HIMETRICTOCONTAINER)) )
{
posRect.right = ((LONG)container.x)+posRect.left;
posRect.bottom = ((LONG)container.y)+posRect.top;
}
p_controlSite->Release();
}
else {
// use HIMETRIC to display transform
HDC hDC = CreateDevDC(NULL);
posRect.right = (pSizel->cx*GetDeviceCaps(hDC, LOGPIXELSX)/2540L)+posRect.left;
posRect.bottom = (pSizel->cy*GetDeviceCaps(hDC, LOGPIXELSY)/2540L)+posRect.top;
DeleteDC(hDC);
}
p_inPlaceSite->OnPosRectChange(&posRect);
p_inPlaceSite->Release();
}
}
return S_OK;
}
return E_NOTIMPL; return E_NOTIMPL;
}; };
......
...@@ -116,7 +116,7 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr ...@@ -116,7 +116,7 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr
return _p_instance->onLoad(); return _p_instance->onLoad();
}; };
STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDiry, BOOL fSaveAllProperties) STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties)
{ {
if( NULL == pPropBag ) if( NULL == pPropBag )
return E_POINTER; return E_POINTER;
......
...@@ -250,6 +250,12 @@ VLCPlugin::VLCPlugin(VLCPluginClass *p_class) : ...@@ -250,6 +250,12 @@ VLCPlugin::VLCPlugin(VLCPluginClass *p_class) :
vlcObjectSafety = new VLCObjectSafety(this); vlcObjectSafety = new VLCObjectSafety(this);
vlcControl = new VLCControl(this); vlcControl = new VLCControl(this);
vlcViewObject = new VLCViewObject(this); vlcViewObject = new VLCViewObject(this);
// set default/preferred size (320x240) pixels in HIMETRIC
HDC hDC = CreateDevDC(NULL);
_extent.cx = (320*2540L)/GetDeviceCaps(hDC, LOGPIXELSX);
_extent.cy = (240*2540L)/GetDeviceCaps(hDC, LOGPIXELSY);
DeleteDC(hDC);
}; };
VLCPlugin::~VLCPlugin() VLCPlugin::~VLCPlugin()
...@@ -383,6 +389,12 @@ STDMETHODIMP VLCPlugin::QueryInterface(REFIID riid, void **ppv) ...@@ -383,6 +389,12 @@ STDMETHODIMP VLCPlugin::QueryInterface(REFIID riid, void **ppv)
*ppv = reinterpret_cast<LPVOID>(vlcViewObject); *ppv = reinterpret_cast<LPVOID>(vlcViewObject);
return NOERROR; return NOERROR;
} }
else if( IID_IViewObject2 == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcViewObject);
return NOERROR;
}
*ppv = NULL; *ppv = NULL;
...@@ -407,29 +419,30 @@ STDMETHODIMP_(ULONG) VLCPlugin::Release(void) ...@@ -407,29 +419,30 @@ STDMETHODIMP_(ULONG) VLCPlugin::Release(void)
////////////////////////////////////// //////////////////////////////////////
/* /*
** we use an in-place child window to represent plugin viewport, ** we use a window to represent plugin viewport,
** whose size is limited by the clipping rectangle ** whose geometry is limited by the clipping rectangle
** all drawing within this window must follow ** all drawing within this window must follow must
** cartesian coordinate system represented by _bounds. ** follow coordinates system described in lprPosRect
*/ */
void VLCPlugin::calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect) static void getViewportCoords(LPRECT lprPosRect, LPRECT lprClipRect)
{ {
_bounds.right = lprPosRect->right-lprPosRect->left; RECT bounds;
bounds.right = lprPosRect->right-lprPosRect->left;
if( lprcClipRect->left <= lprPosRect->left ) if( lprClipRect->left <= lprPosRect->left )
{ {
// left side is not clipped out // left side is not clipped out
_bounds.left = 0; bounds.left = 0;
if( lprcClipRect->right >= lprPosRect->right ) if( lprClipRect->right >= lprPosRect->right )
{ {
// right side is not clipped out, no change // right side is not clipped out, no change
} }
else if( lprcClipRect->right >= lprPosRect->left ) else if( lprClipRect->right >= lprPosRect->left )
{ {
// right side is clipped out // right side is clipped out
lprPosRect->right = lprcClipRect->right; lprPosRect->right = lprClipRect->right;
} }
else else
{ {
...@@ -440,36 +453,36 @@ void VLCPlugin::calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect) ...@@ -440,36 +453,36 @@ void VLCPlugin::calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect)
else else
{ {
// left side is clipped out // left side is clipped out
_bounds.left = lprPosRect->left-lprcClipRect->left; bounds.left = lprPosRect->left-lprClipRect->left;
_bounds.right += _bounds.left; bounds.right += bounds.left;
lprPosRect->left = lprcClipRect->left; lprPosRect->left = lprClipRect->left;
if( lprcClipRect->right >= lprPosRect->right ) if( lprClipRect->right >= lprPosRect->right )
{ {
// right side is not clipped out // right side is not clipped out
} }
else else
{ {
// right side is clipped out // right side is clipped out
lprPosRect->right = lprcClipRect->right; lprPosRect->right = lprClipRect->right;
} }
} }
_bounds.bottom = lprPosRect->bottom-lprPosRect->top; bounds.bottom = lprPosRect->bottom-lprPosRect->top;
if( lprcClipRect->top <= lprPosRect->top ) if( lprClipRect->top <= lprPosRect->top )
{ {
// top side is not clipped out // top side is not clipped out
_bounds.top = 0; bounds.top = 0;
if( lprcClipRect->bottom >= lprPosRect->bottom ) if( lprClipRect->bottom >= lprPosRect->bottom )
{ {
// bottom side is not clipped out, no change // bottom side is not clipped out, no change
} }
else if( lprcClipRect->bottom >= lprPosRect->top ) else if( lprClipRect->bottom >= lprPosRect->top )
{ {
// bottom side is clipped out // bottom side is clipped out
lprPosRect->bottom = lprcClipRect->bottom; lprPosRect->bottom = lprClipRect->bottom;
} }
else else
{ {
...@@ -479,20 +492,22 @@ void VLCPlugin::calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect) ...@@ -479,20 +492,22 @@ void VLCPlugin::calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect)
} }
else else
{ {
_bounds.top = lprPosRect->top-lprcClipRect->top; bounds.top = lprPosRect->top-lprClipRect->top;
_bounds.bottom += _bounds.top; bounds.bottom += bounds.top;
lprPosRect->top = lprcClipRect->top; lprPosRect->top = lprClipRect->top;
if( lprcClipRect->bottom >= lprPosRect->bottom ) if( lprClipRect->bottom >= lprPosRect->bottom )
{ {
// bottom side is not clipped out // bottom side is not clipped out
} }
else else
{ {
// bottom side is clipped out // bottom side is clipped out
lprPosRect->bottom = lprcClipRect->bottom; lprPosRect->bottom = lprClipRect->bottom;
} }
} }
*lprClipRect = *lprPosRect;
*lprPosRect = bounds;
}; };
HRESULT VLCPlugin::onInit(BOOL isNew) HRESULT VLCPlugin::onInit(BOOL isNew)
...@@ -522,7 +537,7 @@ HRESULT VLCPlugin::onInit(BOOL isNew) ...@@ -522,7 +537,7 @@ HRESULT VLCPlugin::onInit(BOOL isNew)
RegCloseKey( h_key ); RegCloseKey( h_key );
} }
#if 0 #if 1
ppsz_argv[0] = "C:\\cygwin\\home\\Damien_Fouilleul\\dev\\videolan\\vlc-trunk\\vlc"; ppsz_argv[0] = "C:\\cygwin\\home\\Damien_Fouilleul\\dev\\videolan\\vlc-trunk\\vlc";
#endif #endif
...@@ -610,16 +625,30 @@ BOOL VLCPlugin::isInPlaceActive(void) ...@@ -610,16 +625,30 @@ BOOL VLCPlugin::isInPlaceActive(void)
HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect) HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect)
{ {
RECT posRect = *lprcPosRect; RECT posRect = *lprcPosRect;
RECT clipRect = *lprcClipRect;
calcPositionChange(&posRect, lprcClipRect); /*
** record keeping of control geometry within container
*/
_posRect = posRect;
/*
** convert posRect & clipRect to match control viewport coordinates
*/
getViewportCoords(&posRect, &clipRect);
/*
** Create a window for in place activated control.
** the window geometry represents the control viewport
** so that embedded video is always properly clipped.
*/
_inplacewnd = CreateWindow(_p_class->getInPlaceWndClassName(), _inplacewnd = CreateWindow(_p_class->getInPlaceWndClassName(),
"VLC Plugin In-Place Window", "VLC Plugin In-Place Window",
WS_CHILD|WS_CLIPCHILDREN|WS_TABSTOP, WS_CHILD|WS_CLIPCHILDREN|WS_TABSTOP,
posRect.left, clipRect.left,
posRect.top, clipRect.top,
posRect.right-posRect.left, clipRect.right-clipRect.left,
posRect.bottom-posRect.top, clipRect.bottom-clipRect.top,
hwndParent, hwndParent,
0, 0,
_p_class->getHInstance(), _p_class->getHInstance(),
...@@ -631,13 +660,18 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc ...@@ -631,13 +660,18 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
SetWindowLongPtr(_inplacewnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); SetWindowLongPtr(_inplacewnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
/*
** VLC embedded video geometry automatically matches parent window.
** hence create a child window so that video position and size
** is always correct relative to the viewport bounds
*/
_videownd = CreateWindow(_p_class->getVideoWndClassName(), _videownd = CreateWindow(_p_class->getVideoWndClassName(),
"VLC Plugin Video Window", "VLC Plugin Video Window",
WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE, WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,
_bounds.left, posRect.left,
_bounds.top, posRect.top,
_bounds.right-_bounds.left, posRect.right-posRect.left,
_bounds.bottom-_bounds.top, posRect.bottom-posRect.top,
_inplacewnd, _inplacewnd,
0, 0,
_p_class->getHInstance(), _p_class->getHInstance(),
...@@ -763,36 +797,48 @@ void VLCPlugin::onPaint(HDC hdc, const RECT &bounds, const RECT &pr) ...@@ -763,36 +797,48 @@ void VLCPlugin::onPaint(HDC hdc, const RECT &bounds, const RECT &pr)
void VLCPlugin::onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect) void VLCPlugin::onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect)
{ {
RECT posRect = *lprcPosRect; RECT clipRect = *lprcClipRect;
RECT posRect = *lprcPosRect;
/*
** record keeping of control geometry within container
*/
_posRect = posRect;
calcPositionChange(&posRect, lprcClipRect); /*
** convert posRect & clipRect to match control viewport coordinates
*/
getViewportCoords(&posRect, &clipRect);
/* /*
** change in-place window geometry to match clipping region ** change in-place window geometry to match clipping region
*/ */
MoveWindow(_inplacewnd, MoveWindow(_inplacewnd,
posRect.left, clipRect.left,
posRect.top, clipRect.top,
posRect.right-posRect.left, clipRect.right-clipRect.left,
posRect.bottom-posRect.top, clipRect.bottom-clipRect.top,
FALSE); FALSE);
/* /*
** change video window geometry to match object bounds within clipping region ** change video window geometry to match object bounds within clipping region
*/ */
MoveWindow(_videownd, MoveWindow(_videownd,
_bounds.left, posRect.left,
_bounds.top, posRect.top,
_bounds.right-_bounds.left, posRect.right-posRect.left,
_bounds.bottom-_bounds.top, posRect.bottom-posRect.top,
FALSE); FALSE);
RECT updateRect;
updateRect.left = -_bounds.left; /*
updateRect.top = -_bounds.top; ** force a full refresh of control content
updateRect.right = _bounds.right-_bounds.left; */
updateRect.bottom = _bounds.bottom-_bounds.top; RECT updateRect;
updateRect.left = -posRect.left;
updateRect.top = -posRect.top;
updateRect.right = posRect.right-posRect.left;
updateRect.bottom = posRect.bottom-posRect.top;
ValidateRect(_videownd, NULL); ValidateRect(_videownd, NULL);
InvalidateRect(_videownd, &updateRect, FALSE); InvalidateRect(_videownd, &updateRect, FALSE);
......
...@@ -116,6 +116,7 @@ public: ...@@ -116,6 +116,7 @@ public:
void setVisible(BOOL fVisible); void setVisible(BOOL fVisible);
BOOL getVisible(void) { return _b_visible; }; BOOL getVisible(void) { return _b_visible; };
// container events // container events
void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect); void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect);
void onPaint(HDC hdc, const RECT &bounds, const RECT &pr); void onPaint(HDC hdc, const RECT &bounds, const RECT &pr);
...@@ -126,14 +127,19 @@ public: ...@@ -126,14 +127,19 @@ public:
void fireOnPauseEvent(void); void fireOnPauseEvent(void);
void fireOnStopEvent(void); void fireOnStopEvent(void);
// control size in HIMETRIC
const SIZEL& getExtent(void) { return _extent; };
void setExtent(const SIZEL& extent) { _extent = extent; };
// control geometry within container
RECT getPosRect(void) { return _posRect; };
protected: protected:
virtual ~VLCPlugin(); virtual ~VLCPlugin();
private: private:
void calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect);
//implemented interfaces //implemented interfaces
class VLCOleObject *vlcOleObject; class VLCOleObject *vlcOleObject;
class VLCOleControl *vlcOleControl; class VLCOleControl *vlcOleControl;
...@@ -152,7 +158,6 @@ private: ...@@ -152,7 +158,6 @@ private:
HWND _inplacewnd; HWND _inplacewnd;
// video window (Drawing window) // video window (Drawing window)
HWND _videownd; HWND _videownd;
RECT _bounds;
VLCPluginClass *_p_class; VLCPluginClass *_p_class;
ULONG _i_ref; ULONG _i_ref;
...@@ -163,7 +168,10 @@ private: ...@@ -163,7 +168,10 @@ private:
BOOL _b_loopmode; BOOL _b_loopmode;
BOOL _b_visible; BOOL _b_visible;
BOOL _b_sendevents; BOOL _b_sendevents;
int _i_vlc; int _i_vlc;
SIZEL _extent;
RECT _posRect;
}; };
#endif #endif
......
...@@ -98,4 +98,36 @@ HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v) ...@@ -98,4 +98,36 @@ HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v)
return hr; return hr;
}; };
HDC CreateDevDC(DVTARGETDEVICE *ptd)
{
HDC hdc=NULL;
LPDEVNAMES lpDevNames;
LPDEVMODE lpDevMode;
LPTSTR lpszDriverName;
LPTSTR lpszDeviceName;
LPTSTR lpszPortName;
if (ptd == NULL) {
hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
goto errReturn;
}
lpDevNames = (LPDEVNAMES) ptd; // offset for size field
if (ptd->tdExtDevmodeOffset == 0) {
lpDevMode = NULL;
}else{
lpDevMode = (LPDEVMODE) ((LPTSTR)ptd + ptd->tdExtDevmodeOffset);
}
lpszDriverName = (LPTSTR) lpDevNames + ptd->tdDriverNameOffset;
lpszDeviceName = (LPTSTR) lpDevNames + ptd->tdDeviceNameOffset;
lpszPortName = (LPTSTR) lpDevNames + ptd->tdPortNameOffset;
hdc = CreateDC(lpszDriverName, lpszDeviceName, lpszPortName, lpDevMode);
errReturn:
return hdc;
};
...@@ -34,6 +34,9 @@ extern BSTR BSTRFromCStr(int codePage, const char *s); ...@@ -34,6 +34,9 @@ extern BSTR BSTRFromCStr(int codePage, const char *s);
// properties // properties
extern HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v); extern HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v);
// properties
extern HDC CreateDevDC(DVTARGETDEVICE *ptd);
// enumeration // enumeration
template<class T> class VLCEnum : IUnknown template<class T> class VLCEnum : IUnknown
{ {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "plugin.h" #include "plugin.h"
#include "viewobject.h" #include "viewobject.h"
#include <iostream> #include "utils.h"
using namespace std; using namespace std;
...@@ -31,25 +31,18 @@ STDMETHODIMP VLCViewObject::Draw(DWORD dwAspect, LONG lindex, PVOID pvAspect, ...@@ -31,25 +31,18 @@ STDMETHODIMP VLCViewObject::Draw(DWORD dwAspect, LONG lindex, PVOID pvAspect,
DVTARGETDEVICE *ptd, HDC hicTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, DVTARGETDEVICE *ptd, HDC hicTargetDev, HDC hdcDraw, LPCRECTL lprcBounds,
LPCRECTL lprcWBounds, BOOL(CALLBACK *pfnContinue)(DWORD), DWORD dwContinue) LPCRECTL lprcWBounds, BOOL(CALLBACK *pfnContinue)(DWORD), DWORD dwContinue)
{ {
switch( dwAspect ) if( dwAspect & DVASPECT_CONTENT )
{ {
case DVASPECT_CONTENT: if( _p_instance->getVisible() )
if( _p_instance->getVisible() ) {
{ RECT bounds;
RECT bounds; bounds.left = lprcBounds->left;
bounds.left = lprcBounds->left; bounds.top = lprcBounds->top;
bounds.top = lprcBounds->top; bounds.right = lprcBounds->right;
bounds.right = lprcBounds->right; bounds.bottom = lprcBounds->bottom;
bounds.bottom = lprcBounds->bottom; _p_instance->onPaint(hdcDraw, bounds, bounds);
_p_instance->onPaint(hdcDraw, bounds, bounds); }
} return S_OK;
return S_OK;
case DVASPECT_THUMBNAIL:
break;
case DVASPECT_ICON:
break;
case DVASPECT_DOCPRINT:
break;
} }
return E_NOTIMPL; return E_NOTIMPL;
}; };
...@@ -60,19 +53,28 @@ STDMETHODIMP VLCViewObject::Freeze(DWORD dwAspect, LONG lindex, ...@@ -60,19 +53,28 @@ STDMETHODIMP VLCViewObject::Freeze(DWORD dwAspect, LONG lindex,
if( NULL != pvAspect ) if( NULL != pvAspect )
return E_INVALIDARG; return E_INVALIDARG;
return OLE_E_BLANK; return E_NOTIMPL;
}; };
STDMETHODIMP VLCViewObject::GetAdvise(LPDWORD pdwAspect, LPDWORD padvf, STDMETHODIMP VLCViewObject::GetAdvise(LPDWORD pdwAspect, LPDWORD padvf,
LPADVISESINK *ppAdviseSink) LPADVISESINK *ppAdviseSink)
{ {
return E_NOTIMPL; if( NULL != pdwAspect )
*pdwAspect = 0;
if( NULL != padvf )
*padvf = 0;
if( NULL != ppAdviseSink )
*ppAdviseSink = NULL;
return S_OK;
}; };
STDMETHODIMP VLCViewObject::GetColorSet(DWORD dwAspect, LONG lindex, STDMETHODIMP VLCViewObject::GetColorSet(DWORD dwAspect, LONG lindex,
PVOID pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LPLOGPALETTE *ppColorSet) PVOID pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LPLOGPALETTE *ppColorSet)
{ {
return E_NOTIMPL; return S_FALSE;
}; };
STDMETHODIMP VLCViewObject::SetAdvise(DWORD dwAspect, DWORD advf, STDMETHODIMP VLCViewObject::SetAdvise(DWORD dwAspect, DWORD advf,
...@@ -86,3 +88,16 @@ STDMETHODIMP VLCViewObject::Unfreeze(DWORD dwFreeze) ...@@ -86,3 +88,16 @@ STDMETHODIMP VLCViewObject::Unfreeze(DWORD dwFreeze)
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCViewObject::GetExtent(DWORD dwAspect, LONG lindex,
DVTARGETDEVICE *ptd, LPSIZEL lpSizel)
{
if( dwAspect & DVASPECT_CONTENT )
{
*lpSizel = _p_instance->getExtent();
return S_OK;
}
lpSizel->cx= 0L;
lpSizel->cy= 0L;
return E_NOTIMPL;
};
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <oleidl.h> #include <oleidl.h>
class VLCViewObject : public IViewObject class VLCViewObject : public IViewObject2
{ {
public: public:
...@@ -39,7 +39,8 @@ public: ...@@ -39,7 +39,8 @@ public:
if( (NULL != ppv) if( (NULL != ppv)
&& (IID_IUnknown == riid) && (IID_IUnknown == riid)
&& (IID_IPersist == riid) && (IID_IPersist == riid)
&& (IID_IViewObject == riid) ) { && (IID_IViewObject == riid)
&& (IID_IViewObject2 == riid) ) {
AddRef(); AddRef();
*ppv = reinterpret_cast<LPVOID>(this); *ppv = reinterpret_cast<LPVOID>(this);
return NOERROR; return NOERROR;
...@@ -58,6 +59,9 @@ public: ...@@ -58,6 +59,9 @@ public:
STDMETHODIMP SetAdvise(DWORD,DWORD,LPADVISESINK); STDMETHODIMP SetAdvise(DWORD,DWORD,LPADVISESINK);
STDMETHODIMP Unfreeze(DWORD); STDMETHODIMP Unfreeze(DWORD);
// IViewObject2 methods
STDMETHODIMP GetExtent(DWORD,LONG,DVTARGETDEVICE *,LPSIZEL);
private: private:
VLCPlugin *_p_instance; VLCPlugin *_p_instance;
......
...@@ -54,6 +54,9 @@ HRESULT VLCControl::getTypeInfo(void) ...@@ -54,6 +54,9 @@ HRESULT VLCControl::getTypeInfo(void)
STDMETHODIMP VLCControl::GetTypeInfoCount(UINT* pctInfo) STDMETHODIMP VLCControl::GetTypeInfoCount(UINT* pctInfo)
{ {
if( NULL == pctInfo )
return E_INVALIDARG;
if( SUCCEEDED(getTypeInfo()) ) if( SUCCEEDED(getTypeInfo()) )
*pctInfo = 1; *pctInfo = 1;
else else
...@@ -102,7 +105,7 @@ STDMETHODIMP VLCControl::Invoke(DISPID dispIdMember, REFIID riid, ...@@ -102,7 +105,7 @@ STDMETHODIMP VLCControl::Invoke(DISPID dispIdMember, REFIID riid,
STDMETHODIMP VLCControl::get_Value(VARIANT *pvarValue) STDMETHODIMP VLCControl::get_Value(VARIANT *pvarValue)
{ {
if( NULL == pvarValue ) if( NULL == pvarValue )
return E_INVALIDARG; return E_POINTER;
V_VT(pvarValue) = VT_BOOL; V_VT(pvarValue) = VT_BOOL;
return get_Playing(&V_BOOL(pvarValue)); return get_Playing(&V_BOOL(pvarValue));
...@@ -127,7 +130,7 @@ STDMETHODIMP VLCControl::put_Value(VARIANT pvarValue) ...@@ -127,7 +130,7 @@ STDMETHODIMP VLCControl::put_Value(VARIANT pvarValue)
STDMETHODIMP VLCControl::get_Visible(VARIANT_BOOL *isVisible) STDMETHODIMP VLCControl::get_Visible(VARIANT_BOOL *isVisible)
{ {
if( NULL == isVisible ) if( NULL == isVisible )
return E_INVALIDARG; return E_POINTER;
*isVisible = _p_instance->getVisible(); *isVisible = _p_instance->getVisible();
...@@ -180,7 +183,7 @@ STDMETHODIMP VLCControl::stop(void) ...@@ -180,7 +183,7 @@ STDMETHODIMP VLCControl::stop(void)
STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying) STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying)
{ {
if( NULL == isPlaying ) if( NULL == isPlaying )
return E_INVALIDARG; return E_POINTER;
int i_vlc = _p_instance->getVLCObject(); int i_vlc = _p_instance->getVLCObject();
if( i_vlc ) if( i_vlc )
...@@ -215,7 +218,7 @@ STDMETHODIMP VLCControl::put_Playing(VARIANT_BOOL isPlaying) ...@@ -215,7 +218,7 @@ STDMETHODIMP VLCControl::put_Playing(VARIANT_BOOL isPlaying)
STDMETHODIMP VLCControl::get_Position(float *position) STDMETHODIMP VLCControl::get_Position(float *position)
{ {
if( NULL == position ) if( NULL == position )
return E_INVALIDARG; return E_POINTER;
int i_vlc = _p_instance->getVLCObject(); int i_vlc = _p_instance->getVLCObject();
if( i_vlc ) if( i_vlc )
...@@ -241,7 +244,7 @@ STDMETHODIMP VLCControl::put_Position(float position) ...@@ -241,7 +244,7 @@ STDMETHODIMP VLCControl::put_Position(float position)
STDMETHODIMP VLCControl::get_Time(int *seconds) STDMETHODIMP VLCControl::get_Time(int *seconds)
{ {
if( NULL == seconds ) if( NULL == seconds )
return E_INVALIDARG; return E_POINTER;
int i_vlc = _p_instance->getVLCObject(); int i_vlc = _p_instance->getVLCObject();
if( i_vlc ) if( i_vlc )
...@@ -289,7 +292,7 @@ STDMETHODIMP VLCControl::fullscreen(void) ...@@ -289,7 +292,7 @@ STDMETHODIMP VLCControl::fullscreen(void)
STDMETHODIMP VLCControl::get_Length(int *seconds) STDMETHODIMP VLCControl::get_Length(int *seconds)
{ {
if( NULL == seconds ) if( NULL == seconds )
return E_INVALIDARG; return E_POINTER;
int i_vlc = _p_instance->getVLCObject(); int i_vlc = _p_instance->getVLCObject();
if( i_vlc ) if( i_vlc )
...@@ -326,7 +329,7 @@ STDMETHODIMP VLCControl::playSlower(void) ...@@ -326,7 +329,7 @@ STDMETHODIMP VLCControl::playSlower(void)
STDMETHODIMP VLCControl::get_Volume(int *volume) STDMETHODIMP VLCControl::get_Volume(int *volume)
{ {
if( NULL == volume ) if( NULL == volume )
return E_INVALIDARG; return E_POINTER;
int i_vlc = _p_instance->getVLCObject(); int i_vlc = _p_instance->getVLCObject();
if( i_vlc ) if( i_vlc )
...@@ -557,7 +560,7 @@ static HRESULT createTargetOptions(int codePage, VARIANT *options, char ***cOpti ...@@ -557,7 +560,7 @@ static HRESULT createTargetOptions(int codePage, VARIANT *options, char ***cOpti
STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistMode mode, int position) STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistMode mode, int position)
{ {
if( NULL == uri ) if( 0 == SysStringLen(uri) )
return E_INVALIDARG; return E_INVALIDARG;
HRESULT hr = E_UNEXPECTED; HRESULT hr = E_UNEXPECTED;
...@@ -588,7 +591,7 @@ STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistM ...@@ -588,7 +591,7 @@ STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistM
STDMETHODIMP VLCControl::get_PlaylistIndex(int *index) STDMETHODIMP VLCControl::get_PlaylistIndex(int *index)
{ {
if( NULL == index ) if( NULL == index )
return E_INVALIDARG; return E_POINTER;
int i_vlc = _p_instance->getVLCObject(); int i_vlc = _p_instance->getVLCObject();
if( i_vlc ) if( i_vlc )
...@@ -647,7 +650,7 @@ STDMETHODIMP VLCControl::playlistClear(void) ...@@ -647,7 +650,7 @@ STDMETHODIMP VLCControl::playlistClear(void)
STDMETHODIMP VLCControl::get_VersionInfo(BSTR *version) STDMETHODIMP VLCControl::get_VersionInfo(BSTR *version)
{ {
if( NULL == version ) if( NULL == version )
return E_INVALIDARG; return E_POINTER;
const char *versionStr = VLC_Version(); const char *versionStr = VLC_Version();
if( NULL != versionStr ) if( NULL != versionStr )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment