filters: add another dumb helper

Can be used with mp_chain_filters() to combine multiple filters into a
single one. This is a bit silly, but whatever. I'm making it an explicit
separate filter, because it lets the user access mp_filter.ppins against
all conventions.
This commit is contained in:
wm4 2019-10-02 21:09:30 +02:00
parent 95e13e3d3e
commit 61961d03f6
2 changed files with 22 additions and 0 deletions

View File

@ -178,6 +178,22 @@ struct mp_filter *mp_bidir_nop_filter_create(struct mp_filter *parent)
return f;
}
static const struct mp_filter_info bidir_dummy_filter = {
.name = "dummy",
};
struct mp_filter *mp_bidir_dummy_filter_create(struct mp_filter *parent)
{
struct mp_filter *f = mp_filter_create(parent, &bidir_dummy_filter);
if (!f)
return NULL;
mp_filter_add_pin(f, MP_PIN_IN, "in");
mp_filter_add_pin(f, MP_PIN_OUT, "out");
return f;
}
struct fixed_aframe_size_priv {
int samples;
bool pad_silence;

View File

@ -71,6 +71,12 @@ bool mp_subfilter_drain_destroy(struct mp_subfilter *sub);
// A bidrectional filter which passes through all data.
struct mp_filter *mp_bidir_nop_filter_create(struct mp_filter *parent);
// A bidrectional filter which does not connect its pins. Instead, the user is,
// by convention, allowed to access the filter's private pins, and use them
// freely. (This is sometimes convenient, such as when you need to pass a single
// filter instance to other code, and you don't need a full "proper" filter.)
struct mp_filter *mp_bidir_dummy_filter_create(struct mp_filter *parent);
// A filter which repacks audio frame to fixed frame sizes with the given
// number of samples. On hard format changes (sample format/channels/srate),
// the frame can be shorter, unless pad_silence is true. Fails on non-aframes.