1 /*****************************************************************************
2 * vlccontrol.h: ActiveX control for VLC
3 *****************************************************************************
4 * Copyright (C) 2006 the VideoLAN team
6 * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
7 * Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef _VLCCONTROL2_H_
25 #define _VLCCONTROL2_H_
27 #include "axvlc_idl.h"
29 #include <vlc/libvlc.h>
31 class VLCAudio
: public IVLCAudio
34 VLCAudio(VLCPlugin
*p_instance
) :
35 _p_instance(p_instance
), _p_typeinfo(NULL
) {};
39 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
43 if( (IID_IUnknown
== riid
)
44 || (IID_IDispatch
== riid
)
45 || (IID_IVLCAudio
== riid
) )
48 *ppv
= reinterpret_cast<LPVOID
>(this);
51 // behaves as a standalone object
55 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_instance
->pUnkOuter
->AddRef(); };
56 STDMETHODIMP_(ULONG
) Release(void) { return _p_instance
->pUnkOuter
->Release(); };
59 STDMETHODIMP
GetTypeInfoCount(UINT
*);
60 STDMETHODIMP
GetTypeInfo(UINT
, LCID
, LPTYPEINFO
*);
61 STDMETHODIMP
GetIDsOfNames(REFIID
,LPOLESTR
*,UINT
,LCID
,DISPID
*);
62 STDMETHODIMP
Invoke(DISPID
,REFIID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,UINT
*);
65 STDMETHODIMP
get_mute(VARIANT_BOOL
*);
66 STDMETHODIMP
put_mute(VARIANT_BOOL
);
67 STDMETHODIMP
get_volume(long*);
68 STDMETHODIMP
put_volume(long);
69 STDMETHODIMP
get_track(long*);
70 STDMETHODIMP
put_track(long);
71 STDMETHODIMP
get_channel(long*);
72 STDMETHODIMP
put_channel(long);
73 STDMETHODIMP
toggleMute();
76 HRESULT
loadTypeInfo();
79 VLCPlugin
* _p_instance
;
80 ITypeInfo
* _p_typeinfo
;
84 class VLCInput
: public IVLCInput
88 VLCInput(VLCPlugin
*p_instance
) :
89 _p_instance(p_instance
), _p_typeinfo(NULL
) {};
93 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
97 if( (IID_IUnknown
== riid
)
98 || (IID_IDispatch
== riid
)
99 || (IID_IVLCInput
== riid
) )
102 *ppv
= reinterpret_cast<LPVOID
>(this);
105 // behaves as a standalone object
106 return E_NOINTERFACE
;
109 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_instance
->pUnkOuter
->AddRef(); };
110 STDMETHODIMP_(ULONG
) Release(void) { return _p_instance
->pUnkOuter
->Release(); };
113 STDMETHODIMP
GetTypeInfoCount(UINT
*);
114 STDMETHODIMP
GetTypeInfo(UINT
, LCID
, LPTYPEINFO
*);
115 STDMETHODIMP
GetIDsOfNames(REFIID
,LPOLESTR
*,UINT
,LCID
,DISPID
*);
116 STDMETHODIMP
Invoke(DISPID
,REFIID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,UINT
*);
119 STDMETHODIMP
get_length(double*);
120 STDMETHODIMP
get_position(double*);
121 STDMETHODIMP
put_position(double);
122 STDMETHODIMP
get_time(double*);
123 STDMETHODIMP
put_time(double);
124 STDMETHODIMP
get_state(long*);
125 STDMETHODIMP
get_rate(double*);
126 STDMETHODIMP
put_rate(double);
127 STDMETHODIMP
get_fps(double*);
128 STDMETHODIMP
get_hasVout(VARIANT_BOOL
*);
131 HRESULT
loadTypeInfo();
134 VLCPlugin
* _p_instance
;
135 ITypeInfo
* _p_typeinfo
;
139 class VLCMessage
: public IVLCMessage
143 VLCMessage(VLCPlugin
*p_instance
, struct libvlc_log_message_t
&msg
) :
144 _p_instance(p_instance
),
148 virtual ~VLCMessage();
151 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
155 if( (IID_IUnknown
== riid
)
156 || (IID_IDispatch
== riid
)
157 || (IID_IVLCMessage
== riid
) )
160 *ppv
= reinterpret_cast<LPVOID
>(this);
163 // behaves as a standalone object
164 return E_NOINTERFACE
;
167 STDMETHODIMP_(ULONG
) AddRef(void) { return InterlockedIncrement(&_refcount
); };
168 STDMETHODIMP_(ULONG
) Release(void)
170 ULONG refcount
= InterlockedDecrement(&_refcount
);
180 STDMETHODIMP
GetTypeInfoCount(UINT
*);
181 STDMETHODIMP
GetTypeInfo(UINT
, LCID
, LPTYPEINFO
*);
182 STDMETHODIMP
GetIDsOfNames(REFIID
,LPOLESTR
*,UINT
,LCID
,DISPID
*);
183 STDMETHODIMP
Invoke(DISPID
,REFIID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,UINT
*);
185 // IVLCMessage methods
186 STDMETHODIMP
get__Value(VARIANT
*);
187 STDMETHODIMP
get_severity(long *);
188 STDMETHODIMP
get_type(BSTR
*);
189 STDMETHODIMP
get_name(BSTR
*);
190 STDMETHODIMP
get_header(BSTR
*);
191 STDMETHODIMP
get_message(BSTR
*);
194 HRESULT
loadTypeInfo();
197 VLCPlugin
* _p_instance
;
198 ITypeInfo
* _p_typeinfo
;
201 struct libvlc_log_message_t _msg
;
206 class VLCMessageIterator
: public IVLCMessageIterator
210 VLCMessageIterator(VLCPlugin
*p_instance
, VLCLog
* p_vlclog
);
211 virtual ~VLCMessageIterator();
214 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
218 if( (IID_IUnknown
== riid
)
219 || (IID_IDispatch
== riid
)
220 || (IID_IVLCMessageIterator
== riid
) )
223 *ppv
= reinterpret_cast<LPVOID
>(this);
226 // behaves as a standalone object
227 return E_NOINTERFACE
;
230 STDMETHODIMP_(ULONG
) AddRef(void) { return InterlockedIncrement(&_refcount
); };
231 STDMETHODIMP_(ULONG
) Release(void)
233 ULONG refcount
= InterlockedDecrement(&_refcount
);
243 STDMETHODIMP
GetTypeInfoCount(UINT
*);
244 STDMETHODIMP
GetTypeInfo(UINT
, LCID
, LPTYPEINFO
*);
245 STDMETHODIMP
GetIDsOfNames(REFIID
,LPOLESTR
*,UINT
,LCID
,DISPID
*);
246 STDMETHODIMP
Invoke(DISPID
,REFIID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,UINT
*);
248 // IVLCMessageIterator methods
249 STDMETHODIMP
get_hasNext(VARIANT_BOOL
*);
250 STDMETHODIMP
next(IVLCMessage
**);
253 HRESULT
loadTypeInfo();
256 VLCPlugin
* _p_instance
;
257 ITypeInfo
* _p_typeinfo
;
261 libvlc_log_iterator_t
* _p_iter
;
264 class VLCMessages
: public IVLCMessages
268 VLCMessages(VLCPlugin
*p_instance
, VLCLog
*p_vlclog
) :
270 _p_instance(p_instance
),
272 virtual ~VLCMessages();
275 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
279 if( (IID_IUnknown
== riid
)
280 || (IID_IDispatch
== riid
)
281 || (IID_IVLCMessages
== riid
) )
284 *ppv
= reinterpret_cast<LPVOID
>(this);
287 // behaves as a standalone object
288 return E_NOINTERFACE
;
291 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_instance
->pUnkOuter
->AddRef(); };
292 STDMETHODIMP_(ULONG
) Release(void) { return _p_instance
->pUnkOuter
->Release(); };
295 STDMETHODIMP
GetTypeInfoCount(UINT
*);
296 STDMETHODIMP
GetTypeInfo(UINT
, LCID
, LPTYPEINFO
*);
297 STDMETHODIMP
GetIDsOfNames(REFIID
,LPOLESTR
*,UINT
,LCID
,DISPID
*);
298 STDMETHODIMP
Invoke(DISPID
,REFIID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,UINT
*);
300 // IVLCMessages methods
301 STDMETHODIMP
get__NewEnum(LPUNKNOWN
*);
302 STDMETHODIMP
clear();
303 STDMETHODIMP
get_count(long*);
304 STDMETHODIMP
iterator(IVLCMessageIterator
**);
307 HRESULT
loadTypeInfo();
312 VLCPlugin
* _p_instance
;
313 ITypeInfo
* _p_typeinfo
;
316 class VLCLog
: public IVLCLog
320 friend class VLCMessages
;
321 friend class VLCMessageIterator
;
323 VLCLog(VLCPlugin
*p_instance
) :
325 _p_instance(p_instance
),
329 _p_vlcmessages
= new VLCMessages(p_instance
, this);
334 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
338 if( (IID_IUnknown
== riid
)
339 || (IID_IDispatch
== riid
)
340 || (IID_IVLCLog
== riid
) )
343 *ppv
= reinterpret_cast<LPVOID
>(this);
346 // behaves as a standalone object
347 return E_NOINTERFACE
;
350 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_instance
->pUnkOuter
->AddRef(); };
351 STDMETHODIMP_(ULONG
) Release(void) { return _p_instance
->pUnkOuter
->Release(); };
354 STDMETHODIMP
GetTypeInfoCount(UINT
*);
355 STDMETHODIMP
GetTypeInfo(UINT
, LCID
, LPTYPEINFO
*);
356 STDMETHODIMP
GetIDsOfNames(REFIID
,LPOLESTR
*,UINT
,LCID
,DISPID
*);
357 STDMETHODIMP
Invoke(DISPID
,REFIID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,UINT
*);
360 STDMETHODIMP
get_messages(IVLCMessages
**);
361 STDMETHODIMP
get_verbosity(long *);
362 STDMETHODIMP
put_verbosity(long);
365 HRESULT
loadTypeInfo();
367 libvlc_log_t
*_p_log
;
370 VLCPlugin
* _p_instance
;
371 ITypeInfo
* _p_typeinfo
;
373 VLCMessages
* _p_vlcmessages
;
376 class VLCPlaylistItems
: public IVLCPlaylistItems
379 VLCPlaylistItems(VLCPlugin
*p_instance
) :
380 _p_instance(p_instance
), _p_typeinfo(NULL
) {};
381 virtual ~VLCPlaylistItems();
384 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
388 if( (IID_IUnknown
== riid
)
389 || (IID_IDispatch
== riid
)
390 || (IID_IVLCPlaylistItems
== riid
) )
393 *ppv
= reinterpret_cast<LPVOID
>(this);
396 // behaves as a standalone object
397 return E_NOINTERFACE
;
400 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_instance
->pUnkOuter
->AddRef(); };
401 STDMETHODIMP_(ULONG
) Release(void) { return _p_instance
->pUnkOuter
->Release(); };
404 STDMETHODIMP
GetTypeInfoCount(UINT
*);
405 STDMETHODIMP
GetTypeInfo(UINT
, LCID
, LPTYPEINFO
*);
406 STDMETHODIMP
GetIDsOfNames(REFIID
,LPOLESTR
*,UINT
,LCID
,DISPID
*);
407 STDMETHODIMP
Invoke(DISPID
,REFIID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,UINT
*);
409 // IVLCPlaylistItems methods
410 STDMETHODIMP
get_count(long*);
411 STDMETHODIMP
clear();
412 STDMETHODIMP
remove(long);
415 HRESULT
loadTypeInfo();
418 VLCPlugin
* _p_instance
;
419 ITypeInfo
* _p_typeinfo
;
423 class VLCPlaylist
: public IVLCPlaylist
426 VLCPlaylist(VLCPlugin
*p_instance
) :
427 _p_instance(p_instance
),
429 _p_vlcplaylistitems(NULL
)
431 _p_vlcplaylistitems
= new VLCPlaylistItems(p_instance
);
433 virtual ~VLCPlaylist();
436 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
440 if( (IID_IUnknown
== riid
)
441 || (IID_IDispatch
== riid
)
442 || (IID_IVLCPlaylist
== riid
) )
445 *ppv
= reinterpret_cast<LPVOID
>(this);
448 // behaves as a standalone object
449 return E_NOINTERFACE
;
452 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_instance
->pUnkOuter
->AddRef(); };
453 STDMETHODIMP_(ULONG
) Release(void) { return _p_instance
->pUnkOuter
->Release(); };
456 STDMETHODIMP
GetTypeInfoCount(UINT
*);
457 STDMETHODIMP
GetTypeInfo(UINT
, LCID
, LPTYPEINFO
*);
458 STDMETHODIMP
GetIDsOfNames(REFIID
,LPOLESTR
*,UINT
,LCID
,DISPID
*);
459 STDMETHODIMP
Invoke(DISPID
,REFIID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,UINT
*);
461 // IVLCPlaylist methods
462 STDMETHODIMP
get_itemCount(long*);
463 STDMETHODIMP
get_isPlaying(VARIANT_BOOL
*);
464 STDMETHODIMP
add(BSTR
, VARIANT
, VARIANT
, long*);
466 STDMETHODIMP
playItem(long);
467 STDMETHODIMP
togglePause();
471 STDMETHODIMP
clear();
472 STDMETHODIMP
removeItem(long);
473 STDMETHODIMP
get_items(IVLCPlaylistItems
**);
476 HRESULT
loadTypeInfo();
479 VLCPlugin
* _p_instance
;
480 ITypeInfo
* _p_typeinfo
;
482 VLCPlaylistItems
* _p_vlcplaylistitems
;
485 class VLCVideo
: public IVLCVideo
488 VLCVideo(VLCPlugin
*p_instance
) :
489 _p_instance(p_instance
), _p_typeinfo(NULL
) {};
493 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
497 if( (IID_IUnknown
== riid
)
498 || (IID_IDispatch
== riid
)
499 || (IID_IVLCVideo
== riid
) )
502 *ppv
= reinterpret_cast<LPVOID
>(this);
505 // behaves as a standalone object
506 return E_NOINTERFACE
;
509 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_instance
->pUnkOuter
->AddRef(); };
510 STDMETHODIMP_(ULONG
) Release(void) { return _p_instance
->pUnkOuter
->Release(); };
513 STDMETHODIMP
GetTypeInfoCount(UINT
*);
514 STDMETHODIMP
GetTypeInfo(UINT
, LCID
, LPTYPEINFO
*);
515 STDMETHODIMP
GetIDsOfNames(REFIID
,LPOLESTR
*,UINT
,LCID
,DISPID
*);
516 STDMETHODIMP
Invoke(DISPID
,REFIID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,UINT
*);
519 STDMETHODIMP
get_fullscreen(VARIANT_BOOL
*);
520 STDMETHODIMP
put_fullscreen(VARIANT_BOOL
);
521 STDMETHODIMP
get_width(long*);
522 STDMETHODIMP
get_height(long*);
523 STDMETHODIMP
get_aspectRatio(BSTR
*);
524 STDMETHODIMP
put_aspectRatio(BSTR
);
525 STDMETHODIMP
get_subtitle(long*);
526 STDMETHODIMP
put_subtitle(long);
527 STDMETHODIMP
get_crop(BSTR
*);
528 STDMETHODIMP
put_crop(BSTR
);
529 STDMETHODIMP
get_teletext(long*);
530 STDMETHODIMP
put_teletext(long);
531 STDMETHODIMP
takeSnapshot(LPPICTUREDISP
*);
532 STDMETHODIMP
toggleFullscreen();
533 STDMETHODIMP
toggleTeletext();
536 HRESULT
loadTypeInfo();
539 VLCPlugin
* _p_instance
;
540 ITypeInfo
* _p_typeinfo
;
544 class VLCControl2
: public IVLCControl2
548 VLCControl2(VLCPlugin
*p_instance
);
549 virtual ~VLCControl2();
552 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
556 if( (IID_IUnknown
== riid
)
557 || (IID_IDispatch
== riid
)
558 || (IID_IVLCControl2
== riid
) )
561 *ppv
= reinterpret_cast<LPVOID
>(this);
564 return _p_instance
->pUnkOuter
->QueryInterface(riid
, ppv
);
567 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_instance
->pUnkOuter
->AddRef(); };
568 STDMETHODIMP_(ULONG
) Release(void) { return _p_instance
->pUnkOuter
->Release(); };
571 STDMETHODIMP
GetTypeInfoCount(UINT
*);
572 STDMETHODIMP
GetTypeInfo(UINT
, LCID
, LPTYPEINFO
*);
573 STDMETHODIMP
GetIDsOfNames(REFIID
,LPOLESTR
*,UINT
,LCID
,DISPID
*);
574 STDMETHODIMP
Invoke(DISPID
,REFIID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,UINT
*);
576 // IVLCControl2 methods
577 STDMETHODIMP
get_AutoLoop(VARIANT_BOOL
*autoloop
);
578 STDMETHODIMP
put_AutoLoop(VARIANT_BOOL autoloop
);
579 STDMETHODIMP
get_AutoPlay(VARIANT_BOOL
*autoplay
);
580 STDMETHODIMP
put_AutoPlay(VARIANT_BOOL autoplay
);
581 STDMETHODIMP
get_BaseURL(BSTR
*url
);
582 STDMETHODIMP
put_BaseURL(BSTR url
);
583 STDMETHODIMP
get_MRL(BSTR
*mrl
);
584 STDMETHODIMP
put_MRL(BSTR mrl
);
585 STDMETHODIMP
get_Toolbar(VARIANT_BOOL
*visible
);
586 STDMETHODIMP
put_Toolbar(VARIANT_BOOL visible
);
587 STDMETHODIMP
get_StartTime(long *seconds
);
588 STDMETHODIMP
put_StartTime(long seconds
);
589 STDMETHODIMP
get_VersionInfo(BSTR
*version
);
590 STDMETHODIMP
get_Visible(VARIANT_BOOL
*visible
);
591 STDMETHODIMP
put_Visible(VARIANT_BOOL visible
);
592 STDMETHODIMP
get_Volume(long *volume
);
593 STDMETHODIMP
put_Volume(long volume
);
594 STDMETHODIMP
get_BackColor(OLE_COLOR
*backcolor
);
595 STDMETHODIMP
put_BackColor(OLE_COLOR backcolor
);
597 STDMETHODIMP
get_audio(IVLCAudio
**);
598 STDMETHODIMP
get_input(IVLCInput
**);
599 STDMETHODIMP
get_log(IVLCLog
**);
600 STDMETHODIMP
get_playlist(IVLCPlaylist
**);
601 STDMETHODIMP
get_video(IVLCVideo
**);
604 HRESULT
loadTypeInfo();
607 VLCPlugin
* _p_instance
;
608 ITypeInfo
* _p_typeinfo
;
610 VLCAudio
* _p_vlcaudio
;
611 VLCInput
* _p_vlcinput
;
613 VLCPlaylist
* _p_vlcplaylist
;
614 VLCVideo
* _p_vlcvideo
;