]> git.sesse.net Git - vlc/blobdiff - modules/access/cdda.c
Fix invalid mix of closedir and free on Win32.
[vlc] / modules / access / cdda.c
index d71d5c410295f6449aaec138fcdf248c556c7eee..1d5a11cdbc7003c3f4ab5d08004817e7da5826a8 100644 (file)
@@ -31,6 +31,7 @@
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
+#define _GNU_SOURCE
 #include <stdlib.h>
 
 #include <vlc/vlc.h>
@@ -174,18 +175,7 @@ static int Open( vlc_object_t *p_this )
     free( psz_name );
 
     /* Set up p_access */
-    p_access->pf_read = NULL;
-    p_access->pf_block = Block;
-    p_access->pf_control = Control;
-    p_access->pf_seek = Seek;
-    p_access->info.i_update = 0;
-    p_access->info.i_size = 0;
-    p_access->info.i_pos = 0;
-    p_access->info.b_eof = VLC_FALSE;
-    p_access->info.i_title = 0;
-    p_access->info.i_seekpoint = 0;
-    p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
-    memset( p_sys, 0, sizeof( access_sys_t ) );
+    STANDARD_BLOCK_ACCESS_INIT
     p_sys->vcddev = vcddev;
 
     /* We only do separate items if the whole disc is requested -
@@ -197,10 +187,7 @@ static int Open( vlc_object_t *p_this )
 
    if( p_sys->i_track < 0 && i_mrl_tracknum <= 0 )
    {
-        p_playlist = (playlist_t *) vlc_object_find( p_access,
-                                       VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
-        if( !p_playlist ) return VLC_EGENERIC;
-
+        p_playlist = pl_Yield( p_access );
         if( p_playlist->status.p_item->p_input ==
              ((input_thread_t *)p_access->p_parent)->input.p_item )
             p_item = p_playlist->status.p_item;
@@ -208,7 +195,7 @@ static int Open( vlc_object_t *p_this )
         {
             input_item_t *p_current = ( (input_thread_t*)p_access->p_parent)->
                                          input.p_item;
-            p_item = playlist_LockItemGetByInput( p_playlist, p_current );
+            p_item = playlist_ItemGetByInput( p_playlist, p_current, VLC_FALSE );
 
             if( !p_item )
             {
@@ -428,7 +415,7 @@ static int GetTracks( access_t *p_access,
         return VLC_EGENERIC;
     }
 
-    p_item_in_category = playlist_LockItemToNode( p_playlist, p_parent );
+    p_item_in_category = playlist_ItemToNode( p_playlist, p_parent, VLC_FALSE );
     psz_name = strdup( "Audio CD" );
     vlc_mutex_lock( &p_playlist->object_lock );
     playlist_ItemSetName( p_parent, psz_name );
@@ -483,9 +470,9 @@ static int GetTracks( access_t *p_access,
         p_input_item = input_ItemNewWithType( VLC_OBJECT( p_playlist ),
                                               psz_uri, psz_name, 0, NULL, -1,
                                               ITEM_TYPE_DISC );
-        vlc_input_item_AddOption( p_input_item, psz_first );
-        vlc_input_item_AddOption( p_input_item, psz_last );
-        vlc_input_item_AddOption( p_input_item, psz_opt );
+        input_ItemAddOption( p_input_item, psz_first );
+        input_ItemAddOption( p_input_item, psz_last );
+        input_ItemAddOption( p_input_item, psz_opt );
 
 #ifdef HAVE_LIBCDDB
         /* If we have CDDB info, change the name */
@@ -497,7 +484,7 @@ static int GetTracks( access_t *p_access,
             {
                 if( cddb_track_get_title( t )  != NULL )
                 {
-                    vlc_input_item_AddInfo( p_input_item, _(VLC_META_INFO_CAT),
+                    input_ItemAddInfo( p_input_item, _(VLC_META_INFO_CAT),
                                             _(VLC_META_TITLE),
                                             cddb_track_get_title( t ) );
                     if( p_input_item->psz_name )
@@ -508,14 +495,14 @@ static int GetTracks( access_t *p_access,
                 psz_result = cddb_track_get_artist( t );
                 if( psz_result )
                 {
-                    vlc_input_item_AddInfo( p_input_item, _(VLC_META_INFO_CAT),
+                    input_ItemAddInfo( p_input_item, _(VLC_META_INFO_CAT),
                                             _(VLC_META_ARTIST), psz_result );
                 }
             }
         }
 #endif
-        playlist_AddWhereverNeeded( p_playlist, p_input_item, p_parent,
-                               p_item_in_category, VLC_FALSE, PLAYLIST_APPEND );
+        playlist_BothAddInput( p_playlist, p_input_item, p_item_in_category,
+                               PLAYLIST_APPEND, PLAYLIST_END, NULL, NULL );
         free( psz_uri ); free( psz_opt ); free( psz_name );
         free( psz_first ); free( psz_last );
     }