From 5fd8a1e04c725329435e3bead5f11ee3ffb9f1c1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 10 Nov 2014 22:01:23 +0100 Subject: audio: make decoders output refcounted frames This rewrites the audio decode loop to some degree. Audio filters don't do refcounted frames yet, so af.c contains a hacky "emulation". Remove some of the weird heuristic-heavy code in dec_audio.c. Instead of estimating how much audio we need to filter, we always filter full frames. Maybe this should be adjusted later: in case filtering increases the volume of the audio data, we should try not to buffer too much filter output by reducing the input that is fed at once. For ad_spdif.c and ad_mpg123.c, we don't avoid extra copying yet - it doesn't seem worth the trouble. --- audio/decode/dec_audio.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'audio/decode/dec_audio.h') diff --git a/audio/decode/dec_audio.h b/audio/decode/dec_audio.h index 08fa87e8a7..ab7ae3375a 100644 --- a/audio/decode/dec_audio.h +++ b/audio/decode/dec_audio.h @@ -33,12 +33,13 @@ struct dec_audio { struct mpv_global *global; const struct ad_functions *ad_driver; struct sh_stream *header; - struct mp_audio_buffer *decode_buffer; struct af_stream *afilter; char *decoder_desc; int init_retries; + struct mp_audio_pool *pool; + struct mp_audio decode_format; + struct mp_audio *waiting; // used on format-change // set by decoder - struct mp_audio decoded; // decoded audio set by last decode_packet() call int bitrate; // input bitrate, can change with VBR sources // last known pts value in output from decoder double pts; -- cgit v1.2.3