dataobject.h \
viewobject.cpp \
viewobject.h \
+ supporterrorinfo.cpp \
+ supporterrorinfo.h \
vlccontrol.cpp \
vlccontrol.h \
vlccontrol2.cpp \
odl,\r
uuid(9E0BD17B-2D3C-4656-B94D-03084F3FD9D4),\r
helpstring("VLC Audio APIs"),\r
+ hidden,\r
dual,\r
+ nonextensible,\r
oleautomation\r
]\r
interface IVLCAudio : IDispatch\r
odl,\r
uuid(49E0DBD1-9440-466C-9C97-95C67190C603),\r
helpstring("VLC Input APIs"),\r
+ hidden,\r
dual,\r
+ nonextensible,\r
oleautomation\r
]\r
interface IVLCInput : IDispatch\r
odl,\r
uuid(54613049-40BF-4035-9E70-0A9312C0188D),\r
helpstring("VLC Playlist APIs"),\r
+ hidden,\r
dual,\r
+ nonextensible,\r
oleautomation\r
]\r
interface IVLCPlaylist : IDispatch\r
odl,\r
uuid(0AAEDF0B-D333-4B27-A0C6-BBF31413A42E),\r
helpstring("VLC Video APIs"),\r
+ hidden,\r
dual,\r
+ nonextensible,\r
oleautomation\r
]\r
interface IVLCVideo : IDispatch\r
\r
[propget, helpstring("Returns video original height.")]\r
HRESULT height([out, retval] int* height);\r
+\r
+ [helpstring("toggle fullscreen/windowed state.")]\r
+ HRESULT toggleFullscreen();\r
};\r
\r
[\r
odl,\r
uuid(2D719729-5333-406C-BF12-8DE787FD65E3),\r
helpstring("VLC Control"),\r
+ hidden,\r
dual,\r
oleautomation\r
]\r
virtual HRESULT STDMETHODCALLTYPE get_height(
int* height) = 0;
+ virtual HRESULT STDMETHODCALLTYPE toggleFullscreen(
+ ) = 0;
+
};
#else
typedef struct IVLCVideoVtbl {
IVLCVideo* This,
int* height);
+ HRESULT (STDMETHODCALLTYPE *toggleFullscreen)(
+ IVLCVideo* This);
+
END_INTERFACE
} IVLCVideoVtbl;
interface IVLCVideo {
#define IVLCVideo_put_fullscreen(p,a) (p)->lpVtbl->put_fullscreen(p,a)
#define IVLCVideo_get_width(p,a) (p)->lpVtbl->get_width(p,a)
#define IVLCVideo_get_height(p,a) (p)->lpVtbl->get_height(p,a)
+#define IVLCVideo_toggleFullscreen(p) (p)->lpVtbl->toggleFullscreen(p)
#endif
#endif
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
+HRESULT CALLBACK IVLCVideo_toggleFullscreen_Proxy(
+ IVLCVideo* This);
+void __RPC_STUB IVLCVideo_toggleFullscreen_Stub(
+ IRpcStubBuffer* This,
+ IRpcChannelBuffer* pRpcChannelBuffer,
+ PRPC_MESSAGE pRpcMessage,
+ DWORD* pdwStubPhase);
#endif /* __IVLCVideo_INTERFACE_DEFINED__ */
#include "vlccontrol2.h"
#include "viewobject.h"
#include "dataobject.h"
+#include "supporterrorinfo.h"
#include "utils.h"
vlcViewObject = new VLCViewObject(this);
vlcDataObject = new VLCDataObject(this);
vlcOleObject = new VLCOleObject(this);
+ vlcSupportErrorInfo = new VLCSupportErrorInfo(this);
// configure controlling IUnknown interface for implemented interfaces
this->pUnkOuter = (NULL != pUnkOuter) ? pUnkOuter : dynamic_cast<LPUNKNOWN>(this);
VLCPlugin::~VLCPlugin()
{
+ delete vlcSupportErrorInfo;
delete vlcOleObject;
delete vlcDataObject;
delete vlcViewObject;
*ppv = reinterpret_cast<LPVOID>(vlcViewObject);
else if( IID_IDataObject == riid )
*ppv = reinterpret_cast<LPVOID>(vlcDataObject);
+ else if( IID_ISupportErrorInfo == riid )
+ *ppv = reinterpret_cast<LPVOID>(vlcSupportErrorInfo);
else
{
*ppv = NULL;
if( i_type == REG_SZ )
{
strcat( p_data, "\\plugins" );
- ppsz_argv[ppsz_argc++] = "--plugin-path";
- ppsz_argv[ppsz_argc++] = p_data;
+ //ppsz_argv[ppsz_argc++] = "--plugin-path";
+ //ppsz_argv[ppsz_argc++] = p_data;
}
}
RegCloseKey( h_key );
return S_OK;
};
+void VLCPlugin::setErrorInfo(REFIID riid, const char *description)
+{
+ vlcSupportErrorInfo->setErrorInfo( getClassID() == CLSID_VLCPlugin2 ?
+ OLESTR("VideoLAN.VLCPlugin.2") : OLESTR("VideoLAN.VLCPlugin.1"),
+ riid, description );
+};
+
HRESULT VLCPlugin::onAmbientChanged(LPUNKNOWN pContainer, DISPID dispID)
{
VARIANT v;
/* change cliprect coordinates system relative to window bounding rect */
OffsetRect(&clipRect, -lprcPosRect->left, -lprcPosRect->top);
HRGN clipRgn = CreateRectRgnIndirect(&clipRect);
- SetWindowRgn(_inplacewnd, clipRgn, TRUE);
+ SetWindowRgn(_inplacewnd, clipRgn, FALSE);
//RedrawWindow(_videownd, &posRect, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN);
if( isRunning() )
inline BOOL isRunning(void) { return NULL != _p_libvlc; };
HRESULT getVLCObject(int *i_vlc);
HRESULT getVLC(libvlc_instance_t** p_vlc);
+ void setErrorInfo(REFIID riid, const char *description);
// control geometry within container
RECT getPosRect(void) { return _posRect; };
class VLCControl2 *vlcControl2;
class VLCViewObject *vlcViewObject;
class VLCDataObject *vlcDataObject;
+ class VLCSupportErrorInfo *vlcSupportErrorInfo;
// in place activated window (Plugin window)
HWND _inplacewnd;
--- /dev/null
+/*****************************************************************************
+ * supporterrorinfo.cpp: ActiveX control for VLC
+ *****************************************************************************
+ * Copyright (C) 2005 the VideoLAN team
+ *
+ * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include "plugin.h"
+#include "supporterrorinfo.h"
+
+#include "utils.h"
+
+using namespace std;
+
+STDMETHODIMP VLCSupportErrorInfo::InterfaceSupportsErrorInfo(REFIID riid)
+{
+ if( IID_NULL == riid )
+ return S_FALSE;
+
+ return riid == _riid ? S_OK : S_FALSE;
+};
+
+void VLCSupportErrorInfo::setErrorInfo(LPCOLESTR progid, REFIID riid, const char *description)
+{
+ _riid = IID_NULL;
+ BSTR bstrDescription = BSTRFromCStr(CP_UTF8, description);
+ if( NULL != bstrDescription )
+ {
+ ICreateErrorInfo* pcerrinfo;
+
+ HRESULT hr = CreateErrorInfo(&pcerrinfo);
+ if( SUCCEEDED(hr) )
+ {
+ IErrorInfo* perrinfo;
+
+ pcerrinfo->SetSource((LPOLESTR)progid);
+ pcerrinfo->SetGUID(riid);
+ pcerrinfo->SetDescription((LPOLESTR)bstrDescription);
+ hr = pcerrinfo->QueryInterface(IID_IErrorInfo, (LPVOID*) &perrinfo);
+ if( SUCCEEDED(hr) )
+ {
+ _riid = riid;
+ ::SetErrorInfo(0, perrinfo);
+ perrinfo->Release();
+ }
+ pcerrinfo->Release();
+ }
+ SysFreeString(bstrDescription);
+ }
+};
+
--- /dev/null
+/*****************************************************************************
+ * supporterrorinfo.h: ActiveX control for VLC
+ *****************************************************************************
+ * Copyright (C) 2006 the VideoLAN team
+ *
+ * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef __SUPPORTERRORINFO_H__
+#define __SUPPORTERRORINFO_H__
+
+#include <oaidl.h>
+
+class VLCSupportErrorInfo : public ISupportErrorInfo
+{
+
+public:
+
+ VLCSupportErrorInfo(VLCPlugin *p_instance) :
+ _p_instance(p_instance),
+ _riid(IID_NULL)
+ {};
+ virtual ~VLCSupportErrorInfo()
+ {};
+
+ // IUnknown methods
+ STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
+ {
+ if( NULL == ppv )
+ return E_POINTER;
+ if( (IID_IUnknown == riid)
+ || (IID_ISupportErrorInfo == riid) )
+ {
+ AddRef();
+ *ppv = reinterpret_cast<LPVOID>(this);
+ return NOERROR;
+ }
+ return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
+ };
+
+ STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
+ STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
+
+ // ISupportErrorInfo methods
+ STDMETHODIMP InterfaceSupportsErrorInfo(REFIID riid);
+
+ // VLCSupportErrorInfo methods
+ void setErrorInfo(LPCOLESTR progid, REFIID riid, const char *description);
+
+private:
+ VLCPlugin *_p_instance;
+ IID _riid;
+};
+
+#endif
+
*mute = libvlc_audio_get_mute(p_libvlc, &ex) ? VARIANT_TRUE : VARIANT_FALSE;
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
libvlc_audio_set_mute(p_libvlc, VARIANT_FALSE != mute, &ex);
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
*volume = libvlc_audio_get_volume(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
libvlc_audio_set_volume(p_libvlc, volume, &ex);
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
libvlc_audio_toggle_mute(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
}
+ _p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
}
+ _p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
}
+ _p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
}
+ _p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
}
+ _p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
}
+ _p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
}
+ _p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
}
+ _p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
}
+ _p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
*count = libvlc_playlist_items_count(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCPlaylist,
+ libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
*isPlaying = libvlc_playlist_isplaying(p_libvlc, &ex) ? VARIANT_TRUE: VARIANT_FALSE;
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCPlaylist,
+ libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
CoTaskMemFree(psz_name);
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCPlaylist,
+ libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
libvlc_playlist_play(p_libvlc, item, 0, NULL, &ex);
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCPlaylist,
+ libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
libvlc_playlist_pause(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCPlaylist,
+ libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
libvlc_playlist_stop(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCPlaylist,
+ libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
libvlc_playlist_next(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCPlaylist,
+ libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
libvlc_playlist_prev(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCPlaylist,
+ libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
libvlc_playlist_clear(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCPlaylist,
+ libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
libvlc_playlist_delete_item(p_libvlc, item, &ex);
if( libvlc_exception_raised(&ex) )
{
+ _p_instance->setErrorInfo(IID_IVLCPlaylist,
+ libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
}
+ _p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
}
+ _p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
}
+ _p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
}
+ _p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
+ return hr;
+};
+
+STDMETHODIMP VLCVideo::toggleFullscreen()
+{
+ libvlc_instance_t* p_libvlc;
+ HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(hr) )
+ {
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_input_t *p_input = libvlc_playlist_get_input(p_libvlc, &ex);
+ if( ! libvlc_exception_raised(&ex) )
+ {
+ libvlc_toggle_fullscreen(p_input, &ex);
+ libvlc_input_free(p_input);
+ if( ! libvlc_exception_raised(&ex) )
+ {
+ return NOERROR;
+ }
+ }
+ _p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
STDMETHODIMP put_fullscreen(VARIANT_BOOL);
STDMETHODIMP get_width(int*);
STDMETHODIMP get_height(int*);
+ STDMETHODIMP toggleFullscreen();
protected:
HRESULT loadTypeInfo();