mirror of
https://github.com/mpv-player/mpv
synced 2025-01-20 21:07:29 +01:00
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
This commit is contained in:
parent
1d92564554
commit
bbd5473353
16
libaf/af.c
16
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);
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user