synced with r22428
[mplayer/greg.git] / libaf / af_dummy.c
blob6eb128d86cf895bf71a48bb2457f124978809966
1 /* The name speaks for itself this filter is a dummy and will not blow
2 up regardless of what you do with it. */
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
7 #include "af.h"
9 // Initialization and runtime control
10 static int control(struct af_instance_s* af, int cmd, void* arg)
12 switch(cmd){
13 case AF_CONTROL_REINIT:
14 memcpy(af->data,(af_data_t*)arg,sizeof(af_data_t));
15 af_msg(AF_MSG_VERBOSE,"[dummy] Was reinitialized: %iHz/%ich/%s\n",
16 af->data->rate,af->data->nch,af_fmt2str_short(af->data->format));
17 return AF_OK;
19 return AF_UNKNOWN;
22 // Deallocate memory
23 static void uninit(struct af_instance_s* af)
25 if(af->data)
26 free(af->data);
29 // Filter data through filter
30 static af_data_t* play(struct af_instance_s* af, af_data_t* data)
32 // Do something necessary to get rid of annoying warning during compile
33 if(!af)
34 af_msg(AF_MSG_ERROR,"EEEK: Argument af == NULL in af_dummy.c play().");
35 return data;
38 // Allocate memory and set function pointers
39 static int open(af_instance_t* af){
40 af->control=control;
41 af->uninit=uninit;
42 af->play=play;
43 af->mul.d=1;
44 af->mul.n=1;
45 af->data=malloc(sizeof(af_data_t));
46 if(af->data == NULL)
47 return AF_ERROR;
48 return AF_OK;
51 // Description of this filter
52 af_info_t af_info_dummy = {
53 "dummy",
54 "dummy",
55 "Anders",
56 "",
57 AF_FLAGS_REENTRANT,
58 open