ao: add ao_stop_streaming

This commit is contained in:
Misaki Kasumi 2024-04-24 08:30:07 +08:00 committed by sfan5
parent bfadd31957
commit aebe58203b
2 changed files with 12 additions and 0 deletions

View File

@ -267,6 +267,16 @@ int ao_read_data_converted(struct ao *ao, struct ao_convert_fmt *fmt,
return res; 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) int ao_control(struct ao *ao, enum aocontrol cmd, void *arg)
{ {
struct buffer_state *p = ao->buffer_state; struct buffer_state *p = ao->buffer_state;

View File

@ -234,4 +234,6 @@ void ao_wakeup(struct ao *ao);
int ao_read_data_converted(struct ao *ao, struct ao_convert_fmt *fmt, int ao_read_data_converted(struct ao *ao, struct ao_convert_fmt *fmt,
void **data, int samples, int64_t out_time_ns); void **data, int samples, int64_t out_time_ns);
void ao_stop_streaming(struct ao *ao);
#endif #endif