Commit f01a23d5 authored by Jean-Paul Saman's avatar Jean-Paul Saman Committed by Jean-Paul Saman

Fix backporting of mozilla plugin.

parent f38a36b3
......@@ -508,6 +508,38 @@ int libvlc_audio_get_volume( libvlc_instance_t *, libvlc_exception_t * );
*/
void libvlc_audio_set_volume( libvlc_instance_t *, int , libvlc_exception_t *);
/**
* Get current audio track
* \param p_input input instance
* \param p_exception an initialized exception
* \return the audio track (int)
*/
int libvlc_audio_get_track( libvlc_input_t *, libvlc_exception_t * );
/**
* Set current audio track
* \param p_input input instance
* \param i_track the track (int)
* \param p_exception an initialized exception
*/
void libvlc_audio_set_track( libvlc_input_t *, int, libvlc_exception_t * );
/**
* Get current audio channel
* \param p_instance input instance
* \param p_exception an initialized exception
* \return the audio channel (int)
*/
int libvlc_audio_get_channel( libvlc_instance_t *, libvlc_exception_t * );
/**
* Set current audio channel
* \param p_instance input instance
* \param i_channel the audio channel (int)
* \param p_exception an initialized exception
*/
void libvlc_audio_set_channel( libvlc_instance_t *, int, libvlc_exception_t * );
/** @} */
......
......@@ -320,38 +320,41 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
}
return INVOKERESULT_INVALID_VALUE;
case ID_audio_track:
{
int 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;
}
track = libvlc_audio_get_track(p_input, &ex);
libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) )
if( isNumberValue(value) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
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, numberValue(value), &ex);
libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
return INVOKERESULT_NO_ERROR;
libvlc_input_free(p_input);
}
INT32_TO_NPVARIANT(track, result);
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_INVALID_VALUE;
case ID_audio_channel:
{
int channel = libvlc_audio_get_channel(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
if( isNumberValue(value) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
libvlc_audio_set_channel(p_plugin->getVLC(),
numberValue(value), &ex);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
return INVOKERESULT_NO_ERROR;
}
INT32_TO_NPVARIANT(channel, result);
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_INVALID_VALUE;
default:
;
}
......@@ -1772,19 +1775,6 @@ void LibvlcPlaylistNPObject::parseOptions(NPObject *obj, int *i_options, char***
*i_options = nOptions;
*ppsz_options = options;
}
case ID_video_teletext:
{
int i_page = libvlc_video_get_teletext(p_input, &ex);
libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
INT32_TO_NPVARIANT(i_page, result);
return INVOKERESULT_NO_ERROR;
}
}
}
}
......@@ -1809,7 +1799,7 @@ enum LibvlcVideoNPObjectPropertyIds
ID_video_height,
ID_video_width,
ID_video_aspectratio,
ID_video_subtitle
ID_video_subtitle,
ID_video_teletext
};
......@@ -1904,21 +1894,16 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
}
case ID_video_teletext:
{
if( isNumberValue(value) )
int i_page = libvlc_video_get_teletext(p_input, &ex);
libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) )
{
libvlc_video_set_teletext(p_input,
numberValue(value), &ex);
libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
return INVOKERESULT_NO_ERROR;
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
libvlc_input_free(p_input);
return INVOKERESULT_INVALID_VALUE;
INT32_TO_NPVARIANT(i_page, result);
return INVOKERESULT_NO_ERROR;
}
}
libvlc_input_free(p_input);
......@@ -2010,6 +1995,24 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
libvlc_input_free(p_input);
return INVOKERESULT_INVALID_VALUE;
}
case ID_video_teletext:
{
if( isNumberValue(value) )
{
libvlc_video_set_teletext(p_input,
numberValue(value), &ex);
libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
return INVOKERESULT_NO_ERROR;
}
libvlc_input_free(p_input);
return INVOKERESULT_INVALID_VALUE;
}
}
libvlc_input_free(p_input);
}
......
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