1 /*****************************************************************************
2 * plugin.h: ActiveX control for VLC
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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(LPUNKNOWN 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 LPPICTURE getInPlacePict(void) const
55 { if( NULL != _inplace_picture) _inplace_picture->AddRef(); return _inplace_picture; };
59 virtual ~VLCPluginClass();
65 ATOM _inplace_wndclass_atom;
66 ATOM _video_wndclass_atom;
67 LPPICTURE _inplace_picture;
70 class VLCPlugin : public IUnknown
75 VLCPlugin(VLCPluginClass *p_class, LPUNKNOWN pUnkOuter);
77 /* IUnknown methods */
78 STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
79 STDMETHODIMP_(ULONG) AddRef(void);
80 STDMETHODIMP_(ULONG) Release(void);
83 HRESULT getTypeLib(LCID lcid, ITypeLib **pTL) { return LoadRegTypeLib(LIBID_AXVLC, 1, 0, lcid, pTL); };
84 REFCLSID getClassID(void) { return (REFCLSID)CLSID_VLCPlugin; };
85 REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; };
88 ** persistant properties
92 SysFreeString(_bstr_mrl);
93 _bstr_mrl = SysAllocStringLen(mrl, SysStringLen(mrl));
96 const BSTR getMRL(void) { return _bstr_mrl; };
98 inline void setAutoPlay(BOOL autoplay)
100 _b_autoplay = autoplay;
103 inline BOOL getAutoPlay(void) { return _b_autoplay; };
105 inline void setAutoLoop(BOOL autoloop)
107 _b_autoloop = autoloop;
110 inline BOOL getAutoLoop(void) { return _b_autoloop;};
112 void setVolume(int volume);
113 BOOL getVolume(void) { return _i_volume; };
115 void setVisible(BOOL fVisible);
116 BOOL getVisible(void) { return _b_visible; };
118 // control size in HIMETRIC
119 inline void setExtent(const SIZEL& extent)
124 const SIZEL& getExtent(void) { return _extent; };
126 // transient properties
127 inline void setMute(BOOL mute) { _b_mute = mute; };
129 inline void setPicture(LPPICTURE pict)
131 if( NULL != _p_pict )
138 inline LPPICTURE getPicture(void)
140 if( NULL != _p_pict )
146 void setFocus(BOOL fFocus);
148 inline UINT getCodePage(void) { return _i_codepage; };
149 inline void setCodePage(UINT cp)
151 // accept new codepage only if it works on this system
152 size_t mblen = WideCharToMultiByte(cp,
153 0, L"test", -1, NULL, 0, NULL, NULL);
158 inline BOOL isUserMode(void) { return _b_usermode; };
159 inline void setUserMode(BOOL um) { _b_usermode = um; };
161 inline BOOL isDirty(void) { return _b_dirty; };
162 inline void setDirty(BOOL dirty) { _b_dirty = dirty; };
164 inline BOOL isRunning(void) { return 0 != _i_vlc; };
166 // control geometry within container
167 RECT getPosRect(void) { return _posRect; };
168 inline HWND getInPlaceWindow(void) const { return _inplacewnd; };
169 BOOL isInPlaceActive(void);
171 inline int getVLCObject(void) const { return _i_vlc; };
176 HRESULT onInit(void);
177 HRESULT onLoad(void);
179 HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);
180 HRESULT onInPlaceDeactivate(void);
181 HRESULT onAmbientChanged(LPUNKNOWN pContainer, DISPID dispID);
182 HRESULT onClose(DWORD dwSaveOption);
183 void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect);
184 void onDraw(DVTARGETDEVICE * ptd, HDC hicTargetDev,
185 HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds);
186 void onPaint(HDC hdc, const RECT &bounds, const RECT &pr);
191 void freezeEvents(BOOL freeze);
192 void firePropChangedEvent(DISPID dispid);
193 void fireOnPlayEvent(void);
194 void fireOnPauseEvent(void);
195 void fireOnStopEvent(void);
197 // controlling IUnknown interface
202 virtual ~VLCPlugin();
206 //implemented interfaces
207 class VLCOleObject *vlcOleObject;
208 class VLCOleControl *vlcOleControl;
209 class VLCOleInPlaceObject *vlcOleInPlaceObject;
210 class VLCOleInPlaceActiveObject *vlcOleInPlaceActiveObject;
211 class VLCPersistStreamInit *vlcPersistStreamInit;
212 class VLCPersistStorage *vlcPersistStorage;
213 class VLCPersistPropertyBag *vlcPersistPropertyBag;
214 class VLCProvideClassInfo *vlcProvideClassInfo;
215 class VLCConnectionPointContainer *vlcConnectionPointContainer;
216 class VLCObjectSafety *vlcObjectSafety;
217 class VLCControl *vlcControl;
218 class VLCViewObject *vlcViewObject;
219 class VLCDataObject *vlcDataObject;
221 // in place activated window (Clipping window)
223 // video window (Drawing window)
226 VLCPluginClass *_p_class;
234 // persistable properties