1 /*****************************************************************************
2 * vlccontrol.cpp: ActiveX control for VLC
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
6 * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
7 * Jean-Paul Saman <jpsaman@videolan.org>
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 *****************************************************************************/
25 #include "vlccontrol.h"
31 VLCControl::~VLCControl()
34 _p_typeinfo->Release();
37 HRESULT VLCControl::getTypeInfo(void)
40 if( NULL == _p_typeinfo )
44 hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
47 hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCControl, &_p_typeinfo);
58 STDMETHODIMP VLCControl::GetTypeInfoCount(UINT* pctInfo)
63 if( SUCCEEDED(getTypeInfo()) )
71 STDMETHODIMP VLCControl::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
76 if( SUCCEEDED(getTypeInfo()) )
78 _p_typeinfo->AddRef();
79 *ppTInfo = _p_typeinfo;
86 STDMETHODIMP VLCControl::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
87 UINT cNames, LCID lcid, DISPID* rgDispID)
89 if( SUCCEEDED(getTypeInfo()) )
91 return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
96 STDMETHODIMP VLCControl::Invoke(DISPID dispIdMember, REFIID riid,
97 LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
98 VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
100 if( SUCCEEDED(getTypeInfo()) )
102 return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
103 pVarResult, pExcepInfo, puArgErr);
108 STDMETHODIMP VLCControl::get_Visible(VARIANT_BOOL *isVisible)
110 if( NULL == isVisible )
113 *isVisible = _p_instance->getVisible() ? VARIANT_TRUE : VARIANT_FALSE;
118 STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible)
120 _p_instance->setVisible(isVisible != VARIANT_FALSE);
125 STDMETHODIMP VLCControl::play(void)
127 libvlc_instance_t* p_libvlc;
128 HRESULT result = _p_instance->getVLC(&p_libvlc);
129 if( SUCCEEDED(result) )
131 libvlc_exception_t ex;
132 libvlc_exception_init(&ex);
134 libvlc_playlist_play(p_libvlc, -1, 0, NULL, &ex);
135 if( libvlc_exception_raised(&ex) )
137 _p_instance->setErrorInfo(IID_IVLCControl,
138 libvlc_exception_get_message(&ex));
139 libvlc_exception_clear(&ex);
142 _p_instance->fireOnPlayEvent();
148 STDMETHODIMP VLCControl::pause(void)
150 libvlc_instance_t* p_libvlc;
151 HRESULT result = _p_instance->getVLC(&p_libvlc);
152 if( SUCCEEDED(result) )
154 libvlc_exception_t ex;
155 libvlc_exception_init(&ex);
157 libvlc_playlist_pause(p_libvlc, &ex);
158 if( libvlc_exception_raised(&ex) )
160 _p_instance->setErrorInfo(IID_IVLCControl,
161 libvlc_exception_get_message(&ex));
162 libvlc_exception_clear(&ex);
165 _p_instance->fireOnPauseEvent();
171 STDMETHODIMP VLCControl::stop(void)
173 libvlc_instance_t* p_libvlc;
174 HRESULT result = _p_instance->getVLC(&p_libvlc);
175 if( SUCCEEDED(result) )
177 libvlc_exception_t ex;
178 libvlc_exception_init(&ex);
180 libvlc_playlist_stop(p_libvlc, &ex);
181 if( libvlc_exception_raised(&ex) )
183 _p_instance->setErrorInfo(IID_IVLCControl,
184 libvlc_exception_get_message(&ex));
185 libvlc_exception_clear(&ex);
190 _p_instance->fireOnStopEvent();
194 STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying)
196 if( NULL == isPlaying )
199 HRESULT result = NOERROR;
200 if( _p_instance->isRunning() )
202 libvlc_instance_t *p_libvlc;
203 result = _p_instance->getVLC(&p_libvlc);
204 if( SUCCEEDED(result) )
206 if( libvlc_playlist_isplaying(p_libvlc, NULL) )
207 *isPlaying = VARIANT_TRUE;
209 *isPlaying = VARIANT_FALSE;
213 *isPlaying = VARIANT_FALSE;
217 STDMETHODIMP VLCControl::get_Position(float *position)
219 if( NULL == position )
223 libvlc_instance_t* p_libvlc;
224 HRESULT result = E_UNEXPECTED;
225 result = _p_instance->getVLC(&p_libvlc);
226 if( SUCCEEDED(result) )
228 libvlc_exception_t ex;
229 libvlc_exception_init(&ex);
231 libvlc_media_player_t *p_md;
232 p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
233 if( !libvlc_exception_raised(&ex) )
235 *position = libvlc_media_player_get_position(p_md, &ex);
236 libvlc_media_player_release(p_md);
237 if( ! libvlc_exception_raised(&ex) )
242 _p_instance->setErrorInfo(IID_IVLCControl,
243 libvlc_exception_get_message(&ex));
244 libvlc_exception_clear(&ex);
250 STDMETHODIMP VLCControl::put_Position(float position)
252 HRESULT result = E_UNEXPECTED;
253 libvlc_instance_t* p_libvlc;
254 result = _p_instance->getVLC(&p_libvlc);
255 if( SUCCEEDED(result) )
257 libvlc_exception_t ex;
258 libvlc_exception_init(&ex);
260 libvlc_media_player_t *p_md;
261 p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
262 if( ! libvlc_exception_raised(&ex) )
264 libvlc_media_player_set_position(p_md, position, &ex);
265 libvlc_media_player_release(p_md);
266 if( ! libvlc_exception_raised(&ex) )
271 _p_instance->setErrorInfo(IID_IVLCControl,
272 libvlc_exception_get_message(&ex));
273 libvlc_exception_clear(&ex);
279 STDMETHODIMP VLCControl::get_Time(int *seconds)
281 if( NULL == seconds )
285 libvlc_instance_t* p_libvlc;
286 HRESULT result = _p_instance->getVLC(&p_libvlc);
287 if( SUCCEEDED(result) )
289 libvlc_exception_t ex;
290 libvlc_exception_init(&ex);
292 libvlc_media_player_t *p_md;
293 p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
294 if( ! libvlc_exception_raised(&ex) )
296 *seconds = libvlc_media_player_get_time(p_md, &ex);
297 libvlc_media_player_release(p_md);
298 if( ! libvlc_exception_raised(&ex) )
303 _p_instance->setErrorInfo(IID_IVLCControl,
304 libvlc_exception_get_message(&ex));
305 libvlc_exception_clear(&ex);
311 STDMETHODIMP VLCControl::put_Time(int seconds)
313 /* setTime function of the plugin sets the time. */
314 _p_instance->setTime(seconds);
318 STDMETHODIMP VLCControl::shuttle(int seconds)
320 libvlc_instance_t* p_libvlc;
321 HRESULT result = _p_instance->getVLC(&p_libvlc);
322 if( SUCCEEDED(result) )
324 libvlc_exception_t ex;
325 libvlc_exception_init(&ex);
327 libvlc_media_player_t *p_md;
328 p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
329 if( ! libvlc_exception_raised(&ex) )
331 if( seconds < 0 ) seconds = 0;
332 libvlc_media_player_set_time(p_md, (int64_t)seconds, &ex);
333 libvlc_media_player_release(p_md);
334 if( ! libvlc_exception_raised(&ex) )
339 _p_instance->setErrorInfo(IID_IVLCControl,
340 libvlc_exception_get_message(&ex));
341 libvlc_exception_clear(&ex);
348 STDMETHODIMP VLCControl::fullscreen(void)
350 HRESULT result = E_UNEXPECTED;
351 if( _p_instance->isRunning() )
353 libvlc_instance_t *p_libvlc;
354 result = _p_instance->getVLC(&p_libvlc);
355 if( SUCCEEDED(result) )
357 if( libvlc_playlist_isplaying(p_libvlc, NULL) )
359 libvlc_media_player_t *p_md =
360 libvlc_playlist_get_media_player(p_libvlc, NULL);
363 libvlc_toggle_fullscreen(p_md, NULL);
364 libvlc_media_player_release(p_md);
372 STDMETHODIMP VLCControl::get_Length(int *seconds)
374 if( NULL == seconds )
378 libvlc_instance_t* p_libvlc;
379 HRESULT result = _p_instance->getVLC(&p_libvlc);
380 if( SUCCEEDED(result) )
382 libvlc_exception_t ex;
383 libvlc_exception_init(&ex);
385 libvlc_media_player_t *p_md;
386 p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
387 if( ! libvlc_exception_raised(&ex) )
389 *seconds = (double)libvlc_media_player_get_length(p_md, &ex);
390 libvlc_media_player_release(p_md);
391 if( ! libvlc_exception_raised(&ex) )
396 _p_instance->setErrorInfo(IID_IVLCControl,
397 libvlc_exception_get_message(&ex));
398 libvlc_exception_clear(&ex);
405 STDMETHODIMP VLCControl::playFaster(void)
409 HRESULT result = E_UNEXPECTED;
410 if( !_p_instance->isRunning() )
413 libvlc_instance_t* p_libvlc;
414 result = _p_instance->getVLC(&p_libvlc);
415 if( SUCCEEDED(result) )
417 libvlc_exception_t ex;
418 libvlc_exception_init(&ex);
420 libvlc_media_player_t *p_md;
421 p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
422 if( ! libvlc_exception_raised(&ex) )
424 libvlc_media_player_set_rate(p_md, rate, &ex);
425 libvlc_media_player_release(p_md);
426 if( ! libvlc_exception_raised(&ex) )
431 _p_instance->setErrorInfo(IID_IVLCControl,
432 libvlc_exception_get_message(&ex));
433 libvlc_exception_clear(&ex);
439 STDMETHODIMP VLCControl::playSlower(void)
443 HRESULT result = E_UNEXPECTED;
444 if( !_p_instance->isRunning() )
447 libvlc_instance_t* p_libvlc;
448 result = _p_instance->getVLC(&p_libvlc);
449 if( SUCCEEDED(result) )
451 libvlc_exception_t ex;
452 libvlc_exception_init(&ex);
454 libvlc_media_player_t *p_md;
455 p_md = libvlc_playlist_get_media_player(p_libvlc, &ex);
456 if( ! libvlc_exception_raised(&ex) )
458 libvlc_media_player_set_rate(p_md, rate, &ex);
459 libvlc_media_player_release(p_md);
460 if( ! libvlc_exception_raised(&ex) )
465 _p_instance->setErrorInfo(IID_IVLCControl,
466 libvlc_exception_get_message(&ex));
467 libvlc_exception_clear(&ex);
473 STDMETHODIMP VLCControl::get_Volume(int *volume)
478 *volume = _p_instance->getVolume();
482 STDMETHODIMP VLCControl::put_Volume(int volume)
484 _p_instance->setVolume(volume);
488 STDMETHODIMP VLCControl::toggleMute(void)
490 libvlc_instance_t* p_libvlc;
491 HRESULT result = _p_instance->getVLC(&p_libvlc);
492 if( SUCCEEDED(result) )
494 libvlc_exception_t ex;
495 libvlc_exception_init(&ex);
497 libvlc_audio_toggle_mute(p_libvlc, &ex);
498 if( libvlc_exception_raised(&ex) )
500 _p_instance->setErrorInfo(IID_IVLCControl,
501 libvlc_exception_get_message(&ex));
502 libvlc_exception_clear(&ex);
510 STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value)
512 libvlc_instance_t* p_libvlc;
513 HRESULT result = _p_instance->getVLC(&p_libvlc);
514 if( SUCCEEDED(result) )
516 _p_instance->setErrorInfo(IID_IVLCControl,
517 "setVariable() is an unsafe interface to use. "
518 "It has been removed because of security implications." );
523 STDMETHODIMP VLCControl::getVariable(BSTR name, VARIANT *value)
525 libvlc_instance_t* p_libvlc;
526 HRESULT result = _p_instance->getVLC(&p_libvlc);
527 if( SUCCEEDED(result) )
529 _p_instance->setErrorInfo(IID_IVLCControl,
530 "getVariable() is an unsafe interface to use. "
531 "It has been removed because of security implications." );
536 void VLCControl::FreeTargetOptions(char **cOptions, int cOptionCount)
539 if( NULL != cOptions )
541 for( int pos=0; pos<cOptionCount; ++pos )
543 char *cOption = cOptions[pos];
544 if( NULL != cOption )
545 CoTaskMemFree(cOption);
549 CoTaskMemFree(cOptions);
553 static HRESULT parseStringOptions(int codePage, BSTR bstr, char*** cOptions, int *cOptionCount)
555 HRESULT hr = E_INVALIDARG;
556 if( SysStringLen(bstr) > 0 )
559 char *s = CStrFromBSTR(codePage, bstr);
564 char **options = (char **)CoTaskMemAlloc(capacity*sizeof(char *));
569 char *end = val + strlen(val);
572 // skip leading blanks
574 && ((*val == ' ' ) || (*val == '\t')) )
578 // skip till we get a blank character
584 if( ('\'' == c) || ('"' == c) )
586 // skip till end of string
587 while( (val < end) && (*(val++) != c ) );
593 if( nOptions == capacity )
596 char **moreOptions = (char **)CoTaskMemRealloc(options, capacity*sizeof(char*));
599 /* failed to allocate more memory */
601 /* return what we got so far */
602 *cOptionCount = nOptions;
606 options = moreOptions;
609 options[nOptions] = (char *)CoTaskMemAlloc(val-start);
610 if( options[nOptions] )
612 memcpy(options[nOptions], start, val-start);
617 /* failed to allocate memory */
619 /* return what we got so far */
620 *cOptionCount = nOptions;
626 // must be end of string
629 *cOptionCount = nOptions;
639 HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char ***cOptions, int *cOptionCount)
641 HRESULT hr = E_INVALIDARG;
642 if( VT_ERROR == V_VT(options) )
644 if( DISP_E_PARAMNOTFOUND == V_ERROR(options) )
646 // optional parameter not set
652 else if( (VT_EMPTY == V_VT(options)) || (VT_NULL == V_VT(options)) )
659 else if( VT_DISPATCH == V_VT(options) )
661 // if object is a collection, retrieve enumerator
663 V_VT(&colEnum) = VT_UNKNOWN;
664 hr = GetObjectProperty(V_DISPATCH(options), DISPID_NEWENUM, colEnum);
667 IEnumVARIANT *enumVar;
668 hr = V_UNKNOWN(&colEnum)->QueryInterface(IID_IEnumVARIANT, (LPVOID *)&enumVar);
675 *cOptions = (char **)CoTaskMemAlloc(capacity*sizeof(char *));
676 if( NULL != *cOptions )
678 ZeroMemory(*cOptions, sizeof(char *)*capacity);
679 while( SUCCEEDED(hr) && (S_OK == enumVar->Next(1, &option, NULL)) )
681 if( VT_BSTR == V_VT(&option) )
683 char *cOption = CStrFromBSTR(codePage, V_BSTR(&option));
684 (*cOptions)[pos] = cOption;
685 if( NULL != cOption )
688 if( pos == capacity )
690 char **moreOptions = (char **)CoTaskMemRealloc(*cOptions, (capacity+16)*sizeof(char *));
691 if( NULL != moreOptions )
693 ZeroMemory(moreOptions+capacity, sizeof(char *)*16);
695 *cOptions = moreOptions;
702 hr = ( SysStringLen(V_BSTR(&option)) > 0 ) ?
703 E_OUTOFMEMORY : E_INVALIDARG;
708 VariantClear(&option);
713 // free already processed elements
714 FreeTargetOptions(*cOptions, *cOptionCount);
725 // coerce object into a string and parse it
727 VariantInit(&v_name);
728 hr = VariantChangeType(&v_name, options, 0, VT_BSTR);
731 hr = parseStringOptions(codePage, V_BSTR(&v_name), cOptions, cOptionCount);
732 VariantClear(&v_name);
736 else if( V_ISARRAY(options) )
739 SAFEARRAY *array = V_ISBYREF(options) ? *V_ARRAYREF(options) : V_ARRAY(options);
741 if( SafeArrayGetDim(array) != 1 )
746 SafeArrayGetLBound(array, 1, &lBound);
747 SafeArrayGetUBound(array, 1, &uBound);
749 // have we got any options
750 if( uBound >= lBound )
753 hr = SafeArrayGetVartype(array, &vType);
759 // marshall options into an array of C strings
760 if( VT_VARIANT == vType )
762 *cOptions = (char **)CoTaskMemAlloc(sizeof(char *)*(uBound-lBound+1));
763 if( NULL == *cOptions )
764 return E_OUTOFMEMORY;
766 ZeroMemory(*cOptions, sizeof(char *)*(uBound-lBound+1));
767 for(pos=lBound; (pos<=uBound) && SUCCEEDED(hr); ++pos )
770 hr = SafeArrayGetElement(array, &pos, &option);
773 if( VT_BSTR == V_VT(&option) )
775 char *cOption = CStrFromBSTR(codePage, V_BSTR(&option));
776 (*cOptions)[pos-lBound] = cOption;
777 if( NULL == cOption )
778 hr = ( SysStringLen(V_BSTR(&option)) > 0 ) ?
779 E_OUTOFMEMORY : E_INVALIDARG;
783 VariantClear(&option);
787 else if( VT_BSTR == vType )
789 *cOptions = (char **)CoTaskMemAlloc(sizeof(char *)*(uBound-lBound+1));
790 if( NULL == *cOptions )
791 return E_OUTOFMEMORY;
793 ZeroMemory(*cOptions, sizeof(char *)*(uBound-lBound+1));
794 for(pos=lBound; (pos<=uBound) && SUCCEEDED(hr); ++pos )
797 hr = SafeArrayGetElement(array, &pos, &option);
800 char *cOption = CStrFromBSTR(codePage, option);
802 (*cOptions)[pos-lBound] = cOption;
803 if( NULL == cOption )
804 hr = ( SysStringLen(option) > 0 ) ?
805 E_OUTOFMEMORY : E_INVALIDARG;
806 SysFreeString(option);
816 *cOptionCount = pos-lBound;
819 // free already processed elements
820 FreeTargetOptions(*cOptions, *cOptionCount);
831 else if( VT_UNKNOWN == V_VT(options) )
833 // coerce object into a string and parse it
835 VariantInit(&v_name);
836 hr = VariantChangeType(&v_name, options, 0, VT_BSTR);
839 hr = parseStringOptions(codePage, V_BSTR(&v_name), cOptions, cOptionCount);
840 VariantClear(&v_name);
843 else if( VT_BSTR == V_VT(options) )
845 hr = parseStringOptions(codePage, V_BSTR(options), cOptions, cOptionCount);
851 ** use VARIANT rather than a SAFEARRAY as argument type
852 ** for compatibility with some scripting language (JScript)
855 STDMETHODIMP VLCControl::addTarget(BSTR uri, VARIANT options, enum VLCPlaylistMode mode, int position)
857 if( 0 == SysStringLen(uri) )
860 libvlc_instance_t *p_libvlc;
861 HRESULT hr = _p_instance->getVLC(&p_libvlc);
864 char *cUri = CStrFromBSTR(CP_UTF8, uri);
866 return E_OUTOFMEMORY;
871 if( FAILED(CreateTargetOptions(CP_UTF8, &options, &cOptions, &cOptionsCount)) )
874 libvlc_exception_t ex;
875 libvlc_exception_init(&ex);
877 position = libvlc_playlist_add_extended(p_libvlc, cUri, cUri,
879 const_cast<const char**>(cOptions),
882 FreeTargetOptions(cOptions, cOptionsCount);
885 if( libvlc_exception_raised(&ex) )
887 _p_instance->setErrorInfo(IID_IVLCPlaylist,
888 libvlc_exception_get_message(&ex));
889 libvlc_exception_clear(&ex);
891 if( mode & VLCPlayListAppendAndGo )
892 _p_instance->fireOnStopEvent();
896 if( mode & VLCPlayListAppendAndGo )
897 _p_instance->fireOnPlayEvent();
903 STDMETHODIMP VLCControl::get_PlaylistIndex(int *index)
909 libvlc_instance_t *p_libvlc;
910 HRESULT result = _p_instance->getVLC(&p_libvlc);
911 if( SUCCEEDED(result) )
913 libvlc_exception_t ex;
914 libvlc_exception_init(&ex);
916 *index = libvlc_playlist_get_current_index(p_libvlc, &ex);
917 if( libvlc_exception_raised(&ex) )
919 _p_instance->setErrorInfo(IID_IVLCControl,
920 libvlc_exception_get_message(&ex));
921 libvlc_exception_clear(&ex);
929 STDMETHODIMP VLCControl::get_PlaylistCount(int *count)
935 libvlc_instance_t* p_libvlc;
936 HRESULT result = _p_instance->getVLC(&p_libvlc);
937 if( SUCCEEDED(result) )
939 libvlc_exception_t ex;
940 libvlc_exception_init(&ex);
942 *count = libvlc_playlist_items_count(p_libvlc, &ex);
943 if( libvlc_exception_raised(&ex) )
945 _p_instance->setErrorInfo(IID_IVLCControl,
946 libvlc_exception_get_message(&ex));
947 libvlc_exception_clear(&ex);
955 STDMETHODIMP VLCControl::playlistNext(void)
957 libvlc_instance_t* p_libvlc;
958 HRESULT result = _p_instance->getVLC(&p_libvlc);
959 if( SUCCEEDED(result) )
961 libvlc_exception_t ex;
962 libvlc_exception_init(&ex);
964 libvlc_playlist_next(p_libvlc, &ex);
965 if( libvlc_exception_raised(&ex) )
967 _p_instance->setErrorInfo(IID_IVLCControl,
968 libvlc_exception_get_message(&ex));
969 libvlc_exception_clear(&ex);
977 STDMETHODIMP VLCControl::playlistPrev(void)
979 libvlc_instance_t* p_libvlc;
980 HRESULT result = _p_instance->getVLC(&p_libvlc);
981 if( SUCCEEDED(result) )
983 libvlc_exception_t ex;
984 libvlc_exception_init(&ex);
986 libvlc_playlist_prev(p_libvlc, &ex);
987 if( libvlc_exception_raised(&ex) )
989 _p_instance->setErrorInfo(IID_IVLCControl,
990 libvlc_exception_get_message(&ex));
991 libvlc_exception_clear(&ex);
999 STDMETHODIMP VLCControl::playlistClear(void)
1001 libvlc_instance_t* p_libvlc;
1002 HRESULT result = _p_instance->getVLC(&p_libvlc);
1003 if( SUCCEEDED(result) )
1005 libvlc_exception_t ex;
1006 libvlc_exception_init(&ex);
1008 libvlc_playlist_clear(p_libvlc, &ex);
1009 if( libvlc_exception_raised(&ex) )
1011 _p_instance->setErrorInfo(IID_IVLCControl,
1012 libvlc_exception_get_message(&ex));
1013 libvlc_exception_clear(&ex);
1021 STDMETHODIMP VLCControl::get_VersionInfo(BSTR *version)
1023 if( NULL == version )
1026 const char *versionStr = libvlc_get_version();
1027 if( NULL != versionStr )
1029 *version = BSTRFromCStr(CP_UTF8, versionStr);
1030 return (NULL == *version) ? E_OUTOFMEMORY : NOERROR;
1036 STDMETHODIMP VLCControl::get_MRL(BSTR *mrl)
1041 *mrl = SysAllocStringLen(_p_instance->getMRL(),
1042 SysStringLen(_p_instance->getMRL()));
1046 STDMETHODIMP VLCControl::put_MRL(BSTR mrl)
1048 _p_instance->setMRL(mrl);
1053 STDMETHODIMP VLCControl::get_AutoPlay(VARIANT_BOOL *autoplay)
1055 if( NULL == autoplay )
1058 *autoplay = _p_instance->getAutoPlay() ? VARIANT_TRUE: VARIANT_FALSE;
1062 STDMETHODIMP VLCControl::put_AutoPlay(VARIANT_BOOL autoplay)
1064 _p_instance->setAutoPlay((VARIANT_FALSE != autoplay) ? TRUE: FALSE);
1068 STDMETHODIMP VLCControl::get_AutoLoop(VARIANT_BOOL *autoloop)
1070 if( NULL == autoloop )
1073 *autoloop = _p_instance->getAutoLoop() ? VARIANT_TRUE: VARIANT_FALSE;
1077 STDMETHODIMP VLCControl::put_AutoLoop(VARIANT_BOOL autoloop)
1079 _p_instance->setAutoLoop((VARIANT_FALSE != autoloop) ? TRUE: FALSE);