]> git.sesse.net Git - vlc/blobdiff - lib/audio.c
fourcc: add NV24 semiplanar Y/UV 4:4:4 (partial)
[vlc] / lib / audio.c
index 0d3fcce92ef2cdda29abc73c756bbe0812fd70b4..d125f5e714a77da9adb37c4c3a915d12cd79f424 100644 (file)
@@ -135,7 +135,7 @@ libvlc_audio_output_device_list_get( libvlc_instance_t *p_instance,
                                      const char *aout )
 {
     char varname[32];
-    if( (size_t)snprintf( varname, sizeof(varname), "%s-output-device", aout )
+    if( (size_t)snprintf( varname, sizeof(varname), "%s-audio-device", aout )
                                                            >= sizeof(varname) )
         return NULL;
 
@@ -217,33 +217,16 @@ void libvlc_audio_output_device_set( libvlc_media_player_t *mp,
     free( psz_config_name );
 }
 
-/*****************************************************************************
- * libvlc_audio_output_get_device_type : Get the current audio device type
- *****************************************************************************/
 int libvlc_audio_output_get_device_type( libvlc_media_player_t *mp )
 {
-    audio_output_t *p_aout = GetAOut( mp );
-    if( p_aout )
-    {
-        int i_device_type = var_GetInteger( p_aout, "audio-device" );
-        vlc_object_release( p_aout );
-        return i_device_type;
-    }
+    (void) mp;
     return libvlc_AudioOutputDevice_Error;
 }
 
-/*****************************************************************************
- * libvlc_audio_output_set_device_type : Set the audio device type
- *****************************************************************************/
 void libvlc_audio_output_set_device_type( libvlc_media_player_t *mp,
                                           int device_type )
 {
-    audio_output_t *p_aout = GetAOut( mp );
-    if( !p_aout )
-        return;
-    if( var_SetInteger( p_aout, "audio-device", device_type ) < 0 )
-        libvlc_printerr( "Error setting audio device" );
-    vlc_object_release( p_aout );
+    (void) mp; (void) device_type;
 }
 
 void libvlc_audio_toggle_mute( libvlc_media_player_t *mp )
@@ -341,33 +324,12 @@ libvlc_track_description_t *
 int libvlc_audio_get_track( libvlc_media_player_t *p_mi )
 {
     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
-    vlc_value_t val_list;
-    vlc_value_t val;
-    int i_track = -1;
-    int i;
-
     if( !p_input_thread )
         return -1;
 
-    if( var_Get( p_input_thread, "audio-es", &val ) < 0 )
-    {
-        vlc_object_release( p_input_thread );
-        libvlc_printerr( "Audio track information not found" );
-        return -1;
-    }
-
-    var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL );
-    for( i = 0; i < val_list.p_list->i_count; i++ )
-    {
-        if( val_list.p_list->p_values[i].i_int == val.i_int )
-        {
-            i_track = i;
-            break;
-        }
-    }
-    var_FreeList( &val_list, NULL );
+    int id = var_GetInteger( p_input_thread, "audio-es" );
     vlc_object_release( p_input_thread );
-    return i_track;
+    return id;
 }
 
 /*****************************************************************************
@@ -377,30 +339,23 @@ int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track )
 {
     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
     vlc_value_t val_list;
-    vlc_value_t newval;
-    int i_ret;
+    int i_ret = -1;
 
     if( !p_input_thread )
         return -1;
 
     var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL );
-    if( (i_track < 0) || (i_track > val_list.p_list->i_count) )
-    {
-        libvlc_printerr( "Audio track out of range" );
-        i_ret = -1;
-        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 )
+    for( int i = 0; i < val_list.p_list->i_count; i++ )
     {
-        libvlc_printerr( "Audio track out of range" ); /* Race... */
-        i_ret = -1;
-        goto end;
+        if( i_track == val_list.p_list->p_values[i].i_int )
+        {
+            if( var_SetInteger( p_input_thread, "audio-es", i_track ) < 0 )
+                break;
+            i_ret = 0;
+            goto end;
+        }
     }
-    i_ret = 0;
-
+    libvlc_printerr( "Track identifier not found" );
 end:
     var_FreeList( &val_list, NULL );
     vlc_object_release( p_input_thread );