Mercurial > audlegacy-plugins
annotate src/tta/ttalib.h @ 3178:4634dab72608
alsa-ng: Add get_volume() implementation.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Wed, 10 Jun 2009 00:06:15 -0500 |
parents | 3134a0987162 |
children |
rev | line source |
---|---|
290 | 1 /* |
2 * ttalib.h | |
3 * | |
4 * Description: TTAv1 player library prototypes | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
5 * Developed by: Alexander Djourik <ald@true-audio.com> |
290 | 6 * |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
7 * Copyright (c) 1999-2007 Alexander Djourik. All rights reserved. |
290 | 8 * |
9 */ | |
10 | |
11 /* | |
12 * This library is free software; you can redistribute it and/or | |
13 * modify it under the terms of the GNU Lesser General Public | |
14 * License as published by the Free Software Foundation; either | |
15 * version 2.1 of the License, or (at your option) any later version. | |
16 * | |
17 * This library is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
20 * Lesser General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU Lesser General Public | |
23 * License along with this library; if not, write to the Free Software | |
2835 | 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
290 | 25 * |
26 * Please see the file COPYING in this directory for full copyright | |
27 * information. | |
28 */ | |
29 | |
30 #ifndef TTALIB_H_ | |
31 #define TTALIB_H_ | |
32 | |
2971
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2835
diff
changeset
|
33 #include <audlegacy/plugin.h> |
290 | 34 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
35 // audacious support |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
36 #define FILE VFSFile |
1978 | 37 #define fopen aud_vfs_fopen |
38 #define fclose aud_vfs_fclose | |
39 #define fwrite aud_vfs_fwrite | |
40 #define fread aud_vfs_fread | |
41 #define frewind aud_vfs_frewind | |
42 #define ftell aud_vfs_ftell | |
43 #define fseek aud_vfs_fseek | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
44 |
290 | 45 #define MAX_BPS 24 // Max supported Bit resolution |
46 #define MAX_NCH 8 // Max supported number of channels | |
47 | |
48 // return codes | |
49 #define NO_ERROR 0 | |
50 #define OPEN_ERROR 1 // Can't open file | |
51 #define FORMAT_ERROR 2 // Unknown TTA format version | |
52 #define PLAYER_ERROR 3 // Not supported file format | |
53 #define FILE_ERROR 4 // File is corrupted | |
54 #define READ_ERROR 5 // Can't read from file | |
55 #define MEMORY_ERROR 6 // Insufficient memory available | |
56 | |
57 #define FRAME_TIME 1.04489795918367346939 | |
58 #define SEEK_STEP (int)(FRAME_TIME * 1000) | |
59 | |
60 #define ISO_BUFFER_LENGTH (1024*32) | |
61 #define ISO_NBUFFERS (8) | |
62 #define ISO_BUFFERS_SIZE (ISO_BUFFER_LENGTH*ISO_NBUFFERS) | |
63 #define PCM_BUFFER_LENGTH (4608) | |
64 | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
65 #define MAX_LINE 4096 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
66 #define MAX_YEAR 5 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
67 #define MAX_TRACK 3 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
68 #define MAX_GENRE 256 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
69 |
290 | 70 typedef struct { |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
71 unsigned char name[MAX_LINE]; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
72 unsigned char title[MAX_LINE]; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
73 unsigned char artist[MAX_LINE]; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
74 unsigned char album[MAX_LINE]; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
75 unsigned char comment[MAX_LINE]; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
76 unsigned char year[MAX_YEAR]; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
77 unsigned char track[MAX_TRACK]; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
78 unsigned char genre[MAX_GENRE]; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
79 unsigned char id3has; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
80 } id3_info; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
81 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
82 typedef struct { |
1237
0d5b0f861bf0
- quick fix for link breakage to libaudid3tag.so when --prefix is specified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1190
diff
changeset
|
83 VFSFile *HANDLE; // file handle |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
84 unsigned short NCH; // number of channels |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
85 unsigned short BPS; // bits per sample |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
86 unsigned short BSIZE; // byte size |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
87 unsigned short FORMAT; // audio format |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
88 unsigned int SAMPLERATE; // samplerate (sps) |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
89 unsigned int DATALENGTH; // data length in samples |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
90 unsigned int FRAMELEN; // frame length |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
91 unsigned int LENGTH; // playback time (sec) |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
92 unsigned int STATE; // return code |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
93 unsigned int DATAPOS; // size of ID3v2 header |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
94 id3_info ID3; |
290 | 95 } tta_info; |
96 | |
97 /*********************** Library functions *************************/ | |
98 | |
99 #ifdef LIBTEST | |
100 #ifndef DPRINTF | |
101 #define DPRINTF(x) fprintf(stderr, (x)) | |
102 #endif /* DPRINTF */ | |
103 | |
104 static void tta_error (int error) { | |
105 DPRINTF("TTA Decoder Error - "); | |
106 switch (error) { | |
107 case OPEN_ERROR: DPRINTF("Can't open file\n"); break; | |
108 case FORMAT_ERROR: DPRINTF("Not supported file format\n"); break; | |
109 case FILE_ERROR: DPRINTF("File is corrupted\n"); break; | |
110 case READ_ERROR: DPRINTF("Can't read from file\n"); break; | |
111 case MEMORY_ERROR: DPRINTF("Insufficient memory available\n"); break; | |
112 } | |
113 } | |
114 #endif /* LIBTEST */ | |
115 | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
116 int open_tta_file ( // FUNCTION: opens TTA file |
290 | 117 const char *filename, // file to open |
118 tta_info *info, // file info structure | |
551
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
119 unsigned int offset); // ID3v2 header size |
290 | 120 /* |
121 * RETURN VALUE | |
122 * This function returns 0 if success. Otherwise, -1 is returned | |
123 * and the variable STATE of the currently using info structure | |
124 * is set to indicate the error. | |
125 * | |
126 */ | |
127 | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
128 void close_tta_file ( // FUNCTION: closes currently playing file |
290 | 129 tta_info *info); // file info structure |
130 | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
131 int set_position ( // FUNCTION: sets playback position |
551
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
132 unsigned int pos); // seek position = seek_time_ms / SEEK_STEP |
290 | 133 /* |
134 * RETURN VALUE | |
135 * This function returns 0 if success. Otherwise, -1 is returned | |
136 * and the variable STATE of the currently using info structure | |
137 * is set to indicate the error. | |
138 * | |
139 */ | |
140 | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
141 int player_init ( // FUNCTION: initializes TTA player |
290 | 142 tta_info *info); // file info structure |
143 /* | |
144 * RETURN VALUE | |
145 * This function returns 0 if success. Otherwise, -1 is returned | |
146 * and the variable STATE of the currently using info structure | |
147 * is set to indicate the error. | |
148 * | |
149 */ | |
150 | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
151 void player_stop (void); // FUNCTION: destroys memory pools |
290 | 152 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
153 int get_samples ( // FUNCTION: decode PCM_BUFFER_LENGTH samples |
290 | 154 unsigned char *buffer); // into the current PCM buffer position |
155 /* | |
156 * RETURN VALUE | |
157 * This function returns the number of samples successfully decoded. | |
158 * Otherwise, -1 is returned and the variable STATE of the currently | |
159 * using info structure is set to indicate the error. | |
160 * | |
161 */ | |
162 | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
551
diff
changeset
|
163 int get_bitrate (void); // RETURN VALUE: TTA dynamic bitrate |
290 | 164 |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1012
diff
changeset
|
165 int get_id3_tags (const char *filename, tta_info *ttainfo); |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1012
diff
changeset
|
166 |
290 | 167 #endif /* TTALIB_H_ */ |
168 |