added persistent properties such as MRL, AutoPlay, AutoLoop which allows a user to play a default target
without programming.
interface IVLCControl;\r
dispinterface DVLCEvents;\r
\r
- enum VLCPlaylistMode {\r
+ enum VLCPlaylistMode\r
+ {\r
VLCPlayListInsert = 1,\r
+ VLCPlayListInsertAndGo = 9,\r
VLCPlayListReplace = 2,\r
+ VLCPlayListReplaceAndGo = 10,\r
VLCPlayListAppend = 4,\r
- VLCPlayListGo = 8,\r
+ VLCPlayListAppendAndGo = 12,\r
VLCPlayListCheckInsert = 16\r
};\r
\r
const int VLCPlayListEnd = -666;\r
\r
// DISPID definitions\r
- const int DISPID_Visible = 1;\r
- const int DISPID_Playing = 2;\r
- const int DISPID_Position = 3;\r
- const int DISPID_Time = 4;\r
- const int DISPID_Length = 5;\r
- const int DISPID_Volume = 6;\r
-\r
- const int DISPID_PlayEvent = 1;\r
- const int DISPID_PauseEvent = 2;\r
- const int DISPID_StopEvent = 3;\r
+ const int DISPID_Visible = 100;\r
+ const int DISPID_Playing = 101;\r
+ const int DISPID_Position = 102;\r
+ const int DISPID_Time = 103;\r
+ const int DISPID_Length = 104;\r
+ const int DISPID_Volume = 105;\r
+ const int DISPID_MRL = 106;\r
+ const int DISPID_AutoPlay = 107;\r
+ const int DISPID_AutoLoop = 108;\r
\r
[\r
odl,\r
hidden,\r
oleautomation\r
]\r
- interface IVLCControl : IDispatch {\r
-\r
+ interface IVLCControl : IDispatch\r
+ {\r
[id(DISPID_Visible), propget, bindable, helpstring("Shows or hides plugin.")]\r
HRESULT Visible([out, retval] VARIANT_BOOL* visible);\r
[id(DISPID_Visible), propput, bindable, helpstring("Shows or hides plugin.")]\r
HRESULT pause();\r
[helpstring("Stop playback.")]\r
HRESULT stop();\r
- [id(DISPID_Playing), bindable, propget, helpstring("Specifies whether VLC is playing.")]\r
+ [id(DISPID_Playing), hidden, propget, helpstring("Returns whether VLC is playing.")]\r
HRESULT Playing([out, retval] VARIANT_BOOL* isPlaying);\r
- [id(DISPID_Playing), bindable, propput, helpstring("Specifies whether VLC is playing.")]\r
- HRESULT Playing([in] VARIANT_BOOL isPlaying);\r
- [id(DISPID_Position), bindable, propget, helpstring("Specifies playback position within current target in playlist, position is a relative value ranging from 0.0 to 1.0.")]\r
+ [id(DISPID_Position), propget, helpstring("Specifies playback position within current target in playlist, position is a relative value ranging from 0.0 to 1.0.")]\r
HRESULT Position([out, retval] float* position);\r
- [id(DISPID_Position), bindable, propput, helpstring("Specifies playback position within current target in playlist, position is a relative value ranging from 0.0 to 1.0.")]\r
+ [id(DISPID_Position), propput, helpstring("Specifies playback position within current target in playlist, position is a relative value ranging from 0.0 to 1.0.")]\r
HRESULT Position([in] float position);\r
[id(DISPID_Time), propget, helpstring("Specifies playback time relative to the start of current target in playlist.")]\r
HRESULT Time([out, retval] int* seconds);\r
HRESULT shuttle([in] int seconds);\r
[helpstring("Switch between normal and fullscreen video.")]\r
HRESULT fullscreen();\r
- [id(DISPID_Length), bindable, propget, helpstring("Returns total length in seconds of current target in playlist, may be unknown.")]\r
+ [id(DISPID_Length), propget, hidden, helpstring("Returns total length in seconds of current target in playlist, may be unknown.")]\r
HRESULT Length([out, retval] int* seconds);\r
[helpstring("Increases playback speed, one of 1x, 2x, 4x, 8x.")]\r
HRESULT playFaster();\r
[helpstring("Decreases playback speed, one of 1x, 2x, 4x, 8x.")]\r
HRESULT playSlower();\r
- [id(DISPID_Volume), bindable, propget, helpstring("Specifies playback sound volume, ranges from 0 to 200%.")]\r
+ [id(DISPID_Volume), propget, helpstring("Specifies playback sound volume, ranges from 0 to 200%.")]\r
HRESULT Volume([out, retval] int* volume);\r
- [id(DISPID_Volume), bindable, propput, helpstring("Specifies playback sound volume, ranges from 0 to 200%.")]\r
+ [id(DISPID_Volume), propput, helpstring("Specifies playback sound volume, ranges from 0 to 200%.")]\r
HRESULT Volume([in] int volume);\r
[helpstring("Mute/unmute playback sound volume.")]\r
HRESULT toggleMute();\r
HRESULT playlistPrev();\r
[helpstring("Remove all items from playlist.")]\r
HRESULT playlistClear();\r
- [propget, helpstring("Returns VLC Version.")]\r
+ [propget, hidden, helpstring("Returns VLC Version.")]\r
HRESULT VersionInfo([out, retval] BSTR* version);\r
+ [id(DISPID_MRL), propget, helpstring("Returns initial MRL in default playlist")]\r
+ HRESULT MRL([out, retval] BSTR* mrl);\r
+ [id(DISPID_MRL), propput, helpstring("Specifies initial MRL in default playlist")]\r
+ HRESULT MRL([in] BSTR mrl);\r
+ [id(DISPID_AutoPlay), propget, helpstring("Specifies whether default playlist is played on startup")]\r
+ HRESULT AutoPlay([out, retval] VARIANT_BOOL* autoplay);\r
+ [id(DISPID_AutoPlay), propput, helpstring("Returns whether default playlist is played on startup")]\r
+ HRESULT AutoPlay([in] VARIANT_BOOL autoplay);\r
+ [id(DISPID_AutoLoop), propget, helpstring("Specifies whether default playlist is looped")]\r
+ HRESULT AutoLoop([out, retval] VARIANT_BOOL* autoloop);\r
+ [id(DISPID_AutoLoop), propput, helpstring("Returns whether default playlist is looped")]\r
+ HRESULT AutoLoop([in] VARIANT_BOOL autoloop);\r
};\r
\r
+ const int DISPID_PlayEvent = 100;\r
+ const int DISPID_PauseEvent = 101;\r
+ const int DISPID_StopEvent = 102;\r
+\r
[\r
uuid(DF48072F-5EF8-434e-9B40-E2F3AE759B5F),\r
helpstring("Event interface for VLC control"),\r
hidden\r
]\r
- dispinterface DVLCEvents {\r
+ dispinterface DVLCEvents\r
+ {\r
properties:\r
methods:\r
[id(DISPID_PlayEvent), helpstring("Playback in progress")]\r
- void Play();\r
+ void play();\r
[id(DISPID_PauseEvent), helpstring("Playback has paused")]\r
- void Pause();\r
+ void pause();\r
[id(DISPID_StopEvent), helpstring("Playback has stopped")]\r
- void Stop();\r
+ void stop();\r
};\r
\r
[\r
helpstring("VLC control"),\r
control\r
]\r
- coclass VLCPlugin {\r
+ coclass VLCPlugin\r
+ {\r
[default] interface IVLCControl;\r
[default, source] dispinterface DVLCEvents;\r
};\r
/* File created by MIDL compiler version 5.01.0164 */
-/* at Tue May 10 21:24:51 2005
+/* at Sun Aug 21 17:16:22 2005
*/
/* Compiler settings for axvlc.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
/* File created by MIDL compiler version 5.01.0164 */
-/* at Tue May 10 21:24:51 2005
+/* at Sun Aug 21 17:16:22 2005
*/
/* Compiler settings for axvlc.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
enum VLCPlaylistMode
{ VLCPlayListInsert = 1,
+ VLCPlayListInsertAndGo = 9,
VLCPlayListReplace = 2,
+ VLCPlayListReplaceAndGo = 10,
VLCPlayListAppend = 4,
- VLCPlayListGo = 8,
+ VLCPlayListAppendAndGo = 12,
VLCPlayListCheckInsert = 16
};
#define VLCPlayListEnd ( -666 )
-#define DISPID_Visible ( 1 )
+#define DISPID_Visible ( 100 )
-#define DISPID_Playing ( 2 )
+#define DISPID_Playing ( 101 )
-#define DISPID_Position ( 3 )
+#define DISPID_Position ( 102 )
-#define DISPID_Time ( 4 )
+#define DISPID_Time ( 103 )
-#define DISPID_Length ( 5 )
+#define DISPID_Length ( 104 )
-#define DISPID_Volume ( 6 )
+#define DISPID_Volume ( 105 )
-#define DISPID_PlayEvent ( 1 )
+#define DISPID_MRL ( 106 )
-#define DISPID_PauseEvent ( 2 )
+#define DISPID_AutoPlay ( 107 )
-#define DISPID_StopEvent ( 3 )
+#define DISPID_AutoLoop ( 108 )
+
+#define DISPID_PlayEvent ( 100 )
+
+#define DISPID_PauseEvent ( 101 )
+
+#define DISPID_StopEvent ( 102 )
EXTERN_C const IID LIBID_AXVLC;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE stop( void) = 0;
- virtual /* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE get_Playing(
+ virtual /* [helpstring][propget][hidden][id] */ HRESULT STDMETHODCALLTYPE get_Playing(
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *isPlaying) = 0;
- virtual /* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE put_Playing(
- /* [in] */ VARIANT_BOOL isPlaying) = 0;
-
- virtual /* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE get_Position(
+ virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Position(
/* [retval][out] */ float __RPC_FAR *position) = 0;
- virtual /* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE put_Position(
+ virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Position(
/* [in] */ float position) = 0;
virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Time(
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE fullscreen( void) = 0;
- virtual /* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE get_Length(
+ virtual /* [helpstring][hidden][propget][id] */ HRESULT STDMETHODCALLTYPE get_Length(
/* [retval][out] */ int __RPC_FAR *seconds) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE playFaster( void) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE playSlower( void) = 0;
- virtual /* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE get_Volume(
+ virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Volume(
/* [retval][out] */ int __RPC_FAR *volume) = 0;
- virtual /* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE put_Volume(
+ virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Volume(
/* [in] */ int volume) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE toggleMute( void) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE playlistClear( void) = 0;
- virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_VersionInfo(
+ virtual /* [helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE get_VersionInfo(
/* [retval][out] */ BSTR __RPC_FAR *version) = 0;
+ virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_MRL(
+ /* [retval][out] */ BSTR __RPC_FAR *mrl) = 0;
+
+ virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_MRL(
+ /* [in] */ BSTR mrl) = 0;
+
+ virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_AutoPlay(
+ /* [retval][out] */ VARIANT_BOOL __RPC_FAR *autoplay) = 0;
+
+ virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_AutoPlay(
+ /* [in] */ VARIANT_BOOL autoplay) = 0;
+
+ virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_AutoLoop(
+ /* [retval][out] */ VARIANT_BOOL __RPC_FAR *autoloop) = 0;
+
+ virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_AutoLoop(
+ /* [in] */ VARIANT_BOOL autoloop) = 0;
+
};
#else /* C style interface */
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *stop )(
IVLCControl __RPC_FAR * This);
- /* [helpstring][propget][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Playing )(
+ /* [helpstring][propget][hidden][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Playing )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *isPlaying);
- /* [helpstring][propput][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Playing )(
- IVLCControl __RPC_FAR * This,
- /* [in] */ VARIANT_BOOL isPlaying);
-
- /* [helpstring][propget][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Position )(
+ /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Position )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ float __RPC_FAR *position);
- /* [helpstring][propput][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Position )(
+ /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Position )(
IVLCControl __RPC_FAR * This,
/* [in] */ float position);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *fullscreen )(
IVLCControl __RPC_FAR * This);
- /* [helpstring][propget][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Length )(
+ /* [helpstring][hidden][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Length )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *seconds);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *playSlower )(
IVLCControl __RPC_FAR * This);
- /* [helpstring][propget][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Volume )(
+ /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Volume )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *volume);
- /* [helpstring][propput][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Volume )(
+ /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Volume )(
IVLCControl __RPC_FAR * This,
/* [in] */ int volume);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *playlistClear )(
IVLCControl __RPC_FAR * This);
- /* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VersionInfo )(
+ /* [helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VersionInfo )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ BSTR __RPC_FAR *version);
+ /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_MRL )(
+ IVLCControl __RPC_FAR * This,
+ /* [retval][out] */ BSTR __RPC_FAR *mrl);
+
+ /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_MRL )(
+ IVLCControl __RPC_FAR * This,
+ /* [in] */ BSTR mrl);
+
+ /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_AutoPlay )(
+ IVLCControl __RPC_FAR * This,
+ /* [retval][out] */ VARIANT_BOOL __RPC_FAR *autoplay);
+
+ /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_AutoPlay )(
+ IVLCControl __RPC_FAR * This,
+ /* [in] */ VARIANT_BOOL autoplay);
+
+ /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_AutoLoop )(
+ IVLCControl __RPC_FAR * This,
+ /* [retval][out] */ VARIANT_BOOL __RPC_FAR *autoloop);
+
+ /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_AutoLoop )(
+ IVLCControl __RPC_FAR * This,
+ /* [in] */ VARIANT_BOOL autoloop);
+
END_INTERFACE
} IVLCControlVtbl;
#define IVLCControl_get_Playing(This,isPlaying) \
(This)->lpVtbl -> get_Playing(This,isPlaying)
-#define IVLCControl_put_Playing(This,isPlaying) \
- (This)->lpVtbl -> put_Playing(This,isPlaying)
-
#define IVLCControl_get_Position(This,position) \
(This)->lpVtbl -> get_Position(This,position)
#define IVLCControl_get_VersionInfo(This,version) \
(This)->lpVtbl -> get_VersionInfo(This,version)
+#define IVLCControl_get_MRL(This,mrl) \
+ (This)->lpVtbl -> get_MRL(This,mrl)
+
+#define IVLCControl_put_MRL(This,mrl) \
+ (This)->lpVtbl -> put_MRL(This,mrl)
+
+#define IVLCControl_get_AutoPlay(This,autoplay) \
+ (This)->lpVtbl -> get_AutoPlay(This,autoplay)
+
+#define IVLCControl_put_AutoPlay(This,autoplay) \
+ (This)->lpVtbl -> put_AutoPlay(This,autoplay)
+
+#define IVLCControl_get_AutoLoop(This,autoloop) \
+ (This)->lpVtbl -> get_AutoLoop(This,autoloop)
+
+#define IVLCControl_put_AutoLoop(This,autoloop) \
+ (This)->lpVtbl -> put_AutoLoop(This,autoloop)
+
#endif /* COBJMACROS */
DWORD *_pdwStubPhase);
-/* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Playing_Proxy(
+/* [helpstring][propget][hidden][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Playing_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *isPlaying);
DWORD *_pdwStubPhase);
-/* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Playing_Proxy(
- IVLCControl __RPC_FAR * This,
- /* [in] */ VARIANT_BOOL isPlaying);
-
-
-void __RPC_STUB IVLCControl_put_Playing_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Position_Proxy(
+/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Position_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ float __RPC_FAR *position);
DWORD *_pdwStubPhase);
-/* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Position_Proxy(
+/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Position_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ float position);
DWORD *_pdwStubPhase);
-/* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Length_Proxy(
+/* [helpstring][hidden][propget][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Length_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *seconds);
DWORD *_pdwStubPhase);
-/* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Volume_Proxy(
+/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Volume_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *volume);
DWORD *_pdwStubPhase);
-/* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Volume_Proxy(
+/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Volume_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ int volume);
DWORD *_pdwStubPhase);
-/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_VersionInfo_Proxy(
+/* [helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_VersionInfo_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ BSTR __RPC_FAR *version);
DWORD *_pdwStubPhase);
+/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_MRL_Proxy(
+ IVLCControl __RPC_FAR * This,
+ /* [retval][out] */ BSTR __RPC_FAR *mrl);
+
+
+void __RPC_STUB IVLCControl_get_MRL_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_MRL_Proxy(
+ IVLCControl __RPC_FAR * This,
+ /* [in] */ BSTR mrl);
+
+
+void __RPC_STUB IVLCControl_put_MRL_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_AutoPlay_Proxy(
+ IVLCControl __RPC_FAR * This,
+ /* [retval][out] */ VARIANT_BOOL __RPC_FAR *autoplay);
+
+
+void __RPC_STUB IVLCControl_get_AutoPlay_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_AutoPlay_Proxy(
+ IVLCControl __RPC_FAR * This,
+ /* [in] */ VARIANT_BOOL autoplay);
+
+
+void __RPC_STUB IVLCControl_put_AutoPlay_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_AutoLoop_Proxy(
+ IVLCControl __RPC_FAR * This,
+ /* [retval][out] */ VARIANT_BOOL __RPC_FAR *autoloop);
+
+
+void __RPC_STUB IVLCControl_get_AutoLoop_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_AutoLoop_Proxy(
+ IVLCControl __RPC_FAR * This,
+ /* [in] */ VARIANT_BOOL autoloop);
+
+
+void __RPC_STUB IVLCControl_put_AutoLoop_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
#endif /* __IVLCControl_INTERFACE_DEFINED__ */
SIZEL size = _p_instance->getExtent();
RECTL wBounds = { 0L, 0L, size.cx, size.cy };
- LONG width = size.cx*GetDeviceCaps(hicTargetDev, LOGPIXELSX)/2540L;
- LONG height = size.cy*GetDeviceCaps(hicTargetDev, LOGPIXELSY)/2540L;
-
pMetaFilePict->mm = MM_ANISOTROPIC;
pMetaFilePict->xExt = size.cx;
pMetaFilePict->yExt = size.cy;
+ DPFromHimetric(hicTargetDev, (LPPOINT)&size, 1);
+
SetMapMode(hdcMeta, MM_ANISOTROPIC);
- SetWindowOrgEx(hdcMeta, 0, 0, NULL);
- SetWindowExtEx(hdcMeta, width, height, NULL);
+ SetWindowExtEx(hdcMeta, size.cx, size.cy, NULL);
- RECTL bounds = { 0L, 0L, width, height };
+ RECTL bounds = { 0L, 0L, size.cx, size.cy };
_p_instance->onDraw(pFormatEtc->ptd, hicTargetDev, hdcMeta, &bounds, &wBounds);
pMetaFilePict->hMF = CloseMetaFile(hdcMeta);
{
RECTL wBounds = { 0L, 0L, size.cx, size.cy };
- LONG width = size.cx*GetDeviceCaps(hicTargetDev, LOGPIXELSX)/2540L;
- LONG height = size.cy*GetDeviceCaps(hicTargetDev, LOGPIXELSY)/2540L;
+ DPFromHimetric(hicTargetDev, (LPPOINT)&size, 1);
- RECTL bounds = { 0L, 0L, width, height };
+ RECTL bounds = { 0L, 0L, size.cx, size.cy };
_p_instance->onDraw(pFormatEtc->ptd, hicTargetDev, hdcMeta, &bounds, &wBounds);
pMedium->hEnhMetaFile = CloseEnhMetaFile(hdcMeta);
return E_NOTIMPL;
};
+/*void VLCDataObject::onDataChange(void)
+{
+ _p_adviseHolder->SendOnDataChange(this, 0, 0);
+};*/
+
void VLCDataObject::onClose(void)
{
_p_adviseHolder->SendOnDataChange(this, 0, ADVF_DATAONSTOP);
if( len > 0 )
{
clsidStr = (wchar_t *)CoTaskMemAlloc(len*sizeof(wchar_t));
- WideCharToMultiByte(CP_ACP, 0, oleStr, -1, pct_CLSID, len);
+ MultiByteToWideChar(CP_ACP, 0, oleStr, -1, pct_CLSID, len);
}
#endif
CoTaskMemFree(oleStr);
#include "plugin.h"
#include "olecontrol.h"
-#include "utils.h"
-
using namespace std;
STDMETHODIMP VLCOleControl::GetControlInfo(CONTROLINFO *pCI)
return E_NOTIMPL;
};
-static HRESULT getAmbientProperty(VLCPlugin& instance, DISPID dispID, VARIANT& v)
+STDMETHODIMP VLCOleControl::OnAmbientPropertyChange(DISPID dispID)
{
HRESULT hr;
IOleObject *oleObj;
- hr = instance.QueryInterface(IID_IOleObject, (LPVOID *)&oleObj);
+ hr = QueryInterface(IID_IOleObject, (LPVOID *)&oleObj);
if( SUCCEEDED(hr) )
{
IOleClientSite *clientSite;
hr = oleObj->GetClientSite(&clientSite);
if( SUCCEEDED(hr) && (NULL != clientSite) )
{
- hr = GetObjectProperty(clientSite, dispID, v);
+ _p_instance->onAmbientChanged(clientSite, dispID);
clientSite->Release();
}
oleObj->Release();
}
- return hr;
-};
-
-STDMETHODIMP VLCOleControl::OnAmbientPropertyChange(DISPID dispID)
-{
- switch( dispID )
- {
- case DISPID_AMBIENT_BACKCOLOR:
- break;
- case DISPID_AMBIENT_DISPLAYNAME:
- break;
- case DISPID_AMBIENT_FONT:
- break;
- case DISPID_AMBIENT_FORECOLOR:
- break;
- case DISPID_AMBIENT_LOCALEID:
- break;
- case DISPID_AMBIENT_MESSAGEREFLECT:
- break;
- case DISPID_AMBIENT_SCALEUNITS:
- break;
- case DISPID_AMBIENT_TEXTALIGN:
- break;
- case DISPID_AMBIENT_USERMODE:
- break;
- case DISPID_AMBIENT_UIDEAD:
- break;
- case DISPID_AMBIENT_SHOWGRABHANDLES:
- break;
- case DISPID_AMBIENT_SHOWHATCHING:
- break;
- case DISPID_AMBIENT_DISPLAYASDEFAULT:
- break;
- case DISPID_AMBIENT_SUPPORTSMNEMONICS:
- break;
- case DISPID_AMBIENT_AUTOCLIP:
- break;
- case DISPID_AMBIENT_APPEARANCE:
- break;
- case DISPID_AMBIENT_CODEPAGE:
- VARIANT v;
- VariantInit(&v);
- V_VT(&v) = VT_I4;
- if( SUCCEEDED(getAmbientProperty(*_p_instance, dispID, v)) )
- {
- _p_instance->setCodePage(V_I4(&v));
- }
- break;
- case DISPID_AMBIENT_PALETTE:
- break;
- case DISPID_AMBIENT_CHARSET:
- break;
- case DISPID_AMBIENT_RIGHTTOLEFT:
- break;
- case DISPID_AMBIENT_TOPTOBOTTOM:
- break;
- default:
- break;
- }
return S_OK;
};
STDMETHODIMP VLCOleInPlaceActiveObject::GetWindow(HWND *pHwnd)
{
if( NULL == pHwnd )
- return E_INVALIDARG;
+ return E_POINTER;
+ *pHwnd = NULL;
if( _p_instance->isInPlaceActive() )
{
if( NULL != (*pHwnd = _p_instance->getInPlaceWindow()) )
return S_OK;
-
- return E_FAIL;
}
- *pHwnd = NULL;
-
- return E_UNEXPECTED;
+ return E_FAIL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::EnableModeless(BOOL fEnable)
STDMETHODIMP VLCOleInPlaceObject::GetWindow(HWND *pHwnd)
{
if( NULL == pHwnd )
- return E_INVALIDARG;
+ return E_POINTER;
+ *pHwnd = NULL;
if( _p_instance->isInPlaceActive() )
{
if( NULL != (*pHwnd = _p_instance->getInPlaceWindow()) )
return S_OK;
-
- return E_FAIL;
}
- *pHwnd = NULL;
-
- return E_UNEXPECTED;
+ return E_FAIL;
};
STDMETHODIMP VLCOleInPlaceObject::ContextSensitiveHelp(BOOL fEnterMode)
if( _p_instance->isInPlaceActive() )
{
UIDeactivate();
+
_p_instance->onInPlaceDeactivate();
LPOLEOBJECT p_oleObject;
if( _p_instance->hasFocus() )
{
_p_instance->setFocus(FALSE);
+ }
- LPOLEOBJECT p_oleObject;
- if( SUCCEEDED(QueryInterface(IID_IOleObject, (void**)&p_oleObject)) )
+ LPOLEOBJECT p_oleObject;
+ if( SUCCEEDED(QueryInterface(IID_IOleObject, (void**)&p_oleObject)) )
+ {
+ LPOLECLIENTSITE p_clientSite;
+ if( SUCCEEDED(p_oleObject->GetClientSite(&p_clientSite)) )
{
- LPOLECLIENTSITE p_clientSite;
- if( SUCCEEDED(p_oleObject->GetClientSite(&p_clientSite)) )
+ LPOLEINPLACESITE p_inPlaceSite;
+
+ if( SUCCEEDED(p_clientSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
- LPOLEINPLACESITE p_inPlaceSite;
-
- if( SUCCEEDED(p_clientSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
- {
- p_inPlaceSite->OnUIDeactivate(FALSE);
- p_inPlaceSite->Release();
- }
- p_clientSite->Release();
+ p_inPlaceSite->OnUIDeactivate(FALSE);
+ p_inPlaceSite->Release();
}
- p_oleObject->Release();
+ p_clientSite->Release();
}
- return S_OK;
+ p_oleObject->Release();
}
+ return S_OK;
}
return E_UNEXPECTED;
};
VLCOleObject::~VLCOleObject()
{
+ SetClientSite(NULL);
+ Close(OLECLOSE_NOSAVE);
_p_advise_holder->Release();
- SetClientSite(NULL);
};
STDMETHODIMP VLCOleObject::Advise(IAdviseSink *pAdvSink, DWORD *dwConnection)
STDMETHODIMP VLCOleObject::Close(DWORD dwSaveOption)
{
- _p_advise_holder->SendOnClose();
- return _p_instance->onClose(dwSaveOption);
+ if( _p_instance->isRunning() )
+ {
+ _p_advise_holder->SendOnClose();
+ return _p_instance->onClose(dwSaveOption);
+ }
+ return S_OK;
};
STDMETHODIMP VLCOleObject::DoVerb(LONG iVerb, LPMSG lpMsg, LPOLECLIENTSITE pActiveSite,
LPOLEINPLACEUIWINDOW p_inPlaceUIWindow;
OLEINPLACEFRAMEINFO oleFrameInfo;
+ oleFrameInfo.cb = sizeof(OLEINPLACEFRAMEINFO);
if( SUCCEEDED(p_inPlaceSite->GetWindowContext(&p_inPlaceFrame, &p_inPlaceUIWindow, &posRect, &clipRect, &oleFrameInfo)) )
{
lprcPosRect = &posRect;
STDMETHODIMP VLCOleObject::SetClientSite(LPOLECLIENTSITE pClientSite)
{
- if( NULL != pClientSite )
- {
- pClientSite->AddRef();
-
- /*
- ** retrieve container ambient properties
- */
- VARIANT v;
- VariantInit(&v);
- V_VT(&v) = VT_I4;
- if( SUCCEEDED(GetObjectProperty(pClientSite, DISPID_AMBIENT_CODEPAGE, v)) )
- {
- _p_instance->setCodePage(V_I4(&v));
- VariantClear(&v);
- }
- }
-
if( NULL != _p_clientsite )
_p_clientsite->Release();
_p_clientsite = pClientSite;
- _p_instance->onClientSiteChanged(pClientSite);
+ if( NULL != pClientSite )
+ {
+ pClientSite->AddRef();
+ _p_instance->onAmbientChanged(pClientSite, DISPID_UNKNOWN);
+ }
return S_OK;
};
STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog)
{
- if( NULL == pPropBag )
- return E_POINTER;
-
HRESULT hr = _p_instance->onInit();
if( FAILED(hr) )
return hr;
+ if( NULL == pPropBag )
+ return E_INVALIDARG;
+
VARIANT value;
V_VT(&value) = VT_BSTR;
- if( S_OK == pPropBag->Read(OLESTR("filename"), &value, pErrorLog) )
+ if( S_OK == pPropBag->Read(OLESTR("mrl"), &value, pErrorLog) )
{
- char *src = CStrFromBSTR(_p_instance->getCodePage(), V_BSTR(&value));
- if( NULL != src )
- {
- _p_instance->setSourceURL(src);
- free(src);
- }
+ _p_instance->setMRL(V_BSTR(&value));
VariantClear(&value);
}
-
- V_VT(&value) = VT_BSTR;
- if( S_OK == pPropBag->Read(OLESTR("src"), &value, pErrorLog) )
+ else
{
- char *src = CStrFromBSTR(_p_instance->getCodePage(), V_BSTR(&value));
- if( NULL != src )
+ /*
+ ** try alternative syntax
+ */
+ V_VT(&value) = VT_BSTR;
+ if( S_OK == pPropBag->Read(OLESTR("src"), &value, pErrorLog) )
{
- _p_instance->setSourceURL(src);
- free(src);
+ _p_instance->setMRL(V_BSTR(&value));
+ VariantClear(&value);
+ }
+ else
+ {
+ V_VT(&value) = VT_BSTR;
+ if( S_OK == pPropBag->Read(OLESTR("filename"), &value, pErrorLog) )
+ {
+ _p_instance->setMRL(V_BSTR(&value));
+ VariantClear(&value);
+ }
}
- VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("autoplay"), &value, pErrorLog) )
{
- _p_instance->setAutoStart(V_BOOL(&value) != VARIANT_FALSE);
+ _p_instance->setAutoPlay(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
+ else
+ {
+ /*
+ ** try alternative syntax
+ */
+ V_VT(&value) = VT_BOOL;
+ if( S_OK == pPropBag->Read(OLESTR("autostart"), &value, pErrorLog) )
+ {
+ _p_instance->setAutoPlay(V_BOOL(&value) != VARIANT_FALSE);
+ VariantClear(&value);
+ }
+ }
- V_VT(&value) = VT_BOOL;
- if( S_OK == pPropBag->Read(OLESTR("autostart"), &value, pErrorLog) )
+ SIZEL size = _p_instance->getExtent();
+ V_VT(&value) = VT_I4;
+ if( S_OK == pPropBag->Read(OLESTR("extentwidth"), &value, pErrorLog) )
+ {
+ size.cx = V_I4(&value);
+ VariantClear(&value);
+ }
+ V_VT(&value) = VT_I4;
+ if( S_OK == pPropBag->Read(OLESTR("extentheight"), &value, pErrorLog) )
{
- _p_instance->setAutoStart(V_BOOL(&value) != VARIANT_FALSE);
+ size.cy = V_I4(&value);
VariantClear(&value);
}
+ _p_instance->setExtent(size);
V_VT(&value) = VT_BOOL;
- if( S_OK == pPropBag->Read(OLESTR("loop"), &value, pErrorLog) )
+ if( S_OK == pPropBag->Read(OLESTR("autoloop"), &value, pErrorLog) )
{
- _p_instance->setLoopMode(V_BOOL(&value) != VARIANT_FALSE);
+ _p_instance->setAutoLoop(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
+ else
+ {
+ /*
+ ** try alternative syntax
+ */
+ V_VT(&value) = VT_BOOL;
+ if( S_OK == pPropBag->Read(OLESTR("loop"), &value, pErrorLog) )
+ {
+ _p_instance->setAutoLoop(V_BOOL(&value) != VARIANT_FALSE);
+ VariantClear(&value);
+ }
+ }
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("mute"), &value, pErrorLog) )
}
V_VT(&value) = VT_BOOL;
- if( S_OK == pPropBag->Read(OLESTR("showdisplay"), &value, pErrorLog) )
+ if( S_OK == pPropBag->Read(OLESTR("visible"), &value, pErrorLog) )
{
_p_instance->setVisible(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
+ else
+ {
+ /*
+ ** try alternative syntax
+ */
+ V_VT(&value) = VT_BOOL;
+ if( S_OK == pPropBag->Read(OLESTR("showdisplay"), &value, pErrorLog) )
+ {
+ _p_instance->setVisible(V_BOOL(&value) != VARIANT_FALSE);
+ VariantClear(&value);
+ }
+ }
+ int i_vlc = _p_instance->getVLCObject();
+ V_VT(&value) = VT_I4;
+ if( S_OK == pPropBag->Read(OLESTR("volume"), &value, pErrorLog) )
+ {
+ VLC_VolumeSet(i_vlc, V_I4(&value));
+ VariantClear(&value);
+ }
return _p_instance->onLoad();
};
STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties)
{
if( NULL == pPropBag )
- return E_POINTER;
+ return E_INVALIDARG;
+
+ VARIANT value;
+
+ VariantInit(&value);
+
+ V_VT(&value) = VT_BOOL;
+ V_BOOL(&value) = _p_instance->getAutoLoop()? VARIANT_TRUE : VARIANT_FALSE;
+ pPropBag->Write(OLESTR("AutoLoop"), &value);
+ VariantClear(&value);
+
+ V_VT(&value) = VT_BOOL;
+ V_BOOL(&value) = _p_instance->getAutoPlay()? VARIANT_TRUE : VARIANT_FALSE;
+ pPropBag->Write(OLESTR("AutoPlay"), &value);
+ VariantClear(&value);
+
+ SIZEL size = _p_instance->getExtent();
+ V_VT(&value) = VT_I4;
+ V_I4(&value) = size.cx;
+ pPropBag->Write(OLESTR("ExtentWidth"), &value);
+ V_I4(&value) = size.cy;
+ pPropBag->Write(OLESTR("ExtentHeight"), &value);
+
+ V_VT(&value) = VT_BSTR;
+ V_BSTR(&value) = SysAllocString(_p_instance->getMRL());
+ pPropBag->Write(OLESTR("MRL"), &value);
+ VariantClear(&value);
+
+ V_VT(&value) = VT_BOOL;
+ V_BOOL(&value) = _p_instance->getVisible()? VARIANT_TRUE : VARIANT_FALSE;
+ pPropBag->Write(OLESTR("Visible"), &value);
+ VariantClear(&value);
+
+ int i_vlc = _p_instance->getVLCObject();
+ if( i_vlc )
+ {
+ V_VT(&value) = VT_I4;
+ V_I4(&value) = VLC_VolumeGet(i_vlc);
+ pPropBag->Write(OLESTR("Volume"), &value);
+ VariantClear(&value);
+ }
+
+ if( fClearDirty )
+ _p_instance->setDirty(FALSE);
return S_OK;
};
STDMETHODIMP VLCPersistStorage::IsDirty(void)
{
- return S_FALSE;
+ return _p_instance->isDirty() ? S_OK : S_FALSE;
};
STDMETHODIMP VLCPersistStorage::InitNew(IStorage *pStg)
{
- if( NULL == pStg )
- return E_POINTER;
-
return _p_instance->onInit();
};
STDMETHODIMP VLCPersistStorage::Load(IStorage *pStg)
{
if( NULL == pStg )
- return E_POINTER;
+ return E_INVALIDARG;
- return _p_instance->onInit();
+ LPSTREAM pStm = NULL;
+ HRESULT result = pStg->OpenStream(L"VideoLAN ActiveX Plugin Data", NULL,
+ STGM_READ|STGM_SHARE_EXCLUSIVE, 0, &pStm);
+
+ if( FAILED(result) )
+ return result;
+
+ LPPERSISTSTREAMINIT pPersistStreamInit;
+ if( SUCCEEDED(QueryInterface(IID_IPersistStreamInit, (void **)&pPersistStreamInit)) )
+ {
+ result = pPersistStreamInit->Load(pStm);
+ pPersistStreamInit->Release();
+ }
+
+ pStm->Release();
+
+ return result;
};
STDMETHODIMP VLCPersistStorage::Save(IStorage *pStg, BOOL fSameAsLoad)
{
if( NULL == pStg )
- return E_POINTER;
+ return E_INVALIDARG;
- return S_OK;
+ if( fSameAsLoad && (S_FALSE == IsDirty()) )
+ return S_OK;
+
+ LPSTREAM pStm = NULL;
+ HRESULT result = pStg->CreateStream(L"VideoLAN ActiveX Plugin Data",
+ STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, 0, &pStm);
+
+ if( FAILED(result) )
+ return result;
+
+ LPPERSISTSTREAMINIT pPersistStreamInit;
+ if( SUCCEEDED(QueryInterface(IID_IPersistStreamInit, (void **)&pPersistStreamInit)) )
+ {
+ result = pPersistStreamInit->Save(pStm, fSameAsLoad);
+ pPersistStreamInit->Release();
+ }
+
+ pStm->Release();
+
+ return result;
};
STDMETHODIMP VLCPersistStorage::SaveCompleted(IStorage *pStg)
#include "plugin.h"
#include "persiststreaminit.h"
+#include "utils.h"
+#include <map>
+
+#include <malloc.h>
+#include <wchar.h>
+
using namespace std;
+class AxVLCVariant
+{
+
+public:
+
+ AxVLCVariant(void)
+ {
+ VariantInit(&_v);
+ };
+
+ ~AxVLCVariant(void)
+ {
+ VariantClear(&_v);
+ }
+
+ AxVLCVariant(VARIANTARG &v)
+ {
+ //VariantInit(&_v);
+ //VariantCopy(&_v, &v);
+ _v = v;
+ };
+
+ AxVLCVariant(VARIANTARG *v)
+ {
+ VariantInit(&_v);
+ VariantCopy(&_v, v);
+ };
+
+ AxVLCVariant(const AxVLCVariant &vv)
+ {
+ VariantInit(&_v);
+ VariantCopy(&_v, const_cast<VARIANTARG *>(&(vv._v)));
+ };
+
+ AxVLCVariant(int i)
+ {
+ V_VT(&_v) = VT_I4;
+ V_I4(&_v) = i;
+ };
+
+ AxVLCVariant(BSTR bstr)
+ {
+ VARIANT arg;
+ V_VT(&arg) = VT_BSTR;
+ V_BSTR(&arg) = bstr;
+ VariantCopy(&_v, &arg);
+ };
+
+ inline const VARIANTARG *variantArg(void) const {
+ return &_v;
+ }
+
+ inline void swap(AxVLCVariant &v1, AxVLCVariant &v2)
+ {
+ VARIANTARG tmp = v1._v;
+ v1._v = v2._v;
+ v2._v = tmp;
+ };
+
+private:
+
+ VARIANTARG _v;
+};
+
+class AxVLCWSTR
+{
+
+public:
+
+ AxVLCWSTR(void) : _data(NULL) {};
+
+ virtual ~AxVLCWSTR()
+ {
+ if( NULL != _data )
+ {
+ ULONG refcount = InterlockedDecrement(&(_data->refcount));
+ if( 0 == refcount )
+ CoTaskMemFree(_data);
+ }
+ };
+
+ AxVLCWSTR(LPCWSTR s)
+ {
+ if( NULL != s )
+ {
+ size_t len = wcslen(s);
+ if( len > 0 )
+ {
+ size_t size = len*sizeof(WCHAR);
+ _data = (struct data *)CoTaskMemAlloc(sizeof(struct data)+size);
+ if( NULL != _data )
+ {
+ _data->len = len;
+ _data->refcount = 1;
+ memcpy(_data->wstr, s, size);
+ _data->wstr[len]=L'\0';
+ return;
+ }
+ }
+ }
+ _data = NULL;
+ };
+
+ AxVLCWSTR(const AxVLCWSTR &s)
+ {
+ _data = s._data;
+ if( NULL != _data )
+ InterlockedIncrement(&(_data->refcount));
+ };
+
+ inline bool operator<(const AxVLCWSTR &s) const
+ {
+ return compareNoCase(s.wstr()) < 0;
+ };
+
+ inline bool operator<(LPCWSTR s) const
+ {
+ return compareNoCase(s) < 0;
+ };
+
+ inline bool operator==(const AxVLCWSTR &s) const
+ {
+ return compareNoCase(s.wstr()) == 0;
+ };
+
+ inline bool operator==(LPCWSTR s) const
+ {
+ return compareNoCase(s) == 0;
+ };
+
+ LPCWSTR wstr(void) const
+ {
+ return (NULL != _data) ? _data->wstr : NULL;
+ };
+
+ size_t size(void) const
+ {
+ return (NULL != _data) ? _data->len : 0;
+ };
+
+private:
+
+ inline int compareNoCase(LPCWSTR s) const
+ {
+ if( NULL == _data )
+ {
+ return (NULL == s) ? 0 : -1;
+ }
+ if( NULL == s )
+ return 1;
+
+ return _wcsicmp(_data->wstr, s);
+ };
+
+ struct data {
+ size_t len;
+ LONG refcount;
+ wchar_t wstr[1];
+ } *_data;
+};
+
+typedef pair<class AxVLCWSTR, class AxVLCVariant> AxVLCPropertyPair;
+typedef map<class AxVLCWSTR, class AxVLCVariant> AxVLCPropertyMap;
+
+///////////////////////////
+
+class VLCPropertyBag : public IPropertyBag
+{
+
+public:
+
+ VLCPropertyBag(void) : _i_ref(1) {};
+ virtual ~VLCPropertyBag() {};
+
+ // IUnknown methods
+ STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
+ {
+ if( NULL == ppv )
+ return E_POINTER;
+ if( (IID_IUnknown == riid)
+ && (IID_IPropertyBag == riid) )
+ {
+ AddRef();
+ *ppv = reinterpret_cast<LPVOID>(this);
+ return NOERROR;
+ }
+ // standalone object
+ return E_NOINTERFACE;
+ };
+
+ STDMETHODIMP_(ULONG) AddRef(void)
+ { return InterlockedIncrement(&_i_ref); };
+
+ STDMETHODIMP_(ULONG) Release(void)
+ {
+ ULONG refcount = InterlockedDecrement(&_i_ref);
+ if( 0 == refcount )
+ {
+ delete this;
+ return 0;
+ }
+ return refcount;
+ };
+
+ // IPropertyBag methods
+
+ STDMETHODIMP Read(LPCOLESTR pszPropName, VARIANT *pVar, IErrorLog *pErrorLog)
+ {
+ if( (NULL == pszPropName) || (NULL == pVar) )
+ return E_POINTER;
+
+ AxVLCPropertyMap::const_iterator notfound = _pm.end();
+ AxVLCPropertyMap::const_iterator iter = _pm.find(pszPropName);
+ if( notfound != iter )
+ {
+ VARTYPE vtype = V_VT(pVar);
+ VariantCopy(pVar, const_cast<VARIANTARG*>((*iter).second.variantArg()));
+ if( (V_VT(pVar) != vtype) && FAILED(VariantChangeType(pVar, pVar, 0, vtype)) )
+ {
+ VariantClear(pVar);
+ return E_FAIL;
+ }
+ return S_OK;
+ }
+ else
+ return E_INVALIDARG;
+ };
+
+ STDMETHODIMP Write(LPCOLESTR pszPropName, VARIANT *pVar)
+ {
+ if( (NULL == pszPropName) || (NULL == pVar) )
+ return E_POINTER;
+
+ AxVLCPropertyPair val(pszPropName, pVar);
+ pair<AxVLCPropertyMap::iterator, bool> p = _pm.insert(val);
+ if( false == p.second )
+ // replace existing key value
+ (*p.first).second = val.second;
+ return S_OK;
+ };
+
+ // custom methods
+
+ HRESULT Load(LPSTREAM pStm)
+ {
+ if( NULL == pStm )
+ return E_INVALIDARG;
+
+ HRESULT result;
+
+ AxVLCPropertyPair *val;
+ result = ReadProperty(pStm, &val);
+ if( SUCCEEDED(result) )
+ {
+ if( (val->first == L"(Count)") && (VT_I4 == V_VT(val->second.variantArg())) )
+ {
+ size_t count = V_I4(val->second.variantArg());
+ delete val;
+ while( count-- )
+ {
+ result = ReadProperty(pStm, &val);
+ if( FAILED(result) )
+ return result;
+
+ pair<AxVLCPropertyMap::iterator, bool> p = _pm.insert(*val);
+ if( false == p.second )
+ // replace existing key value
+ (*p.first).second = val->second;
+ delete val;
+ }
+ }
+ }
+ return result;
+ };
+
+ HRESULT Save(LPSTREAM pStm)
+ {
+ if( NULL == pStm )
+ return E_INVALIDARG;
+
+ HRESULT result;
+
+ AxVLCPropertyPair header(L"(Count)", _pm.size());
+ result = WriteProperty(pStm, header);
+ if( SUCCEEDED(result) )
+ {
+ AxVLCPropertyMap::const_iterator iter = _pm.begin();
+ AxVLCPropertyMap::const_iterator end = _pm.end();
+
+ while( iter != end )
+ {
+ result = WriteProperty(pStm, *(iter++));
+ if( FAILED(result) )
+ return result;
+ }
+ }
+ return result;
+ };
+
+ BOOL IsEmpty()
+ {
+ return _pm.size() == 0;
+ }
+
+private:
+
+ HRESULT WriteProperty(LPSTREAM pStm, const AxVLCPropertyPair &prop)
+ {
+ HRESULT result;
+
+ const AxVLCWSTR propName = prop.first;
+
+ ULONG len = propName.size();
+
+ if( 0 == len )
+ return E_INVALIDARG;
+
+ result = pStm->Write(&len, sizeof(len), NULL);
+ if( FAILED(result) )
+ return result;
+
+ result = pStm->Write(propName.wstr(), len*sizeof(WCHAR), NULL);
+ if( FAILED(result) )
+ return result;
+
+ const VARIANTARG *propValue = prop.second.variantArg();
+ VARTYPE vtype = V_VT(propValue);
+ switch( vtype )
+ {
+ case VT_BOOL:
+ result = pStm->Write(&vtype, sizeof(vtype), NULL);
+ if( FAILED(result) )
+ return result;
+ result = pStm->Write(&V_BOOL(propValue), sizeof(V_BOOL(propValue)), NULL);
+ if( FAILED(result) )
+ return result;
+ break;
+ case VT_I4:
+ result = pStm->Write(&vtype, sizeof(vtype), NULL);
+ if( FAILED(result) )
+ return result;
+ result = pStm->Write(&V_I4(propValue), sizeof(V_I4(propValue)), NULL);
+ if( FAILED(result) )
+ return result;
+ break;
+ case VT_BSTR:
+ result = pStm->Write(&vtype, sizeof(vtype), NULL);
+ if( FAILED(result) )
+ return result;
+ len = SysStringLen(V_BSTR(propValue));
+ result = pStm->Write(&len, sizeof(len), NULL);
+ if( FAILED(result) )
+ return result;
+ if( len > 0 )
+ {
+ result = pStm->Write(V_BSTR(propValue), len*sizeof(OLECHAR), NULL);
+ if( FAILED(result) )
+ return result;
+ }
+ break;
+ default:
+ vtype = VT_EMPTY;
+ result = pStm->Write(&vtype, sizeof(vtype), NULL);
+ if( FAILED(result) )
+ return result;
+ }
+ return result;
+ };
+
+ static HRESULT ReadProperty(LPSTREAM pStm, AxVLCPropertyPair **prop)
+ {
+ HRESULT result;
+
+ ULONG len;
+
+ result = pStm->Read(&len, sizeof(len), NULL);
+ if( FAILED(result) )
+ return result;
+
+ if( 0 == len )
+ return E_INVALIDARG;
+
+ LPWSTR propName = (LPOLESTR)::alloca((len+1)*sizeof(WCHAR));
+ if( NULL == propName )
+ return E_OUTOFMEMORY;
+
+ result = pStm->Read(propName, len*sizeof(WCHAR), NULL);
+ if( FAILED(result) )
+ return result;
+
+ propName[len] = L'\0';
+
+ VARIANTARG propValue;
+
+ VARTYPE vtype;
+ result = pStm->Read(&vtype, sizeof(vtype), NULL);
+ if( FAILED(result) )
+ return result;
+
+ switch( vtype )
+ {
+ case VT_BOOL:
+ V_VT(&propValue) = vtype;
+ result = pStm->Read(&V_BOOL(&propValue), sizeof(V_BOOL(&propValue)), NULL);
+ if( FAILED(result) )
+ return result;
+ break;
+ case VT_I4:
+ V_VT(&propValue) = vtype;
+ result = pStm->Read(&V_I4(&propValue), sizeof(V_I4(&propValue)), NULL);
+ if( FAILED(result) )
+ return result;
+ break;
+ case VT_BSTR:
+ V_VT(&propValue) = vtype;
+ result = pStm->Read(&len, sizeof(len), NULL);
+ if( FAILED(result) )
+ return result;
+
+ V_BSTR(&propValue) = NULL;
+ if( len > 0 )
+ {
+ V_BSTR(&propValue) = SysAllocStringLen(NULL, len);
+ if( NULL == V_BSTR(&propValue) )
+ return E_OUTOFMEMORY;
+
+ result = pStm->Read(V_BSTR(&propValue), len*sizeof(OLECHAR), NULL);
+ if( FAILED(result) )
+ {
+ SysFreeString(V_BSTR(&propValue));
+ return result;
+ }
+ }
+ break;
+ default:
+ VariantInit(&propValue);
+ }
+
+ *prop = new AxVLCPropertyPair(propName, propValue);
+
+ return S_OK;
+ };
+
+ AxVLCPropertyMap _pm;
+ LONG _i_ref;
+};
+
+///////////////////////////
+
+VLCPersistStreamInit::VLCPersistStreamInit(VLCPlugin *p_instance) : _p_instance(p_instance)
+{
+ _p_props = new VLCPropertyBag();
+};
+
+VLCPersistStreamInit::~VLCPersistStreamInit()
+{
+ _p_props->Release();
+};
+
STDMETHODIMP VLCPersistStreamInit::GetClassID(LPCLSID pClsID)
{
if( NULL == pClsID )
STDMETHODIMP VLCPersistStreamInit::Load(LPSTREAM pStm)
{
- if( NULL == pStm )
- return E_POINTER;
+ HRESULT result = _p_props->Load(pStm);
+ if( FAILED(result) )
+ return result;
- return _p_instance->onInit();
+ LPPERSISTPROPERTYBAG pPersistPropBag;
+ if( FAILED(QueryInterface(IID_IPersistPropertyBag, (void**)&pPersistPropBag)) )
+ return E_FAIL;
+
+ result = pPersistPropBag->Load(_p_props, NULL);
+ pPersistPropBag->Release();
+
+ return result;
};
STDMETHODIMP VLCPersistStreamInit::Save(LPSTREAM pStm, BOOL fClearDirty)
{
if( NULL == pStm )
- return E_POINTER;
+ return E_INVALIDARG;
- return S_OK;
+ LPPERSISTPROPERTYBAG pPersistPropBag;
+ if( FAILED(QueryInterface(IID_IPersistPropertyBag, (void**)&pPersistPropBag)) )
+ return E_FAIL;
+
+ HRESULT result = pPersistPropBag->Save(_p_props, fClearDirty, _p_props->IsEmpty());
+ pPersistPropBag->Release();
+ if( FAILED(result) )
+ return result;
+
+ return _p_props->Save(pStm);
};
STDMETHODIMP VLCPersistStreamInit::IsDirty(void)
{
- return S_FALSE;
+ return _p_instance->isDirty() ? S_OK : S_FALSE;
};
STDMETHODIMP VLCPersistStreamInit::GetSizeMax(ULARGE_INTEGER *pcbSize)
{
- pcbSize->QuadPart = 0ULL;
+ pcbSize->HighPart = 0UL;
+ pcbSize->LowPart = 4096UL; // just a guess
return S_OK;
};
public:
- VLCPersistStreamInit(VLCPlugin *p_instance) : _p_instance(p_instance) {};
- virtual ~VLCPersistStreamInit() {};
+ VLCPersistStreamInit(VLCPlugin *p_instance);
+ virtual ~VLCPersistStreamInit();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
private:
VLCPlugin *_p_instance;
+ class VLCPropertyBag *_p_props;
};
#endif
#include <string.h>
#include <winreg.h>
+#include <winuser.h>
+#include <servprov.h>
+#include <shlwapi.h>
+#include <wininet.h>
using namespace std;
if( ! GetClassInfo(hInstance, getInPlaceWndClassName(), &wClass) )
{
- wClass.style = CS_NOCLOSE|CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
+ wClass.style = CS_NOCLOSE|CS_DBLCLKS;
wClass.lpfnWndProc = VLCInPlaceClassWndProc;
wClass.cbClsExtra = 0;
wClass.cbWndExtra = 0;
if( ! GetClassInfo(hInstance, getVideoWndClassName(), &wClass) )
{
- wClass.style = CS_NOCLOSE|CS_HREDRAW|CS_VREDRAW;
+ wClass.style = CS_NOCLOSE;
wClass.lpfnWndProc = VLCVideoClassWndProc;
wClass.cbClsExtra = 0;
wClass.cbWndExtra = 0;
_inplacewnd(NULL),
_p_class(p_class),
_i_ref(1UL),
- _codepage(CP_ACP),
- _psz_src(NULL),
- _b_autostart(TRUE),
- _b_loopmode(FALSE),
+ _i_codepage(CP_ACP),
+ _b_usermode(TRUE),
+ _bstr_mrl(NULL),
+ _b_autoplay(TRUE),
+ _b_autoloop(FALSE),
_b_visible(TRUE),
_b_mute(FALSE),
_i_vlc(0)
{
p_class->AddRef();
- vlcOleObject = new VLCOleObject(this);
vlcOleControl = new VLCOleControl(this);
vlcOleInPlaceObject = new VLCOleInPlaceObject(this);
vlcOleInPlaceActiveObject = new VLCOleInPlaceActiveObject(this);
vlcControl = new VLCControl(this);
vlcViewObject = new VLCViewObject(this);
vlcDataObject = new VLCDataObject(this);
+ vlcOleObject = new VLCOleObject(this);
// configure controlling IUnknown interface for implemented interfaces
this->pUnkOuter = (NULL != pUnkOuter) ? pUnkOuter : dynamic_cast<LPUNKNOWN>(this);
// default picure
- _pict = p_class->getInPlacePict();
+ _p_pict = p_class->getInPlacePict();
// set default/preferred size (320x240) pixels in HIMETRIC
HDC hDC = CreateDevDC(NULL);
- _extent.cx = (320*2540L)/GetDeviceCaps(hDC, LOGPIXELSX);
- _extent.cy = (240*2540L)/GetDeviceCaps(hDC, LOGPIXELSY);
+ _extent.cx = 320;
+ _extent.cy = 240;
+ HimetricFromDP(hDC, (LPPOINT)&_extent, 1);
DeleteDC(hDC);
};
VLCPlugin::~VLCPlugin()
{
- vlcOleInPlaceObject->UIDeactivate();
- vlcOleInPlaceObject->InPlaceDeactivate();
-
+ delete vlcOleObject;
delete vlcDataObject;
delete vlcViewObject;
delete vlcControl;
- delete vlcObjectSafety;
delete vlcConnectionPointContainer;
delete vlcProvideClassInfo;
delete vlcPersistPropertyBag;
delete vlcPersistStorage;
delete vlcOleInPlaceActiveObject;
delete vlcOleInPlaceObject;
- delete vlcOleControl;
- delete vlcOleObject;
+ delete vlcObjectSafety;
- if( _pict )
- _pict->Release();
+ delete vlcOleControl;
+ if( _p_pict )
+ _p_pict->Release();
- if( _psz_src )
- free(_psz_src);
+ SysFreeString(_bstr_mrl),
_p_class->Release();
};
else if( IID_IOleInPlaceActiveObject == riid )
*ppv = reinterpret_cast<LPVOID>(vlcOleInPlaceActiveObject);
else if( IID_IPersist == riid )
- *ppv = reinterpret_cast<LPVOID>(vlcPersistPropertyBag);
+ *ppv = reinterpret_cast<LPVOID>(vlcPersistStreamInit);
else if( IID_IPersistStreamInit == riid )
*ppv = reinterpret_cast<LPVOID>(vlcPersistStreamInit);
else if( IID_IPersistStorage == riid )
{
if( 0 == _i_vlc )
{
-#ifdef ACTIVEX_DEBUG
- char *ppsz_argv[] = { "vlc", "-vvv", "--fast-mutex", "--win9x-cv-method=1" };
+//#ifdef ACTIVEX_DEBUG
+#if 1
+ char *ppsz_argv[] = { "vlc", "-vv", "--fast-mutex", "--win9x-cv-method=1" };
#else
char *ppsz_argv[] = { "vlc", "-vv" };
#endif
RegCloseKey( h_key );
}
-#if 0
+#if 1
ppsz_argv[0] = "C:\\cygwin\\home\\Damien_Fouilleul\\dev\\videolan\\vlc-trunk\\vlc";
#endif
if( _b_mute )
VLC_VolumeMute(_i_vlc);
- if( NULL != _psz_src )
+ if( NULL != _bstr_mrl )
{
- // add default target to playlist
- char *cOptions[1];
- int cOptionsCount = 0;
+ /*
+ ** try to combine MRL with client site moniker, which for Internet Explorer
+ ** is the URL of the page the plugin is embedded into. Hence, if the MRL
+ ** is a relative URL, we should end up with an absolute URL
+ */
+ IOleClientSite *pClientSite;
+ if( SUCCEEDED(vlcOleObject->GetClientSite(&pClientSite)) )
+ {
+ IBindCtx *pBC = 0;
+ if( SUCCEEDED(CreateBindCtx(0, &pBC)) )
+ {
+ LPMONIKER pContMoniker = NULL;
+ if( SUCCEEDED(pClientSite->GetMoniker(OLEGETMONIKER_ONLYIFTHERE,
+ OLEWHICHMK_CONTAINER, &pContMoniker)) )
+ {
+ LPOLESTR name;
+ if( SUCCEEDED(pContMoniker->GetDisplayName(pBC, NULL, &name)) )
+ {
+ if( UrlIsW(name, URLIS_URL) )
+ {
+ LPOLESTR url = (LPOLESTR)CoTaskMemAlloc(sizeof(OLECHAR)*INTERNET_MAX_URL_LENGTH);
+ if( NULL != url )
+ {
+ DWORD len = INTERNET_MAX_URL_LENGTH;
+ if( SUCCEEDED(UrlCombineW(name, _bstr_mrl, url, &len,
+ URL_ESCAPE_UNSAFE)) )
+ {
+ SysFreeString(_bstr_mrl);
+ _bstr_mrl = SysAllocString(url);
+ }
+ CoTaskMemFree(url);
+ }
+ }
+ CoTaskMemFree(name);
+ }
+ pContMoniker->Release();
+ }
+ pBC->Release();
+ }
+ pClientSite->Release();
+ }
- if( _b_loopmode )
+ char *psz_mrl = CStrFromBSTR(CP_UTF8, _bstr_mrl);
+ if( NULL != psz_mrl )
{
- cOptions[cOptionsCount++] = "loop";
+ // add default target to playlist
+ char *cOptions[1];
+ int cOptionsCount = 0;
+
+ if( _b_autoloop )
+ {
+ cOptions[cOptionsCount++] = "loop";
+ }
+ VLC_AddTarget(_i_vlc, psz_mrl, (const char **)&cOptions, cOptionsCount, PLAYLIST_APPEND, PLAYLIST_END);
+ CoTaskMemFree(psz_mrl);
}
- VLC_AddTarget(_i_vlc, _psz_src, (const char **)&cOptions, cOptionsCount, PLAYLIST_APPEND, PLAYLIST_END);
}
+ setDirty(FALSE);
return S_OK;
};
-HRESULT VLCPlugin::onClientSiteChanged(LPOLECLIENTSITE pActiveSite)
+HRESULT VLCPlugin::onAmbientChanged(LPUNKNOWN pContainer, DISPID dispID)
{
- if( NULL != pActiveSite )
+ VARIANT v;
+ switch( dispID )
{
- /*
- ** object is embedded in container
- ** try to activate in place if it has already been initialized
- */
- if( _i_vlc )
- {
- vlcOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, pActiveSite, 0, NULL, NULL);
- }
+ case DISPID_AMBIENT_BACKCOLOR:
+ break;
+ case DISPID_AMBIENT_DISPLAYNAME:
+ break;
+ case DISPID_AMBIENT_FONT:
+ break;
+ case DISPID_AMBIENT_FORECOLOR:
+ break;
+ case DISPID_AMBIENT_LOCALEID:
+ break;
+ case DISPID_AMBIENT_MESSAGEREFLECT:
+ break;
+ case DISPID_AMBIENT_SCALEUNITS:
+ break;
+ case DISPID_AMBIENT_TEXTALIGN:
+ break;
+ case DISPID_AMBIENT_USERMODE:
+ VariantInit(&v);
+ V_VT(&v) = VT_BOOL;
+ if( SUCCEEDED(GetObjectProperty(pContainer, dispID, v)) )
+ {
+ setUserMode(V_BOOL(&v) != VARIANT_FALSE);
+ VariantClear(&v);
+ }
+ break;
+ case DISPID_AMBIENT_UIDEAD:
+ break;
+ case DISPID_AMBIENT_SHOWGRABHANDLES:
+ break;
+ case DISPID_AMBIENT_SHOWHATCHING:
+ break;
+ case DISPID_AMBIENT_DISPLAYASDEFAULT:
+ break;
+ case DISPID_AMBIENT_SUPPORTSMNEMONICS:
+ break;
+ case DISPID_AMBIENT_AUTOCLIP:
+ break;
+ case DISPID_AMBIENT_APPEARANCE:
+ break;
+ case DISPID_AMBIENT_CODEPAGE:
+ VariantInit(&v);
+ V_VT(&v) = VT_I4;
+ if( SUCCEEDED(GetObjectProperty(pContainer, dispID, v)) )
+ {
+ setCodePage(V_I4(&v));
+ }
+ break;
+ case DISPID_AMBIENT_PALETTE:
+ break;
+ case DISPID_AMBIENT_CHARSET:
+ break;
+ case DISPID_AMBIENT_RIGHTTOLEFT:
+ break;
+ case DISPID_AMBIENT_TOPTOBOTTOM:
+ break;
+ case DISPID_UNKNOWN:
+ VariantInit(&v);
+ V_VT(&v) = VT_BOOL;
+ if( SUCCEEDED(GetObjectProperty(pContainer, DISPID_AMBIENT_USERMODE, v)) )
+ {
+ setUserMode(V_BOOL(&v) != VARIANT_FALSE);
+ VariantClear(&v);
+ }
+ VariantInit(&v);
+ V_VT(&v) = VT_I4;
+ if( SUCCEEDED(GetObjectProperty(pContainer, dispID, v)) )
+ {
+ setCodePage(V_I4(&v));
+ }
+ break;
}
return S_OK;
};
*/
_inplacewnd = CreateWindow(_p_class->getInPlaceWndClassName(),
"VLC Plugin In-Place Window",
- WS_CHILD|WS_CLIPCHILDREN|WS_TABSTOP,
+ WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,
clipRect.left,
clipRect.top,
clipRect.right-clipRect.left,
vlc_value_t val;
val.i_int = reinterpret_cast<int>(_videownd);
VLC_VariableSet(_i_vlc, "drawable", val);
+ val.i_int = posRect.right-posRect.left;
+ VLC_VariableSet(_i_vlc, "width", val);
+ val.i_int = posRect.bottom-posRect.top;
+ VLC_VariableSet(_i_vlc, "height", val);
- if( _b_autostart & (VLC_PlaylistNumberOfItems(_i_vlc) > 0) )
+ if( _b_usermode && _b_autoplay & (VLC_PlaylistNumberOfItems(_i_vlc) > 0) )
{
VLC_Play(_i_vlc);
fireOnPlayEvent();
long width = lprcBounds->right-lprcBounds->left;
long height = lprcBounds->bottom-lprcBounds->top;
- SIZEL devSize;
- if( NULL != hicTargetDev ) {
- devSize.cx = GetDeviceCaps(hicTargetDev, LOGPIXELSX);
- devSize.cy = GetDeviceCaps(hicTargetDev, LOGPIXELSY);
- }
- else if( NULL != (hicTargetDev = CreateDevDC(ptd)) )
- {
- devSize.cx = GetDeviceCaps(hicTargetDev, LOGPIXELSX);
- devSize.cy = GetDeviceCaps(hicTargetDev, LOGPIXELSY);
- DeleteDC(hicTargetDev);
- }
-
RECT bounds = { lprcBounds->left, lprcBounds->top, lprcBounds->right, lprcBounds->bottom };
FillRect(hdcDraw, &bounds, (HBRUSH)GetStockObject(WHITE_BRUSH));
pict->get_Width(&picWidth);
pict->get_Height(&picHeight);
- POINT dstSize = { picWidth*devSize.cx/2540L, picHeight*devSize.cy/2540L };
+ SIZEL picSize = { picWidth, picHeight };
- DPtoLP(hdcDraw, &dstSize, 1);
- if( dstSize.x > width-4 )
- dstSize.x = width-4;
- if( dstSize.y > height-4 )
- dstSize.y = height-4;
+ if( NULL != hicTargetDev )
+ {
+ DPFromHimetric(hicTargetDev, (LPPOINT)&picSize, 1);
+ }
+ else if( NULL != (hicTargetDev = CreateDevDC(ptd)) )
+ {
+ DPFromHimetric(hicTargetDev, (LPPOINT)&picSize, 1);
+ DeleteDC(hicTargetDev);
+ }
+
+ if( picSize.cx > width-4 )
+ picSize.cx = width-4;
+ if( picSize.cy > height-4 )
+ picSize.cy = height-4;
- long dstX = lprcBounds->left+(width-dstSize.x)/2;
- long dstY = lprcBounds->top+(height-dstSize.y)/2;
+ LONG dstX = lprcBounds->left+(width-picSize.cx)/2;
+ LONG dstY = lprcBounds->top+(height-picSize.cy)/2;
if( NULL != lprcWBounds )
{
RECT wBounds = { lprcWBounds->left, lprcWBounds->top, lprcWBounds->right, lprcWBounds->bottom };
- pict->Render(hdcDraw, dstX, dstY, dstSize.x, dstSize.y,
+ pict->Render(hdcDraw, dstX, dstY, picSize.cx, picSize.cy,
0L, picHeight, picWidth, -picHeight, &wBounds);
}
else
- pict->Render(hdcDraw, dstX, dstY, dstSize.x, dstSize.y,
+ pict->Render(hdcDraw, dstX, dstY, picSize.cx, picSize.cy,
0L, picHeight, picWidth, -picHeight, NULL);
pict->Release();
{
/** if VLC is playing, it may not display any VIDEO content
** hence, draw control logo*/
- HDC hdcPict = CreateCompatibleDC(hdc);
- if( NULL != hdcPict )
+ HDC hdcDraw = CreateCompatibleDC(hdc);
+ if( NULL != hdcDraw )
{
+ SIZEL size = getExtent();
+ DPFromHimetric(hdc, (LPPOINT)&size, 1);
+ RECTL posRect = { 0, 0, size.cx, size.cy };
+
int width = bounds.right-bounds.left;
int height = bounds.bottom-bounds.top;
+
HBITMAP hBitmap = CreateCompatibleBitmap(hdc, width, height);
if( NULL != hBitmap )
{
- HBITMAP oldBmp = (HBITMAP)SelectObject(hdcPict, hBitmap);
+ HBITMAP oldBmp = (HBITMAP)SelectObject(hdcDraw, hBitmap);
- RECTL rcBounds = { bounds.left, bounds.top, bounds.right, bounds.bottom };
+ if( (size.cx != width) || (size.cx != height) )
+ {
+ // needs to scale canvas
+ SetMapMode(hdcDraw, MM_ANISOTROPIC);
+ SetWindowExtEx(hdcDraw, size.cx, size.cy, NULL);
+ SetViewportExtEx(hdcDraw, width, height, NULL);
+ }
- onDraw(NULL, hdc, hdcPict, &rcBounds, NULL);
+ onDraw(NULL, hdc, hdcDraw, &posRect, NULL);
- BitBlt(hdc, bounds.left, bounds.top, width, height,
- hdcPict, 0, 0, SRCCOPY);
+ SetMapMode(hdcDraw, MM_TEXT);
+ BitBlt(hdc, bounds.left, bounds.top,
+ width, height,
+ hdcDraw, 0, 0,
+ SRCCOPY);
- SelectObject(hdcPict, oldBmp);
+ SelectObject(hdcDraw, oldBmp);
DeleteObject(hBitmap);
}
- DeleteDC(hdcPict);
+ DeleteDC(hdcDraw);
}
}
};
RECT clipRect = *lprcClipRect;
RECT posRect = *lprcPosRect;
- /*
- ** tell container that previous area needs redrawing
- */
-
- InvalidateRect(GetParent(_inplacewnd), &_posRect, TRUE);
+ //RedrawWindow(GetParent(_inplacewnd), &_posRect, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN);
/*
** record keeping of control geometry within container
*/
-
_posRect = posRect;
/*
/*
** change in-place window geometry to match clipping region
*/
- MoveWindow(_inplacewnd,
+ SetWindowPos(_inplacewnd, NULL,
clipRect.left,
clipRect.top,
clipRect.right-clipRect.left,
clipRect.bottom-clipRect.top,
- FALSE);
+ SWP_NOACTIVATE|
+ SWP_NOCOPYBITS|
+ SWP_NOZORDER|
+ SWP_NOOWNERZORDER );
/*
** change video window geometry to match object bounds within clipping region
*/
- MoveWindow(_videownd,
+ SetWindowPos(_videownd, NULL,
posRect.left,
posRect.top,
posRect.right-posRect.left,
posRect.bottom-posRect.top,
- FALSE);
+ SWP_NOACTIVATE|
+ SWP_NOCOPYBITS|
+ SWP_NOZORDER|
+ SWP_NOOWNERZORDER );
- /*
- ** force a full refresh of control content
- */
- RECT updateRect;
- updateRect.left = -posRect.left;
- updateRect.top = -posRect.top;
- updateRect.right = posRect.right-posRect.left;
- updateRect.bottom = posRect.bottom-posRect.top;
-
- ValidateRect(_videownd, NULL);
- InvalidateRect(_videownd, &updateRect, FALSE);
- UpdateWindow(_videownd);
+ //RedrawWindow(_videownd, &posRect, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN);
+ vlc_value_t val;
+ val.i_int = posRect.right-posRect.left;
+ VLC_VariableSet(_i_vlc, "width", val);
+ val.i_int = posRect.bottom-posRect.top;
+ VLC_VariableSet(_i_vlc, "height", val);
};
void VLCPlugin::freezeEvents(BOOL freeze)
STDMETHODIMP_(ULONG) Release(void);
/* custom methods */
- HRESULT getTypeLib(LCID lcid, ITypeLib **pTL)
- { return LoadRegTypeLib(LIBID_AXVLC, 1, 0, lcid, pTL); };
+ HRESULT getTypeLib(LCID lcid, ITypeLib **pTL) { return LoadRegTypeLib(LIBID_AXVLC, 1, 0, lcid, pTL); };
REFCLSID getClassID(void) { return (REFCLSID)CLSID_VLCPlugin; };
REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; };
- HRESULT onInit(void);
- HRESULT onLoad(void);
- HRESULT onClientSiteChanged(LPOLECLIENTSITE pActiveSite);
- HRESULT onClose(DWORD dwSaveOption);
+ /*
+ ** persistant properties
+ */
+ void setMRL(BSTR mrl)
+ {
+ SysFreeString(_bstr_mrl);
+ _bstr_mrl = SysAllocString(mrl);
+ setDirty(TRUE);
+ };
+ const BSTR getMRL(void) { return _bstr_mrl; };
+
+ inline void setAutoPlay(BOOL autoplay)
+ {
+ _b_autoplay = autoplay;
+ setDirty(TRUE);
+ };
+ inline BOOL getAutoPlay(void) { return _b_autoplay; };
+
+ inline void setAutoLoop(BOOL autoloop)
+ {
+ _b_autoloop = autoloop;
+ setDirty(TRUE);
+ };
+ inline BOOL getAutoLoop(void) { return _b_autoloop;};
- BOOL isInPlaceActive(void);
- HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);
- HRESULT onInPlaceDeactivate(void);
- HWND getInPlaceWindow(void) const { return _inplacewnd; };
+ void setVisible(BOOL fVisible);
+ BOOL getVisible(void) { return _b_visible; };
+ // control size in HIMETRIC
+ inline void setExtent(const SIZEL& extent)
+ {
+ _extent = extent;
+ setDirty(TRUE);
+ };
+ const SIZEL& getExtent(void) { return _extent; };
+
+ // transient properties
+ inline void setMute(BOOL mute) { _b_mute = mute; };
+
+ inline void setPicture(LPPICTURE pict)
+ {
+ if( NULL != _p_pict )
+ _p_pict->Release();
+ if( NULL != pict )
+ _p_pict->AddRef();
+ _p_pict = pict;
+ };
+
+ inline LPPICTURE getPicture(void)
+ {
+ if( NULL != _p_pict )
+ _p_pict->AddRef();
+ return _p_pict;
+ };
+
BOOL hasFocus(void);
void setFocus(BOOL fFocus);
- UINT getCodePage(void) { return _codepage; };
- void setCodePage(UINT cp) { _codepage = cp; };
+ inline UINT getCodePage(void) { return _i_codepage; };
+ inline void setCodePage(UINT cp) { _i_codepage = cp; };
- int getVLCObject(void) { return _i_vlc; };
+ inline BOOL isUserMode(void) { return _b_usermode; };
+ inline void setUserMode(BOOL um) { _b_usermode = um; };
- // persistent control properties, may be overriden by HTML & javascript
- void setSourceURL(const char *url) { _psz_src = strdup(url); };
- void setAutoStart(BOOL autostart) { _b_autostart = autostart; };
- void setLoopMode(BOOL loopmode) { _b_loopmode = loopmode; };
- void setMute(BOOL mute) { _b_mute = mute; };
- void setVisible(BOOL fVisible);
- BOOL getVisible(void) { return _b_visible; };
- LPPICTURE getPicture(void) { if( NULL != _pict ) _pict->AddRef(); return _pict; };
-
- // container events
+ inline BOOL isDirty(void) { return _b_dirty; };
+ inline void setDirty(BOOL dirty) { _b_dirty = dirty; };
+
+ inline BOOL isRunning(void) { return 0 != _i_vlc; };
+
+ // control geometry within container
+ RECT getPosRect(void) { return _posRect; };
+ inline HWND getInPlaceWindow(void) const { return _inplacewnd; };
+ BOOL isInPlaceActive(void);
+
+ inline int getVLCObject(void) const { return _i_vlc; };
+
+ /*
+ ** container events
+ */
+ HRESULT onInit(void);
+ HRESULT onLoad(void);
+ HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);
+ HRESULT onInPlaceDeactivate(void);
+ HRESULT onAmbientChanged(LPUNKNOWN pContainer, DISPID dispID);
+ HRESULT onClose(DWORD dwSaveOption);
void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect);
void onDraw(DVTARGETDEVICE * ptd, HDC hicTargetDev,
HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds);
void onPaint(HDC hdc, const RECT &bounds, const RECT &pr);
- // control events
+ /*
+ ** control events
+ */
void freezeEvents(BOOL freeze);
void firePropChangedEvent(DISPID dispid);
void fireOnPlayEvent(void);
void fireOnPauseEvent(void);
void fireOnStopEvent(void);
- // control size in HIMETRIC
- const SIZEL& getExtent(void) { return _extent; };
- void setExtent(const SIZEL& extent) { _extent = extent; };
-
- // control geometry within container
- RECT getPosRect(void) { return _posRect; };
-
// controlling IUnknown interface
LPUNKNOWN pUnkOuter;
VLCPluginClass *_p_class;
ULONG _i_ref;
- LPPICTURE _pict;
- UINT _codepage;
- char *_psz_src;
- BOOL _b_autostart;
- BOOL _b_loopmode;
+ LPPICTURE _p_pict;
+ UINT _i_codepage;
+ BOOL _b_usermode;
+ BSTR _bstr_mrl;
+ BOOL _b_autoplay;
+ BOOL _b_autoloop;
BOOL _b_visible;
BOOL _b_mute;
+ BOOL _b_dirty;
int _i_vlc;
SIZEL _extent;
-->
<OBJECT classid="clsid:E23FE9C6-778E-49D4-B537-38FCDE4887D8" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab"
width="640" height="480" id="vlc" events="True">
-<param name="Src" value="" />
+<param name="MRL" value="" />
<param name="ShowDisplay" value="True" />
-<param name="Loop" value="False" />
+<param name="AutoLoop" value="False" />
<param name="AutoPlay" value="False" />
</OBJECT>
</TD></TR>
};
function doGo(targetURL)
{
- var options = new Array(":input-repeat=1");
+ var options = new Array(":input-repeat=0");
document.vlc.addTarget(targetURL, options, 4+8, -666);
};
function doPlayOrPause()
document.vlc.play();
}
};
-function vlc::play()
+function vlc::Play()
{
if( ! sliderTimerId )
{
}
onPlay();
};
-function vlc::pause()
+function vlc::Pause()
{
if( sliderTimerId )
{
}
onPause();
};
-function vlc::stop()
+function vlc::Stop()
{
if( sliderTimerId )
{
char *buffer = (char *)CoTaskMemAlloc(mblen+1);
ZeroMemory(buffer, mblen+1);
if( WideCharToMultiByte(codePage, 0, bstr, len, buffer, mblen, NULL, NULL) )
+ {
+ buffer[mblen] = '\0';
return buffer;
+ }
}
}
return NULL;
return hdc;
};
+#define HIMETRIC_PER_INCH 2540
+
+void DPFromHimetric(HDC hdc, LPPOINT pt, int count)
+{
+ LONG lpX = GetDeviceCaps(hdc, LOGPIXELSX);
+ LONG lpY = GetDeviceCaps(hdc, LOGPIXELSY);
+ while( count-- )
+ {
+ pt->x = pt->x*lpX/HIMETRIC_PER_INCH;
+ pt->y = pt->y*lpY/HIMETRIC_PER_INCH;
+ ++pt;
+ }
+};
+
+void HimetricFromDP(HDC hdc, LPPOINT pt, int count)
+{
+ LONG lpX = GetDeviceCaps(hdc, LOGPIXELSX);
+ LONG lpY = GetDeviceCaps(hdc, LOGPIXELSY);
+ while( count-- )
+ {
+ pt->x = pt->x*HIMETRIC_PER_INCH/lpX;
+ pt->y = pt->y*HIMETRIC_PER_INCH/lpY;
+ ++pt;
+ }
+};
// properties
extern HDC CreateDevDC(DVTARGETDEVICE *ptd);
+extern void DPFromHimetric(HDC hdc, LPPOINT pt, int count);
+extern void HimetricFromDP(HDC hdc, LPPOINT pt, int count);
+
// enumeration
template<class T> class VLCEnum : IUnknown
{
if( dwAspect & DVASPECT_CONTENT )
{
- _p_instance->onDraw(ptd, hicTargetDev, hdcDraw, lprcBounds, lprcWBounds);
+ if( NULL == lprcBounds )
+ return E_INVALIDARG;
+
+ BOOL releaseDC = FALSE;
+ SIZEL size = _p_instance->getExtent();
+
+ if( NULL == ptd )
+ {
+ hicTargetDev = CreateDevDC(NULL);
+ releaseDC = TRUE;
+ }
+ DPFromHimetric(hicTargetDev, (LPPOINT)&size, 1);
+
+ RECTL bounds = { 0L, 0L, size.cx, size.cy };
+
+ int sdc = SaveDC(hdcDraw);
+ SetMapMode(hdcDraw, MM_ANISOTROPIC);
+ SetWindowOrgEx(hdcDraw, 0, 0, NULL);
+ SetWindowExtEx(hdcDraw, size.cx, size.cy, NULL);
+ OffsetViewportOrgEx(hdcDraw, lprcBounds->left, lprcBounds->top, NULL);
+ SetViewportExtEx(hdcDraw, lprcBounds->right-lprcBounds->left,
+ lprcBounds->bottom-lprcBounds->top, NULL);
+
+ _p_instance->onDraw(ptd, hicTargetDev, hdcDraw, &bounds, lprcWBounds);
+ RestoreDC(hdcDraw, sdc);
+
+ if( releaseDC )
+ DeleteDC(hicTargetDev);
+
return S_OK;
}
return E_NOTIMPL;
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
- if( ! _p_instance->isInPlaceActive() )
- {
- /*
- ** object has not yet been activated. try doing it by ourself
- ** if parent container is known
- */
- LPOLEOBJECT p_oleobject;
- if( SUCCEEDED(QueryInterface(IID_IOleObject, (LPVOID *)&p_oleobject)) )
- {
- LPOLECLIENTSITE p_clientsite;
- if( SUCCEEDED(p_oleobject->GetClientSite(&p_clientsite)
- && (NULL != p_clientsite)) )
- {
- p_oleobject->DoVerb(OLEIVERB_INPLACEACTIVATE,
- NULL, p_clientsite, 0, NULL, NULL);
- p_clientsite->Release();
- }
- p_oleobject->Release();
- }
- }
VLC_Play(i_vlc);
_p_instance->fireOnPlayEvent();
return NOERROR;
return NOERROR;
}
return E_UNEXPECTED;
-}
+};
STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying)
{
return E_UNEXPECTED;
};
-STDMETHODIMP VLCControl::put_Playing(VARIANT_BOOL isPlaying)
-{
- int i_vlc = _p_instance->getVLCObject();
- if( i_vlc )
- {
- if( VARIANT_FALSE == isPlaying )
- {
- if( VLC_IsPlaying(i_vlc) )
- VLC_Stop(i_vlc);
- }
- else
- {
- if( ! VLC_IsPlaying(i_vlc) )
- VLC_Play(i_vlc);
- }
- return NOERROR;
- }
- return E_UNEXPECTED;
-};
-
STDMETHODIMP VLCControl::get_Position(float *position)
{
if( NULL == position )
return E_UNEXPECTED;
};
-STDMETHODIMP VLCControl::setVariable( BSTR name, VARIANT value)
+STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value)
{
if( 0 == SysStringLen(name) )
return E_INVALIDARG;
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
- int codePage = _p_instance->getCodePage();
- char *cUri = CStrFromBSTR(codePage, uri);
+ char *cUri = CStrFromBSTR(CP_UTF8, uri);
if( NULL == cUri )
return E_OUTOFMEMORY;
int cOptionsCount;
char **cOptions;
- if( FAILED(createTargetOptions(codePage, &options, &cOptions, &cOptionsCount)) )
+ if( FAILED(createTargetOptions(CP_UTF8, &options, &cOptions, &cOptionsCount)) )
return E_INVALIDARG;
if( VLC_SUCCESS <= VLC_AddTarget(i_vlc, cUri, (const char **)cOptions, cOptionsCount, mode, position) )
{
hr = NOERROR;
- if( mode & VLCPlayListGo )
+ if( mode & PLAYLIST_GO )
_p_instance->fireOnPlayEvent();
}
else
{
hr = E_FAIL;
- if( mode & VLCPlayListGo )
+ if( mode & PLAYLIST_GO )
_p_instance->fireOnStopEvent();
}
return E_FAIL;
};
+STDMETHODIMP VLCControl::get_MRL(BSTR *mrl)
+{
+ if( NULL == mrl )
+ return E_POINTER;
+
+ *mrl = SysAllocString(_p_instance->getMRL());
+ return NOERROR;
+};
+
+STDMETHODIMP VLCControl::put_MRL(BSTR mrl)
+{
+ _p_instance->setMRL(mrl);
+
+ return S_OK;
+};
+
+STDMETHODIMP VLCControl::get_AutoPlay(VARIANT_BOOL *autoplay)
+{
+ if( NULL == autoplay )
+ return E_POINTER;
+
+ *autoplay = _p_instance->getAutoPlay() ? VARIANT_TRUE: VARIANT_FALSE;
+ return S_OK;
+};
+
+STDMETHODIMP VLCControl::put_AutoPlay(VARIANT_BOOL autoplay)
+{
+ _p_instance->setAutoPlay((VARIANT_FALSE != autoplay) ? TRUE: FALSE);
+ return S_OK;
+};
+
+STDMETHODIMP VLCControl::get_AutoLoop(VARIANT_BOOL *autoloop)
+{
+ if( NULL == autoloop )
+ return E_POINTER;
+
+ *autoloop = _p_instance->getAutoLoop() ? VARIANT_TRUE: VARIANT_FALSE;
+ return S_OK;
+};
+
+STDMETHODIMP VLCControl::put_AutoLoop(VARIANT_BOOL autoloop)
+{
+ _p_instance->setAutoLoop((VARIANT_FALSE != autoloop) ? TRUE: FALSE);
+ return S_OK;
+};
+
STDMETHODIMP pause(void);
STDMETHODIMP stop(void);
STDMETHODIMP get_Playing(VARIANT_BOOL *isPlaying);
- STDMETHODIMP put_Playing(VARIANT_BOOL isPlaying);
STDMETHODIMP get_Position(float *position);
STDMETHODIMP put_Position(float position);
STDMETHODIMP get_Time(int *seconds);
STDMETHODIMP playlistPrev(void);
STDMETHODIMP playlistClear(void);
STDMETHODIMP get_VersionInfo(BSTR *version);
+ STDMETHODIMP get_MRL(BSTR *mrl);
+ STDMETHODIMP put_MRL(BSTR mrl);
+ STDMETHODIMP get_AutoLoop(VARIANT_BOOL *autoloop);
+ STDMETHODIMP put_AutoLoop(VARIANT_BOOL autoloop);
+ STDMETHODIMP get_AutoPlay(VARIANT_BOOL *autoplay);
+ STDMETHODIMP put_AutoPlay(VARIANT_BOOL autoplay);
private: