comparison libaf/af_dummy.c @ 7568:d08513b9fed6

Adding new audio output filter layer libaf
author anders
date Tue, 01 Oct 2002 06:45:08 +0000
parents
children c67328dd459a
comparison
equal deleted inserted replaced
7567:85e9956a6727 7568:d08513b9fed6
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 "../config.h"
8 #include "../mp_msg.h"
9
10 #include "af.h"
11
12 // Initialization and runtime control
13 static int control(struct af_instance_s* af, int cmd, void* arg)
14 {
15 switch(cmd){
16 case AF_CONTROL_REINIT:
17 memcpy(af->data,(af_data_t*)arg,sizeof(af_data_t));
18 mp_msg(MSGT_AFILTER,MSGL_V,"[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);
19 return AF_OK;
20 }
21 return AF_UNKNOWN;
22 }
23
24 // Deallocate memory
25 static void uninit(struct af_instance_s* af)
26 {
27 if(af->data)
28 free(af->data);
29 }
30
31 // Filter data through filter
32 static af_data_t* play(struct af_instance_s* af, af_data_t* data)
33 {
34 // Do something necessary to get rid of annoying warning during compile
35 if(!af)
36 printf("EEEK: Argument af == NULL in af_dummy.c play().");
37 return data;
38 }
39
40 // Allocate memory and set function pointers
41 static int open(af_instance_t* af){
42 af->control=control;
43 af->uninit=uninit;
44 af->play=play;
45 af->mul.d=1;
46 af->mul.n=1;
47 af->data=malloc(sizeof(af_data_t));
48 if(af->data == NULL)
49 return AF_ERROR;
50 return AF_OK;
51 }
52
53 // Description of this filter
54 af_info_t af_info_dummy = {
55 "dummy",
56 "dummy",
57 "Anders",
58 "",
59 open
60 };