Qt: Don't post the initial event of THEMIM, force it.
[vlc.git] / projects / activex / vlccontrol2.h
blob7596676d0a1a3213c0a35d3e7e9fc69ae47d0b2f
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
33 public:
34 VLCAudio(VLCPlugin *p_instance) :
35 _p_instance(p_instance), _p_typeinfo(NULL) {};
36 virtual ~VLCAudio();
38 // IUnknown methods
39 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
41 if( NULL == ppv )
42 return E_POINTER;
43 if( (IID_IUnknown == riid)
44 || (IID_IDispatch == riid)
45 || (IID_IVLCAudio == riid) )
47 AddRef();
48 *ppv = reinterpret_cast<LPVOID>(this);
49 return NOERROR;
51 // behaves as a standalone object
52 return E_NOINTERFACE;
55 STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
56 STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
58 // IDispatch methods
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*);
64 // IVLCAudio methods
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();
75 protected:
76 HRESULT loadTypeInfo();
78 private:
79 VLCPlugin* _p_instance;
80 ITypeInfo* _p_typeinfo;
84 class VLCInput : public IVLCInput
86 public:
88 VLCInput(VLCPlugin *p_instance) :
89 _p_instance(p_instance), _p_typeinfo(NULL) {};
90 virtual ~VLCInput();
92 // IUnknown methods
93 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
95 if( NULL == ppv )
96 return E_POINTER;
97 if( (IID_IUnknown == riid)
98 || (IID_IDispatch == riid)
99 || (IID_IVLCInput == riid) )
101 AddRef();
102 *ppv = reinterpret_cast<LPVOID>(this);
103 return NOERROR;
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(); };
112 // IDispatch methods
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*);
118 // IVLCInput methods
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*);
130 protected:
131 HRESULT loadTypeInfo();
133 private:
134 VLCPlugin* _p_instance;
135 ITypeInfo* _p_typeinfo;
139 class VLCMessage: public IVLCMessage
141 public:
143 VLCMessage(VLCPlugin *p_instance, struct libvlc_log_message_t &msg) :
144 _p_instance(p_instance),
145 _p_typeinfo(NULL),
146 _refcount(1),
147 _msg(msg) {};
148 virtual ~VLCMessage();
150 // IUnknown methods
151 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
153 if( NULL == ppv )
154 return E_POINTER;
155 if( (IID_IUnknown == riid)
156 || (IID_IDispatch == riid)
157 || (IID_IVLCMessage == riid) )
159 AddRef();
160 *ppv = reinterpret_cast<LPVOID>(this);
161 return NOERROR;
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);
171 if( 0 == refcount )
173 delete this;
174 return 0;
176 return refcount;
179 // IDispatch methods
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 *);
193 protected:
194 HRESULT loadTypeInfo();
196 private:
197 VLCPlugin* _p_instance;
198 ITypeInfo* _p_typeinfo;
199 LONG _refcount;
201 struct libvlc_log_message_t _msg;
204 class VLCLog;
206 class VLCMessageIterator : public IVLCMessageIterator
208 public:
210 VLCMessageIterator(VLCPlugin *p_instance, VLCLog* p_vlclog);
211 virtual ~VLCMessageIterator();
213 // IUnknown methods
214 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
216 if( NULL == ppv )
217 return E_POINTER;
218 if( (IID_IUnknown == riid)
219 || (IID_IDispatch == riid)
220 || (IID_IVLCMessageIterator == riid) )
222 AddRef();
223 *ppv = reinterpret_cast<LPVOID>(this);
224 return NOERROR;
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);
234 if( 0 == refcount )
236 delete this;
237 return 0;
239 return refcount;
242 // IDispatch methods
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**);
252 protected:
253 HRESULT loadTypeInfo();
255 private:
256 VLCPlugin* _p_instance;
257 ITypeInfo* _p_typeinfo;
258 LONG _refcount;
260 VLCLog* _p_vlclog;
261 libvlc_log_iterator_t* _p_iter;
264 class VLCMessages : public IVLCMessages
266 public:
268 VLCMessages(VLCPlugin *p_instance, VLCLog *p_vlclog) :
269 _p_vlclog(p_vlclog),
270 _p_instance(p_instance),
271 _p_typeinfo(NULL) {}
272 virtual ~VLCMessages();
274 // IUnknown methods
275 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
277 if( NULL == ppv )
278 return E_POINTER;
279 if( (IID_IUnknown == riid)
280 || (IID_IDispatch == riid)
281 || (IID_IVLCMessages == riid) )
283 AddRef();
284 *ppv = reinterpret_cast<LPVOID>(this);
285 return NOERROR;
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(); };
294 // IDispatch methods
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**);
306 protected:
307 HRESULT loadTypeInfo();
309 VLCLog* _p_vlclog;
311 private:
312 VLCPlugin* _p_instance;
313 ITypeInfo* _p_typeinfo;
316 class VLCLog : public IVLCLog
318 public:
320 friend class VLCMessages;
321 friend class VLCMessageIterator;
323 VLCLog(VLCPlugin *p_instance) :
324 _p_log(NULL),
325 _p_instance(p_instance),
326 _p_typeinfo(NULL),
327 _p_vlcmessages(NULL)
329 _p_vlcmessages = new VLCMessages(p_instance, this);
331 virtual ~VLCLog();
333 // IUnknown methods
334 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
336 if( NULL == ppv )
337 return E_POINTER;
338 if( (IID_IUnknown == riid)
339 || (IID_IDispatch == riid)
340 || (IID_IVLCLog == riid) )
342 AddRef();
343 *ppv = reinterpret_cast<LPVOID>(this);
344 return NOERROR;
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(); };
353 // IDispatch methods
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*);
359 // IVLCLog methods
360 STDMETHODIMP get_messages(IVLCMessages**);
361 STDMETHODIMP get_verbosity(long *);
362 STDMETHODIMP put_verbosity(long);
364 protected:
365 HRESULT loadTypeInfo();
367 libvlc_log_t *_p_log;
369 private:
370 VLCPlugin* _p_instance;
371 ITypeInfo* _p_typeinfo;
373 VLCMessages* _p_vlcmessages;
376 class VLCPlaylistItems : public IVLCPlaylistItems
378 public:
379 VLCPlaylistItems(VLCPlugin *p_instance) :
380 _p_instance(p_instance), _p_typeinfo(NULL) {};
381 virtual ~VLCPlaylistItems();
383 // IUnknown methods
384 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
386 if( NULL == ppv )
387 return E_POINTER;
388 if( (IID_IUnknown == riid)
389 || (IID_IDispatch == riid)
390 || (IID_IVLCPlaylistItems == riid) )
392 AddRef();
393 *ppv = reinterpret_cast<LPVOID>(this);
394 return NOERROR;
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(); };
403 // IDispatch methods
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);
414 protected:
415 HRESULT loadTypeInfo();
417 private:
418 VLCPlugin* _p_instance;
419 ITypeInfo* _p_typeinfo;
423 class VLCPlaylist : public IVLCPlaylist
425 public:
426 VLCPlaylist(VLCPlugin *p_instance) :
427 _p_instance(p_instance),
428 _p_typeinfo(NULL),
429 _p_vlcplaylistitems(NULL)
431 _p_vlcplaylistitems = new VLCPlaylistItems(p_instance);
433 virtual ~VLCPlaylist();
435 // IUnknown methods
436 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
438 if( NULL == ppv )
439 return E_POINTER;
440 if( (IID_IUnknown == riid)
441 || (IID_IDispatch == riid)
442 || (IID_IVLCPlaylist == riid) )
444 AddRef();
445 *ppv = reinterpret_cast<LPVOID>(this);
446 return NOERROR;
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(); };
455 // IDispatch methods
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*);
465 STDMETHODIMP play();
466 STDMETHODIMP playItem(long);
467 STDMETHODIMP togglePause();
468 STDMETHODIMP stop();
469 STDMETHODIMP next();
470 STDMETHODIMP prev();
471 STDMETHODIMP clear();
472 STDMETHODIMP removeItem(long);
473 STDMETHODIMP get_items(IVLCPlaylistItems**);
475 protected:
476 HRESULT loadTypeInfo();
478 private:
479 VLCPlugin* _p_instance;
480 ITypeInfo* _p_typeinfo;
482 VLCPlaylistItems* _p_vlcplaylistitems;
485 class VLCVideo : public IVLCVideo
487 public:
488 VLCVideo(VLCPlugin *p_instance) :
489 _p_instance(p_instance), _p_typeinfo(NULL) {};
490 virtual ~VLCVideo();
492 // IUnknown methods
493 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
495 if( NULL == ppv )
496 return E_POINTER;
497 if( (IID_IUnknown == riid)
498 || (IID_IDispatch == riid)
499 || (IID_IVLCVideo == riid) )
501 AddRef();
502 *ppv = reinterpret_cast<LPVOID>(this);
503 return NOERROR;
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(); };
512 // IDispatch methods
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*);
518 // IVLCVideo methods
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();
535 protected:
536 HRESULT loadTypeInfo();
538 private:
539 VLCPlugin* _p_instance;
540 ITypeInfo* _p_typeinfo;
544 class VLCControl2 : public IVLCControl2
546 public:
548 VLCControl2(VLCPlugin *p_instance);
549 virtual ~VLCControl2();
551 // IUnknown methods
552 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
554 if( NULL == ppv )
555 return E_POINTER;
556 if( (IID_IUnknown == riid)
557 || (IID_IDispatch == riid)
558 || (IID_IVLCControl2 == riid) )
560 AddRef();
561 *ppv = reinterpret_cast<LPVOID>(this);
562 return NOERROR;
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(); };
570 // IDispatch methods
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**);
603 protected:
604 HRESULT loadTypeInfo();
606 private:
607 VLCPlugin* _p_instance;
608 ITypeInfo* _p_typeinfo;
610 VLCAudio* _p_vlcaudio;
611 VLCInput* _p_vlcinput;
612 VLCLog * _p_vlclog;
613 VLCPlaylist* _p_vlcplaylist;
614 VLCVideo* _p_vlcvideo;
617 #endif