Commit 2ca06f95 authored by Damien Fouilleul's avatar Damien Fouilleul

- src/control: multiple bug fix backport from trunk

parent a13e8bee
...@@ -102,16 +102,7 @@ vlc_bool_t libvlc_audio_get_mute( libvlc_instance_t *p_instance, ...@@ -102,16 +102,7 @@ vlc_bool_t libvlc_audio_get_mute( libvlc_instance_t *p_instance,
void libvlc_audio_set_mute( libvlc_instance_t *p_instance, vlc_bool_t status, void libvlc_audio_set_mute( libvlc_instance_t *p_instance, vlc_bool_t status,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
if ( status ) if ( status ^ libvlc_audio_get_mute( p_instance, p_e ) )
{
/* Check if the volume is already muted */
if (! libvlc_audio_get_volume( p_instance, p_e ) )
{
return;
}
aout_VolumeMute( p_instance->p_vlc, NULL );
}
else
{ {
/* the aout_VolumeMute is a toggle function, so this is enough. */ /* the aout_VolumeMute is a toggle function, so this is enough. */
aout_VolumeMute( p_instance->p_vlc, NULL ); aout_VolumeMute( p_instance->p_vlc, NULL );
...@@ -199,7 +190,7 @@ void libvlc_audio_set_track( libvlc_input_t *p_input, int i_track, ...@@ -199,7 +190,7 @@ void libvlc_audio_set_track( libvlc_input_t *p_input, int i_track,
int i; int i;
if( !p_input_thread ) if( !p_input_thread )
return -1; return;
var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL ); var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL );
for( i = 0; i < val_list.p_list->i_count; i++ ) for( i = 0; i < val_list.p_list->i_count; i++ )
......
...@@ -76,7 +76,6 @@ inline void libvlc_exception_raise( libvlc_exception_t *p_exception, ...@@ -76,7 +76,6 @@ inline void libvlc_exception_raise( libvlc_exception_t *p_exception,
vasprintf( &p_exception->psz_message, psz_format, args ); vasprintf( &p_exception->psz_message, psz_format, args );
va_end( args ); va_end( args );
if( p_exception == NULL ) return;
p_exception->b_raised = 1; p_exception->b_raised = 1;
} }
......
...@@ -92,7 +92,10 @@ unsigned libvlc_log_count( const libvlc_log_t *p_log, libvlc_exception_t *p_e ) ...@@ -92,7 +92,10 @@ unsigned libvlc_log_count( const libvlc_log_t *p_log, libvlc_exception_t *p_e )
int i_start = p_log->p_messages->i_start; int i_start = p_log->p_messages->i_start;
int i_stop = *(p_log->p_messages->pi_stop); int i_stop = *(p_log->p_messages->pi_stop);
return (i_stop - i_start) % VLC_MSG_QSIZE; if( i_stop >= i_start )
return i_stop-i_start;
else
return VLC_MSG_QSIZE-(i_start-i_stop);
} }
RAISEZERO("Invalid log object!"); RAISEZERO("Invalid log object!");
} }
......
...@@ -227,34 +227,45 @@ int libvlc_video_get_width( libvlc_input_t *p_input, ...@@ -227,34 +227,45 @@ int libvlc_video_get_width( libvlc_input_t *p_input,
vlc_bool_t libvlc_input_has_vout( libvlc_input_t *p_input, vlc_bool_t libvlc_input_has_vout( libvlc_input_t *p_input,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
vout_thread_t *p_vout = GetVout( p_input, p_e ); input_thread_t *p_input_thread = GetInput(p_input, p_e);
vlc_bool_t has_vout = VLC_FALSE;
/* GetVout will raise the exception for us */ if( p_input_thread )
if( !p_vout )
{ {
return VLC_FALSE; vout_thread_t *p_vout;
}
p_vout = vlc_object_find( p_input_thread, VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout )
{
has_vout = VLC_TRUE;
vlc_object_release( p_vout ); vlc_object_release( p_vout );
}
return VLC_TRUE; vlc_object_release( p_input_thread );
}
return has_vout;
} }
int libvlc_video_reparent( libvlc_input_t *p_input, libvlc_drawable_t d, int libvlc_video_reparent( libvlc_input_t *p_input, libvlc_drawable_t d,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
vout_thread_t *p_vout = GetVout( p_input, p_e ); vout_thread_t *p_vout = GetVout( p_input, p_e );
if( p_vout )
{
vout_Control( p_vout , VOUT_REPARENT, d); vout_Control( p_vout , VOUT_REPARENT, d);
vlc_object_release( p_vout ); vlc_object_release( p_vout );
}
return 0; return 0;
} }
void libvlc_video_resize( libvlc_input_t *p_input, int width, int height, libvlc_exception_t *p_e ) void libvlc_video_resize( libvlc_input_t *p_input, int width, int height, libvlc_exception_t *p_e )
{ {
vout_thread_t *p_vout = GetVout( p_input, p_e ); vout_thread_t *p_vout = GetVout( p_input, p_e );
if( p_vout )
{
vout_Control( p_vout, VOUT_SET_SIZE, width, height ); vout_Control( p_vout, VOUT_SET_SIZE, width, height );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
}
} }
/* global video settings */ /* global video settings */
......
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