From 1b0b094ca2c25ad162f8f8c84ebebef9a963552e Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 4 May 2015 23:57:25 +0200 Subject: audio: introduce mp_audio readonly bit Convenience for the following commit. --- audio/audio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'audio/audio.c') 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]); -- cgit v1.2.3