1 /*****************************************************************************
2 * plugin.h: ActiveX control for VLC
3 *****************************************************************************
4 * Copyright (C) 2005 VideoLAN
6 * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
31 extern const GUID CLSID_VLCPlugin;
32 extern const GUID LIBID_AXVLC;
33 extern const GUID DIID_DVLCEvents;
35 class VLCPluginClass : public IClassFactory
40 VLCPluginClass(LONG *p_class_ref,HINSTANCE hInstance);
42 /* IUnknown methods */
43 STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
44 STDMETHODIMP_(ULONG) AddRef(void);
45 STDMETHODIMP_(ULONG) Release(void);
47 /* IClassFactory methods */
48 STDMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
49 STDMETHODIMP LockServer(BOOL fLock);
51 LPCSTR getInPlaceWndClassName(void) const { return TEXT("VLC Plugin In-Place"); };
52 LPCSTR getVideoWndClassName(void) const { return TEXT("VLC Plugin Video"); };
53 HINSTANCE getHInstance(void) const { return _hinstance; };
54 HBITMAP getInPlacePict(void) const { return _inplace_hbitmap; };
58 virtual ~VLCPluginClass();
64 ATOM _inplace_wndclass_atom;
65 ATOM _video_wndclass_atom;
66 HBITMAP _inplace_hbitmap;
69 class VLCPlugin : public IUnknown
74 VLCPlugin(VLCPluginClass *p_class);
76 /* IUnknown methods */
77 STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
78 STDMETHODIMP_(ULONG) AddRef(void);
79 STDMETHODIMP_(ULONG) Release(void);
82 HRESULT getTypeLib(LCID lcid, ITypeLib **pTL)
83 { return LoadRegTypeLib(LIBID_AXVLC, 1, 0, lcid, pTL); };
84 REFCLSID getClassID(void) { return (REFCLSID)CLSID_VLCPlugin; };
85 REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; };
87 HRESULT onInit(BOOL isNew);
89 HRESULT onClientSiteChanged(LPOLECLIENTSITE pActiveSite);
90 HRESULT onClose(DWORD dwSaveOption);
92 BOOL isInPlaceActive(void);
93 HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);
94 HRESULT onInPlaceDeactivate(void);
95 HWND getInPlaceWindow(void) const { return _inplacewnd; };
98 void setFocus(BOOL fFocus);
100 UINT getCodePage(void) { return _codepage; };
101 void setCodePage(UINT cp) { _codepage = cp; };
103 int getVLCObject(void) { return _i_vlc; };
105 // control properties
106 void setSourceURL(const char *url) { _psz_src = strdup(url); };
107 void setAutoStart(BOOL autostart) { _b_autostart = autostart; };
108 void setLoopMode(BOOL loopmode) { _b_loopmode = loopmode; };
109 void setMute(BOOL mute) {
112 VLC_VolumeMute(_i_vlc);
115 void setSendEvents(BOOL sendevents) { _b_sendevents = sendevents; };
116 void setVisible(BOOL fVisible);
117 BOOL getVisible(void) { return _b_visible; };
121 void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect);
122 void onPaint(HDC hdc, const RECT &bounds, const RECT &pr);
125 void firePropChangedEvent(DISPID dispid);
126 void fireOnPlayEvent(void);
127 void fireOnPauseEvent(void);
128 void fireOnStopEvent(void);
130 // control size in HIMETRIC
131 const SIZEL& getExtent(void) { return _extent; };
132 void setExtent(const SIZEL& extent) { _extent = extent; };
134 // control geometry within container
135 RECT getPosRect(void) { return _posRect; };
139 virtual ~VLCPlugin();
143 //implemented interfaces
144 class VLCOleObject *vlcOleObject;
145 class VLCOleControl *vlcOleControl;
146 class VLCOleInPlaceObject *vlcOleInPlaceObject;
147 class VLCOleInPlaceActiveObject *vlcOleInPlaceActiveObject;
148 class VLCPersistStreamInit *vlcPersistStreamInit;
149 class VLCPersistStorage *vlcPersistStorage;
150 class VLCPersistPropertyBag *vlcPersistPropertyBag;
151 class VLCProvideClassInfo *vlcProvideClassInfo;
152 class VLCConnectionPointContainer *vlcConnectionPointContainer;
153 class VLCObjectSafety *vlcObjectSafety;
154 class VLCControl *vlcControl;
155 class VLCViewObject *vlcViewObject;
157 // in place activated window (Clipping window)
159 // video window (Drawing window)
162 VLCPluginClass *_p_class;