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));
|
8167
|
15 af_msg(AF_MSG_VERBOSE,"[dummy] Was reinitialized, rate=%iHz, nch = %i, format = 0x%08X and bps = %i\n",af->data->rate,af->data->nch,af->data->format,af->data->bps);
|
7568
|
16 return AF_OK;
|
|
17 }
|
|
18 return AF_UNKNOWN;
|
|
19 }
|
|
20
|
|
21 // Deallocate memory
|
|
22 static void uninit(struct af_instance_s* af)
|
|
23 {
|
|
24 if(af->data)
|
|
25 free(af->data);
|
|
26 }
|
|
27
|
|
28 // Filter data through filter
|
|
29 static af_data_t* play(struct af_instance_s* af, af_data_t* data)
|
|
30 {
|
|
31 // Do something necessary to get rid of annoying warning during compile
|
|
32 if(!af)
|
8167
|
33 af_msg(AF_MSG_ERROR,"EEEK: Argument af == NULL in af_dummy.c play().");
|
7568
|
34 return data;
|
|
35 }
|
|
36
|
|
37 // Allocate memory and set function pointers
|
|
38 static int open(af_instance_t* af){
|
|
39 af->control=control;
|
|
40 af->uninit=uninit;
|
|
41 af->play=play;
|
|
42 af->mul.d=1;
|
|
43 af->mul.n=1;
|
|
44 af->data=malloc(sizeof(af_data_t));
|
|
45 if(af->data == NULL)
|
|
46 return AF_ERROR;
|
|
47 return AF_OK;
|
|
48 }
|
|
49
|
|
50 // Description of this filter
|
|
51 af_info_t af_info_dummy = {
|
|
52 "dummy",
|
|
53 "dummy",
|
|
54 "Anders",
|
|
55 "",
|
7615
|
56 AF_FLAGS_REENTRANT,
|
7568
|
57 open
|
|
58 };
|