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

Konstantin Pavlov git at videolan.org
Wed Feb 22 00:11:43 CET 2012


vlc/vlc-2.0 | branch: master | Konstantin Pavlov <thresh at videolan.org> | Tue Feb 21 11:19:38 2012 +0400| [f42f00c8e1c819ac320442402ee17feeaf4972b3] | committer: Jean-Baptiste Kempf

CDDA: Implement disc information caching.

Note that CDDA module still needs to query freedb service for disc ID,
only the track information is cached.
(cherry picked from commit c95ed8127b7be0f57703cd5f8ed4a951212267ad)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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