* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#include "libvlc_internal.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <vlc/libvlc.h>
+#include <vlc/libvlc_media.h>
+#include <vlc/libvlc_media_player.h>
+#include <vlc_common.h>
#include <vlc_input.h>
#include <vlc_aout.h>
+#include "libvlc_internal.h"
+#include "media_player_internal.h"
/*
* Remember to release the returned aout_instance_t since it is locked at
p_previous = p_actual;
}
}
- p_actual->psz_name = strdup( module_get_name( p_module, false ) );
+ p_actual->psz_name = strdup( module_get_object( p_module ) );
p_actual->psz_description = strdup( module_get_name( p_module, true ) );
p_actual->p_next = NULL;
if( p_previous != p_actual ) /* not first item */
aout_instance_t *p_aout = GetAOut( p_instance, p_e );
if( p_aout )
{
- vlc_value_t val;
- int i_ret = -1;
-
- val.i_int = (int) device_type;
- i_ret = var_Set( p_aout, "audio-device", val );
- if( i_ret < 0 )
- {
+ if( var_SetInteger( p_aout, "audio-device", device_type ) < 0 )
libvlc_exception_raise( p_e, "Failed setting audio device" );
- vlc_object_release( p_aout );
- return;
- }
-
vlc_object_release( p_aout );
}
}
{
VLC_UNUSED(p_e);
- aout_VolumeMute( p_instance->p_libvlc_int, NULL );
+ aout_ToggleMute( p_instance->p_libvlc_int, NULL );
}
int libvlc_audio_get_mute( libvlc_instance_t *p_instance,
libvlc_exception_t *p_e )
{
- /*
- * If the volume level is 0, then the channel is muted
- */
- audio_volume_t i_volume;
-
- i_volume = libvlc_audio_get_volume(p_instance, p_e);
- if ( i_volume == 0 )
- return true;
- return false;
+ return (libvlc_audio_get_volume(p_instance, p_e) == 0);
}
void libvlc_audio_set_mute( libvlc_instance_t *p_instance, int mute,
{
if ( mute ^ libvlc_audio_get_mute( p_instance, p_e ) )
{
- aout_VolumeMute( p_instance->p_libvlc_int, NULL );
+ aout_ToggleMute( p_instance->p_libvlc_int, NULL );
}
}
libvlc_exception_t *p_e )
{
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
- vlc_value_t val_list;
+ int i_track_count;
if( !p_input_thread )
return -1;
- var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL );
+ i_track_count = var_CountChoices( p_input_thread, "audio-es" );
+
vlc_object_release( p_input_thread );
- return val_list.p_list->i_count;
+ return i_track_count;
}
/*****************************************************************************
var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL );
for( i = 0; i < val_list.p_list->i_count; i++ )
{
- vlc_value_t track_val = val_list.p_list->p_values[i];
- if( track_val.i_int == val.i_int )
+ if( val_list.p_list->p_values[i].i_int == val.i_int )
{
i_track = i;
break;
- }
+ }
}
+ var_FreeList( &val_list, NULL );
vlc_object_release( p_input_thread );
return i_track;
}
if( (i_track < 0) && (i_track > val_list.p_list->i_count) )
{
libvlc_exception_raise( p_e, "Audio track out of range" );
- vlc_object_release( p_input_thread );
- return;
+ goto end;
}
newval = val_list.p_list->p_values[i_track];
i_ret = var_Set( p_input_thread, "audio-es", newval );
if( i_ret < 0 )
- {
libvlc_exception_raise( p_e, "Setting audio track failed" );
- }
+
+end:
+ var_FreeList( &val_list, NULL );
vlc_object_release( p_input_thread );
}