]> git.sesse.net Git - vlc/blobdiff - modules/access/cdda/access.c
Remove interface thread. It was a crock anyway -- any good stuff
[vlc] / modules / access / cdda / access.c
index d600747940d349668739c7635639a144622790d4..49555c54bfd33fbcfd2fa4d3870904cb40270f51 100644 (file)
@@ -2,7 +2,7 @@
  * cddax.c : CD digital audio input module for vlc using libcdio
  *****************************************************************************
  * Copyright (C) 2000,2003 VideoLAN
- * $Id: access.c,v 1.9 2003/12/02 03:33:22 rocky Exp $
+ * $Id: access.c,v 1.13 2003/12/05 02:33:49 rocky Exp $
  *
  * Authors: Rocky Bernstein <rocky@panix.com> 
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -307,9 +307,9 @@ static void CDDASeek( input_thread_t * p_input, off_t i_off )
 }
 
 #define meta_info_add_str(title, str) \
-  if ( str ) {                                         \
-    printf("field %s str %s\n", title, str);           \
-    input_AddInfo( p_cat, _(title), "%s", str );       \
+  if ( str ) {                                                         \
+    dbg_print( INPUT_DBG_META, "field %s: %s\n", title, str);  \
+    input_AddInfo( p_cat, _(title), "%s", str );                       \
   }
 
 
@@ -317,23 +317,11 @@ static void InformationCreate( input_thread_t *p_input  )
 {
   cdda_data_t *p_cdda = (cdda_data_t *) p_input->p_access_data;
   input_info_category_t *p_cat;
-  int use_cddb = p_cdda->i_cddb_enabled;
   
   p_cat = input_InfoCategory( p_input, "General" );
 
 #ifdef HAVE_LIBCDDB
-  if (use_cddb) {
-    
-    if( p_cdda->cddb.disc->length > 1000 )
-      {
-       int64_t i_sec = (int64_t) p_cdda->cddb.disc->length;
-       char psz_buffer[MSTRTIME_MAX_SIZE];
-       input_AddInfo( p_cat, _("Duration"), "%s", 
-                      secstotimestr( psz_buffer, i_sec ) );
-      } else 
-      {
-       use_cddb = 0;
-      }
+  if (p_cdda->i_cddb_enabled) {
     
     meta_info_add_str( "Title", p_cdda->cddb.disc->title );
     meta_info_add_str( "Artist", p_cdda->cddb.disc->artist );
@@ -360,14 +348,14 @@ static void InformationCreate( input_thread_t *p_input  )
 
 #endif /*HAVE_LIBCDDB*/
 
-  if (!use_cddb)
   {
     track_t i_track = p_cdda->i_nb_tracks;
     char psz_buffer[MSTRTIME_MAX_SIZE];
     mtime_t i_duration = 
-      (p_cdda->p_sectors[i_track] - p_cdda->p_sectors[i_track-1]) 
+      (p_cdda->p_sectors[i_track] - p_cdda->p_sectors[0]) 
       / CDIO_CD_FRAMES_PER_SEC;
 
+    dbg_print( INPUT_DBG_META, "Duration %ld", (long int) i_duration );
     input_AddInfo( p_cat, _("Duration"), "%s", 
                   secstotimestr( psz_buffer, i_duration ) );
   }
@@ -618,7 +606,7 @@ CDDAFormatStr(const input_thread_t *p_input, cdda_data_t *p_cdda,
       break;
 
     case 'T':
-      add_format_num_info(i_track, "%d");
+      add_format_num_info(i_track, "%02d");
       break;
 #ifdef HAVE_LIBCDDB      
     not_special:
@@ -658,7 +646,9 @@ CDDACreatePlayListItem(const input_thread_t *p_input, cdda_data_t *p_cdda,
                          config_GetPsz( p_input, config_varname ), 
                          psz_mrl, i_track);
 
-  playlist_AddExt( p_playlist, psz_mrl, p_title, i_duration, 
+  dbg_print( INPUT_DBG_META, "mrl: %s, title: %s, duration, %ld, pos %d",
+            psz_mrl, p_title, (long int) i_duration, i_pos );
+  playlist_AddExt( p_playlist, psz_mrl, p_title, i_duration * 1000000, 
                   0, 0, playlist_operation, i_pos );
 }
 
@@ -957,8 +947,6 @@ E_(Open)( vlc_object_t *p_this )
     p_input->i_pts_delay = config_GetInt( p_input, 
                                          MODULE_STRING "-caching" ) * 1000;
 
-    p_cdda->p_intf = intf_Create( p_input, "cddax" );
-    intf_RunThread( p_cdda->p_intf );
     free( psz_source );
 
     return 0;