diff options
author | wm4 <wm4@nowhere> | 2015-05-04 23:57:25 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-05-04 23:57:25 +0200 |
commit | 1b0b094ca2c25ad162f8f8c84ebebef9a963552e (patch) | |
tree | 20106f81ea6eab12b5d20bd680475a382599bc7e | |
parent | 937c8e513f7b948fff0746e80ecf3d27d7007abe (diff) | |
download | mpv-1b0b094ca2c25ad162f8f8c84ebebef9a963552e.tar.bz2 mpv-1b0b094ca2c25ad162f8f8c84ebebef9a963552e.tar.xz |
audio: introduce mp_audio readonly bit
Convenience for the following commit.
-rw-r--r-- | audio/audio.c | 3 | ||||
-rw-r--r-- | audio/audio.h | 1 |
2 files changed, 3 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]); diff --git a/audio/audio.h b/audio/audio.h index cbcd87cc46..a633a15b4d 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -38,6 +38,7 @@ struct mp_audio { int bps; // size of sub-samples (af_fmt2bps(format)) // private + bool readonly; struct AVBufferRef *allocated[MP_NUM_CHANNELS]; }; |