mirror of
https://github.com/mpv-player/mpv
synced 2025-04-01 00:07:33 +00:00
af: remove old filter compatibility hack
This commit is contained in:
parent
388cf6dc96
commit
ae641d200a
@ -803,43 +803,7 @@ static int af_do_filter(struct af_instance *af, struct mp_audio *frame)
|
||||
{
|
||||
if (frame)
|
||||
assert(mp_audio_config_equals(&af->fmt_in, frame));
|
||||
int r = 0;
|
||||
if (af->filter_frame) {
|
||||
r = af->filter_frame(af, frame);
|
||||
frame = NULL;
|
||||
} else {
|
||||
// Compatibility path.
|
||||
int flags = 0;
|
||||
struct mp_audio input;
|
||||
char dummy[MP_NUM_CHANNELS];
|
||||
if (frame) {
|
||||
// We don't know if the filter will write; but it might possibly.
|
||||
r = mp_audio_make_writeable(frame);
|
||||
input = *frame;
|
||||
// Don't give it a refcounted frame
|
||||
for (int n = 0; n < MP_NUM_CHANNELS; n++)
|
||||
input.allocated[n] = NULL;
|
||||
} else {
|
||||
input = af->fmt_in;
|
||||
mp_audio_set_null_data(&input);
|
||||
flags = AF_FILTER_FLAG_EOF;
|
||||
for (int n = 0; n < MP_NUM_CHANNELS; n++)
|
||||
input.planes[n] = &dummy[n];
|
||||
}
|
||||
if (r < 0)
|
||||
goto done;
|
||||
r = af->filter(af, &input, flags);
|
||||
if (input.samples) {
|
||||
struct mp_audio *new = mp_audio_pool_new_copy(af->out_pool, &input);
|
||||
if (!new) {
|
||||
r = -1;
|
||||
goto done;
|
||||
}
|
||||
af_add_output_frame(af, new);
|
||||
}
|
||||
}
|
||||
done:
|
||||
talloc_free(frame);
|
||||
int r = af->filter_frame(af, frame);
|
||||
if (r < 0)
|
||||
MP_ERR(af, "Error filtering frame.\n");
|
||||
return r;
|
||||
|
@ -62,11 +62,6 @@ struct af_instance {
|
||||
struct replaygain_data *replaygain_data;
|
||||
int (*control)(struct af_instance *af, int cmd, void *arg);
|
||||
void (*uninit)(struct af_instance *af);
|
||||
/* old filter function (use filter_frame instead)
|
||||
* flags is a bit mask of AF_FILTER_FLAG_* values
|
||||
* returns 0 on success, negative value on error
|
||||
*/
|
||||
int (*filter)(struct af_instance *af, struct mp_audio *data, int flags);
|
||||
/* Feed a frame. The frame is NULL if EOF was reached, and the filter
|
||||
* should drain all remaining buffered data.
|
||||
* Use af_add_output_frame() to output data. The optional filter_out
|
||||
|
Loading…
Reference in New Issue
Block a user