From b3958ce98fa87b60a71d3c2ea4b5c969b9570921 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Duraffort?= Date: Sun, 31 Jan 2010 21:32:42 +0100 Subject: [PATCH] mozilla: fix compilation. --- projects/mozilla/control/npolibvlc.cpp | 72 ++++++++++++-------------- projects/mozilla/vlcplugin.cpp | 15 +++--- projects/mozilla/vlcplugin.h | 10 ++-- projects/mozilla/vlcshell.cpp | 8 ++- 4 files changed, 47 insertions(+), 58 deletions(-) diff --git a/projects/mozilla/control/npolibvlc.cpp b/projects/mozilla/control/npolibvlc.cpp index 2efe11688c..801f41e0cf 100644 --- a/projects/mozilla/control/npolibvlc.cpp +++ b/projects/mozilla/control/npolibvlc.cpp @@ -259,13 +259,17 @@ LibvlcAudioNPObject::getProperty(int index, NPVariant &result) { case ID_audio_mute: { - bool muted = libvlc_audio_get_mute(p_plugin->getVLC()); + libvlc_media_player_t *p_md = p_plugin->getMD(&ex); + RETURN_ON_EXCEPTION(this,ex); + bool muted = libvlc_audio_get_mute(p_md); BOOLEAN_TO_NPVARIANT(muted, result); return INVOKERESULT_NO_ERROR; } case ID_audio_volume: { - int volume = libvlc_audio_get_volume(p_plugin->getVLC()); + libvlc_media_player_t *p_md = p_plugin->getMD(&ex); + RETURN_ON_EXCEPTION(this,ex); + int volume = libvlc_audio_get_volume(p_md); INT32_TO_NPVARIANT(volume, result); return INVOKERESULT_NO_ERROR; } @@ -273,8 +277,7 @@ LibvlcAudioNPObject::getProperty(int index, NPVariant &result) { libvlc_media_player_t *p_md = p_plugin->getMD(&ex); RETURN_ON_EXCEPTION(this,ex); - int track = libvlc_audio_get_track(p_md, &ex); - RETURN_ON_EXCEPTION(this,ex); + int track = libvlc_audio_get_track(p_md); INT32_TO_NPVARIANT(track, result); return INVOKERESULT_NO_ERROR; } @@ -283,16 +286,16 @@ LibvlcAudioNPObject::getProperty(int index, NPVariant &result) libvlc_media_player_t *p_md = p_plugin->getMD(&ex); RETURN_ON_EXCEPTION(this,ex); // get the number of audio track available - int i_track = libvlc_audio_get_track_count(p_md, &ex); - RETURN_ON_EXCEPTION(this,ex); + int i_track = libvlc_audio_get_track_count(p_md); // return it INT32_TO_NPVARIANT(i_track, result); return INVOKERESULT_NO_ERROR; } case ID_audio_channel: { - int channel = libvlc_audio_get_channel(p_plugin->getVLC(), &ex); + libvlc_media_player_t *p_md = p_plugin->getMD(&ex); RETURN_ON_EXCEPTION(this,ex); + int channel = libvlc_audio_get_channel(p_md); INT32_TO_NPVARIANT(channel, result); return INVOKERESULT_NO_ERROR; } @@ -318,7 +321,9 @@ LibvlcAudioNPObject::setProperty(int index, const NPVariant &value) case ID_audio_mute: if( NPVARIANT_IS_BOOLEAN(value) ) { - libvlc_audio_set_mute(p_plugin->getVLC(), + libvlc_media_player_t *p_md = p_plugin->getMD(&ex); + RETURN_ON_EXCEPTION(this,ex); + libvlc_audio_set_mute(p_md, NPVARIANT_TO_BOOLEAN(value)); return INVOKERESULT_NO_ERROR; } @@ -326,9 +331,9 @@ LibvlcAudioNPObject::setProperty(int index, const NPVariant &value) case ID_audio_volume: if( isNumberValue(value) ) { - libvlc_audio_set_volume(p_plugin->getVLC(), - numberValue(value), &ex); + libvlc_media_player_t *p_md = p_plugin->getMD(&ex); RETURN_ON_EXCEPTION(this,ex); + libvlc_audio_set_volume(p_md, numberValue(value)); return INVOKERESULT_NO_ERROR; } return INVOKERESULT_INVALID_VALUE; @@ -337,17 +342,16 @@ LibvlcAudioNPObject::setProperty(int index, const NPVariant &value) { libvlc_media_player_t *p_md = p_plugin->getMD(&ex); RETURN_ON_EXCEPTION(this,ex); - libvlc_audio_set_track(p_md, numberValue(value), &ex); - RETURN_ON_EXCEPTION(this,ex); + libvlc_audio_set_track(p_md, numberValue(value)); return INVOKERESULT_NO_ERROR; } return INVOKERESULT_INVALID_VALUE; case ID_audio_channel: if( isNumberValue(value) ) { - libvlc_audio_set_channel(p_plugin->getVLC(), - numberValue(value), &ex); + libvlc_media_player_t *p_md = p_plugin->getMD(&ex); RETURN_ON_EXCEPTION(this,ex); + libvlc_audio_set_channel(p_md, numberValue(value)); return INVOKERESULT_NO_ERROR; } return INVOKERESULT_INVALID_VALUE; @@ -387,7 +391,9 @@ LibvlcAudioNPObject::invoke(int index, const NPVariant *args, case ID_audio_togglemute: if( argCount == 0 ) { - libvlc_audio_toggle_mute(p_plugin->getVLC()); + libvlc_media_player_t *p_md = p_plugin->getMD(&ex); + RETURN_ON_EXCEPTION(this,ex); + libvlc_audio_toggle_mute(p_md); VOID_TO_NPVARIANT(result); return INVOKERESULT_NO_ERROR; } @@ -404,14 +410,12 @@ LibvlcAudioNPObject::invoke(int index, const NPVariant *args, RETURN_ON_EXCEPTION(this,ex); /* get tracks description */ - p_trackDesc = libvlc_audio_get_track_description(p_md, &ex); - RETURN_ON_EXCEPTION(this,ex); + p_trackDesc = libvlc_audio_get_track_description(p_md); if( !p_trackDesc ) return INVOKERESULT_GENERIC_ERROR; /* get the number of track available */ - i_limit = libvlc_audio_get_track_count(p_md, &ex); - RETURN_ON_EXCEPTION(this,ex); + i_limit = libvlc_audio_get_track_count(p_md); /* check if a number is given by the user * and get the track number */ @@ -502,22 +506,19 @@ LibvlcInputNPObject::getProperty(int index, NPVariant &result) { case ID_input_length: { - double val = (double)libvlc_media_player_get_length(p_md, &ex); - RETURN_ON_EXCEPTION(this,ex); + double val = (double)libvlc_media_player_get_length(p_md); DOUBLE_TO_NPVARIANT(val, result); return INVOKERESULT_NO_ERROR; } case ID_input_position: { - double val = libvlc_media_player_get_position(p_md, &ex); - RETURN_ON_EXCEPTION(this,ex); + double val = libvlc_media_player_get_position(p_md); DOUBLE_TO_NPVARIANT(val, result); return INVOKERESULT_NO_ERROR; } case ID_input_time: { - double val = (double)libvlc_media_player_get_time(p_md, &ex); - RETURN_ON_EXCEPTION(this,ex); + double val = (double)libvlc_media_player_get_time(p_md); DOUBLE_TO_NPVARIANT(val, result); return INVOKERESULT_NO_ERROR; } @@ -530,15 +531,13 @@ LibvlcInputNPObject::getProperty(int index, NPVariant &result) } case ID_input_rate: { - float val = libvlc_media_player_get_rate(p_md, &ex); - RETURN_ON_EXCEPTION(this,ex); + float val = libvlc_media_player_get_rate(p_md); DOUBLE_TO_NPVARIANT(val, result); return INVOKERESULT_NO_ERROR; } case ID_input_fps: { - double val = libvlc_media_player_get_fps(p_md, &ex); - RETURN_ON_EXCEPTION(this,ex); + double val = libvlc_media_player_get_fps(p_md); DOUBLE_TO_NPVARIANT(val, result); return INVOKERESULT_NO_ERROR; } @@ -579,8 +578,7 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value) } float val = (float)NPVARIANT_TO_DOUBLE(value); - libvlc_media_player_set_position(p_md, val, &ex); - RETURN_ON_EXCEPTION(this,ex); + libvlc_media_player_set_position(p_md, val); return INVOKERESULT_NO_ERROR; } case ID_input_time: @@ -595,8 +593,7 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value) return INVOKERESULT_INVALID_VALUE; } - libvlc_media_player_set_time(p_md, val, &ex); - RETURN_ON_EXCEPTION(this,ex); + libvlc_media_player_set_time(p_md, val); return INVOKERESULT_NO_ERROR; } case ID_input_rate: @@ -611,8 +608,7 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value) return INVOKERESULT_INVALID_VALUE; } - libvlc_media_player_set_rate(p_md, val, &ex); - RETURN_ON_EXCEPTION(this,ex); + libvlc_media_player_set_rate(p_md, val); return INVOKERESULT_NO_ERROR; } default: @@ -1267,8 +1263,7 @@ LibvlcSubtitleNPObject::invoke(int index, const NPVariant *args, libvlc_track_description_t *p_spuDesc; /* get subtitles description */ - p_spuDesc = libvlc_video_get_spu_description(p_md, &ex); - RETURN_ON_EXCEPTION(this,ex); + p_spuDesc = libvlc_video_get_spu_description(p_md); if( !p_spuDesc ) return INVOKERESULT_GENERIC_ERROR; @@ -1587,8 +1582,7 @@ LibvlcVideoNPObject::invoke(int index, const NPVariant *args, { if( argCount == 0 ) { - libvlc_toggle_teletext(p_md, &ex); - RETURN_ON_EXCEPTION(this,ex); + libvlc_toggle_teletext(p_md); VOID_TO_NPVARIANT(result); return INVOKERESULT_NO_ERROR; } diff --git a/projects/mozilla/vlcplugin.cpp b/projects/mozilla/vlcplugin.cpp index 0028b32be5..4a6b5808fa 100644 --- a/projects/mozilla/vlcplugin.cpp +++ b/projects/mozilla/vlcplugin.cpp @@ -516,7 +516,7 @@ bool VlcPlugin::playlist_select( int idx, libvlc_exception_t *ex ) libvlc_media_player = NULL; } - libvlc_media_player = libvlc_media_player_new_from_media(p_m,ex); + libvlc_media_player = libvlc_media_player_new_from_media(p_m); if( libvlc_media_player ) { set_player_window(); @@ -526,7 +526,7 @@ bool VlcPlugin::playlist_select( int idx, libvlc_exception_t *ex ) } libvlc_media_release( p_m ); - return !libvlc_exception_raised(ex); + return true; bad_unlock: libvlc_media_list_unlock(libvlc_media_list); @@ -578,7 +578,7 @@ bool VlcPlugin::player_has_vout( libvlc_exception_t *ex ) { bool r = false; if( playlist_isplaying() ) - r = libvlc_media_player_has_vout(libvlc_media_player, ex); + r = libvlc_media_player_has_vout(libvlc_media_player); return r; } @@ -900,7 +900,7 @@ void VlcPlugin::redrawToolbar() /* get mute info */ - b_mute = libvlc_audio_get_mute( getVLC() ); + b_mute = libvlc_audio_get_mute( libvlc_media_player ); gcv.foreground = BlackPixel( p_display, 0 ); gc = XCreateGC( p_display, control, GCForeground, &gcv ); @@ -968,11 +968,8 @@ void VlcPlugin::redrawToolbar() /* get movie position in % */ if( playlist_isplaying() ) { - libvlc_exception_t ex; - libvlc_exception_init( &ex ); i_last_position = (int)((window.width-(dst_x+BTN_SPACE))* - libvlc_media_player_get_position(libvlc_media_player,&ex)); - libvlc_exception_clear( &ex ); + libvlc_media_player_get_position(libvlc_media_player)); } if( p_btnTime ) @@ -1007,7 +1004,7 @@ vlc_toolbar_clicked_t VlcPlugin::getToolbarButtonClicked( int i_xpos, int i_ypos is_playing = playlist_isplaying(); /* get mute info */ - b_mute = libvlc_audio_get_mute( getVLC() ); + b_mute = libvlc_audio_get_mute( libvlc_media_player ); /* is Pause of Play button clicked */ if( (is_playing != 1) && diff --git a/projects/mozilla/vlcplugin.h b/projects/mozilla/vlcplugin.h index 950df74d1a..cd98e61898 100644 --- a/projects/mozilla/vlcplugin.h +++ b/projects/mozilla/vlcplugin.h @@ -227,12 +227,12 @@ public: void playlist_play(libvlc_exception_t *ex) { if( libvlc_media_player||playlist_select(0,ex) ) - libvlc_media_player_play(libvlc_media_player,ex); + libvlc_media_player_play(libvlc_media_player); } void playlist_play_item(int idx,libvlc_exception_t *ex) { if( playlist_select(idx,ex) ) - libvlc_media_player_play(libvlc_media_player,ex); + libvlc_media_player_play(libvlc_media_player); } void playlist_stop() { @@ -242,17 +242,17 @@ public: void playlist_next(libvlc_exception_t *ex) { if( playlist_select(playlist_index+1,ex) ) - libvlc_media_player_play(libvlc_media_player,ex); + libvlc_media_player_play(libvlc_media_player); } void playlist_prev(libvlc_exception_t *ex) { if( playlist_select(playlist_index-1,ex) ) - libvlc_media_player_play(libvlc_media_player,ex); + libvlc_media_player_play(libvlc_media_player); } void playlist_pause(libvlc_exception_t *ex) { if( libvlc_media_player ) - libvlc_media_player_pause(libvlc_media_player,ex); + libvlc_media_player_pause(libvlc_media_player); } int playlist_isplaying() { diff --git a/projects/mozilla/vlcshell.cpp b/projects/mozilla/vlcshell.cpp index 5681fbdec3..302bc579c9 100644 --- a/projects/mozilla/vlcshell.cpp +++ b/projects/mozilla/vlcshell.cpp @@ -846,7 +846,7 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event ) case clicked_Mute: case clicked_Unmute: { - libvlc_audio_toggle_mute( p_plugin->getVLC() ); + libvlc_audio_toggle_mute( p_md ); } break; @@ -856,14 +856,12 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event ) if( p_md ) { int64_t f_length; - f_length = libvlc_media_player_get_length( p_md, &ex ) / 100; - libvlc_exception_clear( &ex ); + f_length = libvlc_media_player_get_length( p_md ) / 100; f_length = (float)f_length * ( ((float)i_xPos-4.0 ) / ( ((float)i_width-8.0)/100) ); - libvlc_media_player_set_time( p_md, f_length, &ex ); - libvlc_exception_clear( &ex ); + libvlc_media_player_set_time( p_md, f_length ); } } break; -- 2.39.2