/*****************************************************************************
* 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>
+ * Jean-Paul Saman <jpsaman@videolan.org>
*
* 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
#include <servprov.h>
#include <shlwapi.h>
#include <wininet.h>
+#include <assert.h>
using namespace std;
return S_OK;
};
-
void VLCPlugin::initVLC()
{
extern HMODULE DllGetModule();
if( _b_autoloop )
ppsz_argv[ppsz_argc++] = "--loop";
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv, &ex);
- if( libvlc_exception_raised(&ex) )
+ _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv);
+ if( !_p_libvlc )
return;
_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
if( SysStringLen(_bstr_mrl) > 0 )
{
options[i_options++] = timeBuffer;
}
// 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);
}
}
HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect)
{
RECT clipRect = *lprcClipRect;
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
/*
** record keeping of control geometry within container
if( FAILED(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();
}
}
HRESULT VLCPlugin::onInPlaceDeactivate(void)
{
- if( isPlaying(NULL) )
+ if( isPlaying() )
{
- playlist_stop(NULL);
+ playlist_stop();
fireOnStopEvent();
}
_i_volume = volume;
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);
}
setStartTime(_i_time);
if( NULL != _p_mplayer )
{
- libvlc_media_player_set_time(_p_mplayer, _i_time, NULL);
+ libvlc_media_player_set_time(_p_mplayer, _i_time);
}
}
};
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;
+ assert(_p_mlist);
+
libvlc_media_list_lock(_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;
_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);
-
- if( libvlc_exception_raised(ex) )
+ if( !p_m )
return false;
if( _p_mplayer )
_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 )
- 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 );
- return !libvlc_exception_raised(ex);
+ libvlc_media_release(p_m);
+ return _p_mplayer ? true : false;
bad_unlock:
libvlc_media_list_unlock(_p_mlist);
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
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;
- libvlc_media_t *p_m = libvlc_media_new(_p_libvlc,mrl,ex);
- if( libvlc_exception_raised(ex) )
+ libvlc_media_t *p_m = libvlc_media_new(_p_libvlc,mrl);
+ if( !p_m )
return -1;
for( int i = 0; i < optc; ++i )
libvlc_media_add_option_flag(p_m, optv[i], libvlc_media_option_unique);
libvlc_media_list_lock(_p_mlist);
- libvlc_media_list_add_media(_p_mlist,p_m,ex);
- if( !libvlc_exception_raised(ex) )
+ if( libvlc_media_list_add_media(_p_mlist,p_m) == 0 )
item = libvlc_media_list_count(_p_mlist)-1;
libvlc_media_list_unlock(_p_mlist);
libvlc_media_release(p_m);
/*****************************************************************************
* 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>
* Jean-Paul Saman <jpsaman@videolan.org>
*isVisible = _p_instance->getVisible() ? VARIANT_TRUE : VARIANT_FALSE;
- return NOERROR;
+ return S_OK;
};
STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible)
{
_p_instance->setVisible(isVisible != VARIANT_FALSE);
- return NOERROR;
+ return S_OK;
};
STDMETHODIMP VLCControl::play(void)
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- _p_instance->playlist_play(&ex);
- HRESULT result = exception_bridge(&ex);
- if( SUCCEEDED(result) )
- _p_instance->fireOnPlayEvent();
- return result;
+ _p_instance->playlist_play();
+ _p_instance->fireOnPlayEvent();
+ return S_OK;
};
STDMETHODIMP VLCControl::pause(void)
HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_pause(p_md, &ex);
- result = exception_bridge(&ex);
- if( SUCCEEDED(result) )
- _p_instance->fireOnPauseEvent();
+ libvlc_media_player_pause(p_md);
+ _p_instance->fireOnPauseEvent();
}
return result;
};
HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
libvlc_media_player_stop(p_md);
- result = exception_bridge(&ex);
- if( SUCCEEDED(result) )
- _p_instance->fireOnStopEvent();
+ _p_instance->fireOnStopEvent();
}
return result;
};
HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *position = libvlc_media_player_get_position(p_md, &ex);
- result = exception_bridge(&ex);
+ *position = libvlc_media_player_get_position(p_md);
}
return result;
};
HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_set_position(p_md, position, &ex);
- result = exception_bridge(&ex);
+ libvlc_media_player_set_position(p_md, position);
}
return result;
};
HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *seconds = libvlc_media_player_get_time(p_md, &ex);
- result = exception_bridge(&ex);
+ *seconds = libvlc_media_player_get_time(p_md);
}
return result;
};
{
/* setTime function of the plugin sets the time. */
_p_instance->setTime(seconds);
- return NOERROR;
+ return S_OK;
};
STDMETHODIMP VLCControl::shuttle(int seconds)
HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
if( seconds < 0 ) seconds = 0;
- libvlc_media_player_set_time(p_md, (int64_t)seconds, &ex);
- result = exception_bridge(&ex);
+ libvlc_media_player_set_time(p_md, (int64_t)seconds);
}
return result;
{
if( libvlc_media_player_is_playing(p_md) )
{
- libvlc_toggle_fullscreen(p_md, NULL);
+ libvlc_toggle_fullscreen(p_md);
}
}
return result;
HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *seconds = (double)libvlc_media_player_get_length(p_md, &ex);
- result = exception_bridge(&ex);
+ *seconds = (double)libvlc_media_player_get_length(p_md);
}
return result;
if( SUCCEEDED(result) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_set_rate(p_md, rate, &ex);
- result = exception_bridge(&ex);
+ libvlc_media_player_set_rate(p_md, rate);
}
return result;
};
HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_set_rate(p_md, rate, &ex);
- result = exception_bridge(&ex);
+ libvlc_media_player_set_rate(p_md, rate);
}
return result;
};
return E_POINTER;
*volume = _p_instance->getVolume();
- return NOERROR;
+ return S_OK;
};
STDMETHODIMP VLCControl::put_Volume(int volume)
{
_p_instance->setVolume(volume);
- return NOERROR;
+ return S_OK;
};
STDMETHODIMP VLCControl::toggleMute(void)
{
- libvlc_instance_t* p_libvlc;
- HRESULT result = _p_instance->getVLC(&p_libvlc);
+ libvlc_media_player_t *p_md;
+ HRESULT result = _p_instance->getMD(&p_md);
if( SUCCEEDED(result) )
- libvlc_audio_toggle_mute(p_libvlc);
+ libvlc_audio_toggle_mute(p_md);
return result;
};
if( FAILED(CreateTargetOptions(CP_UTF8, &options, &cOptions, &cOptionsCount)) )
return E_INVALIDARG;
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
position = _p_instance->playlist_add_extended_untrusted(cUri,
- cOptionsCount, const_cast<const char**>(cOptions), &ex);
+ cOptionsCount, const_cast<const char**>(cOptions));
FreeTargetOptions(cOptions, cOptionsCount);
CoTaskMemFree(cUri);
- hr = exception_bridge(&ex);
- if( SUCCEEDED(hr) )
+ if( position >= 0 )
{
if( mode & VLCPlayListAppendAndGo )
_p_instance->fireOnPlayEvent();
HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *index = _p_instance->playlist_get_current_index(&ex);
- result = exception_bridge(&ex);
+ *index = _p_instance->playlist_get_current_index();
}
return result;
};
if( NULL == count )
return E_POINTER;
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *count = _p_instance->playlist_count(&ex);
- return exception_bridge(&ex);
+ *count = _p_instance->playlist_count();
+ return S_OK;
};
STDMETHODIMP VLCControl::playlistNext(void)
HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- _p_instance->playlist_next(&ex);
- result = exception_bridge(&ex);
+ _p_instance->playlist_next();
}
return result;
};
HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- _p_instance->playlist_prev(&ex);
- result = exception_bridge(&ex);
+ _p_instance->playlist_prev();
}
return result;
};
HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- _p_instance->playlist_clear(&ex);
- result = exception_bridge(&ex);
+ _p_instance->playlist_clear();
}
return result;
};
*mrl = SysAllocStringLen(_p_instance->getMRL(),
SysStringLen(_p_instance->getMRL()));
- return NOERROR;
+ return S_OK;
};
STDMETHODIMP VLCControl::put_MRL(BSTR mrl)
// ---------
-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)
{
// if( _ti ) return NOERROR; // unnecessairy
if( NULL == mute )
return E_POINTER;
- libvlc_instance_t* p_libvlc;
- HRESULT hr = getVLC(&p_libvlc);
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
- *mute = varbool( libvlc_audio_get_mute(p_libvlc) );
+ *mute = varbool( libvlc_audio_get_mute(p_md) );
return hr;
};
STDMETHODIMP VLCAudio::put_mute(VARIANT_BOOL mute)
{
- libvlc_instance_t* p_libvlc;
- HRESULT hr = getVLC(&p_libvlc);
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
- libvlc_audio_set_mute(p_libvlc, VARIANT_FALSE != mute);
+ libvlc_audio_set_mute(p_md, VARIANT_FALSE != mute);
return hr;
};
if( NULL == volume )
return E_POINTER;
- libvlc_instance_t* p_libvlc;
- HRESULT hr = getVLC(&p_libvlc);
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
- *volume = libvlc_audio_get_volume(p_libvlc);
+ *volume = libvlc_audio_get_volume(p_md);
return hr;
};
STDMETHODIMP VLCAudio::put_volume(long volume)
{
- libvlc_instance_t* p_libvlc;
- HRESULT hr = getVLC(&p_libvlc);
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_audio_set_volume(p_libvlc, volume, &ex);
- hr = exception_bridge(&ex);
+ libvlc_audio_set_volume(p_md, volume);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *track = libvlc_audio_get_track(p_md, &ex);
- hr = exception_bridge(&ex);
+ *track = libvlc_audio_get_track(p_md);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_audio_set_track(p_md, track, &ex);
- hr = exception_bridge(&ex);
+ libvlc_audio_set_track(p_md, track);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
// get the number of audio track available and return it
- *trackNumber = libvlc_audio_get_track_count(p_md, &ex);
- hr = exception_bridge(&ex);
+ *trackNumber = libvlc_audio_get_track_count(p_md);
}
return hr;
};
return E_POINTER;
libvlc_media_player_t* p_md;
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
libvlc_track_description_t *p_trackDesc;
// get tracks description
- p_trackDesc = libvlc_audio_get_track_description(p_md, &ex);
- hr = exception_bridge(&ex);
- if( FAILED(hr) )
- return hr;
+ p_trackDesc = libvlc_audio_get_track_description(p_md);
+ if( !p_trackDesc )
+ return E_FAIL;
//get the number of available track
- i_limit = libvlc_audio_get_track_count(p_md, &ex);
- hr = exception_bridge(&ex);
- if( FAILED(hr) )
- return hr;
+ i_limit = libvlc_audio_get_track_count(p_md);
+ if( i_limit < 0 )
+ return E_FAIL;
// check if the number given is a good one
if ( ( trackID > ( i_limit -1 ) ) || ( trackID < 0 ) )
if( NULL == channel )
return E_POINTER;
- libvlc_instance_t* p_libvlc;
- HRESULT hr = getVLC(&p_libvlc);
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *channel = libvlc_audio_get_channel(p_libvlc, &ex);
- hr = exception_bridge(&ex);
+ *channel = libvlc_audio_get_channel(p_md);
}
return hr;
};
STDMETHODIMP VLCAudio::put_channel(long channel)
{
- libvlc_instance_t* p_libvlc;
- HRESULT hr = getVLC(&p_libvlc);
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_audio_set_channel(p_libvlc, channel, &ex);
- hr = exception_bridge(&ex);
+ libvlc_audio_set_channel(p_md, channel);
}
return hr;
};
STDMETHODIMP VLCAudio::toggleMute()
{
- libvlc_instance_t* p_libvlc;
- HRESULT hr = getVLC(&p_libvlc);
+ libvlc_media_player_t *p_md;
+ HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
- libvlc_audio_toggle_mute(p_libvlc);
+ libvlc_audio_toggle_mute(p_md);
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_deinterlace(p_md, 0, "", &ex);
- hr = exception_bridge(&ex);
+ libvlc_video_set_deinterlace(p_md, "");
}
return hr;
}
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
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);
- hr = exception_bridge(&ex);
}
return hr;
}
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *length = (double)libvlc_media_player_get_length(p_md, &ex);
- hr = exception_bridge(&ex);
+ *length = (double)libvlc_media_player_get_length(p_md);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *position = libvlc_media_player_get_position(p_md, &ex);
- hr = exception_bridge(&ex);
+ *position = libvlc_media_player_get_position(p_md);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_set_position(p_md, position, &ex);
- hr = exception_bridge(&ex);
+ libvlc_media_player_set_position(p_md, position);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *time = (double)libvlc_media_player_get_time(p_md, &ex);
- hr = exception_bridge(&ex);
+ *time = (double)libvlc_media_player_get_time(p_md);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_set_time(p_md, (int64_t)time, &ex);
- hr = exception_bridge(&ex);
+ libvlc_media_player_set_time(p_md, (int64_t)time);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
*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;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *rate = libvlc_media_player_get_rate(p_md, &ex);
- hr = exception_bridge(&ex);
+ *rate = libvlc_media_player_get_rate(p_md);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_set_rate(p_md, rate, &ex);
- hr = exception_bridge(&ex);
+ libvlc_media_player_set_rate(p_md, rate);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *fps = libvlc_media_player_get_fps(p_md, &ex);
- hr = exception_bridge(&ex);
+ *fps = libvlc_media_player_get_fps(p_md);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *hasVout = varbool( libvlc_media_player_has_vout(p_md, &ex) );
- hr = exception_bridge(&ex);
+ *hasVout = varbool( libvlc_media_player_has_vout(p_md) );
}
return hr;
};
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);
+ libvlc_video_set_marquee_int(p_md, idx, val);
}
return hr;
}
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);
+ *val = libvlc_video_get_marquee_int(p_md, idx);
}
return hr;
}
LONG i;
HRESULT hr = do_get_int(libvlc_marquee_Position, &i);
-
if(SUCCEEDED(hr))
*val = BSTRFromCStr(CP_UTF8, position_bynumber(i));
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- 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))
+ psz = libvlc_video_get_marquee_string(p_md, libvlc_marquee_Text);
+ if( psz )
*val = BSTRFromCStr(CP_UTF8, psz);
}
return hr;
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
char *psz_text = CStrFromBSTR(CP_UTF8, val);
- libvlc_video_set_marquee_string(p_md, libvlc_marquee_Text,
- psz_text, &ex);
- hr = exception_bridge(&ex);
+ libvlc_video_set_marquee_string(p_md, libvlc_marquee_Text, psz_text);
CoTaskMemFree(psz_text);
}
return hr;
if( NULL == count )
return E_POINTER;
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *count = Instance()->playlist_count(&ex);
- return exception_bridge(&ex);
+ *count = Instance()->playlist_count();
+ return S_OK;
};
STDMETHODIMP VLCPlaylistItems::clear()
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- Instance()->playlist_clear(&ex);
- return exception_bridge(&ex);
+ Instance()->playlist_clear();
+ return S_OK;
};
STDMETHODIMP VLCPlaylistItems::remove(long item)
HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- Instance()->playlist_delete_item(item, &ex);
- hr = exception_bridge(&ex);
+ Instance()->playlist_delete_item(item);
}
return hr;
};
return E_POINTER;
*count = 0;
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *count = Instance()->playlist_count(&ex);
- return exception_bridge(&ex);
+ *count = Instance()->playlist_count();
+ return S_OK;
};
STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying)
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
*isPlaying = varbool( libvlc_media_player_is_playing(p_md) );
- libvlc_exception_clear(&ex);
}
return hr;
};
HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
char *psz_uri = NULL;
if( SysStringLen(Instance()->getBaseURL()) > 0 )
{
}
*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);
CoTaskMemFree(psz_uri);
if( psz_name ) /* XXX Do we even need to check? */
CoTaskMemFree(psz_name);
- hr = exception_bridge(&ex);
}
return hr;
};
STDMETHODIMP VLCPlaylist::play()
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- Instance()->playlist_play(&ex);
- return exception_bridge(&ex);
+ Instance()->playlist_play();
+ return S_OK;
};
STDMETHODIMP VLCPlaylist::playItem(long item)
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- Instance()->playlist_play_item(item,&ex);
- return exception_bridge(&ex);;
+ Instance()->playlist_play_item(item);
+ return S_OK;
};
STDMETHODIMP VLCPlaylist::togglePause()
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_pause(p_md, &ex);
- hr = exception_bridge(&ex);;
+ libvlc_media_player_pause(p_md);
}
return hr;
};
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 VLCPlaylist::next()
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- Instance()->playlist_next(&ex);
- return exception_bridge(&ex);;
+ Instance()->playlist_next();
+ return S_OK;
};
STDMETHODIMP VLCPlaylist::prev()
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- Instance()->playlist_prev(&ex);
- return exception_bridge(&ex);;
+ Instance()->playlist_prev();
+ return S_OK;
};
STDMETHODIMP VLCPlaylist::clear()
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- Instance()->playlist_clear(&ex);
- return exception_bridge(&ex);;
+ Instance()->playlist_clear();
+ return S_OK;
};
STDMETHODIMP VLCPlaylist::removeItem(long item)
HRESULT hr = getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- Instance()->playlist_delete_item(item, &ex);
- hr = exception_bridge(&ex);;
+ Instance()->playlist_delete_item(item);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *spu = libvlc_video_get_spu(p_md, &ex);
- hr = exception_bridge(&ex);
+ *spu = libvlc_video_get_spu(p_md);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_spu(p_md, spu, &ex);
- hr = exception_bridge(&ex);
+ libvlc_video_set_spu(p_md, spu);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
// get the number of video subtitle available and return it
- *spuNumber = libvlc_video_get_spu_count(p_md, &ex);
- hr = exception_bridge(&ex);
+ *spuNumber = libvlc_video_get_spu_count(p_md);
}
return hr;
};
return E_POINTER;
libvlc_media_player_t* p_md;
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
libvlc_track_description_t *p_spuDesc;
// get subtitles description
- p_spuDesc = libvlc_video_get_spu_description(p_md, &ex);
- hr = exception_bridge(&ex);
- if( FAILED(hr) )
- return hr;
+ p_spuDesc = libvlc_video_get_spu_description(p_md);
+ if( !p_spuDesc )
+ return E_FAIL;
// get the number of available subtitle
- i_limit = libvlc_video_get_spu_count(p_md, &ex);
- hr = exception_bridge(&ex);
- if( FAILED(hr) )
- return hr;
+ i_limit = libvlc_video_get_spu_count(p_md);
+ if( i_limit < 0 )
+ return E_FAIL;
// check if the number given is a good one
if ( ( nameID > ( i_limit -1 ) ) || ( nameID < 0 ) )
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *fullscreen = varbool( libvlc_get_fullscreen(p_md, &ex) );
- hr = exception_bridge(&ex);
+ *fullscreen = varbool( libvlc_get_fullscreen(p_md) );
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_set_fullscreen(p_md, VARIANT_FALSE != fullscreen, &ex);
- hr = exception_bridge(&ex);
+ libvlc_set_fullscreen(p_md, VARIANT_FALSE != fullscreen);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *width = libvlc_video_get_width(p_md, &ex);
- hr = exception_bridge(&ex);
+ *width = libvlc_video_get_width(p_md);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *height = libvlc_video_get_height(p_md, &ex);
- hr = exception_bridge(&ex);
+ *height = libvlc_video_get_height(p_md);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
+ char *psz_aspect = libvlc_video_get_aspect_ratio(p_md);
- char *psz_aspect = libvlc_video_get_aspect_ratio(p_md, &ex);
-
- hr = exception_bridge(&ex);
- if( SUCCEEDED(hr) && NULL != psz_aspect )
+ if( !psz_aspect )
{
*aspect = BSTRFromCStr(CP_UTF8, psz_aspect);
if( NULL == *aspect )
hr = E_OUTOFMEMORY;
- } else if( NULL == psz_aspect) hr = E_OUTOFMEMORY; // strdup("") failed
+ } else if( NULL == psz_aspect)
+ hr = E_OUTOFMEMORY;
free( psz_aspect );
}
return hr;
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
char *psz_aspect = CStrFromBSTR(CP_UTF8, aspect);
- if( NULL == psz_aspect )
+ if( !psz_aspect )
{
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);
- hr = exception_bridge(&ex);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- *spu = libvlc_video_get_spu(p_md, &ex);
- hr = exception_bridge(&ex);
+ *spu = libvlc_video_get_spu(p_md);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_spu(p_md, spu, &ex);
- hr = exception_bridge(&ex);
+ libvlc_video_set_spu(p_md, spu);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- char *psz_geometry = libvlc_video_get_crop_geometry(p_md, &ex);
-
- hr = exception_bridge(&ex);
- if( SUCCEEDED(&ex) && NULL != psz_geometry )
+ char *psz_geometry = libvlc_video_get_crop_geometry(p_md);
+ if( !psz_geometry )
{
*geometry = BSTRFromCStr(CP_UTF8, psz_geometry);
- if( NULL == geometry ) hr = E_OUTOFMEMORY;
- } else if( NULL == psz_geometry ) hr = E_OUTOFMEMORY;
+ if( !geometry )
+ hr = E_OUTOFMEMORY;
+ } else if( !psz_geometry )
+ hr = E_OUTOFMEMORY;
free( psz_geometry );
}
return hr;
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
char *psz_geometry = CStrFromBSTR(CP_UTF8, geometry);
- if( NULL == psz_geometry )
+ if( !psz_geometry )
{
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);
- hr = exception_bridge(&ex);
}
return hr;
};
libvlc_media_player_t *p_md;
HRESULT hr = getMD(&p_md);
-
if( SUCCEEDED(hr) )
{
*page = libvlc_video_get_teletext(p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_video_set_teletext(p_md, page, &ex);
- hr = exception_bridge(&ex);
+ libvlc_video_set_teletext(p_md, page);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
static int uniqueId = 0;
TCHAR path[MAX_PATH+1];
return E_FAIL;
/* take snapshot into file */
- libvlc_video_take_snapshot(p_md, psz_filepath, 0, 0, &ex);
- hr = exception_bridge(&ex);
- if( SUCCEEDED(hr) )
+ if( libvlc_video_take_snapshot(p_md, 0, psz_filepath, 0, 0) == 0 )
{
/* open snapshot file */
HANDLE snapPic = LoadImage(NULL, filepath, IMAGE_BITMAP, 0, 0,
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_toggle_fullscreen(p_md, &ex);
- hr = exception_bridge(&ex);
+ libvlc_toggle_fullscreen(p_md);
}
return hr;
};
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_toggle_teletext(p_md, &ex);
- hr = exception_bridge(&ex);
+ libvlc_toggle_teletext(p_md);
}
return hr;
};
return object_get(obj,_p_vlcdeint);
}
-
/****************************************************************************/
HRESULT VLCLogo::do_put_int(unsigned idx, LONG val)
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);
+ libvlc_video_set_logo_int(p_md, idx, val);
}
return hr;
}
HRESULT hr = getMD(&p_md);
if( SUCCEEDED(hr) )
{
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
- *val = libvlc_video_get_logo_int(p_md, idx, &ex);
- hr = exception_bridge(&ex);
+ *val = libvlc_video_get_logo_int(p_md, idx);
}
return hr;
}
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);
+ libvlc_video_set_logo_string(p_md, libvlc_logo_file, n);
}
CoTaskMemFree(n);
return E_POINTER;
*seconds = _p_instance->getStartTime();
-
return S_OK;
};
STDMETHODIMP VLCControl2::put_StartTime(long seconds)
{
_p_instance->setStartTime(seconds);
-
- return NOERROR;
+ return S_OK;
};
STDMETHODIMP VLCControl2::get_VersionInfo(BSTR *version)
*isVisible = varbool( _p_instance->getVisible() );
- return NOERROR;
+ return S_OK;
};
STDMETHODIMP VLCControl2::put_Visible(VARIANT_BOOL isVisible)
{
_p_instance->setVisible(isVisible != VARIANT_FALSE);
-
- return NOERROR;
+ return S_OK;
};
STDMETHODIMP VLCControl2::get_Volume(long *volume)
return E_POINTER;
*volume = _p_instance->getVolume();
- return NOERROR;
+ return S_OK;
};
STDMETHODIMP VLCControl2::put_Volume(long volume)
{
_p_instance->setVolume(volume);
- return NOERROR;
+ return S_OK;
};
STDMETHODIMP VLCControl2::get_BackColor(OLE_COLOR *backcolor)
return E_POINTER;
*backcolor = _p_instance->getBackColor();
- return NOERROR;
+ return S_OKs;
};
STDMETHODIMP VLCControl2::put_BackColor(OLE_COLOR backcolor)
{
_p_instance->setBackColor(backcolor);
- return NOERROR;
+ return S_OK;
};
STDMETHODIMP VLCControl2::get_audio(IVLCAudio** obj)