Commit 4d89b290 authored by Jean-Paul Saman's avatar Jean-Paul Saman

activex: remove libvlc_exceptions and adapt to recent libvlc changes

The libvlc_exceptions have been removed from libvlc.
The libvlc audio functions prototypes have changed.
parent 2f58aad4
/***************************************************************************** /*****************************************************************************
* plugin.cpp: ActiveX control for VLC * plugin.cpp: ActiveX control for VLC
***************************************************************************** *****************************************************************************
* Copyright (C) 2006 the VideoLAN team * Copyright (C) 2006-2010 the VideoLAN team
* *
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net> * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -47,6 +48,7 @@ ...@@ -47,6 +48,7 @@
#include <servprov.h> #include <servprov.h>
#include <shlwapi.h> #include <shlwapi.h>
#include <wininet.h> #include <wininet.h>
#include <assert.h>
using namespace std; using namespace std;
...@@ -418,7 +420,6 @@ HRESULT VLCPlugin::onLoad(void) ...@@ -418,7 +420,6 @@ HRESULT VLCPlugin::onLoad(void)
return S_OK; return S_OK;
}; };
void VLCPlugin::initVLC() void VLCPlugin::initVLC()
{ {
extern HMODULE DllGetModule(); extern HMODULE DllGetModule();
...@@ -486,22 +487,12 @@ void VLCPlugin::initVLC() ...@@ -486,22 +487,12 @@ void VLCPlugin::initVLC()
if( _b_autoloop ) if( _b_autoloop )
ppsz_argv[ppsz_argc++] = "--loop"; ppsz_argv[ppsz_argc++] = "--loop";
libvlc_exception_t ex; _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv);
libvlc_exception_init(&ex); if( !_p_libvlc )
_p_libvlc = libvlc_new(ppsz_argc, ppsz_argv, &ex);
if( libvlc_exception_raised(&ex) )
return; return;
_p_mlist = libvlc_media_list_new(_p_libvlc); _p_mlist = libvlc_media_list_new(_p_libvlc);
// initial volume setting
libvlc_audio_set_volume(_p_libvlc, _i_volume, NULL);
if( _b_mute )
{
libvlc_audio_set_mute(_p_libvlc, TRUE);
}
// initial playlist item // initial playlist item
if( SysStringLen(_bstr_mrl) > 0 ) if( SysStringLen(_bstr_mrl) > 0 )
{ {
...@@ -542,7 +533,7 @@ void VLCPlugin::initVLC() ...@@ -542,7 +533,7 @@ void VLCPlugin::initVLC()
options[i_options++] = timeBuffer; options[i_options++] = timeBuffer;
} }
// add default target to playlist // add default target to playlist
playlist_add_extended_untrusted(psz_mrl, i_options, options, NULL); playlist_add_extended_untrusted(psz_mrl, i_options, options);
CoTaskMemFree(psz_mrl); CoTaskMemFree(psz_mrl);
} }
} }
...@@ -668,8 +659,6 @@ BOOL VLCPlugin::isInPlaceActive(void) ...@@ -668,8 +659,6 @@ BOOL VLCPlugin::isInPlaceActive(void)
HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect) HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect)
{ {
RECT clipRect = *lprcClipRect; RECT clipRect = *lprcClipRect;
libvlc_exception_t ex;
libvlc_exception_init(&ex);
/* /*
** record keeping of control geometry within container ** record keeping of control geometry within container
...@@ -714,9 +703,9 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc ...@@ -714,9 +703,9 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
if( FAILED(result) ) if( FAILED(result) )
return result; return result;
if( _b_autoplay && playlist_select(0,NULL) ) if( _b_autoplay && playlist_select(0) )
{ {
libvlc_media_player_play(_p_mplayer,NULL); libvlc_media_player_play(_p_mplayer);
fireOnPlayEvent(); fireOnPlayEvent();
} }
} }
...@@ -729,9 +718,9 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc ...@@ -729,9 +718,9 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
HRESULT VLCPlugin::onInPlaceDeactivate(void) HRESULT VLCPlugin::onInPlaceDeactivate(void)
{ {
if( isPlaying(NULL) ) if( isPlaying() )
{ {
playlist_stop(NULL); playlist_stop();
fireOnStopEvent(); fireOnStopEvent();
} }
...@@ -769,7 +758,10 @@ void VLCPlugin::setVolume(int volume) ...@@ -769,7 +758,10 @@ void VLCPlugin::setVolume(int volume)
_i_volume = volume; _i_volume = volume;
if( isRunning() ) if( isRunning() )
{ {
libvlc_audio_set_volume(_p_libvlc, _i_volume, NULL); libvlc_media_player_t *p_md;
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
libvlc_audio_set_volume(p_md, _i_volume);
} }
setDirty(TRUE); setDirty(TRUE);
} }
...@@ -798,7 +790,7 @@ void VLCPlugin::setTime(int seconds) ...@@ -798,7 +790,7 @@ void VLCPlugin::setTime(int seconds)
setStartTime(_i_time); setStartTime(_i_time);
if( NULL != _p_mplayer ) if( NULL != _p_mplayer )
{ {
libvlc_media_player_set_time(_p_mplayer, _i_time, NULL); libvlc_media_player_set_time(_p_mplayer, _i_time);
} }
} }
}; };
...@@ -1004,25 +996,24 @@ void VLCPlugin::fireOnStopEvent(void) ...@@ -1004,25 +996,24 @@ void VLCPlugin::fireOnStopEvent(void)
vlcConnectionPointContainer->fireEvent(DISPID_StopEvent, &dispparamsNoArgs); vlcConnectionPointContainer->fireEvent(DISPID_StopEvent, &dispparamsNoArgs);
}; };
bool VLCPlugin::playlist_select( int idx, libvlc_exception_t *ex ) bool VLCPlugin::playlist_select( int idx )
{ {
libvlc_media_t *p_m = NULL; libvlc_media_t *p_m = NULL;
assert(_p_mlist);
libvlc_media_list_lock(_p_mlist); libvlc_media_list_lock(_p_mlist);
int count = libvlc_media_list_count(_p_mlist); int count = libvlc_media_list_count(_p_mlist);
if( libvlc_exception_raised(ex) )
goto bad_unlock;
if( idx<0||idx>=count ) if( (idx < 0) || (idx >= count) )
goto bad_unlock; goto bad_unlock;
_i_midx = idx; _i_midx = idx;
p_m = libvlc_media_list_item_at_index(_p_mlist,_i_midx,ex); p_m = libvlc_media_list_item_at_index(_p_mlist,_i_midx);
libvlc_media_list_unlock(_p_mlist); libvlc_media_list_unlock(_p_mlist);
if( !p_m )
if( libvlc_exception_raised(ex) )
return false; return false;
if( _p_mplayer ) if( _p_mplayer )
...@@ -1031,37 +1022,42 @@ bool VLCPlugin::playlist_select( int idx, libvlc_exception_t *ex ) ...@@ -1031,37 +1022,42 @@ bool VLCPlugin::playlist_select( int idx, libvlc_exception_t *ex )
_p_mplayer = NULL; _p_mplayer = NULL;
} }
_p_mplayer = libvlc_media_player_new_from_media(p_m,ex); _p_mplayer = libvlc_media_player_new_from_media(p_m);
if( _p_mplayer ) if( _p_mplayer )
set_player_window(ex); {
// initial volume setting
libvlc_audio_set_volume(_p_mplayer, _i_volume);
if( _b_mute )
libvlc_audio_set_mute(_p_mplayer, TRUE);
set_player_window();
}
libvlc_media_release( p_m ); libvlc_media_release(p_m);
return !libvlc_exception_raised(ex); return _p_mplayer ? true : false;
bad_unlock: bad_unlock:
libvlc_media_list_unlock(_p_mlist); libvlc_media_list_unlock(_p_mlist);
return false; return false;
} }
void VLCPlugin::set_player_window(libvlc_exception_t *ex) void VLCPlugin::set_player_window()
{ {
// XXX FIXME no idea if this is correct or not // XXX FIXME no idea if this is correct or not
libvlc_media_player_set_hwnd(_p_mplayer,getInPlaceWindow()); libvlc_media_player_set_hwnd(_p_mplayer,getInPlaceWindow());
} }
int VLCPlugin::playlist_add_extended_untrusted(const char *mrl, int optc, const char **optv, libvlc_exception_t *ex) int VLCPlugin::playlist_add_extended_untrusted(const char *mrl, int optc, const char **optv)
{ {
int item = -1; int item = -1;
libvlc_media_t *p_m = libvlc_media_new(_p_libvlc,mrl,ex); libvlc_media_t *p_m = libvlc_media_new(_p_libvlc,mrl);
if( libvlc_exception_raised(ex) ) if( !p_m )
return -1; return -1;
for( int i = 0; i < optc; ++i ) for( int i = 0; i < optc; ++i )
libvlc_media_add_option_flag(p_m, optv[i], libvlc_media_option_unique); libvlc_media_add_option_flag(p_m, optv[i], libvlc_media_option_unique);
libvlc_media_list_lock(_p_mlist); libvlc_media_list_lock(_p_mlist);
libvlc_media_list_add_media(_p_mlist,p_m,ex); if( libvlc_media_list_add_media(_p_mlist,p_m) == 0 )
if( !libvlc_exception_raised(ex) )
item = libvlc_media_list_count(_p_mlist)-1; item = libvlc_media_list_count(_p_mlist)-1;
libvlc_media_list_unlock(_p_mlist); libvlc_media_list_unlock(_p_mlist);
libvlc_media_release(p_m); libvlc_media_release(p_m);
......
/***************************************************************************** /*****************************************************************************
* plugin.h: ActiveX control for VLC * plugin.h: ActiveX control for VLC
***************************************************************************** *****************************************************************************
* Copyright (C) 2005 the VideoLAN team * Copyright (C) 2005-2010 the VideoLAN team
* *
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net> * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -199,12 +200,12 @@ public: ...@@ -199,12 +200,12 @@ public:
if( !isRunning() ) if( !isRunning() )
initVLC(); initVLC();
*pp_libvlc = _p_libvlc; *pp_libvlc = _p_libvlc;
return _p_libvlc?S_OK:E_FAIL; return _p_libvlc ? S_OK : E_FAIL;
} }
HRESULT getMD(libvlc_media_player_t **pp_md) HRESULT getMD(libvlc_media_player_t **pp_md)
{ {
*pp_md = _p_mplayer; *pp_md = _p_mplayer;
return _p_mplayer?S_OK:E_FAIL; return _p_mplayer ? S_OK : E_FAIL;
} }
void setErrorInfo(REFIID riid, const char *description); void setErrorInfo(REFIID riid, const char *description);
...@@ -243,18 +244,18 @@ public: ...@@ -243,18 +244,18 @@ public:
/* /*
** libvlc interface ** libvlc interface
*/ */
bool isPlaying(libvlc_exception_t *ex) bool isPlaying()
{ {
return _p_mplayer && libvlc_media_player_is_playing(_p_mplayer); return _p_mplayer && libvlc_media_player_is_playing(_p_mplayer);
} }
int playlist_get_current_index(libvlc_exception_t *) { return _i_midx; } int playlist_get_current_index() { return _i_midx; }
int playlist_add_extended_untrusted(const char *, int, const char **, libvlc_exception_t *); int playlist_add_extended_untrusted(const char *, int, const char **);
void playlist_delete_item(int idx, libvlc_exception_t *ex) void playlist_delete_item(int idx)
{ {
if( _p_mlist ) if( _p_mlist )
libvlc_media_list_remove_index(_p_mlist,idx,ex); libvlc_media_list_remove_index(_p_mlist,idx);
} }
void playlist_clear(libvlc_exception_t *ex) void playlist_clear()
{ {
if( !_p_libvlc ) if( !_p_libvlc )
return; return;
...@@ -262,7 +263,7 @@ public: ...@@ -262,7 +263,7 @@ public:
libvlc_media_list_release(_p_mlist); libvlc_media_list_release(_p_mlist);
_p_mlist = libvlc_media_list_new(_p_libvlc); _p_mlist = libvlc_media_list_new(_p_libvlc);
} }
int playlist_count(libvlc_exception_t *ex) int playlist_count()
{ {
int r = 0; int r = 0;
if( !_p_mlist ) if( !_p_mlist )
...@@ -272,39 +273,39 @@ public: ...@@ -272,39 +273,39 @@ public:
libvlc_media_list_unlock(_p_mlist); libvlc_media_list_unlock(_p_mlist);
return r; return r;
} }
void playlist_pause(libvlc_exception_t *ex) void playlist_pause()
{ {
if( isPlaying(ex) ) if( isPlaying() )
libvlc_media_player_pause(_p_mplayer,ex); libvlc_media_player_pause(_p_mplayer);
} }
void playlist_play(libvlc_exception_t *ex) void playlist_play()
{ {
if( !_p_libvlc ) if( !_p_libvlc )
initVLC(); initVLC();
if( _p_mplayer||playlist_select(0,ex) ) if( _p_mplayer || playlist_select(0) )
libvlc_media_player_play(_p_mplayer,ex); libvlc_media_player_play(_p_mplayer);
} }
void playlist_play_item(int idx,libvlc_exception_t *ex) void playlist_play_item(int idx)
{ {
if( !_p_libvlc ) if( !_p_libvlc )
initVLC(); initVLC();
if( playlist_select(idx,ex) ) if( playlist_select(idx) )
libvlc_media_player_play(_p_mplayer,ex); libvlc_media_player_play(_p_mplayer);
} }
void playlist_stop(libvlc_exception_t *ex) void playlist_stop()
{ {
if( _p_mplayer ) if( _p_mplayer )
libvlc_media_player_stop(_p_mplayer); libvlc_media_player_stop(_p_mplayer);
} }
void playlist_next(libvlc_exception_t *ex) void playlist_next()
{ {
if( playlist_select( _i_midx+1, ex) ) if( playlist_select( _i_midx+1 ) )
libvlc_media_player_play(_p_mplayer,ex); libvlc_media_player_play(_p_mplayer);
} }
void playlist_prev(libvlc_exception_t *ex) void playlist_prev()
{ {
if( playlist_select( _i_midx-1, ex) ) if( playlist_select( _i_midx-1 ) )
libvlc_media_player_play(_p_mplayer,ex); libvlc_media_player_play(_p_mplayer);
} }
protected: protected:
...@@ -313,8 +314,8 @@ protected: ...@@ -313,8 +314,8 @@ protected:
private: private:
void initVLC(); void initVLC();
bool playlist_select(int i,libvlc_exception_t *); bool playlist_select(int i);
void set_player_window(libvlc_exception_t *); void set_player_window();
//implemented interfaces //implemented interfaces
class VLCOleObject *vlcOleObject; class VLCOleObject *vlcOleObject;
......
/***************************************************************************** /*****************************************************************************
* vlccontrol.cpp: ActiveX control for VLC * vlccontrol.cpp: ActiveX control for VLC
***************************************************************************** *****************************************************************************
* Copyright (C) 2005 the VideoLAN team * Copyright (C) 2005-2010 the VideoLAN team
* *
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net> * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
* Jean-Paul Saman <jpsaman@videolan.org> * Jean-Paul Saman <jpsaman@videolan.org>
...@@ -112,26 +112,21 @@ STDMETHODIMP VLCControl::get_Visible(VARIANT_BOOL *isVisible) ...@@ -112,26 +112,21 @@ STDMETHODIMP VLCControl::get_Visible(VARIANT_BOOL *isVisible)
*isVisible = _p_instance->getVisible() ? VARIANT_TRUE : VARIANT_FALSE; *isVisible = _p_instance->getVisible() ? VARIANT_TRUE : VARIANT_FALSE;
return NOERROR; return S_OK;
}; };
STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible) STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible)
{ {
_p_instance->setVisible(isVisible != VARIANT_FALSE); _p_instance->setVisible(isVisible != VARIANT_FALSE);
return NOERROR; return S_OK;
}; };
STDMETHODIMP VLCControl::play(void) STDMETHODIMP VLCControl::play(void)
{ {
libvlc_exception_t ex; _p_instance->playlist_play();
libvlc_exception_init(&ex);
_p_instance->playlist_play(&ex);
HRESULT result = exception_bridge(&ex);
if( SUCCEEDED(result) )
_p_instance->fireOnPlayEvent(); _p_instance->fireOnPlayEvent();
return result; return S_OK;
}; };
STDMETHODIMP VLCControl::pause(void) STDMETHODIMP VLCControl::pause(void)
...@@ -140,12 +135,7 @@ STDMETHODIMP VLCControl::pause(void) ...@@ -140,12 +135,7 @@ STDMETHODIMP VLCControl::pause(void)
HRESULT result = _p_instance->getMD(&p_md); HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
{ {
libvlc_exception_t ex; libvlc_media_player_pause(p_md);
libvlc_exception_init(&ex);
libvlc_media_player_pause(p_md, &ex);
result = exception_bridge(&ex);
if( SUCCEEDED(result) )
_p_instance->fireOnPauseEvent(); _p_instance->fireOnPauseEvent();
} }
return result; return result;
...@@ -157,12 +147,7 @@ STDMETHODIMP VLCControl::stop(void) ...@@ -157,12 +147,7 @@ STDMETHODIMP VLCControl::stop(void)
HRESULT result = _p_instance->getMD(&p_md); HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
{ {
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_media_player_stop(p_md); libvlc_media_player_stop(p_md);
result = exception_bridge(&ex);
if( SUCCEEDED(result) )
_p_instance->fireOnStopEvent(); _p_instance->fireOnStopEvent();
} }
return result; return result;
...@@ -193,11 +178,7 @@ STDMETHODIMP VLCControl::get_Position(float *position) ...@@ -193,11 +178,7 @@ STDMETHODIMP VLCControl::get_Position(float *position)
HRESULT result = _p_instance->getMD(&p_md); HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
{ {
libvlc_exception_t ex; *position = libvlc_media_player_get_position(p_md);
libvlc_exception_init(&ex);
*position = libvlc_media_player_get_position(p_md, &ex);
result = exception_bridge(&ex);
} }
return result; return result;
}; };
...@@ -208,11 +189,7 @@ STDMETHODIMP VLCControl::put_Position(float position) ...@@ -208,11 +189,7 @@ STDMETHODIMP VLCControl::put_Position(float position)
HRESULT result = _p_instance->getMD(&p_md); HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
{ {
libvlc_exception_t ex; libvlc_media_player_set_position(p_md, position);
libvlc_exception_init(&ex);
libvlc_media_player_set_position(p_md, position, &ex);
result = exception_bridge(&ex);
} }
return result; return result;
}; };
...@@ -227,11 +204,7 @@ STDMETHODIMP VLCControl::get_Time(int *seconds) ...@@ -227,11 +204,7 @@ STDMETHODIMP VLCControl::get_Time(int *seconds)
HRESULT result = _p_instance->getMD(&p_md); HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
{ {
libvlc_exception_t ex; *seconds = libvlc_media_player_get_time(p_md);
libvlc_exception_init(&ex);
*seconds = libvlc_media_player_get_time(p_md, &ex);
result = exception_bridge(&ex);
} }
return result; return result;
}; };
...@@ -240,7 +213,7 @@ STDMETHODIMP VLCControl::put_Time(int seconds) ...@@ -240,7 +213,7 @@ STDMETHODIMP VLCControl::put_Time(int seconds)
{ {
/* setTime function of the plugin sets the time. */ /* setTime function of the plugin sets the time. */
_p_instance->setTime(seconds); _p_instance->setTime(seconds);
return NOERROR; return S_OK;
}; };
STDMETHODIMP VLCControl::shuttle(int seconds) STDMETHODIMP VLCControl::shuttle(int seconds)
...@@ -249,12 +222,8 @@ STDMETHODIMP VLCControl::shuttle(int seconds) ...@@ -249,12 +222,8 @@ STDMETHODIMP VLCControl::shuttle(int seconds)
HRESULT result = _p_instance->getMD(&p_md); HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
{ {
libvlc_exception_t ex;
libvlc_exception_init(&ex);
if( seconds < 0 ) seconds = 0; if( seconds < 0 ) seconds = 0;
libvlc_media_player_set_time(p_md, (int64_t)seconds, &ex); libvlc_media_player_set_time(p_md, (int64_t)seconds);
result = exception_bridge(&ex);
} }
return result; return result;
...@@ -268,7 +237,7 @@ STDMETHODIMP VLCControl::fullscreen(void) ...@@ -268,7 +237,7 @@ STDMETHODIMP VLCControl::fullscreen(void)
{ {
if( libvlc_media_player_is_playing(p_md) ) if( libvlc_media_player_is_playing(p_md) )
{ {
libvlc_toggle_fullscreen(p_md, NULL); libvlc_toggle_fullscreen(p_md);
} }
} }
return result; return result;
...@@ -284,11 +253,7 @@ STDMETHODIMP VLCControl::get_Length(int *seconds) ...@@ -284,11 +253,7 @@ STDMETHODIMP VLCControl::get_Length(int *seconds)
HRESULT result = _p_instance->getMD(&p_md); HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
{ {
libvlc_exception_t ex; *seconds = (double)libvlc_media_player_get_length(p_md);
libvlc_exception_init(&ex);
*seconds = (double)libvlc_media_player_get_length(p_md, &ex);
result = exception_bridge(&ex);
} }
return result; return result;
...@@ -303,11 +268,7 @@ STDMETHODIMP VLCControl::playFaster(void) ...@@ -303,11 +268,7 @@ STDMETHODIMP VLCControl::playFaster(void)
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
{ {
libvlc_exception_t ex; libvlc_media_player_set_rate(p_md, rate);
libvlc_exception_init(&ex);
libvlc_media_player_set_rate(p_md, rate, &ex);
result = exception_bridge(&ex);
} }
return result; return result;
}; };
...@@ -320,11 +281,7 @@ STDMETHODIMP VLCControl::playSlower(void) ...@@ -320,11 +281,7 @@ STDMETHODIMP VLCControl::playSlower(void)
HRESULT result = _p_instance->getMD(&p_md); HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
{ {
libvlc_exception_t ex; libvlc_media_player_set_rate(p_md, rate);
libvlc_exception_init(&ex);
libvlc_media_player_set_rate(p_md, rate, &ex);
result = exception_bridge(&ex);
} }
return result; return result;
}; };
...@@ -335,21 +292,21 @@ STDMETHODIMP VLCControl::get_Volume(int *volume) ...@@ -335,21 +292,21 @@ STDMETHODIMP VLCControl::get_Volume(int *volume)
return E_POINTER; return E_POINTER;
*volume = _p_instance->getVolume(); *volume = _p_instance->getVolume();
return NOERROR; return S_OK;
}; };
STDMETHODIMP VLCControl::put_Volume(int volume) STDMETHODIMP VLCControl::put_Volume(int volume)
{ {
_p_instance->setVolume(volume); _p_instance->setVolume(volume);
return NOERROR; return S_OK;
}; };
STDMETHODIMP VLCControl::toggleMute(void) STDMETHODIMP VLCControl::toggleMute(void)
{ {
libvlc_instance_t* p_libvlc; libvlc_media_player_t *p_md;
HRESULT result = _p_instance->getVLC(&p_libvlc); HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
libvlc_audio_toggle_mute(p_libvlc); libvlc_audio_toggle_mute(p_md);
return result; return result;
}; };
...@@ -717,17 +674,13 @@ STDMETHODIMP VLCControl::addTarget(BSTR uri, VARIANT options, enum VLCPlaylistMo ...@@ -717,17 +674,13 @@ STDMETHODIMP VLCControl::addTarget(BSTR uri, VARIANT options, enum VLCPlaylistMo
if( FAILED(CreateTargetOptions(CP_UTF8, &options, &cOptions, &cOptionsCount)) ) if( FAILED(CreateTargetOptions(CP_UTF8, &options, &cOptions, &cOptionsCount)) )
return E_INVALIDARG; return E_INVALIDARG;
libvlc_exception_t ex;
libvlc_exception_init(&ex);
position = _p_instance->playlist_add_extended_untrusted(cUri, position = _p_instance->playlist_add_extended_untrusted(cUri,
cOptionsCount, const_cast<const char**>(cOptions), &ex); cOptionsCount, const_cast<const char**>(cOptions));
FreeTargetOptions(cOptions, cOptionsCount); FreeTargetOptions(cOptions, cOptionsCount);
CoTaskMemFree(cUri); CoTaskMemFree(cUri);
hr = exception_bridge(&ex); if( position >= 0 )
if( SUCCEEDED(hr) )
{ {
if( mode & VLCPlayListAppendAndGo ) if( mode & VLCPlayListAppendAndGo )
_p_instance->fireOnPlayEvent(); _p_instance->fireOnPlayEvent();
...@@ -751,11 +704,7 @@ STDMETHODIMP VLCControl::get_PlaylistIndex(int *index) ...@@ -751,11 +704,7 @@ STDMETHODIMP VLCControl::get_PlaylistIndex(int *index)
HRESULT result = _p_instance->getVLC(&p_libvlc); HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
{ {
libvlc_exception_t ex; *index = _p_instance->playlist_get_current_index();
libvlc_exception_init(&ex);
*index = _p_instance->playlist_get_current_index(&ex);
result = exception_bridge(&ex);
} }
return result; return result;
}; };
...@@ -765,11 +714,8 @@ STDMETHODIMP VLCControl::get_PlaylistCount(int *count) ...@@ -765,11 +714,8 @@ STDMETHODIMP VLCControl::get_PlaylistCount(int *count)
if( NULL == count ) if( NULL == count )
return E_POINTER; return E_POINTER;
libvlc_exception_t ex; *count = _p_instance->playlist_count();
libvlc_exception_init(&ex); return S_OK;
*count = _p_instance->playlist_count(&ex);
return exception_bridge(&ex);
}; };
STDMETHODIMP VLCControl::playlistNext(void) STDMETHODIMP VLCControl::playlistNext(void)
...@@ -778,11 +724,7 @@ STDMETHODIMP VLCControl::playlistNext(void) ...@@ -778,11 +724,7 @@ STDMETHODIMP VLCControl::playlistNext(void)
HRESULT result = _p_instance->getVLC(&p_libvlc); HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
{ {
libvlc_exception_t ex; _p_instance->playlist_next();
libvlc_exception_init(&ex);
_p_instance->playlist_next(&ex);
result = exception_bridge(&ex);
} }
return result; return result;
}; };
...@@ -793,11 +735,7 @@ STDMETHODIMP VLCControl::playlistPrev(void) ...@@ -793,11 +735,7 @@ STDMETHODIMP VLCControl::playlistPrev(void)
HRESULT result = _p_instance->getVLC(&p_libvlc); HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
{ {
libvlc_exception_t ex; _p_instance->playlist_prev();
libvlc_exception_init(&ex);
_p_instance->playlist_prev(&ex);
result = exception_bridge(&ex);
} }
return result; return result;
}; };
...@@ -808,11 +746,7 @@ STDMETHODIMP VLCControl::playlistClear(void) ...@@ -808,11 +746,7 @@ STDMETHODIMP VLCControl::playlistClear(void)
HRESULT result = _p_instance->getVLC(&p_libvlc); HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) ) if( SUCCEEDED(result) )
{ {
libvlc_exception_t ex; _p_instance->playlist_clear();
libvlc_exception_init(&ex);
_p_instance->playlist_clear(&ex);
result = exception_bridge(&ex);
} }
return result; return result;
}; };
...@@ -839,7 +773,7 @@ STDMETHODIMP VLCControl::get_MRL(BSTR *mrl) ...@@ -839,7 +773,7 @@ STDMETHODIMP VLCControl::get_MRL(BSTR *mrl)
*mrl = SysAllocStringLen(_p_instance->getMRL(), *mrl = SysAllocStringLen(_p_instance->getMRL(),
SysStringLen(_p_instance->getMRL())); SysStringLen(_p_instance->getMRL()));
return NOERROR; return S_OK;
}; };
STDMETHODIMP VLCControl::put_MRL(BSTR mrl) STDMETHODIMP VLCControl::put_MRL(BSTR mrl)
......
/***************************************************************************** /*****************************************************************************
* vlccontrol.h: ActiveX control for VLC * vlccontrol.h: ActiveX control for VLC
***************************************************************************** *****************************************************************************
* Copyright (C) 2005 the VideoLAN team * Copyright (C) 2005-2010 the VideoLAN team
* *
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net> * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
* *
...@@ -101,14 +101,6 @@ public: ...@@ -101,14 +101,6 @@ public:
private: private:
HRESULT getTypeInfo(); HRESULT getTypeInfo();
HRESULT exception_bridge(libvlc_exception_t *ex)
{
if( ! libvlc_exception_raised(ex) )
return NOERROR;
_p_instance->setErrorInfo(IID_IVLCControl, libvlc_errmsg());
libvlc_exception_clear(ex);
return E_FAIL;
}
VLCPlugin *_p_instance; VLCPlugin *_p_instance;
ITypeInfo *_p_typeinfo; ITypeInfo *_p_typeinfo;
......
...@@ -36,13 +36,6 @@ ...@@ -36,13 +36,6 @@
// --------- // ---------
HRESULT VLCInterfaceBase::report_exception(REFIID riid, libvlc_exception_t *ex)
{
_plug->setErrorInfo(riid,libvlc_errmsg());
libvlc_exception_clear(ex);
return E_FAIL;
}
HRESULT VLCInterfaceBase::loadTypeInfo(REFIID riid) HRESULT VLCInterfaceBase::loadTypeInfo(REFIID riid)
{ {
// if( _ti ) return NOERROR; // unnecessairy // if( _ti ) return NOERROR; // unnecessairy
...@@ -98,19 +91,19 @@ STDMETHODIMP VLCAudio::get_mute(VARIANT_BOOL* mute) ...@@ -98,19 +91,19 @@ STDMETHODIMP VLCAudio::get_mute(VARIANT_BOOL* mute)
if( NULL == mute ) if( NULL == mute )
return E_POINTER; return E_POINTER;
libvlc_instance_t* p_libvlc; libvlc_media_player_t *p_md;
HRESULT hr = getVLC(&p_libvlc); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
*mute = varbool( libvlc_audio_get_mute(p_libvlc) ); *mute = varbool( libvlc_audio_get_mute(p_md) );
return hr; return hr;
}; };
STDMETHODIMP VLCAudio::put_mute(VARIANT_BOOL mute) STDMETHODIMP VLCAudio::put_mute(VARIANT_BOOL mute)
{ {
libvlc_instance_t* p_libvlc; libvlc_media_player_t *p_md;
HRESULT hr = getVLC(&p_libvlc); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
libvlc_audio_set_mute(p_libvlc, VARIANT_FALSE != mute); libvlc_audio_set_mute(p_md, VARIANT_FALSE != mute);
return hr; return hr;
}; };
...@@ -119,24 +112,20 @@ STDMETHODIMP VLCAudio::get_volume(long* volume) ...@@ -119,24 +112,20 @@ STDMETHODIMP VLCAudio::get_volume(long* volume)
if( NULL == volume ) if( NULL == volume )
return E_POINTER; return E_POINTER;
libvlc_instance_t* p_libvlc; libvlc_media_player_t *p_md;
HRESULT hr = getVLC(&p_libvlc); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
*volume = libvlc_audio_get_volume(p_libvlc); *volume = libvlc_audio_get_volume(p_md);
return hr; return hr;
}; };
STDMETHODIMP VLCAudio::put_volume(long volume) STDMETHODIMP VLCAudio::put_volume(long volume)
{ {
libvlc_instance_t* p_libvlc; libvlc_media_player_t *p_md;
HRESULT hr = getVLC(&p_libvlc); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_audio_set_volume(p_md, volume);
libvlc_exception_init(&ex);
libvlc_audio_set_volume(p_libvlc, volume, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -150,11 +139,7 @@ STDMETHODIMP VLCAudio::get_track(long* track) ...@@ -150,11 +139,7 @@ STDMETHODIMP VLCAudio::get_track(long* track)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *track = libvlc_audio_get_track(p_md);
libvlc_exception_init(&ex);
*track = libvlc_audio_get_track(p_md, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -165,11 +150,7 @@ STDMETHODIMP VLCAudio::put_track(long track) ...@@ -165,11 +150,7 @@ STDMETHODIMP VLCAudio::put_track(long track)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_audio_set_track(p_md, track);
libvlc_exception_init(&ex);
libvlc_audio_set_track(p_md, track, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -183,11 +164,8 @@ STDMETHODIMP VLCAudio::get_count(long* trackNumber) ...@@ -183,11 +164,8 @@ STDMETHODIMP VLCAudio::get_count(long* trackNumber)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex;
libvlc_exception_init(&ex);
// get the number of audio track available and return it // get the number of audio track available and return it
*trackNumber = libvlc_audio_get_track_count(p_md, &ex); *trackNumber = libvlc_audio_get_track_count(p_md);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -199,8 +177,6 @@ STDMETHODIMP VLCAudio::description(long trackID, BSTR* name) ...@@ -199,8 +177,6 @@ STDMETHODIMP VLCAudio::description(long trackID, BSTR* name)
return E_POINTER; return E_POINTER;
libvlc_media_player_t* p_md; libvlc_media_player_t* p_md;
libvlc_exception_t ex;
libvlc_exception_init(&ex);
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
...@@ -210,16 +186,14 @@ STDMETHODIMP VLCAudio::description(long trackID, BSTR* name) ...@@ -210,16 +186,14 @@ STDMETHODIMP VLCAudio::description(long trackID, BSTR* name)
libvlc_track_description_t *p_trackDesc; libvlc_track_description_t *p_trackDesc;
// get tracks description // get tracks description
p_trackDesc = libvlc_audio_get_track_description(p_md, &ex); p_trackDesc = libvlc_audio_get_track_description(p_md);
hr = exception_bridge(&ex); if( !p_trackDesc )
if( FAILED(hr) ) return E_FAIL;
return hr;
//get the number of available track //get the number of available track
i_limit = libvlc_audio_get_track_count(p_md, &ex); i_limit = libvlc_audio_get_track_count(p_md);
hr = exception_bridge(&ex); if( i_limit < 0 )
if( FAILED(hr) ) return E_FAIL;
return hr;
// check if the number given is a good one // check if the number given is a good one
if ( ( trackID > ( i_limit -1 ) ) || ( trackID < 0 ) ) if ( ( trackID > ( i_limit -1 ) ) || ( trackID < 0 ) )
...@@ -250,40 +224,32 @@ STDMETHODIMP VLCAudio::get_channel(long *channel) ...@@ -250,40 +224,32 @@ STDMETHODIMP VLCAudio::get_channel(long *channel)
if( NULL == channel ) if( NULL == channel )
return E_POINTER; return E_POINTER;
libvlc_instance_t* p_libvlc; libvlc_media_player_t *p_md;
HRESULT hr = getVLC(&p_libvlc); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *channel = libvlc_audio_get_channel(p_md);
libvlc_exception_init(&ex);
*channel = libvlc_audio_get_channel(p_libvlc, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
STDMETHODIMP VLCAudio::put_channel(long channel) STDMETHODIMP VLCAudio::put_channel(long channel)
{ {
libvlc_instance_t* p_libvlc; libvlc_media_player_t *p_md;
HRESULT hr = getVLC(&p_libvlc); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_audio_set_channel(p_md, channel);
libvlc_exception_init(&ex);
libvlc_audio_set_channel(p_libvlc, channel, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
STDMETHODIMP VLCAudio::toggleMute() STDMETHODIMP VLCAudio::toggleMute()
{ {
libvlc_instance_t* p_libvlc; libvlc_media_player_t *p_md;
HRESULT hr = getVLC(&p_libvlc); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
libvlc_audio_toggle_mute(p_libvlc); libvlc_audio_toggle_mute(p_md);
return hr; return hr;
}; };
...@@ -295,11 +261,7 @@ STDMETHODIMP VLCDeinterlace::disable() ...@@ -295,11 +261,7 @@ STDMETHODIMP VLCDeinterlace::disable()
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_video_set_deinterlace(p_md, "");
libvlc_exception_init(&ex);
libvlc_video_set_deinterlace(p_md, 0, "", &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
} }
...@@ -310,12 +272,9 @@ STDMETHODIMP VLCDeinterlace::enable(BSTR mode) ...@@ -310,12 +272,9 @@ STDMETHODIMP VLCDeinterlace::enable(BSTR mode)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex;
libvlc_exception_init(&ex);
char *psz_mode = CStrFromBSTR(CP_UTF8, mode); char *psz_mode = CStrFromBSTR(CP_UTF8, mode);
libvlc_video_set_deinterlace(p_md, 1, psz_mode, &ex); libvlc_video_set_deinterlace(p_md, psz_mode);
CoTaskMemFree(psz_mode); CoTaskMemFree(psz_mode);
hr = exception_bridge(&ex);
} }
return hr; return hr;
} }
...@@ -332,11 +291,7 @@ STDMETHODIMP VLCInput::get_length(double* length) ...@@ -332,11 +291,7 @@ STDMETHODIMP VLCInput::get_length(double* length)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *length = (double)libvlc_media_player_get_length(p_md);
libvlc_exception_init(&ex);
*length = (double)libvlc_media_player_get_length(p_md, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -351,11 +306,7 @@ STDMETHODIMP VLCInput::get_position(double* position) ...@@ -351,11 +306,7 @@ STDMETHODIMP VLCInput::get_position(double* position)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *position = libvlc_media_player_get_position(p_md);
libvlc_exception_init(&ex);
*position = libvlc_media_player_get_position(p_md, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -366,11 +317,7 @@ STDMETHODIMP VLCInput::put_position(double position) ...@@ -366,11 +317,7 @@ STDMETHODIMP VLCInput::put_position(double position)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_media_player_set_position(p_md, position);
libvlc_exception_init(&ex);
libvlc_media_player_set_position(p_md, position, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -384,11 +331,7 @@ STDMETHODIMP VLCInput::get_time(double* time) ...@@ -384,11 +331,7 @@ STDMETHODIMP VLCInput::get_time(double* time)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *time = (double)libvlc_media_player_get_time(p_md);
libvlc_exception_init(&ex);
*time = (double)libvlc_media_player_get_time(p_md, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -399,11 +342,7 @@ STDMETHODIMP VLCInput::put_time(double time) ...@@ -399,11 +342,7 @@ STDMETHODIMP VLCInput::put_time(double time)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_media_player_set_time(p_md, (int64_t)time);
libvlc_exception_init(&ex);
libvlc_media_player_set_time(p_md, (int64_t)time, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -417,16 +356,7 @@ STDMETHODIMP VLCInput::get_state(long* state) ...@@ -417,16 +356,7 @@ STDMETHODIMP VLCInput::get_state(long* state)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex;
libvlc_exception_init(&ex);
*state = libvlc_media_player_get_state(p_md); *state = libvlc_media_player_get_state(p_md);
if( libvlc_exception_raised(&ex) )
{
// don't fail, just return the idle state
*state = 0;
libvlc_exception_clear(&ex);
}
} }
return hr; return hr;
}; };
...@@ -440,11 +370,7 @@ STDMETHODIMP VLCInput::get_rate(double* rate) ...@@ -440,11 +370,7 @@ STDMETHODIMP VLCInput::get_rate(double* rate)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *rate = libvlc_media_player_get_rate(p_md);
libvlc_exception_init(&ex);
*rate = libvlc_media_player_get_rate(p_md, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -455,11 +381,7 @@ STDMETHODIMP VLCInput::put_rate(double rate) ...@@ -455,11 +381,7 @@ STDMETHODIMP VLCInput::put_rate(double rate)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_media_player_set_rate(p_md, rate);
libvlc_exception_init(&ex);
libvlc_media_player_set_rate(p_md, rate, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -474,11 +396,7 @@ STDMETHODIMP VLCInput::get_fps(double* fps) ...@@ -474,11 +396,7 @@ STDMETHODIMP VLCInput::get_fps(double* fps)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *fps = libvlc_media_player_get_fps(p_md);
libvlc_exception_init(&ex);
*fps = libvlc_media_player_get_fps(p_md, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -492,11 +410,7 @@ STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout) ...@@ -492,11 +410,7 @@ STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *hasVout = varbool( libvlc_media_player_has_vout(p_md) );
libvlc_exception_init(&ex);
*hasVout = varbool( libvlc_media_player_has_vout(p_md, &ex) );
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -509,10 +423,7 @@ HRESULT VLCMarquee::do_put_int(unsigned idx, LONG val) ...@@ -509,10 +423,7 @@ HRESULT VLCMarquee::do_put_int(unsigned idx, LONG val)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_video_set_marquee_int(p_md, idx, val);
libvlc_exception_init(&ex);
libvlc_video_set_marquee_int(p_md, idx, val, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
} }
...@@ -526,10 +437,7 @@ HRESULT VLCMarquee::do_get_int(unsigned idx, LONG *val) ...@@ -526,10 +437,7 @@ HRESULT VLCMarquee::do_get_int(unsigned idx, LONG *val)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *val = libvlc_video_get_marquee_int(p_md, idx);
libvlc_exception_init(&ex);
*val = libvlc_video_get_marquee_int(p_md, idx, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
} }
...@@ -541,7 +449,6 @@ STDMETHODIMP VLCMarquee::get_position(BSTR* val) ...@@ -541,7 +449,6 @@ STDMETHODIMP VLCMarquee::get_position(BSTR* val)
LONG i; LONG i;
HRESULT hr = do_get_int(libvlc_marquee_Position, &i); HRESULT hr = do_get_int(libvlc_marquee_Position, &i);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
*val = BSTRFromCStr(CP_UTF8, position_bynumber(i)); *val = BSTRFromCStr(CP_UTF8, position_bynumber(i));
...@@ -574,13 +481,8 @@ STDMETHODIMP VLCMarquee::get_text(BSTR *val) ...@@ -574,13 +481,8 @@ STDMETHODIMP VLCMarquee::get_text(BSTR *val)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; psz = libvlc_video_get_marquee_string(p_md, libvlc_marquee_Text);
libvlc_exception_init(&ex); if( psz )
psz = libvlc_video_get_marquee_string(p_md, libvlc_marquee_Text, &ex);
hr = exception_bridge(&ex);
if(SUCCEEDED(hr))
*val = BSTRFromCStr(CP_UTF8, psz); *val = BSTRFromCStr(CP_UTF8, psz);
} }
return hr; return hr;
...@@ -592,13 +494,8 @@ STDMETHODIMP VLCMarquee::put_text(BSTR val) ...@@ -592,13 +494,8 @@ STDMETHODIMP VLCMarquee::put_text(BSTR val)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex;
libvlc_exception_init(&ex);
char *psz_text = CStrFromBSTR(CP_UTF8, val); char *psz_text = CStrFromBSTR(CP_UTF8, val);
libvlc_video_set_marquee_string(p_md, libvlc_marquee_Text, libvlc_video_set_marquee_string(p_md, libvlc_marquee_Text, psz_text);
psz_text, &ex);
hr = exception_bridge(&ex);
CoTaskMemFree(psz_text); CoTaskMemFree(psz_text);
} }
return hr; return hr;
...@@ -611,20 +508,14 @@ STDMETHODIMP VLCPlaylistItems::get_count(long* count) ...@@ -611,20 +508,14 @@ STDMETHODIMP VLCPlaylistItems::get_count(long* count)
if( NULL == count ) if( NULL == count )
return E_POINTER; return E_POINTER;
libvlc_exception_t ex; *count = Instance()->playlist_count();
libvlc_exception_init(&ex); return S_OK;
*count = Instance()->playlist_count(&ex);
return exception_bridge(&ex);
}; };
STDMETHODIMP VLCPlaylistItems::clear() STDMETHODIMP VLCPlaylistItems::clear()
{ {
libvlc_exception_t ex; Instance()->playlist_clear();
libvlc_exception_init(&ex); return S_OK;
Instance()->playlist_clear(&ex);
return exception_bridge(&ex);
}; };
STDMETHODIMP VLCPlaylistItems::remove(long item) STDMETHODIMP VLCPlaylistItems::remove(long item)
...@@ -633,11 +524,7 @@ STDMETHODIMP VLCPlaylistItems::remove(long item) ...@@ -633,11 +524,7 @@ STDMETHODIMP VLCPlaylistItems::remove(long item)
HRESULT hr = getVLC(&p_libvlc); HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; Instance()->playlist_delete_item(item);
libvlc_exception_init(&ex);
Instance()->playlist_delete_item(item, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -650,11 +537,8 @@ STDMETHODIMP VLCPlaylist::get_itemCount(long* count) ...@@ -650,11 +537,8 @@ STDMETHODIMP VLCPlaylist::get_itemCount(long* count)
return E_POINTER; return E_POINTER;
*count = 0; *count = 0;
libvlc_exception_t ex; *count = Instance()->playlist_count();
libvlc_exception_init(&ex); return S_OK;
*count = Instance()->playlist_count(&ex);
return exception_bridge(&ex);
}; };
STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying) STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying)
...@@ -666,11 +550,7 @@ STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying) ...@@ -666,11 +550,7 @@ STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex;
libvlc_exception_init(&ex);
*isPlaying = varbool( libvlc_media_player_is_playing(p_md) ); *isPlaying = varbool( libvlc_media_player_is_playing(p_md) );
libvlc_exception_clear(&ex);
} }
return hr; return hr;
}; };
...@@ -687,9 +567,6 @@ STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* ite ...@@ -687,9 +567,6 @@ STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* ite
HRESULT hr = getVLC(&p_libvlc); HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex;
libvlc_exception_init(&ex);
char *psz_uri = NULL; char *psz_uri = NULL;
if( SysStringLen(Instance()->getBaseURL()) > 0 ) if( SysStringLen(Instance()->getBaseURL()) > 0 )
{ {
...@@ -742,33 +619,26 @@ STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* ite ...@@ -742,33 +619,26 @@ STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* ite
} }
*item = Instance()->playlist_add_extended_untrusted(psz_uri, *item = Instance()->playlist_add_extended_untrusted(psz_uri,
i_options, const_cast<const char **>(ppsz_options), &ex); i_options, const_cast<const char **>(ppsz_options));
VLCControl::FreeTargetOptions(ppsz_options, i_options); VLCControl::FreeTargetOptions(ppsz_options, i_options);
CoTaskMemFree(psz_uri); CoTaskMemFree(psz_uri);
if( psz_name ) /* XXX Do we even need to check? */ if( psz_name ) /* XXX Do we even need to check? */
CoTaskMemFree(psz_name); CoTaskMemFree(psz_name);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
STDMETHODIMP VLCPlaylist::play() STDMETHODIMP VLCPlaylist::play()
{ {
libvlc_exception_t ex; Instance()->playlist_play();
libvlc_exception_init(&ex); return S_OK;
Instance()->playlist_play(&ex);
return exception_bridge(&ex);
}; };
STDMETHODIMP VLCPlaylist::playItem(long item) STDMETHODIMP VLCPlaylist::playItem(long item)
{ {
libvlc_exception_t ex; Instance()->playlist_play_item(item);
libvlc_exception_init(&ex); return S_OK;
Instance()->playlist_play_item(item,&ex);
return exception_bridge(&ex);;
}; };
STDMETHODIMP VLCPlaylist::togglePause() STDMETHODIMP VLCPlaylist::togglePause()
...@@ -777,11 +647,7 @@ STDMETHODIMP VLCPlaylist::togglePause() ...@@ -777,11 +647,7 @@ STDMETHODIMP VLCPlaylist::togglePause()
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_media_player_pause(p_md);
libvlc_exception_init(&ex);
libvlc_media_player_pause(p_md, &ex);
hr = exception_bridge(&ex);;
} }
return hr; return hr;
}; };
...@@ -792,40 +658,27 @@ STDMETHODIMP VLCPlaylist::stop() ...@@ -792,40 +658,27 @@ STDMETHODIMP VLCPlaylist::stop()
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_media_player_stop(p_md); libvlc_media_player_stop(p_md);
hr = exception_bridge(&ex);;
} }
return hr; return hr;
}; };
STDMETHODIMP VLCPlaylist::next() STDMETHODIMP VLCPlaylist::next()
{ {
libvlc_exception_t ex; Instance()->playlist_next();
libvlc_exception_init(&ex); return S_OK;
Instance()->playlist_next(&ex);
return exception_bridge(&ex);;
}; };
STDMETHODIMP VLCPlaylist::prev() STDMETHODIMP VLCPlaylist::prev()
{ {
libvlc_exception_t ex; Instance()->playlist_prev();
libvlc_exception_init(&ex); return S_OK;
Instance()->playlist_prev(&ex);
return exception_bridge(&ex);;
}; };
STDMETHODIMP VLCPlaylist::clear() STDMETHODIMP VLCPlaylist::clear()
{ {
libvlc_exception_t ex; Instance()->playlist_clear();
libvlc_exception_init(&ex); return S_OK;
Instance()->playlist_clear(&ex);
return exception_bridge(&ex);;
}; };
STDMETHODIMP VLCPlaylist::removeItem(long item) STDMETHODIMP VLCPlaylist::removeItem(long item)
...@@ -834,11 +687,7 @@ STDMETHODIMP VLCPlaylist::removeItem(long item) ...@@ -834,11 +687,7 @@ STDMETHODIMP VLCPlaylist::removeItem(long item)
HRESULT hr = getVLC(&p_libvlc); HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; Instance()->playlist_delete_item(item);
libvlc_exception_init(&ex);
Instance()->playlist_delete_item(item, &ex);
hr = exception_bridge(&ex);;
} }
return hr; return hr;
}; };
...@@ -868,11 +717,7 @@ STDMETHODIMP VLCSubtitle::get_track(long* spu) ...@@ -868,11 +717,7 @@ STDMETHODIMP VLCSubtitle::get_track(long* spu)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *spu = libvlc_video_get_spu(p_md);
libvlc_exception_init(&ex);
*spu = libvlc_video_get_spu(p_md, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -883,11 +728,7 @@ STDMETHODIMP VLCSubtitle::put_track(long spu) ...@@ -883,11 +728,7 @@ STDMETHODIMP VLCSubtitle::put_track(long spu)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_video_set_spu(p_md, spu);
libvlc_exception_init(&ex);
libvlc_video_set_spu(p_md, spu, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -901,11 +742,8 @@ STDMETHODIMP VLCSubtitle::get_count(long* spuNumber) ...@@ -901,11 +742,8 @@ STDMETHODIMP VLCSubtitle::get_count(long* spuNumber)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex;
libvlc_exception_init(&ex);
// get the number of video subtitle available and return it // get the number of video subtitle available and return it
*spuNumber = libvlc_video_get_spu_count(p_md, &ex); *spuNumber = libvlc_video_get_spu_count(p_md);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -917,8 +755,6 @@ STDMETHODIMP VLCSubtitle::description(long nameID, BSTR* name) ...@@ -917,8 +755,6 @@ STDMETHODIMP VLCSubtitle::description(long nameID, BSTR* name)
return E_POINTER; return E_POINTER;
libvlc_media_player_t* p_md; libvlc_media_player_t* p_md;
libvlc_exception_t ex;
libvlc_exception_init(&ex);
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
...@@ -928,16 +764,14 @@ STDMETHODIMP VLCSubtitle::description(long nameID, BSTR* name) ...@@ -928,16 +764,14 @@ STDMETHODIMP VLCSubtitle::description(long nameID, BSTR* name)
libvlc_track_description_t *p_spuDesc; libvlc_track_description_t *p_spuDesc;
// get subtitles description // get subtitles description
p_spuDesc = libvlc_video_get_spu_description(p_md, &ex); p_spuDesc = libvlc_video_get_spu_description(p_md);
hr = exception_bridge(&ex); if( !p_spuDesc )
if( FAILED(hr) ) return E_FAIL;
return hr;
// get the number of available subtitle // get the number of available subtitle
i_limit = libvlc_video_get_spu_count(p_md, &ex); i_limit = libvlc_video_get_spu_count(p_md);
hr = exception_bridge(&ex); if( i_limit < 0 )
if( FAILED(hr) ) return E_FAIL;
return hr;
// check if the number given is a good one // check if the number given is a good one
if ( ( nameID > ( i_limit -1 ) ) || ( nameID < 0 ) ) if ( ( nameID > ( i_limit -1 ) ) || ( nameID < 0 ) )
...@@ -974,11 +808,7 @@ STDMETHODIMP VLCVideo::get_fullscreen(VARIANT_BOOL* fullscreen) ...@@ -974,11 +808,7 @@ STDMETHODIMP VLCVideo::get_fullscreen(VARIANT_BOOL* fullscreen)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *fullscreen = varbool( libvlc_get_fullscreen(p_md) );
libvlc_exception_init(&ex);
*fullscreen = varbool( libvlc_get_fullscreen(p_md, &ex) );
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -989,11 +819,7 @@ STDMETHODIMP VLCVideo::put_fullscreen(VARIANT_BOOL fullscreen) ...@@ -989,11 +819,7 @@ STDMETHODIMP VLCVideo::put_fullscreen(VARIANT_BOOL fullscreen)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_set_fullscreen(p_md, VARIANT_FALSE != fullscreen);
libvlc_exception_init(&ex);
libvlc_set_fullscreen(p_md, VARIANT_FALSE != fullscreen, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -1007,11 +833,7 @@ STDMETHODIMP VLCVideo::get_width(long* width) ...@@ -1007,11 +833,7 @@ STDMETHODIMP VLCVideo::get_width(long* width)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *width = libvlc_video_get_width(p_md);
libvlc_exception_init(&ex);
*width = libvlc_video_get_width(p_md, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -1025,11 +847,7 @@ STDMETHODIMP VLCVideo::get_height(long* height) ...@@ -1025,11 +847,7 @@ STDMETHODIMP VLCVideo::get_height(long* height)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *height = libvlc_video_get_height(p_md);
libvlc_exception_init(&ex);
*height = libvlc_video_get_height(p_md, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -1043,18 +861,15 @@ STDMETHODIMP VLCVideo::get_aspectRatio(BSTR* aspect) ...@@ -1043,18 +861,15 @@ STDMETHODIMP VLCVideo::get_aspectRatio(BSTR* aspect)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; char *psz_aspect = libvlc_video_get_aspect_ratio(p_md);
libvlc_exception_init(&ex);
char *psz_aspect = libvlc_video_get_aspect_ratio(p_md, &ex);
hr = exception_bridge(&ex); if( !psz_aspect )
if( SUCCEEDED(hr) && NULL != psz_aspect )
{ {
*aspect = BSTRFromCStr(CP_UTF8, psz_aspect); *aspect = BSTRFromCStr(CP_UTF8, psz_aspect);
if( NULL == *aspect ) if( NULL == *aspect )
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
} else if( NULL == psz_aspect) hr = E_OUTOFMEMORY; // strdup("") failed } else if( NULL == psz_aspect)
hr = E_OUTOFMEMORY;
free( psz_aspect ); free( psz_aspect );
} }
return hr; return hr;
...@@ -1069,19 +884,15 @@ STDMETHODIMP VLCVideo::put_aspectRatio(BSTR aspect) ...@@ -1069,19 +884,15 @@ STDMETHODIMP VLCVideo::put_aspectRatio(BSTR aspect)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex;
libvlc_exception_init(&ex);
char *psz_aspect = CStrFromBSTR(CP_UTF8, aspect); char *psz_aspect = CStrFromBSTR(CP_UTF8, aspect);
if( NULL == psz_aspect ) if( !psz_aspect )
{ {
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
libvlc_video_set_aspect_ratio(p_md, psz_aspect, &ex); libvlc_video_set_aspect_ratio(p_md, psz_aspect);
CoTaskMemFree(psz_aspect); CoTaskMemFree(psz_aspect);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -1095,11 +906,7 @@ STDMETHODIMP VLCVideo::get_subtitle(long* spu) ...@@ -1095,11 +906,7 @@ STDMETHODIMP VLCVideo::get_subtitle(long* spu)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *spu = libvlc_video_get_spu(p_md);
libvlc_exception_init(&ex);
*spu = libvlc_video_get_spu(p_md, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -1110,11 +917,7 @@ STDMETHODIMP VLCVideo::put_subtitle(long spu) ...@@ -1110,11 +917,7 @@ STDMETHODIMP VLCVideo::put_subtitle(long spu)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_video_set_spu(p_md, spu);
libvlc_exception_init(&ex);
libvlc_video_set_spu(p_md, spu, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -1128,17 +931,14 @@ STDMETHODIMP VLCVideo::get_crop(BSTR* geometry) ...@@ -1128,17 +931,14 @@ STDMETHODIMP VLCVideo::get_crop(BSTR* geometry)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; char *psz_geometry = libvlc_video_get_crop_geometry(p_md);
libvlc_exception_init(&ex); if( !psz_geometry )
char *psz_geometry = libvlc_video_get_crop_geometry(p_md, &ex);
hr = exception_bridge(&ex);
if( SUCCEEDED(&ex) && NULL != psz_geometry )
{ {
*geometry = BSTRFromCStr(CP_UTF8, psz_geometry); *geometry = BSTRFromCStr(CP_UTF8, psz_geometry);
if( NULL == geometry ) hr = E_OUTOFMEMORY; if( !geometry )
} else if( NULL == psz_geometry ) hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
} else if( !psz_geometry )
hr = E_OUTOFMEMORY;
free( psz_geometry ); free( psz_geometry );
} }
return hr; return hr;
...@@ -1156,19 +956,15 @@ STDMETHODIMP VLCVideo::put_crop(BSTR geometry) ...@@ -1156,19 +956,15 @@ STDMETHODIMP VLCVideo::put_crop(BSTR geometry)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex;
libvlc_exception_init(&ex);
char *psz_geometry = CStrFromBSTR(CP_UTF8, geometry); char *psz_geometry = CStrFromBSTR(CP_UTF8, geometry);
if( NULL == psz_geometry ) if( !psz_geometry )
{ {
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
libvlc_video_set_crop_geometry(p_md, psz_geometry, &ex); libvlc_video_set_crop_geometry(p_md, psz_geometry);
CoTaskMemFree(psz_geometry); CoTaskMemFree(psz_geometry);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -1180,7 +976,6 @@ STDMETHODIMP VLCVideo::get_teletext(long* page) ...@@ -1180,7 +976,6 @@ STDMETHODIMP VLCVideo::get_teletext(long* page)
libvlc_media_player_t *p_md; libvlc_media_player_t *p_md;
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
*page = libvlc_video_get_teletext(p_md); *page = libvlc_video_get_teletext(p_md);
...@@ -1196,11 +991,7 @@ STDMETHODIMP VLCVideo::put_teletext(long page) ...@@ -1196,11 +991,7 @@ STDMETHODIMP VLCVideo::put_teletext(long page)
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_video_set_teletext(p_md, page);
libvlc_exception_init(&ex);
libvlc_video_set_teletext(p_md, page, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -1214,9 +1005,6 @@ STDMETHODIMP VLCVideo::takeSnapshot(LPPICTUREDISP* picture) ...@@ -1214,9 +1005,6 @@ STDMETHODIMP VLCVideo::takeSnapshot(LPPICTUREDISP* picture)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex;
libvlc_exception_init(&ex);
static int uniqueId = 0; static int uniqueId = 0;
TCHAR path[MAX_PATH+1]; TCHAR path[MAX_PATH+1];
...@@ -1276,9 +1064,7 @@ STDMETHODIMP VLCVideo::takeSnapshot(LPPICTUREDISP* picture) ...@@ -1276,9 +1064,7 @@ STDMETHODIMP VLCVideo::takeSnapshot(LPPICTUREDISP* picture)
return E_FAIL; return E_FAIL;
/* take snapshot into file */ /* take snapshot into file */
libvlc_video_take_snapshot(p_md, psz_filepath, 0, 0, &ex); if( libvlc_video_take_snapshot(p_md, 0, psz_filepath, 0, 0) == 0 )
hr = exception_bridge(&ex);
if( SUCCEEDED(hr) )
{ {
/* open snapshot file */ /* open snapshot file */
HANDLE snapPic = LoadImage(NULL, filepath, IMAGE_BITMAP, 0, 0, HANDLE snapPic = LoadImage(NULL, filepath, IMAGE_BITMAP, 0, 0,
...@@ -1312,11 +1098,7 @@ STDMETHODIMP VLCVideo::toggleFullscreen() ...@@ -1312,11 +1098,7 @@ STDMETHODIMP VLCVideo::toggleFullscreen()
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_toggle_fullscreen(p_md);
libvlc_exception_init(&ex);
libvlc_toggle_fullscreen(p_md, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -1327,11 +1109,7 @@ STDMETHODIMP VLCVideo::toggleTeletext() ...@@ -1327,11 +1109,7 @@ STDMETHODIMP VLCVideo::toggleTeletext()
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_toggle_teletext(p_md);
libvlc_exception_init(&ex);
libvlc_toggle_teletext(p_md, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
}; };
...@@ -1351,7 +1129,6 @@ STDMETHODIMP VLCVideo::get_deinterlace(IVLCDeinterlace** obj) ...@@ -1351,7 +1129,6 @@ STDMETHODIMP VLCVideo::get_deinterlace(IVLCDeinterlace** obj)
return object_get(obj,_p_vlcdeint); return object_get(obj,_p_vlcdeint);
} }
/****************************************************************************/ /****************************************************************************/
HRESULT VLCLogo::do_put_int(unsigned idx, LONG val) HRESULT VLCLogo::do_put_int(unsigned idx, LONG val)
...@@ -1360,10 +1137,7 @@ HRESULT VLCLogo::do_put_int(unsigned idx, LONG val) ...@@ -1360,10 +1137,7 @@ HRESULT VLCLogo::do_put_int(unsigned idx, LONG val)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_video_set_logo_int(p_md, idx, val);
libvlc_exception_init(&ex);
libvlc_video_set_logo_int(p_md, idx, val, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
} }
...@@ -1377,10 +1151,7 @@ HRESULT VLCLogo::do_get_int(unsigned idx, LONG *val) ...@@ -1377,10 +1151,7 @@ HRESULT VLCLogo::do_get_int(unsigned idx, LONG *val)
HRESULT hr = getMD(&p_md); HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; *val = libvlc_video_get_logo_int(p_md, idx);
libvlc_exception_init(&ex);
*val = libvlc_video_get_logo_int(p_md, idx, &ex);
hr = exception_bridge(&ex);
} }
return hr; return hr;
} }
...@@ -1395,10 +1166,7 @@ STDMETHODIMP VLCLogo::file(BSTR fname) ...@@ -1395,10 +1166,7 @@ STDMETHODIMP VLCLogo::file(BSTR fname)
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_video_set_logo_string(p_md, libvlc_logo_file, n);
libvlc_exception_init(&ex);
libvlc_video_set_logo_string(p_md, libvlc_logo_file, n, &ex);
hr = exception_bridge(&ex);
} }
CoTaskMemFree(n); CoTaskMemFree(n);
...@@ -1632,15 +1400,13 @@ STDMETHODIMP VLCControl2::get_StartTime(long *seconds) ...@@ -1632,15 +1400,13 @@ STDMETHODIMP VLCControl2::get_StartTime(long *seconds)
return E_POINTER; return E_POINTER;
*seconds = _p_instance->getStartTime(); *seconds = _p_instance->getStartTime();
return S_OK; return S_OK;
}; };
STDMETHODIMP VLCControl2::put_StartTime(long seconds) STDMETHODIMP VLCControl2::put_StartTime(long seconds)
{ {
_p_instance->setStartTime(seconds); _p_instance->setStartTime(seconds);
return S_OK;
return NOERROR;
}; };
STDMETHODIMP VLCControl2::get_VersionInfo(BSTR *version) STDMETHODIMP VLCControl2::get_VersionInfo(BSTR *version)
...@@ -1666,14 +1432,13 @@ STDMETHODIMP VLCControl2::get_Visible(VARIANT_BOOL *isVisible) ...@@ -1666,14 +1432,13 @@ STDMETHODIMP VLCControl2::get_Visible(VARIANT_BOOL *isVisible)
*isVisible = varbool( _p_instance->getVisible() ); *isVisible = varbool( _p_instance->getVisible() );
return NOERROR; return S_OK;
}; };
STDMETHODIMP VLCControl2::put_Visible(VARIANT_BOOL isVisible) STDMETHODIMP VLCControl2::put_Visible(VARIANT_BOOL isVisible)
{ {
_p_instance->setVisible(isVisible != VARIANT_FALSE); _p_instance->setVisible(isVisible != VARIANT_FALSE);
return S_OK;
return NOERROR;
}; };
STDMETHODIMP VLCControl2::get_Volume(long *volume) STDMETHODIMP VLCControl2::get_Volume(long *volume)
...@@ -1682,13 +1447,13 @@ STDMETHODIMP VLCControl2::get_Volume(long *volume) ...@@ -1682,13 +1447,13 @@ STDMETHODIMP VLCControl2::get_Volume(long *volume)
return E_POINTER; return E_POINTER;
*volume = _p_instance->getVolume(); *volume = _p_instance->getVolume();
return NOERROR; return S_OK;
}; };
STDMETHODIMP VLCControl2::put_Volume(long volume) STDMETHODIMP VLCControl2::put_Volume(long volume)
{ {
_p_instance->setVolume(volume); _p_instance->setVolume(volume);
return NOERROR; return S_OK;
}; };
STDMETHODIMP VLCControl2::get_BackColor(OLE_COLOR *backcolor) STDMETHODIMP VLCControl2::get_BackColor(OLE_COLOR *backcolor)
...@@ -1697,13 +1462,13 @@ STDMETHODIMP VLCControl2::get_BackColor(OLE_COLOR *backcolor) ...@@ -1697,13 +1462,13 @@ STDMETHODIMP VLCControl2::get_BackColor(OLE_COLOR *backcolor)
return E_POINTER; return E_POINTER;
*backcolor = _p_instance->getBackColor(); *backcolor = _p_instance->getBackColor();
return NOERROR; return S_OKs;
}; };
STDMETHODIMP VLCControl2::put_BackColor(OLE_COLOR backcolor) STDMETHODIMP VLCControl2::put_BackColor(OLE_COLOR backcolor)
{ {
_p_instance->setBackColor(backcolor); _p_instance->setBackColor(backcolor);
return NOERROR; return S_OK;
}; };
STDMETHODIMP VLCControl2::get_audio(IVLCAudio** obj) STDMETHODIMP VLCControl2::get_audio(IVLCAudio** obj)
......
...@@ -40,7 +40,6 @@ public: ...@@ -40,7 +40,6 @@ public:
HRESULT getMD(libvlc_media_player_t **pp) const { return _plug->getMD(pp); } HRESULT getMD(libvlc_media_player_t **pp) const { return _plug->getMD(pp); }
protected: protected:
HRESULT report_exception(REFIID riid, libvlc_exception_t *ex);
HRESULT loadTypeInfo(REFIID riid); HRESULT loadTypeInfo(REFIID riid);
ITypeInfo *TypeInfo() const { return _ti; } ITypeInfo *TypeInfo() const { return _ti; }
...@@ -71,12 +70,6 @@ public: ...@@ -71,12 +70,6 @@ public:
HRESULT getVLC(libvlc_instance_t **pp) const { return Base::getVLC(pp); } HRESULT getVLC(libvlc_instance_t **pp) const { return Base::getVLC(pp); }
HRESULT getMD(libvlc_media_player_t **pp) const { return Base::getMD(pp); } HRESULT getMD(libvlc_media_player_t **pp) const { return Base::getMD(pp); }
HRESULT exception_bridge(libvlc_exception_t *ex)
{
return libvlc_exception_raised(ex) ?
Base::report_exception(_riid,ex) : NOERROR;
}
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ {
if( NULL == ppv ) return E_POINTER; if( NULL == ppv ) return E_POINTER;
...@@ -206,7 +199,6 @@ private: ...@@ -206,7 +199,6 @@ private:
HRESULT do_get_int(unsigned idx, LONG *val); HRESULT do_get_int(unsigned idx, LONG *val);
}; };
class VLCLogo: public VLCInterface<VLCLogo,IVLCLogo> class VLCLogo: public VLCInterface<VLCLogo,IVLCLogo>
{ {
public: public:
...@@ -239,7 +231,6 @@ private: ...@@ -239,7 +231,6 @@ private:
HRESULT do_get_int(unsigned idx, LONG *val); HRESULT do_get_int(unsigned idx, LONG *val);
}; };
class VLCDeinterlace: public VLCInterface<VLCDeinterlace,IVLCDeinterlace> class VLCDeinterlace: public VLCInterface<VLCDeinterlace,IVLCDeinterlace>
{ {
public: public:
...@@ -250,7 +241,6 @@ public: ...@@ -250,7 +241,6 @@ public:
STDMETHODIMP disable(); STDMETHODIMP disable();
}; };
class VLCPlaylistItems: public VLCInterface<VLCPlaylistItems,IVLCPlaylistItems> class VLCPlaylistItems: public VLCInterface<VLCPlaylistItems,IVLCPlaylistItems>
{ {
public: public:
......
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