Commit 7bba9f86 authored by Damien Fouilleul's avatar Damien Fouilleul

mozilla: backporting from 0.8.6

parent 12478f83
......@@ -6,7 +6,7 @@ noinst_LIBRARIES = $(noinst_LIBRARIES_mozilla)
MOSTLYCLEANFILES = $(npvlc_DATA)
CLEANFILES = stamp-pic $(BUILT_SOURCES)
EXTRA_DIST = $(DIST_sources) npvlc_rc.rc vlc.r
EXTRA_DIST = $(DIST_sources) install.js npvlc_rc.rc vlc.r
SOURCES_mozilla_common = \
vlcshell.cpp \
......
......@@ -61,6 +61,7 @@ const NPUTF8 * const LibvlcRootNPObject::propertyNames[] =
{
"audio",
"input",
"log",
"playlist",
"video",
"VersionInfo",
......@@ -70,38 +71,54 @@ const int LibvlcRootNPObject::propertyCount = sizeof(LibvlcRootNPObject::propert
enum LibvlcRootNPObjectPropertyIds
{
ID_audio = 0,
ID_input,
ID_playlist,
ID_video,
ID_VersionInfo,
ID_root_audio = 0,
ID_root_input,
ID_root_log,
ID_root_playlist,
ID_root_video,
ID_root_VersionInfo,
};
RuntimeNPObject::InvokeResult LibvlcRootNPObject::getProperty(int index, NPVariant &result)
{
switch( index )
VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);
if( p_plugin )
{
case ID_audio:
OBJECT_TO_NPVARIANT(NPN_RetainObject(audioObj), result);
return INVOKERESULT_NO_ERROR;
case ID_input:
OBJECT_TO_NPVARIANT(NPN_RetainObject(inputObj), result);
return INVOKERESULT_NO_ERROR;
case ID_playlist:
OBJECT_TO_NPVARIANT(NPN_RetainObject(playlistObj), result);
return INVOKERESULT_NO_ERROR;
case ID_video:
OBJECT_TO_NPVARIANT(NPN_RetainObject(videoObj), result);
return INVOKERESULT_NO_ERROR;
case ID_VersionInfo:
NPUTF8 *versionStr = NULL;
versionStr = strdup( VLC_Version() );
if (!versionStr)
return INVOKERESULT_GENERIC_ERROR;
STRINGZ_TO_NPVARIANT(versionStr, result);
return INVOKERESULT_NO_ERROR;
switch( index )
{
case ID_root_audio:
OBJECT_TO_NPVARIANT(NPN_RetainObject(audioObj), result);
return INVOKERESULT_NO_ERROR;
case ID_root_input:
OBJECT_TO_NPVARIANT(NPN_RetainObject(inputObj), result);
return INVOKERESULT_NO_ERROR;
case ID_root_log:
OBJECT_TO_NPVARIANT(NPN_RetainObject(logObj), result);
return INVOKERESULT_NO_ERROR;
case ID_root_playlist:
OBJECT_TO_NPVARIANT(NPN_RetainObject(playlistObj), result);
return INVOKERESULT_NO_ERROR;
case ID_root_video:
OBJECT_TO_NPVARIANT(NPN_RetainObject(videoObj), result);
return INVOKERESULT_NO_ERROR;
case ID_root_VersionInfo:
{
int len = strlen(VLC_Version());
NPUTF8 *retval =(NPUTF8*)NPN_MemAlloc(len);
if( retval )
{
memcpy(retval, VLC_Version(), len);
STRINGN_TO_NPVARIANT(retval, len, result);
}
else
{
NULL_TO_NPVARIANT(result);
}
return INVOKERESULT_NO_ERROR;
}
default:
;
}
}
return INVOKERESULT_GENERIC_ERROR;
}
......@@ -115,7 +132,7 @@ const int LibvlcRootNPObject::methodCount = sizeof(LibvlcRootNPObject::methodNam
enum LibvlcRootNPObjectMethodIds
{
ID_version,
ID_root_versionInfo,
};
RuntimeNPObject::InvokeResult LibvlcRootNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result)
......@@ -128,21 +145,25 @@ RuntimeNPObject::InvokeResult LibvlcRootNPObject::invoke(int index, const NPVari
switch( index )
{
case ID_version:
case ID_root_versionInfo:
if( argCount == 0 )
{
NPUTF8 *versionStr = NULL;
versionStr = strdup( VLC_Version() );
if (!versionStr)
return INVOKERESULT_GENERIC_ERROR;
STRINGZ_TO_NPVARIANT(versionStr, result);
int len = strlen(VLC_Version());
NPUTF8 *retval =(NPUTF8*)NPN_MemAlloc(len);
if( retval )
{
memcpy(retval, VLC_Version(), len);
STRINGN_TO_NPVARIANT(retval, len, result);
}
else
{
NULL_TO_NPVARIANT(result);
}
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_NO_SUCH_METHOD;
default:
return INVOKERESULT_NO_SUCH_METHOD;
;
}
}
return INVOKERESULT_GENERIC_ERROR;
......@@ -162,8 +183,8 @@ const int LibvlcAudioNPObject::propertyCount = sizeof(LibvlcAudioNPObject::prope
enum LibvlcAudioNPObjectPropertyIds
{
ID_mute,
ID_volume,
ID_audio_mute,
ID_audio_volume,
};
RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVariant &result)
......@@ -176,7 +197,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
switch( index )
{
case ID_mute:
case ID_audio_mute:
{
vlc_bool_t muted = libvlc_audio_get_mute(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
......@@ -188,7 +209,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
BOOLEAN_TO_NPVARIANT(muted, result);
return INVOKERESULT_NO_ERROR;
}
case ID_volume:
case ID_audio_volume:
{
int volume = libvlc_audio_get_volume(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
......@@ -200,6 +221,8 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
INT32_TO_NPVARIANT(volume, result);
return INVOKERESULT_NO_ERROR;
}
default:
;
}
}
return INVOKERESULT_GENERIC_ERROR;
......@@ -215,7 +238,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
switch( index )
{
case ID_mute:
case ID_audio_mute:
if( NPVARIANT_IS_BOOLEAN(value) )
{
libvlc_audio_set_mute(p_plugin->getVLC(),
......@@ -229,7 +252,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_INVALID_VALUE;
case ID_volume:
case ID_audio_volume:
if( isNumberValue(value) )
{
libvlc_audio_set_volume(p_plugin->getVLC(),
......@@ -243,6 +266,8 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_INVALID_VALUE;
default:
;
}
}
return INVOKERESULT_GENERIC_ERROR;
......@@ -257,7 +282,7 @@ const int LibvlcAudioNPObject::methodCount = sizeof(LibvlcAudioNPObject::methodN
enum LibvlcAudioNPObjectMethodIds
{
ID_togglemute,
ID_audio_togglemute,
};
RuntimeNPObject::InvokeResult LibvlcAudioNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result)
......@@ -270,7 +295,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::invoke(int index, const NPVar
switch( index )
{
case ID_togglemute:
case ID_audio_togglemute:
if( argCount == 0 )
{
libvlc_audio_toggle_mute(p_plugin->getVLC(), &ex);
......@@ -288,7 +313,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::invoke(int index, const NPVar
}
return INVOKERESULT_NO_SUCH_METHOD;
default:
return INVOKERESULT_NO_SUCH_METHOD;
;
}
}
return INVOKERESULT_GENERIC_ERROR;
......@@ -313,13 +338,13 @@ const int LibvlcInputNPObject::propertyCount = sizeof(LibvlcInputNPObject::prope
enum LibvlcInputNPObjectPropertyIds
{
ID_length,
ID_position,
ID_time,
ID_state,
ID_rate,
ID_fps,
ID_hasvout,
ID_input_length,
ID_input_position,
ID_input_time,
ID_input_state,
ID_input_rate,
ID_input_fps,
ID_input_hasvout,
};
RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVariant &result)
......@@ -333,7 +358,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
{
if( index != ID_state )
if( index != ID_input_state )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
......@@ -349,7 +374,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
switch( index )
{
case ID_length:
case ID_input_length:
{
double val = (double)libvlc_input_get_length(p_input, &ex);
libvlc_input_free(p_input);
......@@ -362,7 +387,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
DOUBLE_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR;
}
case ID_position:
case ID_input_position:
{
double val = libvlc_input_get_position(p_input, &ex);
libvlc_input_free(p_input);
......@@ -375,7 +400,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
DOUBLE_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR;
}
case ID_time:
case ID_input_time:
{
double val = (double)libvlc_input_get_time(p_input, &ex);
libvlc_input_free(p_input);
......@@ -388,7 +413,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
DOUBLE_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR;
}
case ID_state:
case ID_input_state:
{
int val = libvlc_input_get_state(p_input, &ex);
libvlc_input_free(p_input);
......@@ -401,7 +426,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
INT32_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR;
}
case ID_rate:
case ID_input_rate:
{
float val = libvlc_input_get_rate(p_input, &ex);
libvlc_input_free(p_input);
......@@ -414,7 +439,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
DOUBLE_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR;
}
case ID_fps:
case ID_input_fps:
{
double val = libvlc_input_get_fps(p_input, &ex);
libvlc_input_free(p_input);
......@@ -427,7 +452,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
DOUBLE_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR;
}
case ID_hasvout:
case ID_input_hasvout:
{
vlc_bool_t val = libvlc_input_has_vout(p_input, &ex);
libvlc_input_free(p_input);
......@@ -440,6 +465,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
BOOLEAN_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR;
}
default:
;
}
libvlc_input_free(p_input);
}
......@@ -464,7 +491,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
switch( index )
{
case ID_position:
case ID_input_position:
{
if( ! NPVARIANT_IS_DOUBLE(value) )
{
......@@ -483,7 +510,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
}
return INVOKERESULT_NO_ERROR;
}
case ID_time:
case ID_input_time:
{
vlc_int64_t val;
if( NPVARIANT_IS_INT32(value) )
......@@ -506,7 +533,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
}
return INVOKERESULT_NO_ERROR;
}
case ID_rate:
case ID_input_rate:
{
float val;
if( NPVARIANT_IS_INT32(value) )
......@@ -529,6 +556,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
}
return INVOKERESULT_NO_ERROR;
}
default:
;
}
libvlc_input_free(p_input);
}
......@@ -559,93 +588,99 @@ const int LibvlcMessageNPObject::propertyCount = sizeof(LibvlcMessageNPObject::p
enum LibvlcMessageNPObjectPropertyIds
{
ID_severity,
ID_type,
ID_name,
ID_header,
ID_message,
ID_message_severity,
ID_message_type,
ID_message_name,
ID_message_header,
ID_message_message,
};
RuntimeNPObject::InvokeResult LibvlcMessageNPObject::getProperty(int index, NPVariant &result)
{
switch( index )
VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);
if( p_plugin )
{
case ID_severity:
{
INT32_TO_NPVARIANT(_msg.i_severity, result);
return INVOKERESULT_NO_ERROR;
}
case ID_type:
switch( index )
{
if( _msg.psz_type )
{
int len = strlen(_msg.psz_type);
NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);
if( retval )
{
memcpy(retval, _msg.psz_type, len);
STRINGN_TO_NPVARIANT(retval, len, result);
}
}
else
case ID_message_severity:
{
NULL_TO_NPVARIANT(result);
INT32_TO_NPVARIANT(_msg.i_severity, result);
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_NO_ERROR;
}
case ID_name:
{
if( _msg.psz_name )
case ID_message_type:
{
int len = strlen(_msg.psz_name);
NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);
if( retval )
if( _msg.psz_type )
{
memcpy(retval, _msg.psz_name, len);
STRINGN_TO_NPVARIANT(retval, len, result);
int len = strlen(_msg.psz_type);
NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);
if( retval )
{
memcpy(retval, _msg.psz_type, len);
STRINGN_TO_NPVARIANT(retval, len, result);
}
}
}
else
{
NULL_TO_NPVARIANT(result);
}
return INVOKERESULT_NO_ERROR;
}
case ID_header:
{
if( _msg.psz_header )
{
int len = strlen(_msg.psz_header);
NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);
if( retval )
else
{
memcpy(retval, _msg.psz_header, len);
STRINGN_TO_NPVARIANT(retval, len, result);
NULL_TO_NPVARIANT(result);
}
return INVOKERESULT_NO_ERROR;
}
else
case ID_message_name:
{
NULL_TO_NPVARIANT(result);
if( _msg.psz_name )
{
int len = strlen(_msg.psz_name);
NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);
if( retval )
{
memcpy(retval, _msg.psz_name, len);
STRINGN_TO_NPVARIANT(retval, len, result);
}
}
else
{
NULL_TO_NPVARIANT(result);
}
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_NO_ERROR;
}
case ID_message:
{
if( _msg.psz_message )
case ID_message_header:
{
int len = strlen(_msg.psz_message);
NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);
if( retval )
if( _msg.psz_header )
{
memcpy(retval, _msg.psz_message, len);
STRINGN_TO_NPVARIANT(retval, len, result);
int len = strlen(_msg.psz_header);
NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);
if( retval )
{
memcpy(retval, _msg.psz_header, len);
STRINGN_TO_NPVARIANT(retval, len, result);
}
}
else
{
NULL_TO_NPVARIANT(result);
}
return INVOKERESULT_NO_ERROR;
}
else
case ID_message_message:
{
NULL_TO_NPVARIANT(result);
if( _msg.psz_message )
{
int len = strlen(_msg.psz_message);
NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);
if( retval )
{
memcpy(retval, _msg.psz_message, len);
STRINGN_TO_NPVARIANT(retval, len, result);
}
}
else
{
NULL_TO_NPVARIANT(result);
}
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_NO_ERROR;
default:
;
}
}
return INVOKERESULT_GENERIC_ERROR;
......@@ -662,17 +697,27 @@ const int LibvlcMessageNPObject::methodCount = sizeof(LibvlcMessageNPObject::met
** implementation of libvlc message iterator object
*/
void LibvlcMessageIteratorNPObject::setLog(LibvlcLogNPObject* p_vlclog)
LibvlcMessageIteratorNPObject::LibvlcMessageIteratorNPObject(NPP instance, const NPClass *aClass) :
RuntimeNPObject(instance, aClass),
_p_iter(NULL)
{
_p_vlclog = p_vlclog;
if( p_vlclog->_p_log )
VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);
if( p_plugin )
{
_p_iter = libvlc_log_get_iterator(p_vlclog->_p_log, NULL);
libvlc_log_t *p_log = p_plugin->getLog();
if( p_log )
{
_p_iter = libvlc_log_get_iterator(p_log, NULL);
}
}
else
_p_iter = NULL;
};
LibvlcMessageIteratorNPObject::~LibvlcMessageIteratorNPObject()
{
if( _p_iter )
libvlc_log_iterator_free(_p_iter, NULL);
}
const NPUTF8 * const LibvlcMessageIteratorNPObject::propertyNames[] =
{
"hasNext",
......@@ -682,33 +727,39 @@ const int LibvlcMessageIteratorNPObject::propertyCount = sizeof(LibvlcMessageIte
enum LibvlcMessageIteratorNPObjectPropertyIds
{
ID_hasNext,
ID_messageiterator_hasNext,
};
RuntimeNPObject::InvokeResult LibvlcMessageIteratorNPObject::getProperty(int index, NPVariant &result)
{
switch( index )
VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);
if( p_plugin )
{
case ID_hasNext:
switch( index )
{
if( _p_iter && _p_vlclog->_p_log )
case ID_messageiterator_hasNext:
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
if( _p_iter && p_plugin->getLog() )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
BOOLEAN_TO_NPVARIANT(libvlc_log_iterator_has_next(_p_iter, &ex), result);
if( libvlc_exception_raised(&ex) )
BOOLEAN_TO_NPVARIANT(libvlc_log_iterator_has_next(_p_iter, &ex), result);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
}
else
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
BOOLEAN_TO_NPVARIANT(0, result);
}
return INVOKERESULT_NO_ERROR;
}
else
{
BOOLEAN_TO_NPVARIANT(0, result);
}
return INVOKERESULT_NO_ERROR;
default:
;
}
}
return INVOKERESULT_GENERIC_ERROR;
......@@ -728,7 +779,8 @@ enum LibvlcMessageIteratorNPObjectMethodIds
RuntimeNPObject::InvokeResult LibvlcMessageIteratorNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result)
{
if( _p_iter && _p_vlclog->_p_log )
VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);
if( p_plugin )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
......@@ -738,32 +790,37 @@ RuntimeNPObject::InvokeResult LibvlcMessageIteratorNPObject::invoke(int index, c
case ID_messageiterator_next:
if( argCount == 0 )
{
struct libvlc_log_message_t buffer;
if( _p_iter && p_plugin->getLog() )
{
struct libvlc_log_message_t buffer;
buffer.sizeof_msg = sizeof(buffer);
buffer.sizeof_msg = sizeof(buffer);
libvlc_log_iterator_next(_p_iter, &buffer, &ex);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
else
{
LibvlcMessageNPObject* message =
static_cast<LibvlcMessageNPObject*>(NPN_CreateObject(_instance, RuntimeNPClass<LibvlcMessageNPObject>::getClass()));
if( message )
libvlc_log_iterator_next(_p_iter, &buffer, &ex);
if( libvlc_exception_raised(&ex) )
{
message->setMessage(buffer);
OBJECT_TO_NPVARIANT(message, result);
return INVOKERESULT_NO_ERROR;
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
else
{
LibvlcMessageNPObject* message =
static_cast<LibvlcMessageNPObject*>(NPN_CreateObject(_instance, RuntimeNPClass<LibvlcMessageNPObject>::getClass()));
if( message )
{
message->setMessage(buffer);
OBJECT_TO_NPVARIANT(message, result);
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_OUT_OF_MEMORY;
}
return INVOKERESULT_OUT_OF_MEMORY;
}
return INVOKERESULT_GENERIC_ERROR;
}
default:
return INVOKERESULT_NO_SUCH_METHOD;
default:
;
}
}
return INVOKERESULT_GENERIC_ERROR;
......@@ -782,34 +839,40 @@ const int LibvlcMessagesNPObject::propertyCount = sizeof(LibvlcMessagesNPObject:
enum LibvlcMessagesNPObjectPropertyIds
{
ID_count,
ID_messages_count,
};
RuntimeNPObject::InvokeResult LibvlcMessagesNPObject::getProperty(int index, NPVariant &result)
{
switch( index )
VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);
if( p_plugin )
{
case ID_count:
switch( index )
{
libvlc_log_t *p_log = _p_vlclog->_p_log;
if( p_log )
case ID_messages_count:
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_log_t *p_log = p_plugin->getLog();
if( p_log )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
INT32_TO_NPVARIANT(libvlc_log_count(p_log, &ex), result);
if( libvlc_exception_raised(&ex) )
INT32_TO_NPVARIANT(libvlc_log_count(p_log, &ex), result);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
}
else
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
INT32_TO_NPVARIANT(0, result);
}
return INVOKERESULT_NO_ERROR;
}
else
{
INT32_TO_NPVARIANT(0, result);
}
return INVOKERESULT_NO_ERROR;
default:
;
}
}
return INVOKERESULT_GENERIC_ERROR;
......@@ -826,59 +889,75 @@ const int LibvlcMessagesNPObject::methodCount = sizeof(LibvlcMessagesNPObject::m
enum LibvlcMessagesNPObjectMethodIds
{
ID_messages_clear,
ID_iterator,
ID_messages_iterator,
};
RuntimeNPObject::InvokeResult LibvlcMessagesNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result)
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
switch( index )
VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);
if( p_plugin )
{
case ID_messages_clear: