Mercurial > mplayer.hg
annotate libaf/af_dummy.c @ 25094:e27cb70d2302
Move code related to chain initialization and similar
for different chains to separate routine.
author | voroshil |
---|---|
date | Tue, 20 Nov 2007 19:33:27 +0000 |
parents | b2402b4f0afa |
children | 72d0b1444141 |
rev | line source |
---|---|
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 | |
22746
fd6f824ef894
Rename open to af_open so as not to conflict with a previous header definition.
diego
parents:
14816
diff
changeset
|
39 static int af_open(af_instance_t* af){ |
7568 | 40 af->control=control; |
41 af->uninit=uninit; | |
42 af->play=play; | |
24888 | 43 af->mul=1; |
7568 | 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, |
22746
fd6f824ef894
Rename open to af_open so as not to conflict with a previous header definition.
diego
parents:
14816
diff
changeset
|
57 af_open |
7568 | 58 }; |