** Local helper macros and function
*/
#define COUNTNAMES(a,b,c) const int a::b = sizeof(a::c)/sizeof(NPUTF8 *)
-#define RETURN_ON_EXCEPTION(this,ex) \
- do { if( libvlc_exception_raised(&ex) ) \
- { \
- NPN_SetException(this, libvlc_errmsg()); \
- libvlc_exception_clear(&ex); \
- return INVOKERESULT_GENERIC_ERROR; \
- } } while(false)
+#define RETURN_ON_ERROR \
+ do { \
+ NPN_SetException(this, libvlc_errmsg()); \
+ return INVOKERESULT_GENERIC_ERROR; \
+ }while(0)
#define ERROR_EVENT_NOT_FOUND "ERROR: One or more events could not be found."
#define ERROR_API_VERSION "ERROR: NPAPI version not high enough. (Gecko >= 1.9 needed)"
if( !isPluginRunning() )
return INVOKERESULT_GENERIC_ERROR;
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
switch( index )
{
case ID_root_versionInfo:
if( isPluginRunning() )
{
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
if( isPluginRunning() )
{
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
if( isPluginRunning() )
{
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
if( isPluginRunning() )
{
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- if( libvlc_exception_raised(&ex) )
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
{
if( index != ID_input_state )
- {
- NPN_SetException(this, libvlc_errmsg());
- libvlc_exception_clear(&ex);
- return INVOKERESULT_GENERIC_ERROR;
- }
+ RETURN_ON_ERROR;
else
{
/* for input state, return CLOSED rather than an exception */
INT32_TO_NPVARIANT(0, result);
- libvlc_exception_clear(&ex);
return INVOKERESULT_NO_ERROR;
}
}
case ID_input_state:
{
int val = libvlc_media_player_get_state(p_md);
- RETURN_ON_EXCEPTION(this,ex);
INT32_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR;
}
if( isPluginRunning() )
{
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ {
+ NPN_SetException(this, libvlc_errmsg() );
+ return INVOKERESULT_GENERIC_ERROR;
+ }
switch( index )
{
if( isPluginRunning() )
{
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
switch( index )
{
if( isPluginRunning() )
{
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
switch( index )
{
}
int item = p_plugin->playlist_add_extended_untrusted(url, name,
- i_options, const_cast<const char **>(ppsz_options), &ex);
+ i_options, const_cast<const char **>(ppsz_options));
free(url);
free(name);
+ if( item == -1 )
+ RETURN_ON_ERROR;
+
for( int i=0; i< i_options; ++i )
{
free(ppsz_options[i]);
}
free(ppsz_options);
- RETURN_ON_EXCEPTION(this,ex);
INT32_TO_NPVARIANT(item, result);
return INVOKERESULT_NO_ERROR;
}
case ID_playlist_play:
if( argCount == 0 )
{
- p_plugin->playlist_play(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ p_plugin->playlist_play();
VOID_TO_NPVARIANT(result);
return INVOKERESULT_NO_ERROR;
}
case ID_playlist_playItem:
if( (argCount == 1) && isNumberValue(args[0]) )
{
- p_plugin->playlist_play_item(numberValue(args[0]),&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ p_plugin->playlist_play_item(numberValue(args[0]));
VOID_TO_NPVARIANT(result);
return INVOKERESULT_NO_ERROR;
}
case ID_playlist_next:
if( argCount == 0 )
{
- p_plugin->playlist_next(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ p_plugin->playlist_next();
VOID_TO_NPVARIANT(result);
return INVOKERESULT_NO_ERROR;
}
case ID_playlist_prev:
if( argCount == 0 )
{
- p_plugin->playlist_prev(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ p_plugin->playlist_prev();
VOID_TO_NPVARIANT(result);
return INVOKERESULT_NO_ERROR;
}
if( isPluginRunning() )
{
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
if( isPluginRunning() )
{
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
if( isPluginRunning() )
{
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
if( isPluginRunning() )
{
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
if( isPluginRunning() )
{
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
{
if( isNumberValue(value) )
{
- libvlc_video_set_teletext(p_md, numberValue(value), &ex);
- RETURN_ON_EXCEPTION(this,ex);
-
+ libvlc_video_set_teletext(p_md, numberValue(value));
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_INVALID_VALUE;
if( isPluginRunning() )
{
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
return INVOKERESULT_GENERIC_ERROR;
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
case ID_marquee_x:
case ID_marquee_y:
INT32_TO_NPVARIANT(
- libvlc_video_get_marquee_int(p_md, marquee_idx[index], &ex),
+ libvlc_video_get_marquee_int(p_md, marquee_idx[index]),
result );
- RETURN_ON_EXCEPTION(this,ex);
return INVOKERESULT_NO_ERROR;
case ID_marquee_position:
STRINGZ_TO_NPVARIANT( position_bynumber(
- libvlc_video_get_marquee_int(p_md, libvlc_marquee_Position, &ex) ),
+ libvlc_video_get_marquee_int(p_md, libvlc_marquee_Position) ),
result );
- RETURN_ON_EXCEPTION(this,ex);
break;
case ID_marquee_text:
- psz = libvlc_video_get_marquee_string(p_md, libvlc_marquee_Text, &ex);
+ psz = libvlc_video_get_marquee_string(p_md, libvlc_marquee_Text);
if( psz )
{
STRINGZ_TO_NPVARIANT(psz, result);
return INVOKERESULT_GENERIC_ERROR;
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
if( NPVARIANT_IS_INT32( value ) )
{
libvlc_video_set_marquee_int(p_md, marquee_idx[index],
- NPVARIANT_TO_INT32( value ), &ex);
- RETURN_ON_EXCEPTION(this,ex);
+ NPVARIANT_TO_INT32( value ));
return INVOKERESULT_NO_ERROR;
}
break;
!position_byname( NPVARIANT_TO_STRING(value).utf8characters, i ) )
return INVOKERESULT_INVALID_VALUE;
- libvlc_video_set_marquee_int(p_md, libvlc_marquee_Position, i, &ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_video_set_marquee_int(p_md, libvlc_marquee_Position, i);
return INVOKERESULT_NO_ERROR;
case ID_marquee_text:
{
char *psz_text = stringValue( NPVARIANT_TO_STRING( value ) );
libvlc_video_set_marquee_string(p_md, libvlc_marquee_Text,
- psz_text, &ex);
+ psz_text);
free(psz_text);
- RETURN_ON_EXCEPTION(this,ex);
return INVOKERESULT_NO_ERROR;
}
break;
return INVOKERESULT_GENERIC_ERROR;
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
case ID_marquee_enable:
case ID_marquee_disable:
libvlc_video_set_marquee_int(p_md, libvlc_marquee_Enable,
- index!=ID_marquee_disable, &ex);
- RETURN_ON_EXCEPTION(this,ex);
+ index!=ID_marquee_disable);
VOID_TO_NPVARIANT(result);
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_GENERIC_ERROR;
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
case ID_logo_y:
INT32_TO_NPVARIANT(
- libvlc_video_get_logo_int(p_md, logo_idx[index], &ex), result);
-
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_video_get_logo_int(p_md, logo_idx[index]), result);
break;
case ID_logo_position:
STRINGZ_TO_NPVARIANT( position_bynumber(
- libvlc_video_get_logo_int(p_md, libvlc_logo_position, &ex) ),
+ libvlc_video_get_logo_int(p_md, libvlc_logo_position) ),
result );
-
- RETURN_ON_EXCEPTION(this,ex);
break;
default:
return INVOKERESULT_GENERIC_ERROR;
return INVOKERESULT_GENERIC_ERROR;
VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = p_plugin->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
return INVOKERESULT_INVALID_VALUE;
libvlc_video_set_logo_int(p_md, logo_idx[index],
- NPVARIANT_TO_INT32( value ), &ex);
-
- RETURN_ON_EXCEPTION(this,ex);
+ NPVARIANT_TO_INT32( value ));
break;
case ID_logo_position:
!position_byname( NPVARIANT_TO_STRING(value).utf8characters, i ) )
return INVOKERESULT_INVALID_VALUE;
- libvlc_video_set_logo_int(p_md, libvlc_logo_position, i, &ex);
-
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_video_set_logo_int(p_md, libvlc_logo_position, i);
break;
default:
return INVOKERESULT_GENERIC_ERROR;
if( !isPluginRunning() )
return INVOKERESULT_GENERIC_ERROR;
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
- libvlc_media_player_t *p_md = getPrivate<VlcPlugin>()->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = getPrivate<VlcPlugin>()->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{
return INVOKERESULT_GENERIC_ERROR;
libvlc_video_set_logo_int(p_md, libvlc_logo_enable,
- index != ID_logo_disable, &ex);
- RETURN_ON_EXCEPTION(this,ex);
+ index != ID_logo_disable);
VOID_TO_NPVARIANT(result);
break;
}
*h='\0';
- libvlc_video_set_logo_string(p_md, libvlc_logo_file, buf, &ex);
+ libvlc_video_set_logo_string(p_md, libvlc_logo_file, buf);
free( buf );
- RETURN_ON_EXCEPTION(this,ex);
VOID_TO_NPVARIANT(result);
break;
default:
if( !isPluginRunning() )
return INVOKERESULT_GENERIC_ERROR;
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
- libvlc_media_player_t *p_md = getPrivate<VlcPlugin>()->getMD(&ex);
- RETURN_ON_EXCEPTION(this,ex);
+ libvlc_media_player_t *p_md = getPrivate<VlcPlugin>()->getMD();
+ if( !p_md )
+ RETURN_ON_ERROR;
switch( index )
{