libcdio-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libcdio-devel] OpenBSD vs libcdio vs MPV


From: Edd Barrett
Subject: [Libcdio-devel] OpenBSD vs libcdio vs MPV
Date: Sat, 26 Jan 2019 16:45:07 +0000
User-agent: Mutt/1.11.2 (2019-01-07)

Hi,

Here's my findings for mpv. 

The problem with mpv is that it thinks that the CDDA track is changing,
when it is not.

The following output was collected playing track one from a CD:
---8<---
fremen:edd> mpv cdda://
Playing: cdda://
[cdda] Switched to track 1
 (+) Audio --aid=1 (pcm_s16le)
AO: [sdl] 44100Hz stereo 2ch s16
A: 00:00:19 / 00:37:51 (0%) Cache:  9s+24MB
[cdda] Switched to track 2
A: 00:00:35 / 00:37:51 (1%) Cache:  9s+48MB
[cdda] Switched to track 3
A: 00:01:40 / 00:37:51 (4%) Cache: 10s+72MB
[cdda] Switched to track 4
A: 00:03:00 / 00:37:51 (7%) Cache: 10s+73MB
--->8---

So we can see that it thinks we've played 3 and a bit tracks here.

Hunting down that "Switched to track" messages in the sources:
---8<---
static void print_track_info(stream_t *s, int track)
{
    MP_INFO(s, "Switched to track %d\n", track);
    print_cdtext(s, track);
}
...
static int fill_buffer(stream_t *s, char *buffer, int max_len)
{
    cdda_priv *p = (cdda_priv *)s->priv;
    int16_t *buf;
    int i;

    if (max_len < CDIO_CD_FRAMESIZE_RAW)
        return -1;

    if ((p->sector < p->start_sector) || (p->sector > p->end_sector)) {
        return 0;
    }

    buf = paranoia_read(p->cdp, cdparanoia_callback);
    if (!buf)
        return 0;

    p->sector++;
    memcpy(buffer, buf, CDIO_CD_FRAMESIZE_RAW);

    for (i = 0; i < p->cd->tracks; i++) {
        if (p->cd->disc_toc[i].dwStartSector == p->sector - 1) {
            print_track_info(s, i + 1);
            break;
        }
    }

    return CDIO_CD_FRAMESIZE_RAW;
}
--->8---

I see our old friend "assume CDs start at track one" is in full effect here :)

But let's forget that for a moment, as the problem still exists on CDs with
start track one. It looks to me like as they read sectors, they are scan the
TOC checking if the sector about to be played is the start of a track, and if
so, it prints the message.

What is happening here, is that the message is printed when the next track is
being pre-fetched, not when it is being played. If you run with `--no-cache`,
then the message is printed at the correct time.

So there's two mpv bugs there and I think libcdio is innocent.

-- 
Best Regards
Edd Barrett

http://www.theunixzoo.co.uk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]