diff options
author | wm4 <wm4@nowhere> | 2020-08-28 20:23:54 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-08-29 13:12:32 +0200 |
commit | b74c09efbf7c6969fc053265f72cc0501b840ce1 (patch) | |
tree | bfaa86f7b03f28a191e5fdc83594095952e3dfba /audio/out/ao.h | |
parent | bb1f82107801a7981f9ae5b4229f48af68cc85c2 (diff) | |
download | mpv-b74c09efbf7c6969fc053265f72cc0501b840ce1.tar.bz2 mpv-b74c09efbf7c6969fc053265f72cc0501b840ce1.tar.xz |
audio: refactor how data is passed to AO
This replaces the two buffers (ao_chain.ao_buffer in the core, and
buffer_state.buffers in the AO) with a single queue. Instead of having a
byte based buffer, the queue is simply a list of audio frames, as output
by the decoder. This should make dataflow simpler and reduce copying.
It also attempts to simplify fill_audio_out_buffers(), the function I
always hated most, because it's full of subtle and buggy logic.
Unfortunately, I got assaulted by corner cases, dumb features (attempt
at seamless looping, really?), and other crap, so it got pretty
complicated again. fill_audio_out_buffers() is still full of subtle and
buggy logic. Maybe it got worse. On the other hand, maybe there really
is some progress. Who knows.
Originally, the data flow parts was meant to be in f_output_chain, but
due to tricky interactions with the playloop code, it's now in the dummy
filter in audio.c.
At least this improves the way the audio PTS is passed to the encoder in
encoding mode. Now it attempts to pass frames directly, along with the
pts, which should minimize timestamp problems. But to be honest, encoder
mode is one big kludge that shouldn't exist in this way.
This commit should be considered pre-alpha code. There are lots of bugs
still hiding.
Diffstat (limited to 'audio/out/ao.h')
-rw-r--r-- | audio/out/ao.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/audio/out/ao.h b/audio/out/ao.h index 0207e5a8bf..cfcb39790f 100644 --- a/audio/out/ao.h +++ b/audio/out/ao.h @@ -45,7 +45,6 @@ enum { AO_EVENT_RELOAD = 1, AO_EVENT_HOTPLUG = 2, AO_EVENT_INITIAL_UNBLOCK = 4, - AO_EVENT_UNDERRUN = 8, }; enum { @@ -98,16 +97,16 @@ void ao_get_format(struct ao *ao, const char *ao_get_name(struct ao *ao); const char *ao_get_description(struct ao *ao); bool ao_untimed(struct ao *ao); -int ao_play(struct ao *ao, void **data, int samples, int flags); int ao_control(struct ao *ao, enum aocontrol cmd, void *arg); void ao_set_gain(struct ao *ao, float gain); double ao_get_delay(struct ao *ao); -int ao_get_space(struct ao *ao); void ao_reset(struct ao *ao); -void ao_pause(struct ao *ao); -void ao_resume(struct ao *ao); +void ao_start(struct ao *ao); +void ao_set_paused(struct ao *ao, bool paused); void ao_drain(struct ao *ao); -bool ao_eof_reached(struct ao *ao); +bool ao_is_playing(struct ao *ao); +struct mp_async_queue; +struct mp_async_queue *ao_get_queue(struct ao *ao); int ao_query_and_reset_events(struct ao *ao, int events); int ao_add_events(struct ao *ao, int events); void ao_unblock(struct ao *ao); |