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 onInitNew(void);
88 HRESULT onClose(DWORD dwSaveOption);
90 BOOL isInPlaceActive(void);
91 HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);
92 HRESULT onInPlaceDeactivate(void);
93 HWND getInPlaceWindow(void) const { return _inplacewnd; };
96 void setFocus(BOOL fFocus);
98 UINT getCodePage(void) { return _codepage; };
99 void setCodePage(UINT cp) { _codepage = cp; };
101 int getVLCObject(void) { return _i_vlc; };
103 // control properties
104 void setSourceURL(const char *url) { _psz_src = strdup(url); };
105 void setAutoStart(BOOL autostart) { _b_autostart = autostart; };
106 void setLoopMode(BOOL loopmode) { _b_loopmode = loopmode; };
107 void setMute(BOOL mute) {
110 VLC_VolumeMute(_i_vlc);
113 void setSendEvents(BOOL sendevents) { _b_sendevents = sendevents; };
114 void setVisible(BOOL fVisible);
115 BOOL getVisible(void) { return _b_visible; };
118 void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect);
119 void onPaint(PAINTSTRUCT &ps, RECT &pr);
122 void firePropChangedEvent(DISPID dispid);
123 void fireOnPlayEvent(void);
124 void fireOnPauseEvent(void);
125 void fireOnStopEvent(void);
129 virtual ~VLCPlugin();
133 void calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect);
135 //implemented interfaces
136 class VLCOleObject *vlcOleObject;
137 class VLCOleControl *vlcOleControl;
138 class VLCOleInPlaceObject *vlcOleInPlaceObject;
139 class VLCOleInPlaceActiveObject *vlcOleInPlaceActiveObject;
140 class VLCPersistStreamInit *vlcPersistStreamInit;
141 class VLCPersistStorage *vlcPersistStorage;
142 class VLCPersistPropertyBag *vlcPersistPropertyBag;
143 class VLCProvideClassInfo *vlcProvideClassInfo;
144 class VLCConnectionPointContainer *vlcConnectionPointContainer;
145 class VLCObjectSafety *vlcObjectSafety;
146 class VLCControl *vlcControl;
148 // in place activated window (Clipping window)
150 // video window (Drawing window)
154 VLCPluginClass *_p_class;