summaryrefslogtreecommitdiffstats
path: root/audio/audio.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-12 17:44:40 +0200
committerwm4 <wm4@nowhere>2015-06-12 17:44:40 +0200
commit627b87b0d8b165e76c5715cdda1cee578ec3a6fa (patch)
tree89bfad2bca8a54d3974fb57df6e2cd1645a58b67 /audio/audio.h
parent0d2456ae5f0440bbea357d7463618fa8bd41ca88 (diff)
downloadmpv-627b87b0d8b165e76c5715cdda1cee578ec3a6fa.tar.bz2
mpv-627b87b0d8b165e76c5715cdda1cee578ec3a6fa.tar.xz
audio: deal with AVFrame-style buffer assignments
In the AVFrame-style system (which we inreasingly map our internal data stuctures on), buffers and plane pointers don't necessarily have a 1:1 correspondence. For example, a single buffer could cover 2 or more planes, all while other planes are covered by a second buffer, and so on. They don't need to be ordered in the same way. Change mp_audio_get_allocated_size() to retrieve the maximum size all planes provide. This also considers the case of planes not pointing to buffer start. Change mp_audio_realloc() to reset all planes, even if corresponding buffers are not reallocated. (The caller has to be careful anyway if it wants to be sure the contents are preserved on realloc calls.)
Diffstat (limited to 'audio/audio.h')
-rw-r--r--audio/audio.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/audio/audio.h b/audio/audio.h
index a633a15b4d..7bfffa7887 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -37,8 +37,11 @@ struct mp_audio {
int num_planes; // number of planes
int bps; // size of sub-samples (af_fmt2bps(format))
- // private
+ // --- private
bool readonly;
+ // These do not necessarily map directly to planes[]. They can have
+ // different order or count. There shouldn't be more buffers than planes.
+ // If allocated[n] is NULL, allocated[n+1] must also be NULL.
struct AVBufferRef *allocated[MP_NUM_CHANNELS];
};