* vlccontrol2.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
+ * Copyright (C) 2010 M2X BV
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
* Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#include "plugin.h"
-#include "vlccontrol2.h"
-#include "vlccontrol.h"
-
-#include "utils.h"
-
#include <stdio.h>
#include <shlwapi.h>
#include <wininet.h>
#include <tchar.h>
+#include "utils.h"
+#include "plugin.h"
+#include "vlccontrol2.h"
+#include "vlccontrol.h"
-static inline
-HRESULT _exception_bridge(VLCPlugin *p,REFIID riid, libvlc_exception_t *ex)
-{
- if( libvlc_exception_raised(ex) )
- {
- p->setErrorInfo(riid,libvlc_exception_get_message(ex));
- libvlc_exception_clear(ex);
- return E_FAIL;
- }
- return NOERROR;
-}
-
-#define EMIT_EXCEPTION_BRIDGE( classname ) \
- HRESULT classname::exception_bridge( libvlc_exception_t *ex ) \
- { return _exception_bridge( _p_instance, IID_I##classname, ex ); }
-
-EMIT_EXCEPTION_BRIDGE( VLCAudio )
-EMIT_EXCEPTION_BRIDGE( VLCInput )
-EMIT_EXCEPTION_BRIDGE( VLCMarquee )
-EMIT_EXCEPTION_BRIDGE( VLCMessageIterator )
-EMIT_EXCEPTION_BRIDGE( VLCMessages )
-EMIT_EXCEPTION_BRIDGE( VLCLog )
-EMIT_EXCEPTION_BRIDGE( VLCPlaylistItems )
-EMIT_EXCEPTION_BRIDGE( VLCPlaylist )
-EMIT_EXCEPTION_BRIDGE( VLCVideo )
-EMIT_EXCEPTION_BRIDGE( VLCSubtitle )
-
-#undef EMIT_EXCEPTION_BRIDGE
+#include "position.h"
+// ---------
-VLCAudio::~VLCAudio()
+HRESULT VLCInterfaceBase::report_exception(REFIID riid, libvlc_exception_t *ex)
{
- if( _p_typeinfo )
- _p_typeinfo->Release();
-};
+ _plug->setErrorInfo(riid,libvlc_errmsg());
+ libvlc_exception_clear(ex);
+ return E_FAIL;
+}
-HRESULT VLCAudio::loadTypeInfo(void)
+HRESULT VLCInterfaceBase::loadTypeInfo(REFIID riid)
{
- HRESULT hr = NOERROR;
- if( NULL == _p_typeinfo )
- {
- ITypeLib *p_typelib;
+ // if( _ti ) return NOERROR; // unnecessairy
- hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
- if( SUCCEEDED(hr) )
- {
- hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCAudio, &_p_typeinfo);
- if( FAILED(hr) )
- {
- _p_typeinfo = NULL;
- }
- p_typelib->Release();
- }
+ ITypeLib *p_typelib;
+ HRESULT hr = _plug->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
+ if( SUCCEEDED(hr) )
+ {
+ hr = p_typelib->GetTypeInfoOfGuid(riid, &_ti);
+ if( FAILED(hr) ) _ti = NULL;
+ p_typelib->Release();
}
return hr;
-};
+}
-STDMETHODIMP VLCAudio::GetTypeInfoCount(UINT* pctInfo)
-{
- if( NULL == pctInfo )
- return E_INVALIDARG;
+#define BIND_INTERFACE( class ) \
+ template<> REFIID VLCInterface<class, I##class>::_riid = IID_I##class;
- if( SUCCEEDED(loadTypeInfo()) )
- *pctInfo = 1;
- else
- *pctInfo = 0;
+BIND_INTERFACE( VLCAudio )
+BIND_INTERFACE( VLCInput )
+BIND_INTERFACE( VLCMarquee )
+BIND_INTERFACE( VLCLogo )
+BIND_INTERFACE( VLCPlaylistItems )
+BIND_INTERFACE( VLCPlaylist )
+BIND_INTERFACE( VLCVideo )
+BIND_INTERFACE( VLCSubtitle )
- return NOERROR;
-};
+#undef BIND_INTERFACE
-STDMETHODIMP VLCAudio::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
+template<class I> static inline
+HRESULT object_get(I **dst, I *src)
{
- if( NULL == ppTInfo )
- return E_INVALIDARG;
+ if( NULL == dst )
+ return E_POINTER;
- if( SUCCEEDED(loadTypeInfo()) )
+ *dst = src;
+ if( NULL != src )
{
- _p_typeinfo->AddRef();
- *ppTInfo = _p_typeinfo;
+ src->AddRef();
return NOERROR;
}
- *ppTInfo = NULL;
- return E_NOTIMPL;
-};
+ return E_OUTOFMEMORY;
+}
-STDMETHODIMP VLCAudio::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
- UINT cNames, LCID lcid, DISPID* rgDispID)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
- }
- return E_NOTIMPL;
-};
+// ---------
-STDMETHODIMP VLCAudio::Invoke(DISPID dispIdMember, REFIID riid,
- LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
- VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
- pVarResult, pExcepInfo, puArgErr);
- }
- return E_NOTIMPL;
-};
STDMETHODIMP VLCAudio::get_mute(VARIANT_BOOL* mute)
{
return E_POINTER;
libvlc_instance_t* p_libvlc;
- HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *mute = libvlc_audio_get_mute(p_libvlc, &ex) ?
+ *mute = libvlc_audio_get_mute(p_libvlc) ?
VARIANT_TRUE : VARIANT_FALSE;
- hr = exception_bridge(&ex);
- }
return hr;
};
STDMETHODIMP VLCAudio::put_mute(VARIANT_BOOL mute)
{
libvlc_instance_t* p_libvlc;
- HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_audio_set_mute(p_libvlc, VARIANT_FALSE != mute, &ex);
- hr = exception_bridge(&ex);
- }
+ libvlc_audio_set_mute(p_libvlc, VARIANT_FALSE != mute);
return hr;
};
return E_POINTER;
libvlc_instance_t* p_libvlc;
- HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *volume = libvlc_audio_get_volume(p_libvlc, &ex);
- hr = exception_bridge(&ex);
- }
+ *volume = libvlc_audio_get_volume(p_libvlc);
return hr;
};
STDMETHODIMP VLCAudio::put_volume(long volume)
{
libvlc_instance_t* p_libvlc;
- HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t* p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
STDMETHODIMP VLCAudio::put_track(long track)
{
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t* p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_t ex;
libvlc_exception_init(&ex);
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
int i, i_limit;
return E_POINTER;
libvlc_instance_t* p_libvlc;
- HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
STDMETHODIMP VLCAudio::put_channel(long channel)
{
libvlc_instance_t* p_libvlc;
- HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
STDMETHODIMP VLCAudio::toggleMute()
{
libvlc_instance_t* p_libvlc;
- HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_audio_toggle_mute(p_libvlc, &ex);
- hr = exception_bridge(&ex);
- }
- return hr;
-};
-
-/*******************************************************************************/
-
-VLCInput::~VLCInput()
-{
- if( _p_typeinfo )
- _p_typeinfo->Release();
-};
-
-HRESULT VLCInput::loadTypeInfo(void)
-{
- HRESULT hr = NOERROR;
- if( NULL == _p_typeinfo )
- {
- ITypeLib *p_typelib;
-
- hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
- if( SUCCEEDED(hr) )
- {
- hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCInput, &_p_typeinfo);
- if( FAILED(hr) )
- {
- _p_typeinfo = NULL;
- }
- p_typelib->Release();
- }
- }
+ libvlc_audio_toggle_mute(p_libvlc);
return hr;
};
-STDMETHODIMP VLCInput::GetTypeInfoCount(UINT* pctInfo)
-{
- if( NULL == pctInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- *pctInfo = 1;
- else
- *pctInfo = 0;
-
- return NOERROR;
-};
-
-STDMETHODIMP VLCInput::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
-{
- if( NULL == ppTInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- {
- _p_typeinfo->AddRef();
- *ppTInfo = _p_typeinfo;
- return NOERROR;
- }
- *ppTInfo = NULL;
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCInput::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
- UINT cNames, LCID lcid, DISPID* rgDispID)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
- }
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCInput::Invoke(DISPID dispIdMember, REFIID riid,
- LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
- VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
- pVarResult, pExcepInfo, puArgErr);
- }
- return E_NOTIMPL;
-};
+/****************************************************************************/
STDMETHODIMP VLCInput::get_length(double* length)
{
*length = 0;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
*position = 0.0f;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
STDMETHODIMP VLCInput::put_position(double position)
{
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
STDMETHODIMP VLCInput::put_time(double time)
{
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
- *state = libvlc_media_player_get_state(p_md, &ex);
+ *state = libvlc_media_player_get_state(p_md);
if( libvlc_exception_raised(&ex) )
{
// don't fail, just return the idle state
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
STDMETHODIMP VLCInput::put_rate(double rate)
{
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
*fps = 0.0;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return hr;
};
-/*******************************************************************************/
+/****************************************************************************/
-VLCLog::~VLCLog()
+HRESULT VLCMarquee::do_put_int(unsigned idx, LONG val)
{
- delete _p_vlcmessages;
- if( _p_log )
- libvlc_log_close(_p_log);
-
- if( _p_typeinfo )
- _p_typeinfo->Release();
-};
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
+ if( SUCCEEDED(hr) )
+ {
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+ libvlc_video_set_marquee_int(p_md, idx, val, &ex);
+ hr = exception_bridge(&ex);
+ }
+ return hr;
+}
-HRESULT VLCLog::loadTypeInfo(void)
+HRESULT VLCMarquee::do_get_int(unsigned idx, LONG *val)
{
- HRESULT hr = NOERROR;
- if( NULL == _p_typeinfo )
- {
- ITypeLib *p_typelib;
+ if( NULL == val )
+ return E_POINTER;
- hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
- if( SUCCEEDED(hr) )
- {
- hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCLog, &_p_typeinfo);
- if( FAILED(hr) )
- {
- _p_typeinfo = NULL;
- }
- p_typelib->Release();
- }
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
+ if( SUCCEEDED(hr) )
+ {
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+ *val = libvlc_video_get_marquee_int(p_md, idx, &ex);
+ hr = exception_bridge(&ex);
}
return hr;
-};
+}
-STDMETHODIMP VLCLog::GetTypeInfoCount(UINT* pctInfo)
+STDMETHODIMP VLCMarquee::get_position(BSTR* val)
{
- if( NULL == pctInfo )
- return E_INVALIDARG;
+ if( NULL == val )
+ return E_POINTER;
- if( SUCCEEDED(loadTypeInfo()) )
- *pctInfo = 1;
- else
- *pctInfo = 0;
+ LONG i;
+ HRESULT hr = do_get_int(libvlc_marquee_Position, &i);
- return NOERROR;
-};
+ if(SUCCEEDED(hr))
+ *val = BSTRFromCStr(CP_UTF8, position_bynumber(i));
+
+ return hr;
+}
-STDMETHODIMP VLCLog::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
+STDMETHODIMP VLCMarquee::put_position(BSTR val)
{
- if( NULL == ppTInfo )
- return E_INVALIDARG;
+ char *n = CStrFromBSTR(CP_UTF8, val);
+ if( !n ) return E_OUTOFMEMORY;
- if( SUCCEEDED(loadTypeInfo()) )
- {
- _p_typeinfo->AddRef();
- *ppTInfo = _p_typeinfo;
- return NOERROR;
- }
- *ppTInfo = NULL;
- return E_NOTIMPL;
-};
+ size_t i;
+ HRESULT hr;
+ if( position_byname( n, i ) )
+ hr = do_put_int(libvlc_marquee_Position,i);
+ else
+ hr = E_INVALIDARG;
-STDMETHODIMP VLCLog::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
- UINT cNames, LCID lcid, DISPID* rgDispID)
+ CoTaskMemFree(n);
+ return hr;
+}
+
+STDMETHODIMP VLCMarquee::get_text(BSTR *val)
{
- if( SUCCEEDED(loadTypeInfo()) )
+ char *psz;
+ if( NULL == val )
+ return E_POINTER;
+
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
+ if( SUCCEEDED(hr) )
{
- return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ psz = libvlc_video_get_marquee_string(p_md, libvlc_marquee_Text, &ex);
+
+ hr = exception_bridge(&ex);
+ if(SUCCEEDED(hr))
+ *val = BSTRFromCStr(CP_UTF8, psz);
}
- return E_NOTIMPL;
-};
+ return hr;
+}
-STDMETHODIMP VLCLog::Invoke(DISPID dispIdMember, REFIID riid,
- LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
- VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
+STDMETHODIMP VLCMarquee::put_text(BSTR val)
{
- if( SUCCEEDED(loadTypeInfo()) )
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
+ if( SUCCEEDED(hr) )
{
- return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
- pVarResult, pExcepInfo, puArgErr);
- }
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCLog::get_messages(IVLCMessages** obj)
-{
- if( NULL == obj )
- return E_POINTER;
-
- *obj = _p_vlcmessages;
- if( NULL != _p_vlcmessages )
- {
- _p_vlcmessages->AddRef();
- return NOERROR;
- }
- return E_OUTOFMEMORY;
-};
-
-STDMETHODIMP VLCLog::get_verbosity(long* level)
-{
- if( NULL == level )
- return E_POINTER;
-
- if( _p_log )
- {
- libvlc_instance_t* p_libvlc;
- HRESULT hr = _p_instance->getVLC(&p_libvlc);
- if( SUCCEEDED(hr) )
- *level = libvlc_get_log_verbosity(p_libvlc);
- return hr;
- }
- else
- {
- /* log is not enabled, return -1 */
- *level = -1;
- return NOERROR;
- }
-};
-
-STDMETHODIMP VLCLog::put_verbosity(long verbosity)
-{
- libvlc_instance_t* p_libvlc;
- HRESULT hr = _p_instance->getVLC(&p_libvlc);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- if( verbosity >= 0 )
- {
- if( ! _p_log )
- {
- _p_log = libvlc_log_open(p_libvlc, &ex);
- hr = exception_bridge(&ex);
- }
- if( SUCCEEDED(hr) )
- libvlc_set_log_verbosity(p_libvlc, (unsigned)verbosity);
- }
- else if( _p_log )
- {
- /* close log when verbosity is set to -1 */
- libvlc_log_close(_p_log);
- _p_log = NULL;
- }
- hr = exception_bridge(&ex);
- }
- return hr;
-};
-
-/*******************************************************************************/
-
-VLCMarquee::~VLCMarquee()
-{
- if( _p_typeinfo )
- _p_typeinfo->Release();
-};
-
-HRESULT VLCMarquee::loadTypeInfo(void)
-{
- HRESULT hr = NOERROR;
- if( NULL == _p_typeinfo )
- {
- ITypeLib *p_typelib;
-
- hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
- if( SUCCEEDED(hr) )
- {
- hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCMarquee, &_p_typeinfo);
- if( FAILED(hr) )
- {
- _p_typeinfo = NULL;
- }
- p_typelib->Release();
- }
- }
- return hr;
-};
-
-STDMETHODIMP VLCMarquee::GetTypeInfoCount(UINT* pctInfo)
-{
- if( NULL == pctInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- *pctInfo = 1;
- else
- *pctInfo = 0;
-
- return NOERROR;
-};
-
-STDMETHODIMP VLCMarquee::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
-{
- if( NULL == ppTInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- {
- _p_typeinfo->AddRef();
- *ppTInfo = _p_typeinfo;
- return NOERROR;
- }
- *ppTInfo = NULL;
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCMarquee::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
- UINT cNames, LCID lcid, DISPID* rgDispID)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
- }
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCMarquee::Invoke(DISPID dispIdMember, REFIID riid,
- LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
- VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
- pVarResult, pExcepInfo, puArgErr);
- }
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCMarquee::enable()
-{
- libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Enabled, true, &ex);
- hr = exception_bridge(&ex);
- }
- return hr;
-};
-
-STDMETHODIMP VLCMarquee::disable()
-{
- libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Enabled, false, &ex);
- hr = exception_bridge(&ex);
- }
- return hr;
-};
-
-STDMETHODIMP VLCMarquee::color(long val)
-{
- libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Color, val, &ex);
- hr = exception_bridge(&ex);
- }
- return hr;
-};
-
-STDMETHODIMP VLCMarquee::opacity(long val)
-{
- libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Opacity, val, &ex);
- hr = exception_bridge(&ex);
- }
- return hr;
-};
-
-STDMETHODIMP VLCMarquee::position(long val)
-{
- libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Position, val, &ex);
- hr = exception_bridge(&ex);
- }
- return hr;
-};
-
-STDMETHODIMP VLCMarquee::refresh(long val)
-{
- libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Refresh, val, &ex);
- hr = exception_bridge(&ex);
- }
- return hr;
-};
-
-STDMETHODIMP VLCMarquee::size(long val)
-{
- libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Size, val, &ex);
- hr = exception_bridge(&ex);
- }
- return hr;
-};
-
-STDMETHODIMP VLCMarquee::text(BSTR text)
-{
- libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- char *psz_text = CStrFromBSTR(CP_UTF8, text);
- libvlc_video_set_marquee_option_as_string(p_md, libvlc_marquee_Text, psz_text, &ex);
- hr = exception_bridge(&ex);
- CoTaskMemFree(psz_text);
- }
- return hr;
-};
-
-STDMETHODIMP VLCMarquee::timeout(long val)
-{
- libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Timeout, val, &ex);
- hr = exception_bridge(&ex);
- }
- return hr;
-};
-
-STDMETHODIMP VLCMarquee::x(long val)
-{
- libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_X, val, &ex);
- hr = exception_bridge(&ex);
- }
- return hr;
-};
-
-STDMETHODIMP VLCMarquee::y(long val)
-{
- libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Y, val, &ex);
- hr = exception_bridge(&ex);
- }
- return hr;
-};
-
-/*******************************************************************************/
-
-/* STL forward iterator used by VLCEnumIterator class to implement IEnumVARIANT */
-
-class VLCMessageSTLIterator
-{
-
-public:
-
- VLCMessageSTLIterator(IVLCMessageIterator* iter) : iter(iter), msg(NULL)
- {
- // get first message
- operator++();
- };
-
- VLCMessageSTLIterator(const VLCMessageSTLIterator& other)
- {
- iter = other.iter;
- if( iter )
- iter->AddRef();
- msg = other.msg;
- if( msg )
- msg->AddRef();
- };
-
- virtual ~VLCMessageSTLIterator()
- {
- if( msg )
- msg->Release();
-
- if( iter )
- iter->Release();
- };
-
- // we only need prefix ++ operator
- VLCMessageSTLIterator& operator++()
- {
- VARIANT_BOOL hasNext = VARIANT_FALSE;
- if( iter )
- {
- iter->get_hasNext(&hasNext);
-
- if( msg )
- {
- msg->Release();
- msg = NULL;
- }
- if( VARIANT_TRUE == hasNext ) {
- iter->next(&msg);
- }
- }
- return *this;
- };
-
- VARIANT operator*() const
- {
- VARIANT v;
- VariantInit(&v);
- if( msg )
- {
- if( SUCCEEDED(msg->QueryInterface(IID_IDispatch,
- (LPVOID*)&V_DISPATCH(&v))) )
- {
- V_VT(&v) = VT_DISPATCH;
- }
- }
- return v;
- };
-
- bool operator==(const VLCMessageSTLIterator& other) const
- {
- return msg == other.msg;
- };
-
- bool operator!=(const VLCMessageSTLIterator& other) const
- {
- return msg != other.msg;
- };
-
-private:
- IVLCMessageIterator* iter;
- IVLCMessage* msg;
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-VLCMessages::~VLCMessages()
-{
- if( _p_typeinfo )
- _p_typeinfo->Release();
-};
-
-HRESULT VLCMessages::loadTypeInfo(void)
-{
- HRESULT hr = NOERROR;
- if( NULL == _p_typeinfo )
- {
- ITypeLib *p_typelib;
-
- hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
- if( SUCCEEDED(hr) )
- {
- hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCMessages, &_p_typeinfo);
- if( FAILED(hr) )
- {
- _p_typeinfo = NULL;
- }
- p_typelib->Release();
- }
- }
- return hr;
-};
-
-STDMETHODIMP VLCMessages::GetTypeInfoCount(UINT* pctInfo)
-{
- if( NULL == pctInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- *pctInfo = 1;
- else
- *pctInfo = 0;
-
- return NOERROR;
-};
-
-STDMETHODIMP VLCMessages::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
-{
- if( NULL == ppTInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- {
- _p_typeinfo->AddRef();
- *ppTInfo = _p_typeinfo;
- return NOERROR;
- }
- *ppTInfo = NULL;
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCMessages::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
- UINT cNames, LCID lcid, DISPID* rgDispID)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
- }
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCMessages::Invoke(DISPID dispIdMember, REFIID riid,
- LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
- VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
- pVarResult, pExcepInfo, puArgErr);
- }
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCMessages::get__NewEnum(LPUNKNOWN* _NewEnum)
-{
- if( NULL == _NewEnum )
- return E_POINTER;
-
- IVLCMessageIterator* iter = NULL;
- iterator(&iter);
-
- *_NewEnum= new VLCEnumIterator<IID_IEnumVARIANT,
- IEnumVARIANT,
- VARIANT,
- VLCMessageSTLIterator>
- (VLCMessageSTLIterator(iter), VLCMessageSTLIterator(NULL));
-
- return *_NewEnum ? S_OK : E_OUTOFMEMORY;
-};
-
-STDMETHODIMP VLCMessages::clear()
-{
- libvlc_log_t *p_log = _p_vlclog->_p_log;
- if( p_log )
- libvlc_log_clear(p_log);
- return NOERROR;
-};
-
-STDMETHODIMP VLCMessages::get_count(long* count)
-{
- if( NULL == count )
- return E_POINTER;
-
- libvlc_log_t *p_log = _p_vlclog->_p_log;
- *count = libvlc_log_count(p_log);
- return S_OK;
-};
-
-STDMETHODIMP VLCMessages::iterator(IVLCMessageIterator** iter)
-{
- if( NULL == iter )
- return E_POINTER;
-
- *iter = new VLCMessageIterator(_p_instance, _p_vlclog);
-
- return *iter ? S_OK : E_OUTOFMEMORY;
-};
-
-/*******************************************************************************/
-
-VLCMessageIterator::VLCMessageIterator(VLCPlugin *p_instance, VLCLog* p_vlclog ) :
- _p_instance(p_instance),
- _p_typeinfo(NULL),
- _refcount(1),
- _p_vlclog(p_vlclog)
-{
- if( p_vlclog->_p_log )
- {
- _p_iter = libvlc_log_get_iterator(p_vlclog->_p_log, NULL);
- }
- else
- _p_iter = NULL;
-};
-
-VLCMessageIterator::~VLCMessageIterator()
-{
- if( _p_iter )
- libvlc_log_iterator_free(_p_iter);
-
- if( _p_typeinfo )
- _p_typeinfo->Release();
-};
-
-HRESULT VLCMessageIterator::loadTypeInfo(void)
-{
- HRESULT hr = NOERROR;
- if( NULL == _p_typeinfo )
- {
- ITypeLib *p_typelib;
-
- hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
- if( SUCCEEDED(hr) )
- {
- hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCMessageIterator, &_p_typeinfo);
- if( FAILED(hr) )
- {
- _p_typeinfo = NULL;
- }
- p_typelib->Release();
- }
- }
- return hr;
-};
-
-STDMETHODIMP VLCMessageIterator::GetTypeInfoCount(UINT* pctInfo)
-{
- if( NULL == pctInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- *pctInfo = 1;
- else
- *pctInfo = 0;
-
- return NOERROR;
-};
-
-STDMETHODIMP VLCMessageIterator::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
-{
- if( NULL == ppTInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- {
- _p_typeinfo->AddRef();
- *ppTInfo = _p_typeinfo;
- return NOERROR;
- }
- *ppTInfo = NULL;
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCMessageIterator::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
- UINT cNames, LCID lcid, DISPID* rgDispID)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
- }
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCMessageIterator::Invoke(DISPID dispIdMember, REFIID riid,
- LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
- VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
- pVarResult, pExcepInfo, puArgErr);
- }
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCMessageIterator::get_hasNext(VARIANT_BOOL* hasNext)
-{
- if( NULL == hasNext )
- return E_POINTER;
-
- if( _p_iter && _p_vlclog->_p_log )
- {
- *hasNext = libvlc_log_iterator_has_next(_p_iter) ?
- VARIANT_TRUE : VARIANT_FALSE;
- }
- else
- {
- *hasNext = VARIANT_FALSE;
- }
- return S_OK;
-};
-
-STDMETHODIMP VLCMessageIterator::next(IVLCMessage** message)
-{
- HRESULT hr = S_OK;
-
- if( NULL == message )
- return E_POINTER;
-
- if( _p_iter && _p_vlclog->_p_log )
- {
- struct libvlc_log_message_t buffer;
-
- buffer.sizeof_msg = sizeof(buffer);
-
- libvlc_log_iterator_next(_p_iter, &buffer);
- *message = new VLCMessage(_p_instance, buffer);
- if( !message )
- hr = E_OUTOFMEMORY;
- }
- return hr;
-};
-
-/*******************************************************************************/
-
-VLCMessage::~VLCMessage()
-{
- if( _p_typeinfo )
- _p_typeinfo->Release();
-};
-
-HRESULT VLCMessage::loadTypeInfo(void)
-{
- HRESULT hr = NOERROR;
- if( NULL == _p_typeinfo )
- {
- ITypeLib *p_typelib;
-
- hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
- if( SUCCEEDED(hr) )
- {
- hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCMessage, &_p_typeinfo);
- if( FAILED(hr) )
- {
- _p_typeinfo = NULL;
- }
- p_typelib->Release();
- }
- }
- return hr;
-};
-
-STDMETHODIMP VLCMessage::GetTypeInfoCount(UINT* pctInfo)
-{
- if( NULL == pctInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- *pctInfo = 1;
- else
- *pctInfo = 0;
-
- return NOERROR;
-};
-
-STDMETHODIMP VLCMessage::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
-{
- if( NULL == ppTInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- {
- _p_typeinfo->AddRef();
- *ppTInfo = _p_typeinfo;
- return NOERROR;
- }
- *ppTInfo = NULL;
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCMessage::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
- UINT cNames, LCID lcid, DISPID* rgDispID)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
- }
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCMessage::Invoke(DISPID dispIdMember, REFIID riid,
- LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
- VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
- pVarResult, pExcepInfo, puArgErr);
- }
- return E_NOTIMPL;
-};
-
-inline const char *msgSeverity(int sev)
-{
- switch( sev )
- {
- case 0:
- return "info";
- case 1:
- return "error";
- case 2:
- return "warning";
- default:
- return "debug";
- }
-};
-
-STDMETHODIMP VLCMessage::get__Value(VARIANT* _Value)
-{
- if( NULL == _Value )
- return E_POINTER;
-
- char buffer[256];
-
- snprintf(buffer, sizeof(buffer), "%s %s %s: %s",
- _msg.psz_type, _msg.psz_name, msgSeverity(_msg.i_severity), _msg.psz_message);
-
- V_VT(_Value) = VT_BSTR;
- V_BSTR(_Value) = BSTRFromCStr(CP_UTF8, buffer);
-
- return S_OK;
-};
-
-STDMETHODIMP VLCMessage::get_severity(long* level)
-{
- if( NULL == level )
- return E_POINTER;
-
- *level = _msg.i_severity;
-
- return S_OK;
-};
-
-STDMETHODIMP VLCMessage::get_type(BSTR* type)
-{
- if( NULL == type )
- return E_POINTER;
-
- *type = BSTRFromCStr(CP_UTF8, _msg.psz_type);
-
- return NOERROR;
-};
-
-STDMETHODIMP VLCMessage::get_name(BSTR* name)
-{
- if( NULL == name )
- return E_POINTER;
-
- *name = BSTRFromCStr(CP_UTF8, _msg.psz_name);
-
- return NOERROR;
-};
-
-STDMETHODIMP VLCMessage::get_header(BSTR* header)
-{
- if( NULL == header )
- return E_POINTER;
-
- *header = BSTRFromCStr(CP_UTF8, _msg.psz_header);
-
- return NOERROR;
-};
-
-STDMETHODIMP VLCMessage::get_message(BSTR* message)
-{
- if( NULL == message )
- return E_POINTER;
-
- *message = BSTRFromCStr(CP_UTF8, _msg.psz_message);
-
- return NOERROR;
-};
-
-/*******************************************************************************/
-
-VLCPlaylistItems::~VLCPlaylistItems()
-{
- if( _p_typeinfo )
- _p_typeinfo->Release();
-};
-
-HRESULT VLCPlaylistItems::loadTypeInfo(void)
-{
- HRESULT hr = NOERROR;
- if( NULL == _p_typeinfo )
- {
- ITypeLib *p_typelib;
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
- hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
- if( SUCCEEDED(hr) )
- {
- hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCPlaylistItems, &_p_typeinfo);
- if( FAILED(hr) )
- {
- _p_typeinfo = NULL;
- }
- p_typelib->Release();
- }
+ char *psz_text = CStrFromBSTR(CP_UTF8, val);
+ libvlc_video_set_marquee_string(p_md, libvlc_marquee_Text,
+ psz_text, &ex);
+ hr = exception_bridge(&ex);
+ CoTaskMemFree(psz_text);
}
return hr;
-};
-
-STDMETHODIMP VLCPlaylistItems::GetTypeInfoCount(UINT* pctInfo)
-{
- if( NULL == pctInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- *pctInfo = 1;
- else
- *pctInfo = 0;
-
- return NOERROR;
-};
-
-STDMETHODIMP VLCPlaylistItems::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
-{
- if( NULL == ppTInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- {
- _p_typeinfo->AddRef();
- *ppTInfo = _p_typeinfo;
- return NOERROR;
- }
- *ppTInfo = NULL;
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCPlaylistItems::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
- UINT cNames, LCID lcid, DISPID* rgDispID)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
- }
- return E_NOTIMPL;
-};
+}
-STDMETHODIMP VLCPlaylistItems::Invoke(DISPID dispIdMember, REFIID riid,
- LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
- VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
- pVarResult, pExcepInfo, puArgErr);
- }
- return E_NOTIMPL;
-};
+/****************************************************************************/
STDMETHODIMP VLCPlaylistItems::get_count(long* count)
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
- *count = _p_instance->playlist_count(&ex);
+ *count = Instance()->playlist_count(&ex);
return exception_bridge(&ex);
};
libvlc_exception_t ex;
libvlc_exception_init(&ex);
- _p_instance->playlist_clear(&ex);
+ Instance()->playlist_clear(&ex);
return exception_bridge(&ex);
};
STDMETHODIMP VLCPlaylistItems::remove(long item)
{
libvlc_instance_t* p_libvlc;
- HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
- _p_instance->playlist_delete_item(item, &ex);
+ Instance()->playlist_delete_item(item, &ex);
hr = exception_bridge(&ex);
}
return hr;
};
-/*******************************************************************************/
-
-VLCPlaylist::~VLCPlaylist()
-{
- delete _p_vlcplaylistitems;
- if( _p_typeinfo )
- _p_typeinfo->Release();
-};
-
-HRESULT VLCPlaylist::loadTypeInfo(void)
-{
- HRESULT hr = NOERROR;
- if( NULL == _p_typeinfo )
- {
- ITypeLib *p_typelib;
-
- hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
- if( SUCCEEDED(hr) )
- {
- hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCPlaylist, &_p_typeinfo);
- if( FAILED(hr) )
- {
- _p_typeinfo = NULL;
- }
- p_typelib->Release();
- }
- }
- return hr;
-};
-
-STDMETHODIMP VLCPlaylist::GetTypeInfoCount(UINT* pctInfo)
-{
- if( NULL == pctInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- *pctInfo = 1;
- else
- *pctInfo = 0;
-
- return NOERROR;
-};
-
-STDMETHODIMP VLCPlaylist::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
-{
- if( NULL == ppTInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- {
- _p_typeinfo->AddRef();
- *ppTInfo = _p_typeinfo;
- return NOERROR;
- }
- *ppTInfo = NULL;
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCPlaylist::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
- UINT cNames, LCID lcid, DISPID* rgDispID)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
- }
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCPlaylist::Invoke(DISPID dispIdMember, REFIID riid,
- LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
- VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
- pVarResult, pExcepInfo, puArgErr);
- }
- return E_NOTIMPL;
-};
+/****************************************************************************/
STDMETHODIMP VLCPlaylist::get_itemCount(long* count)
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
- *count = _p_instance->playlist_count(&ex);
+ *count = Instance()->playlist_count(&ex);
return exception_bridge(&ex);
};
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
- *isPlaying = libvlc_media_player_is_playing(p_md, &ex) ?
+ *isPlaying = libvlc_media_player_is_playing(p_md) ?
VARIANT_TRUE: VARIANT_FALSE;
libvlc_exception_clear(&ex);
}
return E_INVALIDARG;
libvlc_instance_t* p_libvlc;
- HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
char *psz_uri = NULL;
- if( SysStringLen(_p_instance->getBaseURL()) > 0 )
+ if( SysStringLen(Instance()->getBaseURL()) > 0 )
{
/*
** if the MRL a relative URL, we should end up with an absolute URL
*/
- LPWSTR abs_url = CombineURL(_p_instance->getBaseURL(), uri);
+ LPWSTR abs_url = CombineURL(Instance()->getBaseURL(), uri);
if( NULL != abs_url )
{
psz_uri = CStrFromWSTR(CP_UTF8, abs_url, wcslen(abs_url));
VariantClear(&v_name);
}
- *item = _p_instance->playlist_add_extended_untrusted(psz_uri,
+ *item = Instance()->playlist_add_extended_untrusted(psz_uri,
i_options, const_cast<const char **>(ppsz_options), &ex);
VLCControl::FreeTargetOptions(ppsz_options, i_options);
libvlc_exception_t ex;
libvlc_exception_init(&ex);
- _p_instance->playlist_play(&ex);
+ Instance()->playlist_play(&ex);
return exception_bridge(&ex);
};
libvlc_exception_t ex;
libvlc_exception_init(&ex);
- _p_instance->playlist_play_item(item,&ex);
+ Instance()->playlist_play_item(item,&ex);
return exception_bridge(&ex);;
};
STDMETHODIMP VLCPlaylist::togglePause()
{
libvlc_media_player_t* p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
};
STDMETHODIMP VLCPlaylist::stop()
-{
- libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_stop(p_md, &ex);
- hr = exception_bridge(&ex);;
- }
- return hr;
-};
-
-STDMETHODIMP VLCPlaylist::next()
-{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- _p_instance->playlist_next(&ex);
- return exception_bridge(&ex);;
-};
-
-STDMETHODIMP VLCPlaylist::prev()
-{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- _p_instance->playlist_prev(&ex);
- return exception_bridge(&ex);;
-};
-
-STDMETHODIMP VLCPlaylist::clear()
-{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- _p_instance->playlist_clear(&ex);
- return exception_bridge(&ex);;
-};
-
-STDMETHODIMP VLCPlaylist::removeItem(long item)
-{
- libvlc_instance_t* p_libvlc;
- HRESULT hr = _p_instance->getVLC(&p_libvlc);
- if( SUCCEEDED(hr) )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- _p_instance->playlist_delete_item(item, &ex);
- hr = exception_bridge(&ex);;
- }
- return hr;
-};
-
-STDMETHODIMP VLCPlaylist::get_items(IVLCPlaylistItems** obj)
-{
- if( NULL == obj )
- return E_POINTER;
-
- *obj = _p_vlcplaylistitems;
- if( NULL != _p_vlcplaylistitems )
- {
- _p_vlcplaylistitems->AddRef();
- return NOERROR;
- }
- return E_OUTOFMEMORY;
-};
-
-/*******************************************************************************/
-
-VLCSubtitle::~VLCSubtitle()
-{
- if( _p_typeinfo )
- _p_typeinfo->Release();
-};
-
-HRESULT VLCSubtitle::loadTypeInfo(void)
-{
- HRESULT hr = NOERROR;
- if( NULL == _p_typeinfo )
- {
- ITypeLib *p_typelib;
-
- hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
- if( SUCCEEDED(hr) )
- {
- hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCSubtitle, &_p_typeinfo);
- if( FAILED(hr) )
- {
- _p_typeinfo = NULL;
- }
- p_typelib->Release();
- }
+{
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
+ if( SUCCEEDED(hr) )
+ {
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_media_player_stop(p_md);
+ hr = exception_bridge(&ex);;
}
return hr;
};
-STDMETHODIMP VLCSubtitle::GetTypeInfoCount(UINT* pctInfo)
+STDMETHODIMP VLCPlaylist::next()
{
- if( NULL == pctInfo )
- return E_INVALIDARG;
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
- if( SUCCEEDED(loadTypeInfo()) )
- *pctInfo = 1;
- else
- *pctInfo = 0;
+ Instance()->playlist_next(&ex);
+ return exception_bridge(&ex);;
+};
- return NOERROR;
+STDMETHODIMP VLCPlaylist::prev()
+{
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ Instance()->playlist_prev(&ex);
+ return exception_bridge(&ex);;
};
-STDMETHODIMP VLCSubtitle::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
+STDMETHODIMP VLCPlaylist::clear()
{
- if( NULL == ppTInfo )
- return E_INVALIDARG;
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
- if( SUCCEEDED(loadTypeInfo()) )
- {
- _p_typeinfo->AddRef();
- *ppTInfo = _p_typeinfo;
- return NOERROR;
- }
- *ppTInfo = NULL;
- return E_NOTIMPL;
+ Instance()->playlist_clear(&ex);
+ return exception_bridge(&ex);;
};
-STDMETHODIMP VLCSubtitle::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
- UINT cNames, LCID lcid, DISPID* rgDispID)
+STDMETHODIMP VLCPlaylist::removeItem(long item)
{
- if( SUCCEEDED(loadTypeInfo()) )
+ libvlc_instance_t* p_libvlc;
+ HRESULT hr = getVLC(&p_libvlc);
+ if( SUCCEEDED(hr) )
{
- return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ Instance()->playlist_delete_item(item, &ex);
+ hr = exception_bridge(&ex);;
}
- return E_NOTIMPL;
+ return hr;
};
-STDMETHODIMP VLCSubtitle::Invoke(DISPID dispIdMember, REFIID riid,
- LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
- VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
+STDMETHODIMP VLCPlaylist::get_items(IVLCPlaylistItems** obj)
{
- if( SUCCEEDED(loadTypeInfo()) )
+ if( NULL == obj )
+ return E_POINTER;
+
+ *obj = _p_vlcplaylistitems;
+ if( NULL != _p_vlcplaylistitems )
{
- return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
- pVarResult, pExcepInfo, puArgErr);
+ _p_vlcplaylistitems->AddRef();
+ return NOERROR;
}
- return E_NOTIMPL;
+ return E_OUTOFMEMORY;
};
+/****************************************************************************/
+
STDMETHODIMP VLCSubtitle::get_track(long* spu)
{
if( NULL == spu )
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
STDMETHODIMP VLCSubtitle::put_track(long spu)
{
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_t ex;
libvlc_exception_init(&ex);
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
int i, i_limit;
return hr;
};
-/*******************************************************************************/
-
-VLCVideo::~VLCVideo()
-{
- delete _p_vlcmarquee;
- if( _p_typeinfo )
- _p_typeinfo->Release();
-};
-
-HRESULT VLCVideo::loadTypeInfo(void)
-{
- HRESULT hr = NOERROR;
- if( NULL == _p_typeinfo )
- {
- ITypeLib *p_typelib;
-
- hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
- if( SUCCEEDED(hr) )
- {
- hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCVideo, &_p_typeinfo);
- if( FAILED(hr) )
- {
- _p_typeinfo = NULL;
- }
- p_typelib->Release();
- }
- }
- return hr;
-};
-
-STDMETHODIMP VLCVideo::GetTypeInfoCount(UINT* pctInfo)
-{
- if( NULL == pctInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- *pctInfo = 1;
- else
- *pctInfo = 0;
-
- return NOERROR;
-};
-
-STDMETHODIMP VLCVideo::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
-{
- if( NULL == ppTInfo )
- return E_INVALIDARG;
-
- if( SUCCEEDED(loadTypeInfo()) )
- {
- _p_typeinfo->AddRef();
- *ppTInfo = _p_typeinfo;
- return NOERROR;
- }
- *ppTInfo = NULL;
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCVideo::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
- UINT cNames, LCID lcid, DISPID* rgDispID)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
- }
- return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCVideo::Invoke(DISPID dispIdMember, REFIID riid,
- LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
- VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
-{
- if( SUCCEEDED(loadTypeInfo()) )
- {
- return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
- pVarResult, pExcepInfo, puArgErr);
- }
- return E_NOTIMPL;
-};
+/****************************************************************************/
STDMETHODIMP VLCVideo::get_fullscreen(VARIANT_BOOL* fullscreen)
{
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
STDMETHODIMP VLCVideo::put_fullscreen(VARIANT_BOOL fullscreen)
{
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
STDMETHODIMP VLCVideo::put_subtitle(long spu)
{
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_INVALIDARG;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
+#if 0
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
- *page = libvlc_video_get_teletext(p_md, &ex);
+ *page = libvlc_video_get_teletext(p_md);
hr = exception_bridge(&ex);
}
+#endif
return hr;
};
STDMETHODIMP VLCVideo::put_teletext(long page)
{
+#warning Broken
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
+#if 0
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
- libvlc_video_set_teletext(p_md, page, &ex);
+ libvlc_video_set_teletext(p_md, page);
hr = exception_bridge(&ex);
}
+#endif
return hr;
};
STDMETHODIMP VLCVideo::deinterlaceDisable()
{
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
STDMETHODIMP VLCVideo::deinterlaceEnable(BSTR mode)
{
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
return E_POINTER;
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
if( INVALID_HANDLE_VALUE == dirHandle )
{
- _p_instance->setErrorInfo(IID_IVLCVideo,
+ Instance()->setErrorInfo(IID_IVLCVideo,
"Invalid temporary directory for snapshot images, check values of TMP, TEMP envars.");
return E_FAIL;
}
CloseHandle(dirHandle);
if( !res || !(bhfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{
- _p_instance->setErrorInfo(IID_IVLCVideo,
+ Instance()->setErrorInfo(IID_IVLCVideo,
"Invalid temporary directory for snapshot images, check values of TMP, TEMP envars.");
return E_FAIL;
}
STDMETHODIMP VLCVideo::toggleFullscreen()
{
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
STDMETHODIMP VLCVideo::toggleTeletext()
{
libvlc_media_player_t *p_md;
- HRESULT hr = _p_instance->getMD(&p_md);
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
STDMETHODIMP VLCVideo::get_marquee(IVLCMarquee** obj)
{
- if( NULL == obj )
+ return object_get(obj,_p_vlcmarquee);
+}
+
+STDMETHODIMP VLCVideo::get_logo(IVLCLogo** obj)
+{
+ return object_get(obj,_p_vlclogo);
+}
+
+
+/****************************************************************************/
+
+HRESULT VLCLogo::do_put_int(unsigned idx, LONG val)
+{
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
+ if( SUCCEEDED(hr) )
+ {
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+ libvlc_video_set_logo_int(p_md, idx, val, &ex);
+ hr = exception_bridge(&ex);
+ }
+ return hr;
+}
+
+HRESULT VLCLogo::do_get_int(unsigned idx, LONG *val)
+{
+ if( NULL == val )
return E_POINTER;
- *obj = _p_vlcmarquee;
- if( NULL != _p_vlcmarquee )
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
+ if( SUCCEEDED(hr) )
{
- _p_vlcmarquee->AddRef();
- return NOERROR;
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+ *val = libvlc_video_get_logo_int(p_md, idx, &ex);
+ hr = exception_bridge(&ex);
}
- return E_OUTOFMEMORY;
-};
+ return hr;
+}
+
+STDMETHODIMP VLCLogo::file(BSTR fname)
+{
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
+
+ char *n = CStrFromBSTR(CP_UTF8, fname);
+ if( !n ) hr = E_OUTOFMEMORY;
+
+ if( SUCCEEDED(hr) )
+ {
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+ libvlc_video_set_logo_string(p_md, libvlc_logo_file, n, &ex);
+ hr = exception_bridge(&ex);
+ }
+
+ CoTaskMemFree(n);
+ return hr;
+}
+
+STDMETHODIMP VLCLogo::get_position(BSTR* val)
+{
+ if( NULL == val )
+ return E_POINTER;
+
+ LONG i;
+ HRESULT hr = do_get_int(libvlc_logo_position, &i);
+
+ if(SUCCEEDED(hr))
+ *val = BSTRFromCStr(CP_UTF8, position_bynumber(i));
+
+ return hr;
+}
-/*******************************************************************************/
+STDMETHODIMP VLCLogo::put_position(BSTR val)
+{
+ char *n = CStrFromBSTR(CP_UTF8, val);
+ if( !n ) return E_OUTOFMEMORY;
+
+ size_t i;
+ HRESULT hr;
+ if( position_byname( n, i ) )
+ hr = do_put_int(libvlc_logo_position,i);
+ else
+ hr = E_INVALIDARG;
+
+ CoTaskMemFree(n);
+ return hr;
+}
+
+/****************************************************************************/
VLCControl2::VLCControl2(VLCPlugin *p_instance) :
_p_instance(p_instance),
_p_typeinfo(NULL),
- _p_vlcaudio(NULL),
- _p_vlcinput(NULL),
- _p_vlcplaylist(NULL),
- _p_vlcsubtitle(NULL),
- _p_vlcvideo(NULL)
+ _p_vlcaudio(new VLCAudio(p_instance)),
+ _p_vlcinput(new VLCInput(p_instance)),
+ _p_vlcplaylist(new VLCPlaylist(p_instance)),
+ _p_vlcsubtitle(new VLCSubtitle(p_instance)),
+ _p_vlcvideo(new VLCVideo(p_instance))
{
- _p_vlcaudio = new VLCAudio(p_instance);
- _p_vlcinput = new VLCInput(p_instance);
- _p_vlclog = new VLCLog(p_instance);
- _p_vlcplaylist = new VLCPlaylist(p_instance);
- _p_vlcsubtitle = new VLCSubtitle(p_instance);
- _p_vlcvideo = new VLCVideo(p_instance);
-};
+}
VLCControl2::~VLCControl2()
{
delete _p_vlcvideo;
delete _p_vlcsubtitle;
delete _p_vlcplaylist;
- delete _p_vlclog;
delete _p_vlcinput;
delete _p_vlcaudio;
if( _p_typeinfo )
STDMETHODIMP VLCControl2::get_audio(IVLCAudio** obj)
{
- if( NULL == obj )
- return E_POINTER;
-
- *obj = _p_vlcaudio;
- if( NULL != _p_vlcaudio )
- {
- _p_vlcaudio->AddRef();
- return NOERROR;
- }
- return E_OUTOFMEMORY;
-};
+ return object_get(obj,_p_vlcaudio);
+}
STDMETHODIMP VLCControl2::get_input(IVLCInput** obj)
{
- if( NULL == obj )
- return E_POINTER;
-
- *obj = _p_vlcinput;
- if( NULL != _p_vlcinput )
- {
- _p_vlcinput->AddRef();
- return NOERROR;
- }
- return E_OUTOFMEMORY;
-};
-
-STDMETHODIMP VLCControl2::get_log(IVLCLog** obj)
-{
- if( NULL == obj )
- return E_POINTER;
-
- *obj = _p_vlclog;
- if( NULL != _p_vlclog )
- {
- _p_vlclog->AddRef();
- return NOERROR;
- }
- return E_OUTOFMEMORY;
-};
+ return object_get(obj,_p_vlcinput);
+}
STDMETHODIMP VLCControl2::get_playlist(IVLCPlaylist** obj)
{
- if( NULL == obj )
- return E_POINTER;
-
- *obj = _p_vlcplaylist;
- if( NULL != _p_vlcplaylist )
- {
- _p_vlcplaylist->AddRef();
- return NOERROR;
- }
- return E_OUTOFMEMORY;
-};
+ return object_get(obj,_p_vlcplaylist);
+}
STDMETHODIMP VLCControl2::get_subtitle(IVLCSubtitle** obj)
{
- if( NULL == obj )
- return E_POINTER;
-
- *obj = _p_vlcsubtitle;
- if( NULL != _p_vlcsubtitle )
- {
- _p_vlcsubtitle->AddRef();
- return NOERROR;
- }
- return E_OUTOFMEMORY;
-};
+ return object_get(obj,_p_vlcsubtitle);
+}
STDMETHODIMP VLCControl2::get_video(IVLCVideo** obj)
{
- if( NULL == obj )
- return E_POINTER;
-
- *obj = _p_vlcvideo;
- if( NULL != _p_vlcvideo )
- {
- _p_vlcvideo->AddRef();
- return NOERROR;
- }
- return E_OUTOFMEMORY;
-};
+ return object_get(obj,_p_vlcvideo);
+}