mirror of
https://github.com/mpv-player/mpv
synced 2025-01-11 09:29:29 +00:00
audio: introduce mp_audio readonly bit
Convenience for the following commit.
This commit is contained in:
parent
937c8e513f
commit
1b0b094ca2
@ -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]);
|
||||
|
@ -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];
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user