From e5a9b792ecf08ddbcf3b674de3a00f7a919d1858 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 7 Nov 2019 15:54:34 +0100 Subject: stream: replace STREAM_CTRL_GET_SIZE with a proper entrypoint This is overlay convoluted as a stream control, and important enough to warrant "first class" functionality. --- stream/stream_cdda.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'stream/stream_cdda.c') diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c index cc1c7646a3..158cfd0646 100644 --- a/stream/stream_cdda.c +++ b/stream/stream_cdda.c @@ -262,14 +262,16 @@ static int control(stream_t *stream, int cmd, void *arg) *(double *)arg = pos / (44100.0 * 2 * 2); return STREAM_OK; } - case STREAM_CTRL_GET_SIZE: - *(int64_t *)arg = - (p->end_sector + 1 - p->start_sector) * CDIO_CD_FRAMESIZE_RAW; - return STREAM_OK; } return STREAM_UNSUPPORTED; } +static int64_t get_size(stream_t *st) +{ + cdda_priv *p = st->priv; + return (p->end_sector + 1 - p->start_sector) * CDIO_CD_FRAMESIZE_RAW; +} + static int open_cdda(stream_t *st) { st->priv = mp_get_config_group(st, st->global, &stream_cdda_conf); @@ -383,6 +385,7 @@ static int open_cdda(stream_t *st) st->seek = seek; st->seekable = true; st->control = control; + st->get_size = get_size; st->close = close_cdda; st->streaming = true; -- cgit v1.2.3