summaryrefslogtreecommitdiffstats
path: root/audio/filter/af.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-22 14:43:58 +0200
committerwm4 <wm4@nowhere>2013-07-22 15:11:03 +0200
commit3b8dfddb4cb6e9431da659b10c5b31a9f17c81b5 (patch)
treeb087f6551fa96a6fbe0f1f2b7f0f951f331eb552 /audio/filter/af.h
parent221ef23d0d4454af974b08e68fad6b898d1d8e12 (diff)
downloadmpv-3b8dfddb4cb6e9431da659b10c5b31a9f17c81b5.tar.bz2
mpv-3b8dfddb4cb6e9431da659b10c5b31a9f17c81b5.tar.xz
audio/filter: use new option API
Make the VF/VO/AO option parser available to audio filters. No audio filter uses this yet, but it's still a quite intrusive change. In particular, the commands for manipulating filters at runtime completely change. We delete the old code, and use the same infrastructure as for video filters. (This forces complete reinitialization of the filter chain, which hopefully isn't a problem for any use cases. The old code forced reinitialization too, but it could potentially allow a filter to cache things; e.g. consider loaded ladspa plugins and such.)
Diffstat (limited to 'audio/filter/af.h')
-rw-r--r--audio/filter/af.h44
1 files changed, 8 insertions, 36 deletions
diff --git a/audio/filter/af.h b/audio/filter/af.h
index 4ccc70792f..df4e03b49a 100644
--- a/audio/filter/af.h
+++ b/audio/filter/af.h
@@ -50,15 +50,19 @@ struct af_info {
const int flags;
int (*open)(struct af_instance *vf);
bool (*test_conversion)(int src_format, int dst_format);
+ int priv_size;
+ const void *priv_defaults;
+ const struct m_option *options;
};
// Linked list of audio filters
struct af_instance {
- struct af_info *info;
+ const struct af_info *info;
int (*control)(struct af_instance *af, int cmd, void *arg);
void (*uninit)(struct af_instance *af);
struct mp_audio * (*play)(struct af_instance *af, struct mp_audio *data);
- void *setup; // setup data for this specific instance and filter
+ void *setup; // old field for priv structs
+ void *priv;
struct mp_audio *data; // configuration for outgoing data stream
struct af_instance *next;
struct af_instance *prev;
@@ -69,12 +73,6 @@ struct af_instance {
bool auto_inserted; // inserted by af.c, such as conversion filters
};
-// Configuration switches
-struct af_cfg {
- char **list; /* list of names of filters that are added to filter
- list during first initialization of stream */
-};
-
// Current audio stream
struct af_stream {
// The first and last filter in the list
@@ -86,8 +84,7 @@ struct af_stream {
struct mp_audio input;
struct mp_audio output;
struct mp_audio filter_output;
- // Configuration for this stream
- struct af_cfg cfg;
+
struct MPOpts *opts;
};
@@ -139,13 +136,6 @@ int af_init(struct af_stream *s);
void af_uninit(struct af_stream *s);
/**
- * \brief Reinit the filter list from the given filter on downwards
- * See af.c.
- * \return AF_OK on success or AF_ERROR on failure
- */
-int af_reinit(struct af_stream *s);
-
-/**
* \brief This function adds the filter "name" to the stream s.
* \param name name of filter to add
* \return pointer to the new filter, NULL if insert failed
@@ -154,22 +144,7 @@ int af_reinit(struct af_stream *s);
* list of filters (i.e. at the beginning unless the
* first filter is the format filter (why??).
*/
-struct af_instance *af_add(struct af_stream *s, char *name);
-
-/**
- * \brief Uninit and remove the filter "af"
- * \param af filter to remove
- */
-void af_remove(struct af_stream *s, struct af_instance *af);
-
-/**
- * \brief find filter in chain by name
- * \param name name of the filter to find
- * \return first filter with right name or NULL if not found
- *
- * This function is used for finding already initialized filters
- */
-struct af_instance *af_get(struct af_stream *s, char *name);
+struct af_instance *af_add(struct af_stream *s, char *name, char **args);
/**
* \brief filter data chunk through the filters in the list
@@ -282,9 +257,6 @@ float af_softclip(float a);
/** \} */ // end of af_filter group, but more functions of this group below
-/** Print a list of all available audio filters */
-void af_help(void);
-
/** Memory reallocation macro: if a local buffer is used (i.e. if the
filter doesn't operate on the incoming buffer this macro must be
called to ensure the buffer is big enough.