summaryrefslogtreecommitdiffstats
path: root/audio/audio.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-04 23:57:25 +0200
committerwm4 <wm4@nowhere>2015-05-04 23:57:25 +0200
commit1b0b094ca2c25ad162f8f8c84ebebef9a963552e (patch)
tree20106f81ea6eab12b5d20bd680475a382599bc7e /audio/audio.c
parent937c8e513f7b948fff0746e80ecf3d27d7007abe (diff)
downloadmpv-1b0b094ca2c25ad162f8f8c84ebebef9a963552e.tar.bz2
mpv-1b0b094ca2c25ad162f8f8c84ebebef9a963552e.tar.xz
audio: introduce mp_audio readonly bit
Convenience for the following commit.
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]);