[vlc-commits] CDDA: Implement disc information caching.

Konstantin Pavlov git at videolan.org
Tue Feb 21 11:01:07 CET 2012


vlc | branch: master | Konstantin Pavlov <thresh at videolan.org> | Tue Feb 21 11:19:38 2012 +0400| [c95ed8127b7be0f57703cd5f8ed4a951212267ad] | committer: Konstantin Pavlov

CDDA: Implement disc information caching.

Note that CDDA module still needs to query freedb service for disc ID,
only the track information is cached.

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

 modules/access/cdda.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/access/cdda.c b/modules/access/cdda.c
index 2f37026..2bb4840 100644
--- a/modules/access/cdda.c
+++ b/modules/access/cdda.c
@@ -24,7 +24,7 @@
 
 /**
  * Todo:
- *   - Improve CDDB support (non-blocking, cache, ...)
+ *   - Improve CDDB support (non-blocking, ...)
  *   - Fix tracknumber in MRL
  */
 
@@ -619,12 +619,16 @@ static cddb_disc_t *GetCDDBInfo( access_t *p_access, int i_titles, int *p_sector
     cddb_set_http_path_query( p_cddb, "/~cddb/cddb.cgi" );
     cddb_set_http_path_submit( p_cddb, "/~cddb/submit.cgi" );
 
-    /// \todo
-    cddb_cache_disable( p_cddb );
 
-//    cddb_cache_set_dir( p_cddb,
-//                     var_InheritString( p_access,
-//                                    MODULE_STRING "-cddb-cachedir") );
+    char *psz_cachedir;
+    char *psz_temp = config_GetUserDir( VLC_CACHE_DIR );
+
+    if( asprintf( &psz_cachedir, "%s" DIR_SEP "cddb", psz_temp ) > 0 ) {
+        cddb_cache_enable( p_cddb );
+        cddb_cache_set_dir( p_cddb, psz_cachedir );
+        free( psz_cachedir );
+    }
+    free( psz_temp );
 
     cddb_set_timeout( p_cddb, 10 );
 



More information about the vlc-commits mailing list