00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
00043 STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
00044 STDMETHODIMP_(ULONG) AddRef(void);
00045 STDMETHODIMP_(ULONG) Release(void);
00046
00047
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
00078 STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
00079 STDMETHODIMP_(ULONG) AddRef(void);
00080 STDMETHODIMP_(ULONG) Release(void);
00081
00082
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
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
00116 inline void setExtent(const SIZEL& extent)
00117 {
00118 _extent = extent;
00119 setDirty(TRUE);
00120 };
00121 const SIZEL& getExtent(void) { return _extent; };
00122
00123
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
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
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
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
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
00194 LPUNKNOWN pUnkOuter;
00195
00196 protected:
00197
00198 virtual ~VLCPlugin();
00199
00200 private:
00201
00202
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
00218 HWND _inplacewnd;
00219
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