annotate libaf/af_dummy.c @ 33263:5f527a9a9521

Add an exit function. This function will allow performing clean-up operations. (MPlayer calls guiDone() before exiting, but only if the GUI has been initialized, i.e. if guiInit() has been called successfully. Any exit_player()/exit_player_with_rc() after GUI's cfg_read() until guiInit(), or any exit_player() during guiInit() itself will end the GUI without calling guiDone(). This exit function will at least handle abortions during guiInit() itself. It will be called twice in case of an guiExit() after GUI initialization - first directly, next by guiDone() via MPlayer's exit_player_with_rc().)
author ib
date Tue, 03 May 2011 12:19:22 +0000
parents 8fa2f43cb760
children a93891202051
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28229
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
1 /*
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
2 * The name speaks for itself. This filter is a dummy and will
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
3 * not blow up regardless of what you do with it.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
4 *
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
5 * This file is part of MPlayer.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
6 *
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
7 * MPlayer is free software; you can redistribute it and/or modify
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
8 * it under the terms of the GNU General Public License as published by
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
10 * (at your option) any later version.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
11 *
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
12 * MPlayer is distributed in the hope that it will be useful,
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
15 * GNU General Public License for more details.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
16 *
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
17 * You should have received a copy of the GNU General Public License along
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
18 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
20 */
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 24888
diff changeset
21
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
22 #include <stdio.h>
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
23 #include <stdlib.h>
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
24 #include <string.h>
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
25
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
26 #include "af.h"
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
27
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
28 // Initialization and runtime control
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
29 static int control(struct af_instance_s* af, int cmd, void* arg)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
30 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
31 switch(cmd){
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
32 case AF_CONTROL_REINIT:
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
33 memcpy(af->data,(af_data_t*)arg,sizeof(af_data_t));
29049
8c706ce21c6f Remove af_msg special-casing API in libaf.
bircoph
parents: 28229
diff changeset
34 mp_msg(MSGT_AFILTER, MSGL_V, "[dummy] Was reinitialized: %iHz/%ich/%s\n",
14816
ca769ef8645e better infoline
alex
parents: 8167
diff changeset
35 af->data->rate,af->data->nch,af_fmt2str_short(af->data->format));
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
36 return AF_OK;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
37 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
38 return AF_UNKNOWN;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
39 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
40
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29049
diff changeset
41 // Deallocate memory
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
42 static void uninit(struct af_instance_s* af)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
43 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
44 free(af->data);
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
45 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
46
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
47 // Filter data through filter
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
48 static af_data_t* play(struct af_instance_s* af, af_data_t* data)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
49 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
50 // Do something necessary to get rid of annoying warning during compile
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
51 if(!af)
29049
8c706ce21c6f Remove af_msg special-casing API in libaf.
bircoph
parents: 28229
diff changeset
52 mp_msg(MSGT_AFILTER, MSGL_ERR, "EEEK: Argument af == NULL in af_dummy.c play().");
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
53 return data;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
54 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
55
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
56 // 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
57 static int af_open(af_instance_t* af){
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
58 af->control=control;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
59 af->uninit=uninit;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
60 af->play=play;
24888
b2402b4f0afa libaf: change filter input/output ratio calculations
uau
parents: 22746
diff changeset
61 af->mul=1;
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
62 af->data=malloc(sizeof(af_data_t));
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
63 if(af->data == NULL)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
64 return AF_ERROR;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
65 return AF_OK;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
66 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
67
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
68 // Description of this filter
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
69 af_info_t af_info_dummy = {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
70 "dummy",
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
71 "dummy",
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
72 "Anders",
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
73 "",
7615
c67328dd459a Adding Support for non-reentrant audio filters
anders
parents: 7568
diff changeset
74 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
75 af_open
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
76 };