[MPlayer-dev-eng] [PATCH] -identify audio CD tracks

kiriuja mplayer-patches at en-directo.net
Sun Sep 11 22:49:23 CEST 2005


On Sunday 11 September 2005 09:16, Guillaume POIRIER wrote:
> This hunk doesn't seem too obvious to me, so I'd like you to comment it a bit:
> 
> +  i = cdd_identify(p->device);
> +  if(i >= 0) {
>    if(strncmp(st->url,"cddb",4) == 0) {
>      i = cddb_resolve(p->device, &xmcd_file);
>      if(i == 0) {
> @@ -119,6 +122,7 @@ static int open_cdda(stream_t *st,int m,
>        free(xmcd_file);
>      }
>    }
> +  }
> 
> I don't understand why calling cdd_identify(p->device), which, as its
> names states, just "identifies" p->device gives you information to
> skip a part of the code.

cdd_identify returns -1 if it cannot read the TOC of the CD. In that case
there is no point in calling cddb_resolve, because it cannot do anything
useful without the TOC. I added the comment explaining that.

> +	if (identify)
> +	{
> +		int i, min, sec, frame;
> +		cdtoc_last_track = read_toc(dev);
> +		if (cdtoc_last_track < 0) {
> +			printf("Failed to open %s device.\n", dev);
> +			return -1;
> +		}
> 
> Aren't all messages supposed to use mp_msg() ? The existing code does
> use one printf at least, but that maybe needs to be fixed later.

Yes, it should've been mp_msg. I changed it in the attached patch.

I also added ID_CDDA_TRACK=N output showing the currently played
track number. Updated patch attached.

--
kiriuja
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mplayer-identify-cdd-2.diff
Type: text/x-diff
Size: 3632 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050911/6854fe90/attachment.diff>


More information about the MPlayer-dev-eng mailing list