diff --git a/audio/out/buffer.c b/audio/out/buffer.c index 74e66701f6..e06d67e12a 100644 --- a/audio/out/buffer.c +++ b/audio/out/buffer.c @@ -267,6 +267,16 @@ int ao_read_data_converted(struct ao *ao, struct ao_convert_fmt *fmt, return res; } +// Called by pull-based AO to indicate the AO has stopped requesting more data, +// usually when EOF is got from ao_read_data(). +// After this function is called, the core will call ao->driver->start() again +// when more audio data after EOF arrives. +void ao_stop_streaming(struct ao *ao) +{ + struct buffer_state *p = ao->buffer_state; + p->streaming = false; +} + int ao_control(struct ao *ao, enum aocontrol cmd, void *arg) { struct buffer_state *p = ao->buffer_state; diff --git a/audio/out/internal.h b/audio/out/internal.h index fb8680952e..18445f6e69 100644 --- a/audio/out/internal.h +++ b/audio/out/internal.h @@ -234,4 +234,6 @@ void ao_wakeup(struct ao *ao); int ao_read_data_converted(struct ao *ao, struct ao_convert_fmt *fmt, void **data, int samples, int64_t out_time_ns); +void ao_stop_streaming(struct ao *ao); + #endif