comparison src/audacious/af_compat.h @ 4300:060c9865ea17

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