7568
|
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>
|
|
6
|
|
7 #include "af.h"
|
|
8
|
|
9 // Initialization and runtime control
|
|
10 static int control(struct af_instance_s* af, int cmd, void* arg)
|
|
11 {
|
|
12 switch(cmd){
|
|
13 case AF_CONTROL_REINIT:
|
|
14 memcpy(af->data,(af_data_t*)arg,sizeof(af_data_t));
|
14816
|
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));
|
7568
|
17 return AF_OK;
|
|
18 }
|
|
19 return AF_UNKNOWN;
|
|
20 }
|
|
21
|
|
22 // Deallocate memory
|
|
23 static void uninit(struct af_instance_s* af)
|
|
24 {
|
|
25 if(af->data)
|
|
26 free(af->data);
|
|
27 }
|
|
28
|
|
29 // Filter data through filter
|
|
30 static af_data_t* play(struct af_instance_s* af, af_data_t* data)
|
|
31 {
|
|
32 // Do something necessary to get rid of annoying warning during compile
|
|
33 if(!af)
|
8167
|
34 af_msg(AF_MSG_ERROR,"EEEK: Argument af == NULL in af_dummy.c play().");
|
7568
|
35 return data;
|
|
36 }
|
|
37
|
|
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;
|
|
49 }
|
|
50
|
|
51 // Description of this filter
|
|
52 af_info_t af_info_dummy = {
|
|
53 "dummy",
|
|
54 "dummy",
|
|
55 "Anders",
|
|
56 "",
|
7615
|
57 AF_FLAGS_REENTRANT,
|
7568
|
58 open
|
|
59 };
|