summaryrefslogtreecommitdiffstats
path: root/audio/audio.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-04 23:57:25 +0200
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-05-07 10:46:53 +0900
commit322c79a6e1bac2e8f1a5e042ac0b635c9dae629f (patch)
treef6317c3bf0046dfa4e7602f2a6bc8dd0ff6034ba /audio/audio.c
parent6bcb8d200f28d69158792caa6a10c96fd8be4a5b (diff)
downloadmpv-322c79a6e1bac2e8f1a5e042ac0b635c9dae629f.tar.bz2
mpv-322c79a6e1bac2e8f1a5e042ac0b635c9dae629f.tar.xz
audio: introduce mp_audio readonly bit
Convenience for the following commit. (cherry picked from commit 1b0b094ca2c25ad162f8f8c84ebebef9a963552e)
Diffstat (limited to 'audio/audio.c')
-rw-r--r--audio/audio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/audio/audio.c b/audio/audio.c
index ea0b6203e2..263470261e 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -118,6 +118,7 @@ void mp_audio_set_null_data(struct mp_audio *mpa)
mpa->allocated[n] = NULL;
}
mpa->samples = 0;
+ mpa->readonly = false;
}
static int get_plane_size(const struct mp_audio *mpa, int samples)
@@ -250,7 +251,7 @@ void mp_audio_skip_samples(struct mp_audio *data, int samples)
// Will return true for non-refcounted frames.
bool mp_audio_is_writeable(struct mp_audio *data)
{
- bool ok = true;
+ bool ok = !data->readonly;
for (int n = 0; n < MP_NUM_CHANNELS; n++) {
if (data->allocated[n])
ok &= av_buffer_is_writable(data->allocated[n]);