More #ifdef -> #if fixes
[mplayer/glamo.git] / libaf / af_dummy.c
blob19a765c66dc30ff519e94453091c350a81ad0572
1 /*
2 * The name speaks for itself. This filter is a dummy and will
3 * not blow up regardless of what you do with it.
5 * This file is part of MPlayer.
7 * MPlayer is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * MPlayer is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
26 #include "af.h"
28 // Initialization and runtime control
29 static int control(struct af_instance_s* af, int cmd, void* arg)
31 switch(cmd){
32 case AF_CONTROL_REINIT:
33 memcpy(af->data,(af_data_t*)arg,sizeof(af_data_t));
34 af_msg(AF_MSG_VERBOSE,"[dummy] Was reinitialized: %iHz/%ich/%s\n",
35 af->data->rate,af->data->nch,af_fmt2str_short(af->data->format));
36 return AF_OK;
38 return AF_UNKNOWN;
41 // Deallocate memory
42 static void uninit(struct af_instance_s* af)
44 if(af->data)
45 free(af->data);
48 // Filter data through filter
49 static af_data_t* play(struct af_instance_s* af, af_data_t* data)
51 // Do something necessary to get rid of annoying warning during compile
52 if(!af)
53 af_msg(AF_MSG_ERROR,"EEEK: Argument af == NULL in af_dummy.c play().");
54 return data;
57 // Allocate memory and set function pointers
58 static int af_open(af_instance_t* af){
59 af->control=control;
60 af->uninit=uninit;
61 af->play=play;
62 af->mul=1;
63 af->data=malloc(sizeof(af_data_t));
64 if(af->data == NULL)
65 return AF_ERROR;
66 return AF_OK;
69 // Description of this filter
70 af_info_t af_info_dummy = {
71 "dummy",
72 "dummy",
73 "Anders",
74 "",
75 AF_FLAGS_REENTRANT,
76 af_open