summaryrefslogtreecommitdiffstats
path: root/libmpdemux/cdda.c
diff options
context:
space:
mode:
authorgpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-09-19 18:22:09 +0000
committergpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-09-19 18:22:09 +0000
commit55b7fc210e0fc227027fbdfb9788fa230f6a137f (patch)
tree98848ee8460479178f0d29e0503041e35757f279 /libmpdemux/cdda.c
parentb6428259886a10e1c18801c9ead54bdb31e51a4e (diff)
downloadmpv-55b7fc210e0fc227027fbdfb9788fa230f6a137f.tar.bz2
mpv-55b7fc210e0fc227027fbdfb9788fa230f6a137f.tar.xz
Prints the number of tracks and MSF length for each track of an audio CD,
prints ID_CDDA_TRACK=N output showing the currently played track number when -identify is given. Patch by kiriuja < mplayer TIRET patches CHEZ en TIRET directo POIS net > Doxygen comments by Guillaume POIRIER Original thread: Date: Sep 11, 2005 10:49 PM Subject: Re: [MPlayer-dev-eng] [PATCH] -identify audio CD tracks git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16525 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/cdda.c')
-rw-r--r--libmpdemux/cdda.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libmpdemux/cdda.c b/libmpdemux/cdda.c
index a348e6ce3d..7f74124a6f 100644
--- a/libmpdemux/cdda.c
+++ b/libmpdemux/cdda.c
@@ -81,6 +81,7 @@ m_option_t cdda_opts[] = {
{NULL, NULL, 0, 0, 0, 0, NULL}
};
+extern int cdd_identify(const char *dev);
extern int cddb_resolve(const char *dev, char **xmcd_file);
extern cd_info_t* cddb_parse_xmcd(char *xmcd_file);
@@ -112,7 +113,9 @@ static int open_cdda(stream_t *st,int m, void* opts, int* file_format) {
}
#ifdef MPLAYER_NETWORK
- if(strncmp(st->url,"cddb",4) == 0) {
+ // cdd_identify returns -1 if it cannot read the TOC,
+ // in which case there is no point in calling cddb_resolve
+ if(cdd_identify(p->device) >= 0 && strncmp(st->url,"cddb",4) == 0) {
i = cddb_resolve(p->device, &xmcd_file);
if(i == 0) {
cddb_info = cddb_parse_xmcd(xmcd_file);
@@ -274,7 +277,9 @@ static int fill_buffer(stream_t* s, char* buffer, int max_len) {
cd_track = cd_info_get_track(p->cd_info, i+1);
//printf("Track %d, sector=%d\n", i, p->sector-1);
if( cd_track!=NULL ) {
- printf("\n%s\n", cd_track->name );
+ mp_msg(MSGT_SEEK, MSGL_INFO, "\n%s\n", cd_track->name);
+ if (identify)
+ mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_CDDA_TRACK=%d\n", cd_track->track_nb);
}
break;
}
@@ -315,7 +320,9 @@ static int seek(stream_t* s,off_t newpos) {
//printf("Track %d, sector=%d\n", seeked_track, sec);
cd_track = cd_info_get_track(p->cd_info, seeked_track+1);
if( cd_track!=NULL ) {
- printf("\n%s\n", cd_track->name );
+ mp_msg(MSGT_SEEK, MSGL_INFO, "\n%s\n", cd_track->name);
+ if (identify)
+ mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_CDDA_TRACK=%d\n", cd_track->track_nb);
}
}