summaryrefslogtreecommitdiffstats
path: root/libaf
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-01-01 18:46:56 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-01-01 18:46:56 +0000
commit6119b0371277aee325ab8fdba38035fef1e5bbfc (patch)
tree26a8da208d67d3a9264f75d264153a11f8c20bbd /libaf
parent4be95cc5f456cb07a6f21ba6eda59a6415f3b084 (diff)
downloadmpv-6119b0371277aee325ab8fdba38035fef1e5bbfc.tar.bz2
mpv-6119b0371277aee325ab8fdba38035fef1e5bbfc.tar.xz
Make af_control_any_rev return the matching filter
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14293 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libaf')
-rw-r--r--libaf/af.c15
-rw-r--r--libaf/af.h4
2 files changed, 12 insertions, 7 deletions
diff --git a/libaf/af.c b/libaf/af.c
index aabc6c767c..79b44fcba9 100644
--- a/libaf/af.c
+++ b/libaf/af.c
@@ -615,16 +615,21 @@ inline int af_resize_local_buffer(af_instance_t* af, af_data_t* data)
return AF_OK;
}
-// send control to all filters, starting with the last until
-// one responds with AF_OK
-int af_control_any_rev (af_stream_t* s, int cmd, void* arg) {
+/**
+ * \brief send control to all filters, starting with the last, until
+ * one responds with AF_OK
+ * \return The instance that accepted the command or NULL if none did.
+ */
+af_instance_t *af_control_any_rev (af_stream_t* s, int cmd, void* arg) {
int res = AF_UNKNOWN;
af_instance_t* filt = s->last;
- while (filt && res != AF_OK) {
+ while (filt) {
res = filt->control(filt, cmd, arg);
+ if (res == AF_OK)
+ return filt;
filt = filt->prev;
}
- return (res == AF_OK);
+ return NULL;
}
void af_help (void) {
diff --git a/libaf/af.h b/libaf/af.h
index 05e277d58c..3f1b7d16a5 100644
--- a/libaf/af.h
+++ b/libaf/af.h
@@ -153,8 +153,8 @@ af_data_t* af_play(af_stream_t* s, af_data_t* data);
// send control to all filters, starting with the last until
// one accepts the command with AF_OK.
-// Returns true if accepting filter was found.
-int af_control_any_rev (af_stream_t* s, int cmd, void* arg);
+// Returns the accepting filter or NULL if none was found.
+af_instance_t *af_control_any_rev (af_stream_t* s, int cmd, void* arg);
/* Calculate how long the output from the filters will be given the
input length "len". The calculated length is >= the actual