Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

plugin.h

00001 /*****************************************************************************
00002  * plugin.h: ActiveX control for VLC
00003  *****************************************************************************
00004  * Copyright (C) 2005 the VideoLAN team
00005  *
00006  * Authors: Damien Fouilleul <[email protected]>
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00021  *****************************************************************************/
00022 
00023 #ifndef __PLUGIN_H__
00024 #define __PLUGIN_H__
00025 
00026 #include <ole2.h>
00027 #include <olectl.h>
00028 
00029 #include <vlc/vlc.h>
00030 
00031 extern const GUID CLSID_VLCPlugin; 
00032 extern const GUID LIBID_AXVLC; 
00033 extern const GUID DIID_DVLCEvents; 
00034 
00035 class VLCPluginClass : public IClassFactory
00036 {
00037 
00038 public:
00039 
00040     VLCPluginClass(LONG *p_class_ref,HINSTANCE hInstance);
00041 
00042     /* IUnknown methods */
00043     STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
00044     STDMETHODIMP_(ULONG) AddRef(void);
00045     STDMETHODIMP_(ULONG) Release(void);
00046 
00047     /* IClassFactory methods */
00048     STDMETHODIMP CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv);
00049     STDMETHODIMP LockServer(BOOL fLock);
00050 
00051     LPCSTR getInPlaceWndClassName(void) const { return TEXT("VLC Plugin In-Place"); };
00052     LPCSTR getVideoWndClassName(void) const { return TEXT("VLC Plugin Video"); };
00053     HINSTANCE getHInstance(void) const { return _hinstance; };
00054     LPPICTURE getInPlacePict(void) const
00055         { if( NULL != _inplace_picture) _inplace_picture->AddRef(); return _inplace_picture; };
00056 
00057 protected:
00058 
00059     virtual ~VLCPluginClass();
00060 
00061 private:
00062 
00063     LPLONG      _p_class_ref;
00064     HINSTANCE   _hinstance;
00065     ATOM        _inplace_wndclass_atom;
00066     ATOM        _video_wndclass_atom;
00067     LPPICTURE   _inplace_picture;
00068 };
00069 
00070 class VLCPlugin : public IUnknown
00071 {
00072 
00073 public:
00074 
00075     VLCPlugin(VLCPluginClass *p_class, LPUNKNOWN pUnkOuter);
00076 
00077     /* IUnknown methods */
00078     STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
00079     STDMETHODIMP_(ULONG) AddRef(void);
00080     STDMETHODIMP_(ULONG) Release(void);
00081 
00082     /* custom methods */
00083     HRESULT getTypeLib(LCID lcid, ITypeLib **pTL) { return LoadRegTypeLib(LIBID_AXVLC, 1, 0, lcid, pTL); };
00084     REFCLSID getClassID(void) { return (REFCLSID)CLSID_VLCPlugin; };
00085     REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; };
00086 
00087     /*
00088     ** persistant properties
00089     */
00090     void setMRL(BSTR mrl)
00091     {
00092         SysFreeString(_bstr_mrl);
00093         _bstr_mrl = SysAllocStringLen(mrl, SysStringLen(mrl));
00094         setDirty(TRUE);
00095     };
00096     const BSTR getMRL(void) { return _bstr_mrl; };
00097 
00098     inline void setAutoPlay(BOOL autoplay)
00099     {
00100         _b_autoplay = autoplay;
00101         setDirty(TRUE);
00102     };
00103     inline BOOL getAutoPlay(void) { return _b_autoplay; };
00104 
00105     inline void setAutoLoop(BOOL autoloop) 
00106     {
00107         _b_autoloop = autoloop;
00108         setDirty(TRUE);
00109     };
00110     inline BOOL getAutoLoop(void) { return _b_autoloop;};
00111 
00112     void setVisible(BOOL fVisible);
00113     BOOL getVisible(void) { return _b_visible; };
00114 
00115     // control size in HIMETRIC
00116     inline void setExtent(const SIZEL& extent)
00117     {
00118         _extent = extent;
00119         setDirty(TRUE);
00120     };
00121     const SIZEL& getExtent(void) { return _extent; };
00122 
00123     // transient properties 
00124     inline void setMute(BOOL mute) { _b_mute = mute; };
00125 
00126     inline void setPicture(LPPICTURE pict)
00127     {
00128         if( NULL != _p_pict )
00129             _p_pict->Release();
00130         if( NULL != pict )
00131             _p_pict->AddRef();
00132         _p_pict = pict;
00133     };
00134 
00135     inline LPPICTURE getPicture(void)
00136     {
00137         if( NULL != _p_pict )
00138             _p_pict->AddRef();
00139         return _p_pict;
00140     };
00141     
00142     BOOL hasFocus(void);
00143     void setFocus(BOOL fFocus);
00144 
00145     inline UINT getCodePage(void) { return _i_codepage; };
00146     inline void setCodePage(UINT cp)
00147     {
00148         // accept new codepage only if it works on this system
00149         size_t mblen = WideCharToMultiByte(cp,
00150                 0, L"test", -1, NULL, 0, NULL, NULL);
00151         if( mblen > 0 )
00152             _i_codepage = cp;
00153     };
00154 
00155     inline BOOL isUserMode(void) { return _b_usermode; };
00156     inline void setUserMode(BOOL um) { _b_usermode = um; };
00157 
00158     inline BOOL isDirty(void) { return _b_dirty; };
00159     inline void setDirty(BOOL dirty) { _b_dirty = dirty; };
00160 
00161     inline BOOL isRunning(void) { return 0 != _i_vlc; };
00162 
00163     // control geometry within container
00164     RECT getPosRect(void) { return _posRect; }; 
00165     inline HWND getInPlaceWindow(void) const { return _inplacewnd; };
00166     BOOL isInPlaceActive(void);
00167 
00168     inline int getVLCObject(void) const { return _i_vlc; };
00169 
00170     /*
00171     ** container events
00172     */
00173     HRESULT onInit(void);
00174     HRESULT onLoad(void);
00175     HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);
00176     HRESULT onInPlaceDeactivate(void);
00177     HRESULT onAmbientChanged(LPUNKNOWN pContainer, DISPID dispID);
00178     HRESULT onClose(DWORD dwSaveOption);
00179     void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect);
00180     void onDraw(DVTARGETDEVICE * ptd, HDC hicTargetDev,
00181             HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds);
00182     void onPaint(HDC hdc, const RECT &bounds, const RECT &pr);
00183 
00184     /*
00185     ** control events
00186     */
00187     void freezeEvents(BOOL freeze);
00188     void firePropChangedEvent(DISPID dispid);
00189     void fireOnPlayEvent(void);
00190     void fireOnPauseEvent(void);
00191     void fireOnStopEvent(void);
00192 
00193     // controlling IUnknown interface
00194     LPUNKNOWN pUnkOuter;
00195 
00196 protected:
00197 
00198     virtual ~VLCPlugin();
00199 
00200 private:
00201 
00202     //implemented interfaces
00203     class VLCOleObject *vlcOleObject;
00204     class VLCOleControl *vlcOleControl;
00205     class VLCOleInPlaceObject *vlcOleInPlaceObject;
00206     class VLCOleInPlaceActiveObject *vlcOleInPlaceActiveObject;
00207     class VLCPersistStreamInit *vlcPersistStreamInit;
00208     class VLCPersistStorage *vlcPersistStorage;
00209     class VLCPersistPropertyBag *vlcPersistPropertyBag;
00210     class VLCProvideClassInfo *vlcProvideClassInfo;
00211     class VLCConnectionPointContainer *vlcConnectionPointContainer;
00212     class VLCObjectSafety *vlcObjectSafety;
00213     class VLCControl *vlcControl;
00214     class VLCViewObject *vlcViewObject;
00215     class VLCDataObject *vlcDataObject;
00216 
00217     // in place activated window (Clipping window)
00218     HWND _inplacewnd;
00219     // video window (Drawing window)
00220     HWND _videownd;
00221 
00222     VLCPluginClass *_p_class;
00223     ULONG _i_ref;
00224 
00225     LPPICTURE _p_pict;
00226     UINT _i_codepage;
00227     BOOL _b_usermode;
00228     BSTR _bstr_mrl;
00229     BOOL _b_autoplay;
00230     BOOL _b_autoloop;
00231     BOOL _b_visible;
00232     BOOL _b_mute;
00233     BOOL _b_dirty;
00234     int  _i_vlc;
00235 
00236     SIZEL _extent;
00237     RECT _posRect;
00238 };
00239 
00240 #endif
00241 

Generated on Tue Dec 20 10:14:18 2005 for vlc-0.8.4a by  doxygen 1.4.2