Commit b3958ce9 authored by Rémi Duraffort's avatar Rémi Duraffort

mozilla: fix compilation.

parent 141d72fe
...@@ -259,13 +259,17 @@ LibvlcAudioNPObject::getProperty(int index, NPVariant &result) ...@@ -259,13 +259,17 @@ LibvlcAudioNPObject::getProperty(int index, NPVariant &result)
{ {
case ID_audio_mute: 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); BOOLEAN_TO_NPVARIANT(muted, result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
case ID_audio_volume: 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); INT32_TO_NPVARIANT(volume, result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
...@@ -273,8 +277,7 @@ LibvlcAudioNPObject::getProperty(int index, NPVariant &result) ...@@ -273,8 +277,7 @@ LibvlcAudioNPObject::getProperty(int index, NPVariant &result)
{ {
libvlc_media_player_t *p_md = p_plugin->getMD(&ex); libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
RETURN_ON_EXCEPTION(this,ex); RETURN_ON_EXCEPTION(this,ex);
int track = libvlc_audio_get_track(p_md, &ex); int track = libvlc_audio_get_track(p_md);
RETURN_ON_EXCEPTION(this,ex);
INT32_TO_NPVARIANT(track, result); INT32_TO_NPVARIANT(track, result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
...@@ -283,16 +286,16 @@ LibvlcAudioNPObject::getProperty(int index, NPVariant &result) ...@@ -283,16 +286,16 @@ LibvlcAudioNPObject::getProperty(int index, NPVariant &result)
libvlc_media_player_t *p_md = p_plugin->getMD(&ex); libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
RETURN_ON_EXCEPTION(this,ex); RETURN_ON_EXCEPTION(this,ex);
// get the number of audio track available // get the number of audio track available
int i_track = libvlc_audio_get_track_count(p_md, &ex); int i_track = libvlc_audio_get_track_count(p_md);
RETURN_ON_EXCEPTION(this,ex);
// return it // return it
INT32_TO_NPVARIANT(i_track, result); INT32_TO_NPVARIANT(i_track, result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
case ID_audio_channel: 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); RETURN_ON_EXCEPTION(this,ex);
int channel = libvlc_audio_get_channel(p_md);
INT32_TO_NPVARIANT(channel, result); INT32_TO_NPVARIANT(channel, result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
...@@ -318,7 +321,9 @@ LibvlcAudioNPObject::setProperty(int index, const NPVariant &value) ...@@ -318,7 +321,9 @@ LibvlcAudioNPObject::setProperty(int index, const NPVariant &value)
case ID_audio_mute: case ID_audio_mute:
if( NPVARIANT_IS_BOOLEAN(value) ) 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)); NPVARIANT_TO_BOOLEAN(value));
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
...@@ -326,9 +331,9 @@ LibvlcAudioNPObject::setProperty(int index, const NPVariant &value) ...@@ -326,9 +331,9 @@ LibvlcAudioNPObject::setProperty(int index, const NPVariant &value)
case ID_audio_volume: case ID_audio_volume:
if( isNumberValue(value) ) if( isNumberValue(value) )
{ {
libvlc_audio_set_volume(p_plugin->getVLC(), libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
numberValue(value), &ex);
RETURN_ON_EXCEPTION(this,ex); RETURN_ON_EXCEPTION(this,ex);
libvlc_audio_set_volume(p_md, numberValue(value));
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
return INVOKERESULT_INVALID_VALUE; return INVOKERESULT_INVALID_VALUE;
...@@ -337,17 +342,16 @@ LibvlcAudioNPObject::setProperty(int index, const NPVariant &value) ...@@ -337,17 +342,16 @@ LibvlcAudioNPObject::setProperty(int index, const NPVariant &value)
{ {
libvlc_media_player_t *p_md = p_plugin->getMD(&ex); libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
RETURN_ON_EXCEPTION(this,ex); RETURN_ON_EXCEPTION(this,ex);
libvlc_audio_set_track(p_md, numberValue(value), &ex); libvlc_audio_set_track(p_md, numberValue(value));
RETURN_ON_EXCEPTION(this,ex);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
return INVOKERESULT_INVALID_VALUE; return INVOKERESULT_INVALID_VALUE;
case ID_audio_channel: case ID_audio_channel:
if( isNumberValue(value) ) if( isNumberValue(value) )
{ {
libvlc_audio_set_channel(p_plugin->getVLC(), libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
numberValue(value), &ex);
RETURN_ON_EXCEPTION(this,ex); RETURN_ON_EXCEPTION(this,ex);
libvlc_audio_set_channel(p_md, numberValue(value));
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
return INVOKERESULT_INVALID_VALUE; return INVOKERESULT_INVALID_VALUE;
...@@ -387,7 +391,9 @@ LibvlcAudioNPObject::invoke(int index, const NPVariant *args, ...@@ -387,7 +391,9 @@ LibvlcAudioNPObject::invoke(int index, const NPVariant *args,
case ID_audio_togglemute: case ID_audio_togglemute:
if( argCount == 0 ) 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); VOID_TO_NPVARIANT(result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
...@@ -404,14 +410,12 @@ LibvlcAudioNPObject::invoke(int index, const NPVariant *args, ...@@ -404,14 +410,12 @@ LibvlcAudioNPObject::invoke(int index, const NPVariant *args,
RETURN_ON_EXCEPTION(this,ex); RETURN_ON_EXCEPTION(this,ex);
/* get tracks description */ /* get tracks description */
p_trackDesc = libvlc_audio_get_track_description(p_md, &ex); p_trackDesc = libvlc_audio_get_track_description(p_md);
RETURN_ON_EXCEPTION(this,ex);
if( !p_trackDesc ) if( !p_trackDesc )
return INVOKERESULT_GENERIC_ERROR; return INVOKERESULT_GENERIC_ERROR;
/* get the number of track available */ /* get the number of track available */
i_limit = libvlc_audio_get_track_count(p_md, &ex); i_limit = libvlc_audio_get_track_count(p_md);
RETURN_ON_EXCEPTION(this,ex);
/* check if a number is given by the user /* check if a number is given by the user
* and get the track number */ * and get the track number */
...@@ -502,22 +506,19 @@ LibvlcInputNPObject::getProperty(int index, NPVariant &result) ...@@ -502,22 +506,19 @@ LibvlcInputNPObject::getProperty(int index, NPVariant &result)
{ {
case ID_input_length: case ID_input_length:
{ {
double val = (double)libvlc_media_player_get_length(p_md, &ex); double val = (double)libvlc_media_player_get_length(p_md);
RETURN_ON_EXCEPTION(this,ex);
DOUBLE_TO_NPVARIANT(val, result); DOUBLE_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
case ID_input_position: case ID_input_position:
{ {
double val = libvlc_media_player_get_position(p_md, &ex); double val = libvlc_media_player_get_position(p_md);
RETURN_ON_EXCEPTION(this,ex);
DOUBLE_TO_NPVARIANT(val, result); DOUBLE_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
case ID_input_time: case ID_input_time:
{ {
double val = (double)libvlc_media_player_get_time(p_md, &ex); double val = (double)libvlc_media_player_get_time(p_md);
RETURN_ON_EXCEPTION(this,ex);
DOUBLE_TO_NPVARIANT(val, result); DOUBLE_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
...@@ -530,15 +531,13 @@ LibvlcInputNPObject::getProperty(int index, NPVariant &result) ...@@ -530,15 +531,13 @@ LibvlcInputNPObject::getProperty(int index, NPVariant &result)
} }
case ID_input_rate: case ID_input_rate:
{ {
float val = libvlc_media_player_get_rate(p_md, &ex); float val = libvlc_media_player_get_rate(p_md);
RETURN_ON_EXCEPTION(this,ex);
DOUBLE_TO_NPVARIANT(val, result); DOUBLE_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
case ID_input_fps: case ID_input_fps:
{ {
double val = libvlc_media_player_get_fps(p_md, &ex); double val = libvlc_media_player_get_fps(p_md);
RETURN_ON_EXCEPTION(this,ex);
DOUBLE_TO_NPVARIANT(val, result); DOUBLE_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
...@@ -579,8 +578,7 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value) ...@@ -579,8 +578,7 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value)
} }
float val = (float)NPVARIANT_TO_DOUBLE(value); float val = (float)NPVARIANT_TO_DOUBLE(value);
libvlc_media_player_set_position(p_md, val, &ex); libvlc_media_player_set_position(p_md, val);
RETURN_ON_EXCEPTION(this,ex);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
case ID_input_time: case ID_input_time:
...@@ -595,8 +593,7 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value) ...@@ -595,8 +593,7 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value)
return INVOKERESULT_INVALID_VALUE; return INVOKERESULT_INVALID_VALUE;
} }
libvlc_media_player_set_time(p_md, val, &ex); libvlc_media_player_set_time(p_md, val);
RETURN_ON_EXCEPTION(this,ex);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
case ID_input_rate: case ID_input_rate:
...@@ -611,8 +608,7 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value) ...@@ -611,8 +608,7 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value)
return INVOKERESULT_INVALID_VALUE; return INVOKERESULT_INVALID_VALUE;
} }
libvlc_media_player_set_rate(p_md, val, &ex); libvlc_media_player_set_rate(p_md, val);
RETURN_ON_EXCEPTION(this,ex);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
default: default:
...@@ -1267,8 +1263,7 @@ LibvlcSubtitleNPObject::invoke(int index, const NPVariant *args, ...@@ -1267,8 +1263,7 @@ LibvlcSubtitleNPObject::invoke(int index, const NPVariant *args,
libvlc_track_description_t *p_spuDesc; libvlc_track_description_t *p_spuDesc;
/* get subtitles description */ /* get subtitles description */
p_spuDesc = libvlc_video_get_spu_description(p_md, &ex); p_spuDesc = libvlc_video_get_spu_description(p_md);
RETURN_ON_EXCEPTION(this,ex);
if( !p_spuDesc ) if( !p_spuDesc )
return INVOKERESULT_GENERIC_ERROR; return INVOKERESULT_GENERIC_ERROR;
...@@ -1587,8 +1582,7 @@ LibvlcVideoNPObject::invoke(int index, const NPVariant *args, ...@@ -1587,8 +1582,7 @@ LibvlcVideoNPObject::invoke(int index, const NPVariant *args,
{ {
if( argCount == 0 ) if( argCount == 0 )
{ {
libvlc_toggle_teletext(p_md, &ex); libvlc_toggle_teletext(p_md);
RETURN_ON_EXCEPTION(this,ex);
VOID_TO_NPVARIANT(result); VOID_TO_NPVARIANT(result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
......
...@@ -516,7 +516,7 @@ bool VlcPlugin::playlist_select( int idx, libvlc_exception_t *ex ) ...@@ -516,7 +516,7 @@ bool VlcPlugin::playlist_select( int idx, libvlc_exception_t *ex )
libvlc_media_player = NULL; 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 ) if( libvlc_media_player )
{ {
set_player_window(); set_player_window();
...@@ -526,7 +526,7 @@ bool VlcPlugin::playlist_select( int idx, libvlc_exception_t *ex ) ...@@ -526,7 +526,7 @@ bool VlcPlugin::playlist_select( int idx, libvlc_exception_t *ex )
} }
libvlc_media_release( p_m ); libvlc_media_release( p_m );
return !libvlc_exception_raised(ex); return true;
bad_unlock: bad_unlock:
libvlc_media_list_unlock(libvlc_media_list); libvlc_media_list_unlock(libvlc_media_list);
...@@ -578,7 +578,7 @@ bool VlcPlugin::player_has_vout( libvlc_exception_t *ex ) ...@@ -578,7 +578,7 @@ bool VlcPlugin::player_has_vout( libvlc_exception_t *ex )
{ {
bool r = false; bool r = false;
if( playlist_isplaying() ) if( playlist_isplaying() )
r = libvlc_media_player_has_vout(libvlc_media_player, ex); r = libvlc_media_player_has_vout(libvlc_media_player);
return r; return r;
} }
...@@ -900,7 +900,7 @@ void VlcPlugin::redrawToolbar() ...@@ -900,7 +900,7 @@ void VlcPlugin::redrawToolbar()
/* get mute info */ /* 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 ); gcv.foreground = BlackPixel( p_display, 0 );
gc = XCreateGC( p_display, control, GCForeground, &gcv ); gc = XCreateGC( p_display, control, GCForeground, &gcv );
...@@ -968,11 +968,8 @@ void VlcPlugin::redrawToolbar() ...@@ -968,11 +968,8 @@ void VlcPlugin::redrawToolbar()
/* get movie position in % */ /* get movie position in % */
if( playlist_isplaying() ) if( playlist_isplaying() )
{ {
libvlc_exception_t ex;
libvlc_exception_init( &ex );
i_last_position = (int)((window.width-(dst_x+BTN_SPACE))* i_last_position = (int)((window.width-(dst_x+BTN_SPACE))*
libvlc_media_player_get_position(libvlc_media_player,&ex)); libvlc_media_player_get_position(libvlc_media_player));
libvlc_exception_clear( &ex );
} }
if( p_btnTime ) if( p_btnTime )
...@@ -1007,7 +1004,7 @@ vlc_toolbar_clicked_t VlcPlugin::getToolbarButtonClicked( int i_xpos, int i_ypos ...@@ -1007,7 +1004,7 @@ vlc_toolbar_clicked_t VlcPlugin::getToolbarButtonClicked( int i_xpos, int i_ypos
is_playing = playlist_isplaying(); is_playing = playlist_isplaying();
/* get mute info */ /* 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 */ /* is Pause of Play button clicked */
if( (is_playing != 1) && if( (is_playing != 1) &&
......
...@@ -227,12 +227,12 @@ public: ...@@ -227,12 +227,12 @@ public:
void playlist_play(libvlc_exception_t *ex) void playlist_play(libvlc_exception_t *ex)
{ {
if( libvlc_media_player||playlist_select(0,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) void playlist_play_item(int idx,libvlc_exception_t *ex)
{ {
if( playlist_select(idx,ex) ) if( playlist_select(idx,ex) )
libvlc_media_player_play(libvlc_media_player,ex); libvlc_media_player_play(libvlc_media_player);
} }
void playlist_stop() void playlist_stop()
{ {
...@@ -242,17 +242,17 @@ public: ...@@ -242,17 +242,17 @@ public:
void playlist_next(libvlc_exception_t *ex) void playlist_next(libvlc_exception_t *ex)
{ {
if( playlist_select(playlist_index+1,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) void playlist_prev(libvlc_exception_t *ex)
{ {
if( playlist_select(playlist_index-1,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) void playlist_pause(libvlc_exception_t *ex)
{ {
if( libvlc_media_player ) if( libvlc_media_player )
libvlc_media_player_pause(libvlc_media_player,ex); libvlc_media_player_pause(libvlc_media_player);
} }
int playlist_isplaying() int playlist_isplaying()
{ {
......
...@@ -846,7 +846,7 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event ) ...@@ -846,7 +846,7 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
case clicked_Mute: case clicked_Mute:
case clicked_Unmute: case clicked_Unmute:
{ {
libvlc_audio_toggle_mute( p_plugin->getVLC() ); libvlc_audio_toggle_mute( p_md );
} }
break; break;
...@@ -856,14 +856,12 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event ) ...@@ -856,14 +856,12 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
if( p_md ) if( p_md )
{ {
int64_t f_length; int64_t f_length;
f_length = libvlc_media_player_get_length( p_md, &ex ) / 100; f_length = libvlc_media_player_get_length( p_md ) / 100;
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_media_player_set_time( p_md, f_length, &ex ); libvlc_media_player_set_time( p_md, f_length );
libvlc_exception_clear( &ex );
} }
} }
break; break;
......
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