Commit fa4b23dc authored by Jean-Paul Saman's avatar Jean-Paul Saman

Remove excess libvlc_exception_init() onces per exception instance is enough.

Fix #ifdef XP_UNIX && !defined( __APPLE__), it should be #if defined(XP_UNIX) && !defined( __APPLE__)
parent 876516ef
...@@ -191,6 +191,7 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[]) ...@@ -191,6 +191,7 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
libvlc_exception_clear(&ex); libvlc_exception_clear(&ex);
return NPERR_GENERIC_ERROR; return NPERR_GENERIC_ERROR;
} }
libvlc_exception_clear(&ex);
/* /*
** fetch plugin base URL, which is the URL of the page containing the plugin ** fetch plugin base URL, which is the URL of the page containing the plugin
...@@ -579,19 +580,16 @@ void VlcPlugin::redrawToolbar() ...@@ -579,19 +580,16 @@ void VlcPlugin::redrawToolbar()
libvlc_exception_clear( &ex ); libvlc_exception_clear( &ex );
/* get isplaying */ /* get isplaying */
libvlc_exception_init( &ex );
i_playing = libvlc_playlist_isplaying( getVLC(), &ex ); i_playing = libvlc_playlist_isplaying( getVLC(), &ex );
libvlc_exception_clear( &ex ); libvlc_exception_clear( &ex );
/* get mute info */ /* get mute info */
libvlc_exception_init(&ex);
b_mute = libvlc_audio_get_mute( getVLC(), &ex ); b_mute = libvlc_audio_get_mute( getVLC(), &ex );
libvlc_exception_clear( &ex ); libvlc_exception_clear( &ex );
/* get movie position in % */ /* get movie position in % */
if( i_playing == 1 ) if( i_playing == 1 )
{ {
libvlc_exception_init( &ex );
f_position = libvlc_media_player_get_position( p_md, &ex ) * 100; f_position = libvlc_media_player_get_position( p_md, &ex ) * 100;
libvlc_exception_clear( &ex ); libvlc_exception_clear( &ex );
} }
...@@ -698,7 +696,6 @@ vlc_toolbar_clicked_t VlcPlugin::getToolbarButtonClicked( int i_xpos, int i_ypos ...@@ -698,7 +696,6 @@ vlc_toolbar_clicked_t VlcPlugin::getToolbarButtonClicked( int i_xpos, int i_ypos
libvlc_exception_clear( &ex ); libvlc_exception_clear( &ex );
/* get mute info */ /* get mute info */
libvlc_exception_init(&ex);
b_mute = libvlc_audio_get_mute( getVLC(), &ex ); b_mute = libvlc_audio_get_mute( getVLC(), &ex );
libvlc_exception_clear( &ex ); libvlc_exception_clear( &ex );
......
...@@ -182,7 +182,6 @@ int16 NPP_HandleEvent( NPP instance, void * event ) ...@@ -182,7 +182,6 @@ int16 NPP_HandleEvent( NPP instance, void * event )
{ {
/* double click */ /* double click */
libvlc_instance_t *p_vlc = p_plugin->getVLC(); libvlc_instance_t *p_vlc = p_plugin->getVLC();
if( p_vlc ) if( p_vlc )
{ {
if( libvlc_playlist_isplaying(p_vlc, NULL) ) if( libvlc_playlist_isplaying(p_vlc, NULL) )
...@@ -365,7 +364,7 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save ) ...@@ -365,7 +364,7 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save )
NPError NPP_SetWindow( NPP instance, NPWindow* window ) NPError NPP_SetWindow( NPP instance, NPWindow* window )
{ {
#ifdef XP_UNIX && !defined(__APPLE__) #if defined(XP_UNIX) && !defined(__APPLE__)
Window control; Window control;
unsigned int i_control_height = 0, i_control_width = 0; unsigned int i_control_height = 0, i_control_width = 0;
#endif #endif
...@@ -382,7 +381,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window ) ...@@ -382,7 +381,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
/* we should probably show a splash screen here */ /* we should probably show a splash screen here */
return NPERR_NO_ERROR; return NPERR_NO_ERROR;
} }
#ifdef XP_UNIX && !defined(__APPLE__) #if defined(XP_UNIX) && !defined(__APPLE__)
control = p_plugin->getControlWindow(); control = p_plugin->getControlWindow();
#endif #endif
libvlc_instance_t *p_vlc = p_plugin->getVLC(); libvlc_instance_t *p_vlc = p_plugin->getVLC();
...@@ -847,7 +846,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event ) ...@@ -847,7 +846,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex)); fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
libvlc_exception_clear( &ex ); libvlc_exception_clear( &ex );
libvlc_exception_init( &ex );
i_playing = libvlc_playlist_isplaying( p_plugin->getVLC(), &ex ); i_playing = libvlc_playlist_isplaying( p_plugin->getVLC(), &ex );
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex)); fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
...@@ -860,7 +858,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event ) ...@@ -860,7 +858,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
case clicked_Play: case clicked_Play:
case clicked_Pause: case clicked_Pause:
{ {
libvlc_exception_init( &ex );
if( i_playing == 1 ) if( i_playing == 1 )
libvlc_playlist_pause( p_plugin->getVLC(), &ex ); libvlc_playlist_pause( p_plugin->getVLC(), &ex );
else else
...@@ -874,7 +871,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event ) ...@@ -874,7 +871,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
case clicked_Stop: case clicked_Stop:
{ {
libvlc_exception_init( &ex );
libvlc_playlist_stop( p_plugin->getVLC(), &ex ); libvlc_playlist_stop( p_plugin->getVLC(), &ex );
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex)); fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
...@@ -886,7 +882,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event ) ...@@ -886,7 +882,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
{ {
if( (i_playing == 1) && p_md ) if( (i_playing == 1) && p_md )
{ {
libvlc_exception_init( &ex );
libvlc_set_fullscreen( p_md, 1, &ex ); libvlc_set_fullscreen( p_md, 1, &ex );
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex)); fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
...@@ -898,7 +893,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event ) ...@@ -898,7 +893,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
case clicked_Mute: case clicked_Mute:
case clicked_Unmute: case clicked_Unmute:
{ {
libvlc_exception_init( &ex );
libvlc_audio_toggle_mute( p_plugin->getVLC(), &ex ); libvlc_audio_toggle_mute( p_plugin->getVLC(), &ex );
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex)); fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
...@@ -912,14 +906,12 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event ) ...@@ -912,14 +906,12 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
if( p_md ) if( p_md )
{ {
int64_t f_length; int64_t f_length;
libvlc_exception_init( &ex );
f_length = libvlc_media_player_get_length( p_md, &ex ) / 100; f_length = libvlc_media_player_get_length( p_md, &ex ) / 100;
libvlc_exception_clear( &ex ); libvlc_exception_clear( &ex );
f_length = (float)f_length * f_length = (float)f_length *
( ((float)i_xPos-4.0 ) / ( ((float)i_width-8.0)/100) ); ( ((float)i_xPos-4.0 ) / ( ((float)i_width-8.0)/100) );
libvlc_exception_init( &ex );
libvlc_media_player_set_time( p_md, f_length, &ex ); libvlc_media_player_set_time( p_md, f_length, &ex );
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex)); fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
......
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