Commit f39089df authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

CDDA: cosmetics and debug messages

parent e31d3007
...@@ -41,17 +41,16 @@ ...@@ -41,17 +41,16 @@
#include <vlc_input.h> #include <vlc_input.h>
#include <vlc_access.h> #include <vlc_access.h>
#include <vlc_meta.h> #include <vlc_meta.h>
#include <vlc_charset.h> #include <vlc_charset.h> /* ToLocaleDup */
#include <vlc_codecs.h> /* For WAVEHEADER */ #include <vlc_codecs.h> /* For WAVEHEADER */
#include "vcd/cdrom.h" #include "vcd/cdrom.h" /* For CDDA_DATA_SIZE */
#ifdef HAVE_LIBCDDB #ifdef HAVE_LIBCDDB
#include <cddb/cddb.h> #include <cddb/cddb.h>
#include <errno.h>
#endif #endif
#include <errno.h>
/***************************************************************************** /*****************************************************************************
* Module descriptior * Module descriptior
*****************************************************************************/ *****************************************************************************/
...@@ -64,7 +63,7 @@ static void Close( vlc_object_t * ); ...@@ -64,7 +63,7 @@ static void Close( vlc_object_t * );
"value should be set in milliseconds." ) "value should be set in milliseconds." )
vlc_module_begin () vlc_module_begin ()
set_shortname( N_("Audio CD")) set_shortname( N_("Audio CD") )
set_description( N_("Audio CD input") ) set_description( N_("Audio CD input") )
set_capability( "access", 10 ) set_capability( "access", 10 )
set_category( CAT_INPUT ) set_category( CAT_INPUT )
...@@ -109,7 +108,7 @@ struct access_sys_t ...@@ -109,7 +108,7 @@ struct access_sys_t
/* Current position */ /* Current position */
int i_sector; /* Current Sector */ int i_sector; /* Current Sector */
int * p_sectors; /* Track sectors */ int *p_sectors; /* Track sectors */
/* Wave header for the output data */ /* Wave header for the output data */
WAVEHEADER waveheader; WAVEHEADER waveheader;
...@@ -139,7 +138,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -139,7 +138,6 @@ static int Open( vlc_object_t *p_this )
access_sys_t *p_sys; access_sys_t *p_sys;
vcddev_t *vcddev; vcddev_t *vcddev;
char *psz_name; char *psz_name;
int i_ret;
if( !p_access->psz_path || !*p_access->psz_path ) if( !p_access->psz_path || !*p_access->psz_path )
{ {
...@@ -161,7 +159,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -161,7 +159,7 @@ static int Open( vlc_object_t *p_this )
#endif #endif
/* Open CDDA */ /* Open CDDA */
if( (vcddev = ioctl_Open( VLC_OBJECT(p_access), psz_name )) == NULL ) if( (vcddev = ioctl_Open( VLC_OBJECT(p_access), psz_name ) ) == NULL )
{ {
msg_Warn( p_access, "could not open %s", psz_name ); msg_Warn( p_access, "could not open %s", psz_name );
free( psz_name ); free( psz_name );
...@@ -181,7 +179,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -181,7 +179,7 @@ static int Open( vlc_object_t *p_this )
/* We only do separate items if the whole disc is requested */ /* We only do separate items if the whole disc is requested */
input_thread_t *p_input = access_GetParentInput( p_access ); input_thread_t *p_input = access_GetParentInput( p_access );
i_ret = -1; int i_ret = -1;
if( p_input ) if( p_input )
{ {
input_item_t *p_current = input_GetItem( p_input ); input_item_t *p_current = input_GetItem( p_input );
...@@ -404,6 +402,7 @@ static int GetTracks( access_t *p_access, input_item_t *p_current ) ...@@ -404,6 +402,7 @@ static int GetTracks( access_t *p_access, input_item_t *p_current )
/* Retreive CDDB informations */ /* Retreive CDDB informations */
#ifdef HAVE_LIBCDDB #ifdef HAVE_LIBCDDB
char psz_year_buffer[4+1]; char psz_year_buffer[4+1];
msg_Dbg( p_access, "fetching infos with CDDB" );
cddb_disc_t *p_disc = GetCDDBInfo( p_access, i_titles, p_sys->p_sectors ); cddb_disc_t *p_disc = GetCDDBInfo( p_access, i_titles, p_sys->p_sectors );
if( p_disc ) if( p_disc )
{ {
...@@ -436,7 +435,7 @@ static int GetTracks( access_t *p_access, input_item_t *p_current ) ...@@ -436,7 +435,7 @@ static int GetTracks( access_t *p_access, input_item_t *p_current )
} }
#endif #endif
/* */ /* CD-Text */
vlc_meta_t **pp_cd_text; vlc_meta_t **pp_cd_text;
int i_cd_text; int i_cd_text;
...@@ -662,14 +661,19 @@ static cddb_disc_t *GetCDDBInfo( access_t *p_access, int i_titles, int *p_sector ...@@ -662,14 +661,19 @@ static cddb_disc_t *GetCDDBInfo( access_t *p_access, int i_titles, int *p_sector
} }
const int i_matches = cddb_query( p_cddb, p_disc ); const int i_matches = cddb_query( p_cddb, p_disc );
if( i_matches <= 0 ) if( i_matches < 0 )
{ {
msg_Warn( p_access, "CDDB error: %s", cddb_error_str(errno)); msg_Warn( p_access, "CDDB error: %s", cddb_error_str(errno) );
goto error; goto error;
} }
else if( i_matches == 0 )
if( i_matches > 1 ) {
msg_Dbg( p_access, "Couldn't find any matches in CDDB." );
goto error;
}
else if( i_matches > 1 )
msg_Warn( p_access, "found %d matches in CDDB. Using first one.", i_matches ); msg_Warn( p_access, "found %d matches in CDDB. Using first one.", i_matches );
cddb_read( p_cddb, p_disc ); cddb_read( p_cddb, p_disc );
cddb_destroy( p_cddb); cddb_destroy( p_cddb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment