Commit d735c0f4 authored by Damien Fouilleul's avatar Damien Fouilleul

- mozilla: most properties in vlc.audio object don't require an active input, be careful jpsaman ;)

parent e8f2c339
...@@ -200,20 +200,11 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari ...@@ -200,20 +200,11 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
switch( index ) switch( index )
{ {
case ID_audio_mute: case ID_audio_mute:
{ {
vlc_bool_t muted = libvlc_audio_get_mute(p_plugin->getVLC(), &ex); vlc_bool_t muted = libvlc_audio_get_mute(p_plugin->getVLC(), &ex);
libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
{ {
NPN_SetException(this, libvlc_exception_get_message(&ex)); NPN_SetException(this, libvlc_exception_get_message(&ex));
...@@ -226,7 +217,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari ...@@ -226,7 +217,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
case ID_audio_volume: case ID_audio_volume:
{ {
int volume = libvlc_audio_get_volume(p_plugin->getVLC(), &ex); int volume = libvlc_audio_get_volume(p_plugin->getVLC(), &ex);
libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
{ {
NPN_SetException(this, libvlc_exception_get_message(&ex)); NPN_SetException(this, libvlc_exception_get_message(&ex));
...@@ -238,6 +228,13 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari ...@@ -238,6 +228,13 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
} }
case ID_audio_track: case ID_audio_track:
{ {
libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
int track = libvlc_audio_get_track(p_input, &ex); int track = libvlc_audio_get_track(p_input, &ex);
libvlc_input_free(p_input); libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
...@@ -252,7 +249,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari ...@@ -252,7 +249,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
case ID_audio_channel: case ID_audio_channel:
{ {
int channel = libvlc_audio_get_channel(p_plugin->getVLC(), &ex); int channel = libvlc_audio_get_channel(p_plugin->getVLC(), &ex);
libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
{ {
NPN_SetException(this, libvlc_exception_get_message(&ex)); NPN_SetException(this, libvlc_exception_get_message(&ex));
...@@ -265,7 +261,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari ...@@ -265,7 +261,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
default: default:
; ;
} }
libvlc_input_free(p_input);
} }
return INVOKERESULT_GENERIC_ERROR; return INVOKERESULT_GENERIC_ERROR;
} }
...@@ -279,14 +274,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const ...@@ -279,14 +274,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
switch( index ) switch( index )
{ {
case ID_audio_mute: case ID_audio_mute:
...@@ -294,7 +281,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const ...@@ -294,7 +281,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
{ {
libvlc_audio_set_mute(p_plugin->getVLC(), libvlc_audio_set_mute(p_plugin->getVLC(),
NPVARIANT_TO_BOOLEAN(value), &ex); NPVARIANT_TO_BOOLEAN(value), &ex);
libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
{ {
NPN_SetException(this, libvlc_exception_get_message(&ex)); NPN_SetException(this, libvlc_exception_get_message(&ex));
...@@ -305,7 +291,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const ...@@ -305,7 +291,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
} }
return INVOKERESULT_INVALID_VALUE; return INVOKERESULT_INVALID_VALUE;
case ID_audio_volume: case ID_audio_volume:
libvlc_input_free(p_input);
if( isNumberValue(value) ) if( isNumberValue(value) )
{ {
libvlc_audio_set_volume(p_plugin->getVLC(), libvlc_audio_set_volume(p_plugin->getVLC(),
...@@ -322,6 +307,13 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const ...@@ -322,6 +307,13 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
case ID_audio_track: case ID_audio_track:
if( isNumberValue(value) ) if( isNumberValue(value) )
{ {
libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
libvlc_audio_set_track(p_input, libvlc_audio_set_track(p_input,
numberValue(value), &ex); numberValue(value), &ex);
libvlc_input_free(p_input); libvlc_input_free(p_input);
...@@ -333,10 +325,8 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const ...@@ -333,10 +325,8 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
} }
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
libvlc_input_free(p_input);
return INVOKERESULT_INVALID_VALUE; return INVOKERESULT_INVALID_VALUE;
case ID_audio_channel: case ID_audio_channel:
libvlc_input_free(p_input);
if( isNumberValue(value) ) if( isNumberValue(value) )
{ {
libvlc_audio_set_channel(p_plugin->getVLC(), libvlc_audio_set_channel(p_plugin->getVLC(),
...@@ -353,7 +343,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const ...@@ -353,7 +343,6 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
default: default:
; ;
} }
libvlc_input_free(p_input);
} }
return INVOKERESULT_GENERIC_ERROR; return INVOKERESULT_GENERIC_ERROR;
} }
......
...@@ -88,7 +88,7 @@ protected: ...@@ -88,7 +88,7 @@ protected:
_instance(instance) _instance(instance)
{ {
_class = const_cast<NPClass *>(aClass); _class = const_cast<NPClass *>(aClass);
//referenceCount = 1; referenceCount = 1;
}; };
virtual ~RuntimeNPObject() {}; virtual ~RuntimeNPObject() {};
......
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