Commit 7194c2f6 authored by Damien Fouilleul's avatar Damien Fouilleul

- activex: multiple bugfix backports from trunk

parent 2ca06f95
This diff is collapsed.
...@@ -565,38 +565,52 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc) ...@@ -565,38 +565,52 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
char *ppsz_argv[32] = { "vlc" }; char *ppsz_argv[32] = { "vlc" };
int ppsz_argc = 1; int ppsz_argc = 1;
char p_progpath[MAX_PATH];
{
TCHAR w_progpath[MAX_PATH];
DWORD len = GetModuleFileName(DllGetModule(), w_progpath, MAX_PATH);
if( len > 0 )
{
len = WideCharToMultiByte(CP_UTF8, 0, w_progpath, len, p_progpath,
sizeof(p_progpath)-1, NULL, NULL);
if( len > 0 )
{
p_progpath[len] = '\0';
ppsz_argv[0] = p_progpath;
}
}
}
ppsz_argv[ppsz_argc++] = "-vv";
HKEY h_key; HKEY h_key;
DWORD i_type, i_data = MAX_PATH + 1; char p_pluginpath[MAX_PATH];
char p_data[MAX_PATH + 1]; if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, TEXT("Software\\VideoLAN\\VLC"),
if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, "Software\\VideoLAN\\VLC",
0, KEY_READ, &h_key ) == ERROR_SUCCESS ) 0, KEY_READ, &h_key ) == ERROR_SUCCESS )
{ {
if( RegQueryValueEx( h_key, "InstallDir", 0, &i_type, DWORD i_type, i_data = MAX_PATH;
(LPBYTE)p_data, &i_data ) == ERROR_SUCCESS ) TCHAR w_pluginpath[MAX_PATH];
if( RegQueryValueEx( h_key, TEXT("InstallDir"), 0, &i_type,
(LPBYTE)w_pluginpath, &i_data ) == ERROR_SUCCESS )
{ {
if( i_type == REG_SZ ) if( i_type == REG_SZ )
{ {
strcat( p_data, "\\plugins" ); if( WideCharToMultiByte(CP_UTF8, 0, w_pluginpath, -1, p_pluginpath,
ppsz_argv[ppsz_argc++] = "--plugin-path"; sizeof(p_pluginpath)-sizeof("\\plugins")+1, NULL, NULL) )
ppsz_argv[ppsz_argc++] = p_data; {
strcat( p_pluginpath, "\\plugins" );
ppsz_argv[ppsz_argc++] = "--plugin-path";
ppsz_argv[ppsz_argc++] = p_pluginpath;
}
} }
} }
RegCloseKey( h_key ); RegCloseKey( h_key );
} }
char p_path[MAX_PATH+1];
DWORD len = GetModuleFileNameA(DllGetModule(), p_path, sizeof(p_path));
if( len > 0 )
{
p_path[len] = '\0';
ppsz_argv[0] = p_path;
}
// make sure plugin isn't affected with VLC single instance mode // make sure plugin isn't affected with VLC single instance mode
ppsz_argv[ppsz_argc++] = "--no-one-instance"; ppsz_argv[ppsz_argc++] = "--no-one-instance";
/* common settings */ /* common settings */
ppsz_argv[ppsz_argc++] = "-vv";
ppsz_argv[ppsz_argc++] = "--no-stats"; ppsz_argv[ppsz_argc++] = "--no-stats";
ppsz_argv[ppsz_argc++] = "--intf"; ppsz_argv[ppsz_argc++] = "--intf";
ppsz_argv[ppsz_argc++] = "dummy"; ppsz_argv[ppsz_argc++] = "dummy";
...@@ -822,7 +836,7 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc ...@@ -822,7 +836,7 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
** properly clipped. ** properly clipped.
*/ */
_inplacewnd = CreateWindow(_p_class->getInPlaceWndClassName(), _inplacewnd = CreateWindow(_p_class->getInPlaceWndClassName(),
"VLC Plugin In-Place Window", TEXT("VLC Plugin In-Place Window"),
WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,
clipRect.left, clipRect.left,
clipRect.top, clipRect.top,
...@@ -846,7 +860,7 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc ...@@ -846,7 +860,7 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
** is always correct relative to the viewport bounds ** is always correct relative to the viewport bounds
*/ */
_videownd = CreateWindow(_p_class->getVideoWndClassName(), _videownd = CreateWindow(_p_class->getVideoWndClassName(),
"VLC Plugin Video Window", TEXT("VLC Plugin Video Window"),
WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE, WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,
posRect.left, posRect.left,
posRect.top, posRect.top,
...@@ -947,6 +961,26 @@ void VLCPlugin::setVolume(int volume) ...@@ -947,6 +961,26 @@ void VLCPlugin::setVolume(int volume)
} }
}; };
void VLCPlugin::setTime(int seconds)
{
if( seconds < 0 )
seconds = 0;
if( seconds != _i_time )
{
setStartTime(_i_time);
if( isRunning() )
{
libvlc_input_t *p_input = libvlc_playlist_get_input(_p_libvlc, NULL);
if( NULL != p_input )
{
libvlc_input_set_time(p_input, _i_time, NULL);
libvlc_input_free(p_input);
}
}
}
};
void VLCPlugin::setFocus(BOOL fFocus) void VLCPlugin::setFocus(BOOL fFocus)
{ {
if( fFocus ) if( fFocus )
......
...@@ -51,8 +51,8 @@ public: ...@@ -51,8 +51,8 @@ public:
REFCLSID getClassID(void) { return (REFCLSID)_classid; }; REFCLSID getClassID(void) { return (REFCLSID)_classid; };
LPCSTR getInPlaceWndClassName(void) const { return TEXT("VLC Plugin In-Place"); }; LPCTSTR getInPlaceWndClassName(void) const { return TEXT("VLC Plugin In-Place"); };
LPCSTR getVideoWndClassName(void) const { return TEXT("VLC Plugin Video"); }; LPCTSTR getVideoWndClassName(void) const { return TEXT("VLC Plugin Video"); };
HINSTANCE getHInstance(void) const { return _hinstance; }; HINSTANCE getHInstance(void) const { return _hinstance; };
LPPICTURE getInPlacePict(void) const LPPICTURE getInPlacePict(void) const
{ if( NULL != _inplace_picture) _inplace_picture->AddRef(); return _inplace_picture; }; { if( NULL != _inplace_picture) _inplace_picture->AddRef(); return _inplace_picture; };
...@@ -127,6 +127,9 @@ public: ...@@ -127,6 +127,9 @@ public:
}; };
inline int getStartTime(void) { return _i_time; }; inline int getStartTime(void) { return _i_time; };
void setTime(int time);
int getTime(void) { return _i_time; };
void setBaseURL(BSTR url) void setBaseURL(BSTR url)
{ {
SysFreeString(_bstr_baseurl); SysFreeString(_bstr_baseurl);
......
...@@ -77,28 +77,6 @@ BSTR BSTRFromCStr(UINT codePage, LPCSTR s) ...@@ -77,28 +77,6 @@ BSTR BSTRFromCStr(UINT codePage, LPCSTR s)
return NULL; return NULL;
}; };
char *CStrFromGUID(REFGUID clsid)
{
LPOLESTR oleStr;
if( FAILED(StringFromIID(clsid, &oleStr)) )
return NULL;
#ifdef OLE2ANSI
return (LPCSTR)oleStr;
#else
char *pct_CLSID = NULL;
size_t len = WideCharToMultiByte(CP_ACP, 0, oleStr, -1, NULL, 0, NULL, NULL);
if( len > 0 )
{
pct_CLSID = (char *)CoTaskMemAlloc(len);
WideCharToMultiByte(CP_ACP, 0, oleStr, -1, pct_CLSID, len, NULL, NULL);
}
CoTaskMemFree(oleStr);
return pct_CLSID;
#endif
};
/* /*
** properties ** properties
*/ */
......
...@@ -32,8 +32,6 @@ extern char *CStrFromWSTR(UINT codePage, LPCWSTR wstr, UINT len); ...@@ -32,8 +32,6 @@ extern char *CStrFromWSTR(UINT codePage, LPCWSTR wstr, UINT len);
extern char *CStrFromBSTR(UINT codePage, BSTR bstr); extern char *CStrFromBSTR(UINT codePage, BSTR bstr);
extern BSTR BSTRFromCStr(UINT codePage, LPCSTR s); extern BSTR BSTRFromCStr(UINT codePage, LPCSTR s);
extern char *CStrFromGUID(REFGUID clsid);
// properties // properties
extern HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v); extern HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v);
...@@ -48,7 +46,7 @@ extern LPWSTR CombineURL(LPCWSTR baseUrl, LPCWSTR url); ...@@ -48,7 +46,7 @@ extern LPWSTR CombineURL(LPCWSTR baseUrl, LPCWSTR url);
/**************************************************************************************************/ /**************************************************************************************************/
/* this function object is used to dereference the iterator into a value */ /* this function object is used to dereference the iterator into a value */
template <class T, class Iterator> template <typename T, class Iterator>
struct VLCDereference struct VLCDereference
{ {
T operator()(const Iterator& i) const T operator()(const Iterator& i) const
...@@ -57,7 +55,7 @@ struct VLCDereference ...@@ -57,7 +55,7 @@ struct VLCDereference
}; };
}; };
template<REFIID EnumeratorIID, class Enumerator, class T, class Iterator, typename Dereference = VLCDereference<T, Iterator> > template<REFIID EnumeratorIID, class Enumerator, typename T, class Iterator, typename Dereference = VLCDereference<T, Iterator> >
class VLCEnumIterator : public Enumerator class VLCEnumIterator : public Enumerator
{ {
......
...@@ -228,31 +228,16 @@ STDMETHODIMP VLCControl::get_Time(int *seconds) ...@@ -228,31 +228,16 @@ STDMETHODIMP VLCControl::get_Time(int *seconds)
} }
} }
else else
*seconds = _p_instance->getStartTime(); *seconds = _p_instance->getTime();
return result; return result;
}; };
STDMETHODIMP VLCControl::put_Time(int seconds) STDMETHODIMP VLCControl::put_Time(int seconds)
{ {
if( seconds < 0 ) _p_instance->setTime(seconds);
seconds = 0;
HRESULT result = NOERROR; return NOERROR;
if( _p_instance->isRunning() )
{
int i_vlc;
result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{
VLC_TimeSet(i_vlc, seconds, VLC_FALSE);
}
}
else if( seconds != _p_instance->getStartTime() )
{
_p_instance->setStartTime(seconds);
}
return result;
}; };
STDMETHODIMP VLCControl::shuttle(int seconds) STDMETHODIMP VLCControl::shuttle(int seconds)
...@@ -561,6 +546,92 @@ void VLCControl::FreeTargetOptions(char **cOptions, int cOptionCount) ...@@ -561,6 +546,92 @@ void VLCControl::FreeTargetOptions(char **cOptions, int cOptionCount)
} }
}; };
static HRESULT parseStringOptions(int codePage, BSTR bstr, char*** cOptions, int *cOptionCount)
{
HRESULT hr = E_INVALIDARG;
if( SysStringLen(bstr) > 0 )
{
hr = E_OUTOFMEMORY;
char *s = CStrFromBSTR(codePage, bstr);
char *val = s;
if( val )
{
long capacity = 16;
char **options = (char **)CoTaskMemAlloc(capacity*sizeof(char *));
if( options )
{
int nOptions = 0;
char *end = val + strlen(val);
while( val < end )
{
// skip leading blanks
while( (val < end)
&& ((*val == ' ' ) || (*val == '\t')) )
++val;
char *start = val;
// skip till we get a blank character
while( (val < end)
&& (*val != ' ' )
&& (*val != '\t') )
{
char c = *(val++);
if( ('\'' == c) || ('"' == c) )
{
// skip till end of string
while( (val < end) && (*(val++) != c ) );
}
}
if( val > start )
{
if( nOptions == capacity )
{
capacity += 16;
char **moreOptions = (char **)CoTaskMemRealloc(options, capacity*sizeof(char*));
if( ! moreOptions )
{
/* failed to allocate more memory */
CoTaskMemFree(s);
/* return what we got so far */
*cOptionCount = nOptions;
*cOptions = options;
return NOERROR;
}
options = moreOptions;
}
*(val++) = '\0';
options[nOptions] = (char *)CoTaskMemAlloc(val-start);
if( options[nOptions] )
{
memcpy(options[nOptions], start, val-start);
++nOptions;
}
else
{
/* failed to allocate memory */
CoTaskMemFree(s);
/* return what we got so far */
*cOptionCount = nOptions;
*cOptions = options;
return NOERROR;
}
}
else
// must be end of string
break;
}
*cOptionCount = nOptions;
*cOptions = options;
hr = NOERROR;
}
CoTaskMemFree(s);
}
}
return hr;
}
HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char ***cOptions, int *cOptionCount) HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char ***cOptions, int *cOptionCount)
{ {
HRESULT hr = E_INVALIDARG; HRESULT hr = E_INVALIDARG;
...@@ -583,7 +654,7 @@ HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char *** ...@@ -583,7 +654,7 @@ HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char ***
} }
else if( VT_DISPATCH == V_VT(options) ) else if( VT_DISPATCH == V_VT(options) )
{ {
// collection parameter // if object is a collection, retrieve enumerator
VARIANT colEnum; VARIANT colEnum;
V_VT(&colEnum) = VT_UNKNOWN; V_VT(&colEnum) = VT_UNKNOWN;
hr = GetObjectProperty(V_DISPATCH(options), DISPID_NEWENUM, colEnum); hr = GetObjectProperty(V_DISPATCH(options), DISPID_NEWENUM, colEnum);
...@@ -645,6 +716,18 @@ HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char *** ...@@ -645,6 +716,18 @@ HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char ***
enumVar->Release(); enumVar->Release();
} }
} }
else
{
// coerce object into a string and parse it
VARIANT v_name;
VariantInit(&v_name);
hr = VariantChangeType(&v_name, options, 0, VT_BSTR);
if( SUCCEEDED(hr) )
{
hr = parseStringOptions(codePage, V_BSTR(&v_name), cOptions, cOptionCount);
VariantClear(&v_name);
}
}
} }
else if( V_ISARRAY(options) ) else if( V_ISARRAY(options) )
{ {
...@@ -741,6 +824,22 @@ HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char *** ...@@ -741,6 +824,22 @@ HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char ***
return NOERROR; return NOERROR;
} }
} }
else if( VT_UNKNOWN == V_VT(options) )
{
// coerce object into a string and parse it
VARIANT v_name;
VariantInit(&v_name);
hr = VariantChangeType(&v_name, options, 0, VT_BSTR);
if( SUCCEEDED(hr) )
{
hr = parseStringOptions(codePage, V_BSTR(&v_name), cOptions, cOptionCount);
VariantClear(&v_name);
}
}
else if( VT_BSTR == V_VT(options) )
{
hr = parseStringOptions(codePage, V_BSTR(options), cOptions, cOptionCount);
}
return hr; return hr;
}; };
...@@ -861,6 +960,7 @@ STDMETHODIMP VLCControl::get_VersionInfo(BSTR *version) ...@@ -861,6 +960,7 @@ STDMETHODIMP VLCControl::get_VersionInfo(BSTR *version)
if( NULL != versionStr ) if( NULL != versionStr )
{ {
*version = BSTRFromCStr(CP_UTF8, versionStr); *version = BSTRFromCStr(CP_UTF8, versionStr);
return NULL == *version ? E_OUTOFMEMORY : NOERROR; return NULL == *version ? E_OUTOFMEMORY : NOERROR;
} }
*version = NULL; *version = NULL;
......
...@@ -87,7 +87,7 @@ STDMETHODIMP VLCAudio::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo) ...@@ -87,7 +87,7 @@ STDMETHODIMP VLCAudio::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCAudio::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, STDMETHODIMP VLCAudio::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID) UINT cNames, LCID lcid, DISPID* rgDispID)
{ {
if( SUCCEEDED(loadTypeInfo()) ) if( SUCCEEDED(loadTypeInfo()) )
...@@ -190,7 +190,8 @@ STDMETHODIMP VLCAudio::put_volume(long volume) ...@@ -190,7 +190,8 @@ STDMETHODIMP VLCAudio::put_volume(long volume)
libvlc_audio_set_volume(p_libvlc, volume, &ex); libvlc_audio_set_volume(p_libvlc, volume, &ex);
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
{ {
_p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex)); _p_instance->setErrorInfo(IID_IVLCAudio,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex); libvlc_exception_clear(&ex);
return E_FAIL; return E_FAIL;
} }
...@@ -216,7 +217,8 @@ STDMETHODIMP VLCAudio::get_track(long* track) ...@@ -216,7 +217,8 @@ STDMETHODIMP VLCAudio::get_track(long* track)
libvlc_input_free(p_input); libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
{ {
_p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex)); _p_instance->setErrorInfo(IID_IVLCAudio,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex); libvlc_exception_clear(&ex);
return E_FAIL; return E_FAIL;
} }
...@@ -239,7 +241,8 @@ STDMETHODIMP VLCAudio::put_track(long track) ...@@ -239,7 +241,8 @@ STDMETHODIMP VLCAudio::put_track(long track)
libvlc_input_free(p_input); libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
{ {
_p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex)); _p_instance->setErrorInfo(IID_IVLCAudio,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex); libvlc_exception_clear(&ex);
return E_FAIL; return E_FAIL;
} }
...@@ -268,7 +271,7 @@ STDMETHODIMP VLCAudio::get_channel(long *channel) ...@@ -268,7 +271,7 @@ STDMETHODIMP VLCAudio::get_channel(long *channel)
libvlc_exception_clear(&ex); libvlc_exception_clear(&ex);
return E_FAIL; return E_FAIL;
} }
return NOERROR; return NOERROR;
} }
return hr; return hr;
}; };
...@@ -297,7 +300,7 @@ STDMETHODIMP VLCAudio::put_channel(long channel) ...@@ -297,7 +300,7 @@ STDMETHODIMP VLCAudio::put_channel(long channel)
STDMETHODIMP VLCAudio::toggleMute() STDMETHODIMP VLCAudio::toggleMute()
{ {
libvlc_instance_t* p_libvlc = NULL; libvlc_instance_t* p_libvlc;
HRESULT hr = _p_instance->getVLC(&p_libvlc); HRESULT hr = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
...@@ -307,8 +310,8 @@ STDMETHODIMP VLCAudio::toggleMute() ...@@ -307,8 +310,8 @@ STDMETHODIMP VLCAudio::toggleMute()
libvlc_audio_toggle_mute(p_libvlc, &ex); libvlc_audio_toggle_mute(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
{ {
_p_instance->setErrorInfo(IID_IVLCAudio, _p_instance->setErrorInfo(IID_IVLCAudio,
libvlc_exception_get_message(&ex)); libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex); libvlc_exception_clear(&ex);
return E_FAIL; return E_FAIL;
} }
...@@ -374,7 +377,7 @@ STDMETHODIMP VLCInput::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo) ...@@ -374,7 +377,7 @@ STDMETHODIMP VLCInput::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCInput::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, STDMETHODIMP VLCInput::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID) UINT cNames, LCID lcid, DISPID* rgDispID)
{ {
if( SUCCEEDED(loadTypeInfo()) ) if( SUCCEEDED(loadTypeInfo()) )
...@@ -740,7 +743,7 @@ STDMETHODIMP VLCLog::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo) ...@@ -740,7 +743,7 @@ STDMETHODIMP VLCLog::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCLog::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, STDMETHODIMP VLCLog::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID) UINT cNames, LCID lcid, DISPID* rgDispID)
{ {
if( SUCCEEDED(loadTypeInfo()) ) if( SUCCEEDED(loadTypeInfo()) )
...@@ -855,6 +858,89 @@ STDMETHODIMP VLCLog::put_verbosity(long verbosity) ...@@ -855,6 +858,89 @@ STDMETHODIMP VLCLog::put_verbosity(long verbosity)
/*******************************************************************************/ /*******************************************************************************/
/* 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() VLCMessages::~VLCMessages()
{ {
if( _p_typeinfo ) if( _p_typeinfo )
...@@ -910,7 +996,7 @@ STDMETHODIMP VLCMessages::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInf ...@@ -910,7 +996,7 @@ STDMETHODIMP VLCMessages::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInf
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCMessages::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, STDMETHODIMP VLCMessages::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID) UINT cNames, LCID lcid, DISPID* rgDispID)
{ {
if( SUCCEEDED(loadTypeInfo()) ) if( SUCCEEDED(loadTypeInfo()) )
...@@ -937,9 +1023,16 @@ STDMETHODIMP VLCMessages::get__NewEnum(LPUNKNOWN* _NewEnum) ...@@ -937,9 +1023,16 @@ STDMETHODIMP VLCMessages::get__NewEnum(LPUNKNOWN* _NewEnum)
if( NULL == _NewEnum ) if( NULL == _NewEnum )
return E_POINTER; return E_POINTER;
// TODO IVLCMessageIterator* iter = NULL;
*_NewEnum = NULL; iterator(&iter);
return E_NOTIMPL;
*_NewEnum= new VLCEnumIterator<IID_IEnumVARIANT,
IEnumVARIANT,
VARIANT,
VLCMessageSTLIterator>
(VLCMessageSTLIterator(iter), VLCMessageSTLIterator(NULL));
return *_NewEnum ? S_OK : E_OUTOFMEMORY;
}; };
STDMETHODIMP VLCMessages::clear() STDMETHODIMP VLCMessages::clear()
...@@ -1069,7 +1162,7 @@ STDMETHODIMP VLCMessageIterator::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ...@@ -1069,7 +1162,7 @@ STDMETHODIMP VLCMessageIterator::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO*
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCMessageIterator::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, STDMETHODIMP VLCMessageIterator::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID) UINT cNames, LCID lcid, DISPID* rgDispID)
{ {
if( SUCCEEDED(loadTypeInfo()) ) if( SUCCEEDED(loadTypeInfo()) )
...@@ -1200,7 +1293,7 @@ STDMETHODIMP VLCMessage::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo ...@@ -1200,7 +1293,7 @@ STDMETHODIMP VLCMessage::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCMessage::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, STDMETHODIMP VLCMessage::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID) UINT cNames, LCID lcid, DISPID* rgDispID)
{ {
if( SUCCEEDED(loadTypeInfo()) ) if( SUCCEEDED(loadTypeInfo()) )
...@@ -1360,7 +1453,7 @@ STDMETHODIMP VLCPlaylistItems::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* p ...@@ -1360,7 +1453,7 @@ STDMETHODIMP VLCPlaylistItems::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* p
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCPlaylistItems::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, STDMETHODIMP VLCPlaylistItems::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID) UINT cNames, LCID lcid, DISPID* rgDispID)
{ {
if( SUCCEEDED(loadTypeInfo()) ) if( SUCCEEDED(loadTypeInfo()) )
...@@ -1509,7 +1602,7 @@ STDMETHODIMP VLCPlaylist::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInf ...@@ -1509,7 +1602,7 @@ STDMETHODIMP VLCPlaylist::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInf
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCPlaylist::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, STDMETHODIMP VLCPlaylist::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID) UINT cNames, LCID lcid, DISPID* rgDispID)
{ {
if( SUCCEEDED(loadTypeInfo()) ) if( SUCCEEDED(loadTypeInfo()) )
...@@ -1648,11 +1741,11 @@ STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* ite ...@@ -1648,11 +1741,11 @@ STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* ite
} }
*item = libvlc_playlist_add_extended(p_libvlc, *item = libvlc_playlist_add_extended(p_libvlc,
psz_uri, psz_uri,
psz_name, psz_name,
i_options, i_options,
const_cast<const char **>(ppsz_options), const_cast<const char **>(ppsz_options),
&ex); &ex);
VLCControl::FreeTargetOptions(ppsz_options, i_options); VLCControl::FreeTargetOptions(ppsz_options, i_options);
CoTaskMemFree(psz_uri); CoTaskMemFree(psz_uri);
...@@ -1915,7 +2008,7 @@ STDMETHODIMP VLCVideo::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo) ...@@ -1915,7 +2008,7 @@ STDMETHODIMP VLCVideo::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCVideo::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, STDMETHODIMP VLCVideo::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID) UINT cNames, LCID lcid, DISPID* rgDispID)
{ {
if( SUCCEEDED(loadTypeInfo()) ) if( SUCCEEDED(loadTypeInfo()) )
...@@ -2100,16 +2193,17 @@ STDMETHODIMP VLCVideo::put_aspectRatio(BSTR aspect) ...@@ -2100,16 +2193,17 @@ STDMETHODIMP VLCVideo::put_aspectRatio(BSTR aspect)
HRESULT hr = _p_instance->getVLC(&p_libvlc); HRESULT hr = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
char *psz_aspect = NULL;
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
libvlc_input_t *p_input = libvlc_playlist_get_input(p_libvlc, &ex); libvlc_input_t *p_input = libvlc_playlist_get_input(p_libvlc, &ex);
if( ! libvlc_exception_raised(&ex) ) if( ! libvlc_exception_raised(&ex) )
{ {
psz_aspect = CStrFromBSTR(CP_UTF8, aspect); char *psz_aspect = CStrFromBSTR(CP_UTF8, aspect);
if( NULL == psz_aspect ) if( NULL == psz_aspect )
{
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
libvlc_video_set_aspect_ratio(p_input, psz_aspect, &ex); libvlc_video_set_aspect_ratio(p_input, psz_aspect, &ex);
...@@ -2127,7 +2221,7 @@ STDMETHODIMP VLCVideo::put_aspectRatio(BSTR aspect) ...@@ -2127,7 +2221,7 @@ STDMETHODIMP VLCVideo::put_aspectRatio(BSTR aspect)
} }
return hr; return hr;
}; };
STDMETHODIMP VLCVideo::get_subtitle(long* spu) STDMETHODIMP VLCVideo::get_subtitle(long* spu)
{ {
if( NULL == spu ) if( NULL == spu )
...@@ -2283,7 +2377,7 @@ STDMETHODIMP VLCControl2::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInf ...@@ -2283,7 +2377,7 @@ STDMETHODIMP VLCControl2::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInf
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCControl2::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, STDMETHODIMP VLCControl2::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID) UINT cNames, LCID lcid, DISPID* rgDispID)
{ {
if( SUCCEEDED(loadTypeInfo()) ) if( SUCCEEDED(loadTypeInfo()) )
......
...@@ -5080,7 +5080,7 @@ then ...@@ -5080,7 +5080,7 @@ then
fi fi
AC_LANG_PUSH(C++) AC_LANG_PUSH(C++)
AC_CHECK_HEADERS(ole2.h olectl.h, AC_CHECK_HEADERS(ole2.h olectl.h,
[ VLC_ADD_CPPFLAGS([activex],[-D_MIDL_USE_GUIDDEF_]) [ VLC_ADD_CPPFLAGS([activex],[-DUNICODE -D_UNICODE -D_MIDL_USE_GUIDDEF_])
VLC_ADD_CXXFLAGS([activex],[-fno-exceptions]) VLC_ADD_CXXFLAGS([activex],[-fno-exceptions])
VLC_ADD_LDFLAGS([activex],[-lole32 -loleaut32 -luuid -lshlwapi]) VLC_ADD_LDFLAGS([activex],[-lole32 -loleaut32 -luuid -lshlwapi])
AC_CHECK_HEADERS(objsafe.h, AC_CHECK_HEADERS(objsafe.h,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment