[vlc-commits] cdda: simplify using access_t.psz_url

Rémi Denis-Courmont git at videolan.org
Wed Sep 2 21:54:15 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Sep  2 22:27:43 2015 +0300| [b10beb9cc82cef0262c2282701172ed3781c20c0] | committer: Rémi Denis-Courmont

cdda: simplify using access_t.psz_url

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b10beb9cc82cef0262c2282701172ed3781c20c0
---

 modules/access/cdda.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/modules/access/cdda.c b/modules/access/cdda.c
index face0f9..e17bf86 100644
--- a/modules/access/cdda.c
+++ b/modules/access/cdda.c
@@ -472,26 +472,24 @@ static int GetTracks( access_t *p_access, input_item_t *p_current )
     /* Build title table */
     for( int i = 0; i < i_titles; i++ )
     {
-        char *psz_uri, *psz_opt, *psz_name;
+        char *psz_opt, *psz_name;
 
         msg_Dbg( p_access, "track[%d] start=%d", i, p_sys->p_sectors[i] );
 
-        if( asprintf( &psz_uri, "cdda://%s", p_access->psz_location ) == -1 )
-            continue;
-
         /* Define a "default name" */
         if( asprintf( &psz_name, _("Audio CD - Track %02i"), (i+1) ) == -1 )
-            psz_name = psz_uri;
+            psz_name = p_access->psz_url;
 
         /* Create playlist items */
         const mtime_t i_duration = (int64_t)( p_sys->p_sectors[i+1] - p_sys->p_sectors[i] ) *
                                    CDDA_DATA_SIZE * 1000000 / 44100 / 2 / 2;
 
-        input_item_t *p_item = input_item_NewWithType( psz_uri, psz_name, 0,
-                                         NULL, 0, i_duration, ITEM_TYPE_DISC );
-        if( likely(psz_name != psz_uri) )
+        input_item_t *p_item = input_item_NewWithType( p_access->psz_url,
+                                                       psz_name, 0, NULL, 0,
+                                                       i_duration,
+                                                       ITEM_TYPE_DISC );
+        if( likely(psz_name != p_access->psz_url) )
             free( psz_name );
-        free( psz_uri );
 
         if( unlikely(p_item == NULL) )
             continue;



More information about the vlc-commits mailing list