]> git.sesse.net Git - vlc/blobdiff - modules/access/cdda.c
Fix UIC compilation.
[vlc] / modules / access / cdda.c
index 6c51cb234a1ceb53aecfb6bed262b5abe8255cbe..e23e91f175c162c3f048f274e6d71d76b9d46443 100644 (file)
  * Preamble
  *****************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 #include <vlc_input.h>
 #include <vlc_access.h>
+#include <vlc_meta.h>
 
 #include <vlc_codecs.h> /* For WAVEHEADER */
 #include "vcd/cdrom.h"
@@ -149,7 +154,7 @@ static int Open( vlc_object_t *p_this )
         psz_name = var_CreateGetString( p_this, "cd-audio" );
         if( !psz_name || !*psz_name )
         {
-            if( psz_name ) free( psz_name );
+            free( psz_name );
             return VLC_EGENERIC;
         }
     }
@@ -380,6 +385,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
         case ACCESS_GET_META:
         case ACCESS_SET_SEEKPOINT:
         case ACCESS_SET_PRIVATE_ID_STATE:
+        case ACCESS_GET_CONTENT_TYPE:
             return VLC_EGENERIC;
 
         default:
@@ -412,9 +418,7 @@ static int GetTracks( access_t *p_access,
     }
 
     p_item_in_category = playlist_ItemToNode( p_playlist, p_parent, VLC_FALSE );
-    vlc_mutex_lock( &p_playlist->object_lock );
     playlist_ItemSetName( p_parent, "Audio CD" );
-    vlc_mutex_unlock( &p_playlist->object_lock );
     var_SetInteger( p_playlist, "item-change", p_parent->p_input->i_id );
 
 #ifdef HAVE_LIBCDDB
@@ -424,9 +428,7 @@ static int GetTracks( access_t *p_access,
         if( cddb_disc_get_title( p_sys->p_disc ) )
         {
             const char *psz_name = cddb_disc_get_title( p_sys->p_disc );
-            vlc_mutex_lock( &p_playlist->object_lock );
             playlist_ItemSetName( p_parent, psz_name );
-            vlc_mutex_unlock( &p_playlist->object_lock );
             var_SetInteger( p_playlist, "item-change",
                             p_parent->p_input->i_id );
         }
@@ -471,33 +473,31 @@ static int GetTracks( access_t *p_access,
         /* If we have CDDB info, change the name */
         if( p_sys->p_disc )
         {
-            const char *psz_result;
             cddb_track_t *t = cddb_disc_get_track( p_sys->p_disc, i );
             if( t!= NULL )
             {
                 if( cddb_track_get_title( t )  != NULL )
                 {
-                    input_ItemAddInfo( p_input_item, _(VLC_META_INFO_CAT),
-                                            _(VLC_META_TITLE),
-                                            "%s", cddb_track_get_title( t ) );
-                    if( p_input_item->psz_name )
-                        free( p_input_item->psz_name );
+                    free( p_input_item->psz_name );
                     p_input_item->psz_name = strdup( cddb_track_get_title( t ) );
+                    input_item_SetTitle( p_input_item, cddb_track_get_title( t ) );
                 }
-                psz_result = cddb_track_get_artist( t );
-                if( psz_result )
+                if( cddb_track_get_artist( t ) != NULL )
                 {
-                    input_ItemAddInfo( p_input_item, _(VLC_META_INFO_CAT),
-                                       _(VLC_META_ARTIST), "%s", psz_result );
+                    input_item_SetArtist( p_input_item, cddb_track_get_artist( t ) );
                 }
             }
         }
 #endif
-        playlist_BothAddInput( p_playlist, p_input_item, p_item_in_category,
+        int i_ret = playlist_BothAddInput( p_playlist, p_input_item,
+                               p_item_in_category,
                                PLAYLIST_APPEND, PLAYLIST_END, NULL, NULL,
                                VLC_FALSE );
+        vlc_gc_decref( p_input_item );
         free( psz_uri ); free( psz_opt ); free( psz_name );
         free( psz_first ); free( psz_last );
+        if( i_ret != VLC_SUCCESS )
+            return VLC_EGENERIC;
     }
     return VLC_SUCCESS;
 }