annotate src/audacious/af_compat.h @ 4381:ce3f2d2455cf

Moved debugging functions to tuple_compiler.c
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 28 Mar 2008 08:49:54 +0200
parents 060c9865ea17
children 2eee464379dc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4300
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
1 /*
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
2 * MPlayer libaf compatibility stuff
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
3 */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
4
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
5 #ifndef AF_COMPAT_H
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
6 #define AF_COMPAT_H
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
7
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
8 #include <glib.h>
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
9 #include "main.h"
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
10
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
11 /* Number of channels */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
12 #ifndef AF_NCH
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
13 #define AF_NCH 6
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
14 #endif
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
15
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
16 /* Format */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
17 #define AF_FORMAT_BE (0<<0) // Big Endian
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
18 #define AF_FORMAT_LE (1<<0) // Little Endian
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
19 #define AF_FORMAT_F (1<<2) // Foating point
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
20 #define AF_FORMAT_32BIT (3<<3)
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
21 #define AF_FORMAT_FLOAT_LE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_LE)
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
22 #define AF_FORMAT_FLOAT_BE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_BE)
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
23
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
24 #if G_BYTE_ORDER == G_BIG_ENDIAN // Native endian of cpu
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
25 #define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_BE
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
26 #else
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
27 #define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_LE
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
28 #endif
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
29
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
30 #define AF_MSG_INFO 0 ///< Important information
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
31
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
32 #define af_msg(a,...) AUDDBG(__VA_ARGS__);
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
33
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
34 /* Control */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
35 #define AF_CONTROL_SET 0x00000000
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
36 #define AF_CONTROL_GET 0x00000001
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
37
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
38 #define AF_CONTROL_MANDATORY 0x10000000
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
39 #define AF_CONTROL_OPTIONAL 0x20000000
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
40 #define AF_CONTROL_FILTER_SPECIFIC 0x40000000
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
41
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
42 #define AF_CONTROL_REINIT 0x00000100 | AF_CONTROL_MANDATORY
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
43 #define AF_CONTROL_COMMAND_LINE 0x00000300 | AF_CONTROL_OPTIONAL
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
44 #define AF_CONTROL_EQUALIZER_GAIN 0x00001C00 | AF_CONTROL_FILTER_SPECIFIC
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
45
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
46 /* Return values */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
47 #define AF_DETACH 2
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
48 #define AF_OK 1
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
49 #define AF_TRUE 1
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
50 #define AF_FALSE 0
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
51 #define AF_UNKNOWN -1
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
52 #define AF_ERROR -2
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
53 #define AF_FATAL -3
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
54
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
55 /* Flags used for defining the behavior of an audio filter */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
56 #define AF_FLAGS_REENTRANT 0x00000000
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
57 #define AF_FLAGS_NOT_REENTRANT 0x00000001
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
58
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
59 /* Audio data chunk */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
60 typedef struct af_data_s
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
61 {
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
62 void* audio; /* data buffer */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
63 int len; /* buffer length */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
64 int rate; /* sample rate */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
65 int nch; /* number of channels */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
66 int format; /* format */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
67 int bps; /* bytes per sample */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
68 } af_data_t;
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
69
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
70 struct af_instance_s;
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
71 /* Audio filter information not specific for current instance, but for
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
72 a specific filter */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
73 typedef struct af_info_s
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
74 {
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
75 const char *info;
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
76 const char *name;
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
77 const char *author;
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
78 const char *comment;
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
79 const int flags;
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
80 int (*open)(struct af_instance_s* vf);
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
81 } af_info_t;
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
82
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
83 /* Linked list of audio filters */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
84 typedef struct af_instance_s
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
85 {
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
86 af_info_t* info;
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
87 int (*control)(struct af_instance_s* af, int cmd, void* arg);
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
88 void (*uninit)(struct af_instance_s* af);
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
89 af_data_t* (*play)(struct af_instance_s* af, af_data_t* data);
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
90 void* setup; // setup data for this specific instance and filter
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
91 af_data_t* data; // configuration for outgoing data stream
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
92 struct af_instance_s* next;
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
93 struct af_instance_s* prev;
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
94 double delay; /* Delay caused by the filter, in units of bytes read without
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
95 * corresponding output */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
96 double mul; /* length multiplier: how much does this instance change
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
97 the length of the buffer. */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
98 }af_instance_t;
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
99
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
100 /*********************************************
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
101 Extended control used with arguments that operates on only one
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
102 channel at the time
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
103 */
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
104 typedef struct af_control_ext_s{
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
105 void* arg; // Argument
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
106 int ch; // Chanel number
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
107 }af_control_ext_t;
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
108
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
109 #ifndef clamp
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
110 #define clamp(a,min,max) (((a)>(max))?(max):(((a)<(min))?(min):(a)))
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
111 #endif
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
112
060c9865ea17 forgotten files
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff changeset
113 #endif /* AF_COMPAT_H */