diff options
author | alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-06-25 19:02:53 +0000 |
---|---|---|
committer | alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-06-25 19:02:53 +0000 |
commit | bbd5473353f7d82d1cdabae1f8806998cbd24ffb (patch) | |
tree | 272c2354b8e801335caacccd48764c97cb1b5c56 /libaf | |
parent | 1d9256455412c4dc39d4a0791245db3a7f3f4867 (diff) | |
download | mpv-bbd5473353f7d82d1cdabae1f8806998cbd24ffb.tar.bz2 mpv-bbd5473353f7d82d1cdabae1f8806998cbd24ffb.tar.xz |
Send a command throught the filter chain until some item returns AF_OK. Patch by Reimar Doeffinger
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12669 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libaf')
-rw-r--r-- | libaf/af.c | 16 | ||||
-rw-r--r-- | libaf/af.h | 5 |
2 files changed, 19 insertions, 2 deletions
diff --git a/libaf/af.c b/libaf/af.c index 1a8513b6b4..10ee1660bb 100644 --- a/libaf/af.c +++ b/libaf/af.c @@ -82,7 +82,6 @@ af_instance_t* af_get(af_stream_t* s, char* name) af_instance_t* af_create(af_stream_t* s, char* name) { char* cmdline = name; - char* delim = "="; // Allocate space for the new filter and reset all pointers af_instance_t* new=malloc(sizeof(af_instance_t)); @@ -93,7 +92,7 @@ af_instance_t* af_create(af_stream_t* s, char* name) memset(new,0,sizeof(af_instance_t)); // Check for commandline parameters - strsep(&cmdline, delim); + strsep(&cmdline, "="); // Find filter from name if(NULL == (new->info=af_find(name))) @@ -598,3 +597,16 @@ inline int af_resize_local_buffer(af_instance_t* af, af_data_t* data) af->data->len=len; 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) { + int res = AF_UNKNOWN; + af_instance_t* filt = s->last; + while (filt && res != AF_OK) { + res = filt->control(filt, cmd, arg); + filt = filt->prev; + } + return (res == AF_OK); +} + diff --git a/libaf/af.h b/libaf/af.h index ba83f86c8e..23dfa7ea82 100644 --- a/libaf/af.h +++ b/libaf/af.h @@ -151,6 +151,11 @@ af_instance_t* af_get(af_stream_t* s, char* name); // Filter data chunk through the filters in the list 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); + /* Calculate how long the output from the filters will be given the input length "len". The calculated length is >= the actual length */ |