/src/libsndfile/src/common.h
Line | Count | Source |
1 | | /* |
2 | | ** Copyright (C) 1999-2018 Erik de Castro Lopo <erikd@mega-nerd.com> |
3 | | ** |
4 | | ** This program is free software; you can redistribute it and/or modify |
5 | | ** it under the terms of the GNU Lesser General Public License as published by |
6 | | ** the Free Software Foundation; either version 2.1 of the License, or |
7 | | ** (at your option) any later version. |
8 | | ** |
9 | | ** This program is distributed in the hope that it will be useful, |
10 | | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | | ** GNU Lesser General Public License for more details. |
13 | | ** |
14 | | ** You should have received a copy of the GNU Lesser General Public License |
15 | | ** along with this program; if not, write to the Free Software |
16 | | ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 | | */ |
18 | | |
19 | | #ifndef SNDFILE_COMMON_H |
20 | | #define SNDFILE_COMMON_H |
21 | | |
22 | | #include "sfconfig.h" |
23 | | |
24 | | #include <stdlib.h> |
25 | | #include <string.h> |
26 | | #include <stdbool.h> |
27 | | #include <stdint.h> |
28 | | #include <inttypes.h> |
29 | | |
30 | | #if HAVE_SYS_TYPES_H |
31 | | #include <sys/types.h> |
32 | | #endif |
33 | | |
34 | | #ifndef SNDFILE_H |
35 | | #include "sndfile.h" |
36 | | #endif |
37 | | |
38 | | #include <math.h> |
39 | | |
40 | | #ifdef USE_SSE2 |
41 | | # ifdef _MSC_VER |
42 | | # include <intrin.h> |
43 | | # else |
44 | | # include <immintrin.h> |
45 | | # endif |
46 | | #endif |
47 | | |
48 | | #ifdef __cplusplus |
49 | | #error "This code is not designed to be compiled with a C++ compiler." |
50 | | #endif |
51 | | |
52 | | |
53 | | |
54 | | /* |
55 | | ** Inspiration : http://sourcefrog.net/weblog/software/languages/C/unused.html |
56 | | */ |
57 | | #ifdef UNUSED |
58 | | #elif defined (__GNUC__) |
59 | | # define UNUSED(x) UNUSED_ ## x __attribute__ ((unused)) |
60 | | #elif defined (__LCLINT__) |
61 | | # define UNUSED(x) /*@unused@*/ x |
62 | | #else |
63 | | # define UNUSED(x) x |
64 | | #endif |
65 | | |
66 | | #ifdef __GNUC__ |
67 | | # define WARN_UNUSED __attribute__ ((warn_unused_result)) |
68 | | #else |
69 | | # define WARN_UNUSED |
70 | | #endif |
71 | | |
72 | 0 | #define SF_BUFFER_LEN (8192) |
73 | | #define SF_FILENAME_LEN (1024) |
74 | | #define SF_SYSERR_LEN (256) |
75 | 60.0k | #define SF_MAX_STRINGS (32) |
76 | | #define SF_PARSELOG_LEN (2048) |
77 | | |
78 | 16 | #define PSF_SEEK_ERROR ((sf_count_t) -1) |
79 | | |
80 | 5.87k | #define BITWIDTH2BYTES(x) (((x) + 7) / 8) |
81 | | |
82 | | /* For some reason sizeof returns an unsigned value which causes |
83 | | ** a warning when that value is added or subtracted from a signed |
84 | | ** value. Use SIGNED_SIZEOF instead. |
85 | | */ |
86 | 342M | #define SIGNED_SIZEOF(x) ((int) sizeof (x)) |
87 | | |
88 | 81.5M | #define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof ((x) [0]))) |
89 | | |
90 | 3.70k | #define SF_MAX(a, b) ((a) > (b) ? (a) : (b)) |
91 | 4.20M | #define SF_MIN(a, b) ((a) < (b) ? (a) : (b)) |
92 | | |
93 | | |
94 | | |
95 | 17.7k | #define SF_MAX_CHANNELS 1024 |
96 | | |
97 | | /* |
98 | | * Macros for splitting the format file of SF_INFO into container type, |
99 | | ** codec type and endian-ness. |
100 | | */ |
101 | 73.6k | #define SF_CONTAINER(x) ((x) & SF_FORMAT_TYPEMASK) |
102 | 35.8k | #define SF_CODEC(x) ((x) & SF_FORMAT_SUBMASK) |
103 | 3.39k | #define SF_ENDIAN(x) ((x) & SF_FORMAT_ENDMASK) |
104 | | |
105 | | /* |
106 | | ** Binheader cast macros. |
107 | | */ |
108 | | |
109 | 0 | #define BHW1(x) ((uint8_t) (x)) |
110 | 0 | #define BHW2(x) ((uint16_t) (x)) |
111 | 0 | #define BHW3(x) ((uint32_t) (x)) |
112 | 0 | #define BHW4(x) ((uint32_t) (x)) |
113 | 0 | #define BHW8(x) ((uint64_t) (x)) |
114 | | |
115 | 0 | #define BHWm(x) ((uint32_t) (x)) |
116 | 0 | #define BHWS(x) ((char *) (x)) |
117 | | |
118 | 0 | #define BHWf(x) ((double) (x)) |
119 | 0 | #define BHWd(x) ((double) (x)) |
120 | | |
121 | 0 | #define BHWh(x) ((void *) (x)) |
122 | 18 | #define BHWj(x) ((size_t) (x)) |
123 | 0 | #define BHWp(x) ((char *) (x)) |
124 | 0 | #define BHWo(x) ((size_t) (x)) |
125 | 0 | #define BHWs(x) ((char *) (x)) |
126 | 18 | #define BHWv(x) ((const void *) (x)) |
127 | 18 | #define BHWz(x) ((size_t) (x)) |
128 | | |
129 | | /*------------------------------------------------------------------------------ |
130 | | */ |
131 | | |
132 | | enum |
133 | | { /* PEAK chunk location. */ |
134 | | SF_PEAK_START = 42, |
135 | | SF_PEAK_END = 43, |
136 | | |
137 | | /* PEAK chunk location. */ |
138 | | SF_SCALE_MAX = 52, |
139 | | SF_SCALE_MIN = 53, |
140 | | |
141 | | /* str_flags values. */ |
142 | | SF_STR_ALLOW_START = 0x0100, |
143 | | SF_STR_ALLOW_END = 0x0200, |
144 | | |
145 | | /* Location of strings. */ |
146 | | SF_STR_LOCATE_START = 0x0400, |
147 | | SF_STR_LOCATE_END = 0x0800, |
148 | | |
149 | | SFD_TYPEMASK = 0x0FFFFFFF |
150 | | } ; |
151 | | |
152 | 0 | #define SFM_MASK (SFM_READ | SFM_WRITE | SFM_RDWR) |
153 | | #define SFM_UNMASK (~SFM_MASK) |
154 | | |
155 | | /*--------------------------------------------------------------------------------------- |
156 | | ** Formats that may be supported at some time in the future. |
157 | | ** When support is finalised, these values move to src/sndfile.h. |
158 | | */ |
159 | | |
160 | | enum |
161 | | { /* Work in progress. */ |
162 | | SF_FORMAT_SPEEX = 0x5000000, |
163 | | SF_FORMAT_OGGFLAC = 0x5000001, |
164 | | |
165 | | /* Formats supported read only. */ |
166 | | SF_FORMAT_TXW = 0x4030000, /* Yamaha TX16 sampler file */ |
167 | | SF_FORMAT_DWD = 0x4040000, /* DiamondWare Digirized */ |
168 | | |
169 | | /* Following are detected but not supported. */ |
170 | | SF_FORMAT_REX = 0x40A0000, /* Propellorheads Rex/Rcy */ |
171 | | SF_FORMAT_REX2 = 0x40D0000, /* Propellorheads Rex2 */ |
172 | | SF_FORMAT_KRZ = 0x40E0000, /* Kurzweil sampler file */ |
173 | | SF_FORMAT_WMA = 0x4100000, /* Windows Media Audio. */ |
174 | | SF_FORMAT_SHN = 0x4110000, /* Shorten. */ |
175 | | |
176 | | /* Unsupported encodings. */ |
177 | | SF_FORMAT_SVX_FIB = 0x1020, /* SVX Fibonacci Delta encoding. */ |
178 | | SF_FORMAT_SVX_EXP = 0x1021, /* SVX Exponential Delta encoding. */ |
179 | | |
180 | | SF_FORMAT_PCM_N = 0x1030 |
181 | | } ; |
182 | | |
183 | | /*--------------------------------------------------------------------------------------- |
184 | | */ |
185 | | |
186 | | typedef struct |
187 | | { unsigned kuki_offset ; |
188 | | unsigned pakt_offset ; |
189 | | |
190 | | unsigned bits_per_sample ; |
191 | | unsigned frames_per_packet ; |
192 | | |
193 | | int64_t packets ; |
194 | | int64_t valid_frames ; |
195 | | int32_t priming_frames ; |
196 | | int32_t remainder_frames ; |
197 | | } ALAC_DECODER_INFO ; |
198 | | |
199 | | /*--------------------------------------------------------------------------------------- |
200 | | ** PEAK_CHUNK - This chunk type is common to both AIFF and WAVE files although their |
201 | | ** endian encodings are different. |
202 | | */ |
203 | | |
204 | | typedef struct |
205 | | { double value ; /* signed value of peak */ |
206 | | sf_count_t position ; /* the sample frame for the peak */ |
207 | | } PEAK_POS ; |
208 | | |
209 | | typedef struct |
210 | | { /* libsndfile internal : write a PEAK chunk at the start or end of the file? */ |
211 | | int peak_loc ; |
212 | | |
213 | | /* WAV/AIFF */ |
214 | | unsigned int version ; /* version of the PEAK chunk */ |
215 | | unsigned int timestamp ; /* secs since 1/1/1970 */ |
216 | | |
217 | | /* CAF */ |
218 | | unsigned int edit_number ; |
219 | | |
220 | | /* the per channel peak info */ |
221 | | PEAK_POS peaks [] ; |
222 | | } PEAK_INFO ; |
223 | | |
224 | | static inline PEAK_INFO * |
225 | | peak_info_calloc (int channels) |
226 | 817 | { return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ; |
227 | 817 | } /* peak_info_calloc */ Unexecuted instantiation: sndfile.c:peak_info_calloc Line | Count | Source | 226 | 256 | { return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ; | 227 | 256 | } /* peak_info_calloc */ |
Unexecuted instantiation: au.c:peak_info_calloc Unexecuted instantiation: avr.c:peak_info_calloc Line | Count | Source | 226 | 199 | { return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ; | 227 | 199 | } /* peak_info_calloc */ |
Unexecuted instantiation: dwd.c:peak_info_calloc Unexecuted instantiation: flac.c:peak_info_calloc Unexecuted instantiation: g72x.c:peak_info_calloc Unexecuted instantiation: htk.c:peak_info_calloc Unexecuted instantiation: ircam.c:peak_info_calloc Unexecuted instantiation: mat4.c:peak_info_calloc Unexecuted instantiation: mat5.c:peak_info_calloc Unexecuted instantiation: nist.c:peak_info_calloc Unexecuted instantiation: paf.c:peak_info_calloc Unexecuted instantiation: pvf.c:peak_info_calloc Unexecuted instantiation: raw.c:peak_info_calloc Unexecuted instantiation: rx2.c:peak_info_calloc Unexecuted instantiation: sd2.c:peak_info_calloc Unexecuted instantiation: sds.c:peak_info_calloc Unexecuted instantiation: svx.c:peak_info_calloc Unexecuted instantiation: txw.c:peak_info_calloc Unexecuted instantiation: voc.c:peak_info_calloc Unexecuted instantiation: wve.c:peak_info_calloc Unexecuted instantiation: w64.c:peak_info_calloc wavlike.c:peak_info_calloc Line | Count | Source | 226 | 362 | { return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ; | 227 | 362 | } /* peak_info_calloc */ |
Unexecuted instantiation: wav.c:peak_info_calloc Unexecuted instantiation: xi.c:peak_info_calloc Unexecuted instantiation: mpc2k.c:peak_info_calloc Unexecuted instantiation: rf64.c:peak_info_calloc Unexecuted instantiation: ogg.c:peak_info_calloc Unexecuted instantiation: mpeg.c:peak_info_calloc Unexecuted instantiation: alac.c:peak_info_calloc Unexecuted instantiation: alaw.c:peak_info_calloc Unexecuted instantiation: audio_detect.c:peak_info_calloc Unexecuted instantiation: broadcast.c:peak_info_calloc Unexecuted instantiation: cart.c:peak_info_calloc Unexecuted instantiation: chanmap.c:peak_info_calloc Unexecuted instantiation: chunk.c:peak_info_calloc Unexecuted instantiation: command.c:peak_info_calloc Unexecuted instantiation: common.c:peak_info_calloc Unexecuted instantiation: dither.c:peak_info_calloc Unexecuted instantiation: double64.c:peak_info_calloc Unexecuted instantiation: dwvw.c:peak_info_calloc Unexecuted instantiation: file_io.c:peak_info_calloc Unexecuted instantiation: float32.c:peak_info_calloc Unexecuted instantiation: gsm610.c:peak_info_calloc Unexecuted instantiation: id3.c:peak_info_calloc Unexecuted instantiation: ima_adpcm.c:peak_info_calloc Unexecuted instantiation: ms_adpcm.c:peak_info_calloc Unexecuted instantiation: nms_adpcm.c:peak_info_calloc Unexecuted instantiation: pcm.c:peak_info_calloc Unexecuted instantiation: strings.c:peak_info_calloc Unexecuted instantiation: ulaw.c:peak_info_calloc Unexecuted instantiation: vox_adpcm.c:peak_info_calloc Unexecuted instantiation: ima_oki_adpcm.c:peak_info_calloc |
228 | | |
229 | | typedef struct |
230 | | { int type ; |
231 | | int flags ; |
232 | | size_t offset ; |
233 | | } STR_DATA ; |
234 | | |
235 | | typedef struct |
236 | | { uint64_t hash ; |
237 | | char id [64] ; |
238 | | unsigned id_size ; |
239 | | uint32_t mark32 ; |
240 | | sf_count_t offset ; |
241 | | uint32_t len ; |
242 | | } READ_CHUNK ; |
243 | | |
244 | | typedef struct |
245 | | { uint64_t hash ; |
246 | | uint32_t mark32 ; |
247 | | uint32_t len ; |
248 | | void *data ; |
249 | | } WRITE_CHUNK ; |
250 | | |
251 | | typedef struct |
252 | | { uint32_t count ; |
253 | | uint32_t used ; |
254 | | READ_CHUNK *chunks ; |
255 | | } READ_CHUNKS ; |
256 | | typedef struct |
257 | | { uint32_t count ; |
258 | | uint32_t used ; |
259 | | WRITE_CHUNK *chunks ; |
260 | | } WRITE_CHUNKS ; |
261 | | |
262 | | struct SF_CHUNK_ITERATOR |
263 | | { uint32_t current ; |
264 | | int64_t hash ; |
265 | | char id [64] ; |
266 | | unsigned id_size ; |
267 | | SNDFILE *sndfile ; |
268 | | } ; |
269 | | |
270 | | static inline size_t |
271 | | make_size_t (int x) |
272 | 3.33k | { return (size_t) x ; |
273 | 3.33k | } /* make_size_t */ Unexecuted instantiation: sndfile.c:make_size_t Line | Count | Source | 272 | 2.87k | { return (size_t) x ; | 273 | 2.87k | } /* make_size_t */ |
Unexecuted instantiation: au.c:make_size_t Unexecuted instantiation: avr.c:make_size_t Unexecuted instantiation: caf.c:make_size_t Unexecuted instantiation: dwd.c:make_size_t Unexecuted instantiation: flac.c:make_size_t Unexecuted instantiation: g72x.c:make_size_t Unexecuted instantiation: htk.c:make_size_t Unexecuted instantiation: ircam.c:make_size_t Unexecuted instantiation: mat4.c:make_size_t Unexecuted instantiation: mat5.c:make_size_t Unexecuted instantiation: nist.c:make_size_t Unexecuted instantiation: paf.c:make_size_t Unexecuted instantiation: pvf.c:make_size_t Unexecuted instantiation: raw.c:make_size_t Unexecuted instantiation: rx2.c:make_size_t Unexecuted instantiation: sd2.c:make_size_t Unexecuted instantiation: sds.c:make_size_t Unexecuted instantiation: svx.c:make_size_t Unexecuted instantiation: txw.c:make_size_t Unexecuted instantiation: voc.c:make_size_t Unexecuted instantiation: wve.c:make_size_t Unexecuted instantiation: w64.c:make_size_t Line | Count | Source | 272 | 448 | { return (size_t) x ; | 273 | 448 | } /* make_size_t */ |
Unexecuted instantiation: wav.c:make_size_t Unexecuted instantiation: xi.c:make_size_t Line | Count | Source | 272 | 9 | { return (size_t) x ; | 273 | 9 | } /* make_size_t */ |
Unexecuted instantiation: rf64.c:make_size_t Unexecuted instantiation: ogg.c:make_size_t Unexecuted instantiation: mpeg.c:make_size_t Unexecuted instantiation: alac.c:make_size_t Unexecuted instantiation: alaw.c:make_size_t Unexecuted instantiation: audio_detect.c:make_size_t Unexecuted instantiation: broadcast.c:make_size_t Unexecuted instantiation: cart.c:make_size_t Unexecuted instantiation: chanmap.c:make_size_t Unexecuted instantiation: chunk.c:make_size_t Unexecuted instantiation: command.c:make_size_t Unexecuted instantiation: common.c:make_size_t Unexecuted instantiation: dither.c:make_size_t Unexecuted instantiation: double64.c:make_size_t Unexecuted instantiation: dwvw.c:make_size_t Unexecuted instantiation: file_io.c:make_size_t Unexecuted instantiation: float32.c:make_size_t Unexecuted instantiation: gsm610.c:make_size_t Unexecuted instantiation: id3.c:make_size_t Unexecuted instantiation: ima_adpcm.c:make_size_t Unexecuted instantiation: ms_adpcm.c:make_size_t Unexecuted instantiation: nms_adpcm.c:make_size_t Unexecuted instantiation: pcm.c:make_size_t Unexecuted instantiation: strings.c:make_size_t Unexecuted instantiation: ulaw.c:make_size_t Unexecuted instantiation: vox_adpcm.c:make_size_t Unexecuted instantiation: ima_oki_adpcm.c:make_size_t |
274 | | |
275 | | typedef SF_BROADCAST_INFO_VAR (16 * 1024) SF_BROADCAST_INFO_16K ; |
276 | | |
277 | | typedef SF_CART_INFO_VAR (16 * 1024) SF_CART_INFO_16K ; |
278 | | |
279 | | typedef struct |
280 | | { sf_count_t offset ; |
281 | | sf_count_t len ; |
282 | | unsigned minor_version ; |
283 | | } ID3V2_HEADER_INFO ; |
284 | | |
285 | | |
286 | | void *psf_memdup (const void *src, size_t n) ; |
287 | | |
288 | | /* |
289 | | ** This version of isprint specifically ignores any locale info. Its used for |
290 | | ** determining which characters can be printed in things like hexdumps. |
291 | | */ |
292 | | int psf_isprint (int ch) ; |
293 | | |
294 | | /*======================================================================================= |
295 | | ** SF_PRIVATE struct - a pointer to this struct is passed back to the caller of the |
296 | | ** sf_open_XXXX functions. The caller however has no knowledge of the struct's |
297 | | ** contents. |
298 | | */ |
299 | | |
300 | | typedef struct |
301 | | { |
302 | | char path [SF_FILENAME_LEN] ; |
303 | | char dir [SF_FILENAME_LEN] ; |
304 | | char name [SF_FILENAME_LEN / 4] ; |
305 | | |
306 | | #if USE_WINDOWS_API |
307 | | /* |
308 | | ** These fields can only be used in src/file_io.c. |
309 | | ** They are basically the same as a windows file HANDLE. |
310 | | */ |
311 | | void *handle, *hsaved ; |
312 | | #else |
313 | | /* These fields can only be used in src/file_io.c. */ |
314 | | int filedes, savedes ; |
315 | | #endif |
316 | | |
317 | | int do_not_close_descriptor ; |
318 | | int mode ; /* Open mode : SFM_READ, SFM_WRITE or SFM_RDWR. */ |
319 | | } PSF_FILE ; |
320 | | |
321 | | |
322 | | |
323 | | typedef union |
324 | | { double dbuf [SF_BUFFER_LEN / sizeof (double)] ; |
325 | | int64_t lbuf [SF_BUFFER_LEN / sizeof (int64_t)] ; |
326 | | float fbuf [SF_BUFFER_LEN / sizeof (float)] ; |
327 | | int ibuf [SF_BUFFER_LEN / sizeof (int)] ; |
328 | | short sbuf [SF_BUFFER_LEN / sizeof (short)] ; |
329 | | char cbuf [SF_BUFFER_LEN / sizeof (char)] ; |
330 | | signed char scbuf [SF_BUFFER_LEN / sizeof (signed char)] ; |
331 | | unsigned char ucbuf [SF_BUFFER_LEN / sizeof (signed char)] ; |
332 | | } BUF_UNION ; |
333 | | |
334 | | |
335 | | |
336 | | typedef struct sf_private_tag |
337 | | { |
338 | | PSF_FILE file, rsrc ; |
339 | | |
340 | | char syserr [SF_SYSERR_LEN] ; |
341 | | |
342 | | /* parselog and indx should only be changed within the logging functions |
343 | | ** of common.c |
344 | | */ |
345 | | struct |
346 | | { char buf [SF_PARSELOG_LEN] ; |
347 | | int indx ; |
348 | | } parselog ; |
349 | | |
350 | | |
351 | | struct |
352 | | { unsigned char * ptr ; |
353 | | sf_count_t indx, end, len ; |
354 | | } header ; |
355 | | |
356 | | int rwf_endian ; /* Header endian-ness flag. */ |
357 | | |
358 | | /* Storage and housekeeping data for adding/reading strings from |
359 | | ** sound files. |
360 | | */ |
361 | | struct |
362 | | { STR_DATA data [SF_MAX_STRINGS] ; |
363 | | char *storage ; |
364 | | size_t storage_len ; |
365 | | size_t storage_used ; |
366 | | uint32_t flags ; |
367 | | } strings ; |
368 | | |
369 | | /* Guard value. If this changes the buffers above have overflowed. */ |
370 | | int Magick ; |
371 | | |
372 | | unsigned unique_id ; |
373 | | |
374 | | int error ; |
375 | | |
376 | | int endian ; /* File endianness : SF_ENDIAN_LITTLE or SF_ENDIAN_BIG. */ |
377 | | int data_endswap ; /* Need to endswap data? */ |
378 | | |
379 | | /* |
380 | | ** Maximum float value for calculating the multiplier for |
381 | | ** float/double to short/int conversions. |
382 | | */ |
383 | | int float_int_mult ; |
384 | | float float_max ; |
385 | | |
386 | | int scale_int_float ; |
387 | | |
388 | | /* Variables for handling pipes. */ |
389 | | int is_pipe ; /* True if file is a pipe. */ |
390 | | sf_count_t pipeoffset ; /* Number of bytes read from a pipe. */ |
391 | | |
392 | | /* True if clipping must be performed on float->int conversions. */ |
393 | | int add_clipping ; |
394 | | |
395 | | SF_INFO sf ; |
396 | | |
397 | | int have_written ; /* Has a single write been done to the file? */ |
398 | | PEAK_INFO *peak_info ; |
399 | | |
400 | | /* Cue Marker Info */ |
401 | | SF_CUES *cues ; |
402 | | |
403 | | /* Loop Info */ |
404 | | SF_LOOP_INFO *loop_info ; |
405 | | SF_INSTRUMENT *instrument ; |
406 | | |
407 | | /* Broadcast (EBU) Info */ |
408 | | SF_BROADCAST_INFO_16K *broadcast_16k ; |
409 | | |
410 | | /* Cart (AES46) Info */ |
411 | | SF_CART_INFO_16K *cart_16k ; |
412 | | |
413 | | /* Channel map data (if present) : an array of ints. */ |
414 | | int *channel_map ; |
415 | | |
416 | | sf_count_t filelength ; /* Overall length of (embedded) file. */ |
417 | | sf_count_t fileoffset ; /* Offset in number of bytes from beginning of file. */ |
418 | | |
419 | | sf_count_t rsrclength ; /* Length of the resource fork (if it exists). */ |
420 | | |
421 | | sf_count_t dataoffset ; /* Offset in number of bytes from beginning of file. */ |
422 | | sf_count_t datalength ; /* Length in bytes of the audio data. */ |
423 | | sf_count_t dataend ; /* Offset to file tailer. */ |
424 | | |
425 | | sf_count_t blockwidth ; /* Size in bytes of one set of interleaved samples. */ |
426 | | int bytewidth ; /* Size in bytes of one sample (one channel). */ |
427 | | |
428 | | void *dither ; |
429 | | void *interleave ; |
430 | | |
431 | | int last_op ; /* Last operation; either SFM_READ or SFM_WRITE */ |
432 | | sf_count_t read_current ; |
433 | | sf_count_t write_current ; |
434 | | |
435 | | void *container_data ; /* This is a pointer to dynamically allocated file |
436 | | ** container format specific data. |
437 | | */ |
438 | | |
439 | | void *codec_data ; /* This is a pointer to dynamically allocated file |
440 | | ** codec format specific data. |
441 | | */ |
442 | | |
443 | | SF_DITHER_INFO write_dither ; |
444 | | SF_DITHER_INFO read_dither ; |
445 | | |
446 | | int norm_double ; |
447 | | int norm_float ; |
448 | | |
449 | | int auto_header ; |
450 | | |
451 | | int ieee_replace ; |
452 | | |
453 | | /* A set of file specific function pointers */ |
454 | | sf_count_t (*read_short) (struct sf_private_tag*, short *ptr, sf_count_t len) ; |
455 | | sf_count_t (*read_int) (struct sf_private_tag*, int *ptr, sf_count_t len) ; |
456 | | sf_count_t (*read_float) (struct sf_private_tag*, float *ptr, sf_count_t len) ; |
457 | | sf_count_t (*read_double) (struct sf_private_tag*, double *ptr, sf_count_t len) ; |
458 | | |
459 | | sf_count_t (*write_short) (struct sf_private_tag*, const short *ptr, sf_count_t len) ; |
460 | | sf_count_t (*write_int) (struct sf_private_tag*, const int *ptr, sf_count_t len) ; |
461 | | sf_count_t (*write_float) (struct sf_private_tag*, const float *ptr, sf_count_t len) ; |
462 | | sf_count_t (*write_double) (struct sf_private_tag*, const double *ptr, sf_count_t len) ; |
463 | | |
464 | | sf_count_t (*seek) (struct sf_private_tag*, int mode, sf_count_t samples_from_start) ; |
465 | | int (*write_header) (struct sf_private_tag*, int calc_length) ; |
466 | | int (*command) (struct sf_private_tag*, int command, void *data, int datasize) ; |
467 | | int (*byterate) (struct sf_private_tag*) ; |
468 | | |
469 | | /* |
470 | | ** Separate close functions for the codec and the container. |
471 | | ** The codec close function is always called first. |
472 | | */ |
473 | | int (*codec_close) (struct sf_private_tag*) ; |
474 | | int (*container_close) (struct sf_private_tag*) ; |
475 | | |
476 | | char *format_desc ; |
477 | | |
478 | | /* Virtual I/O functions. */ |
479 | | int virtual_io ; |
480 | | SF_VIRTUAL_IO vio ; |
481 | | void *vio_user_data ; |
482 | | |
483 | | /* Chunk get/set. */ |
484 | | SF_CHUNK_ITERATOR *iterator ; |
485 | | |
486 | | READ_CHUNKS rchunks ; |
487 | | WRITE_CHUNKS wchunks ; |
488 | | |
489 | | int (*set_chunk) (struct sf_private_tag*, const SF_CHUNK_INFO * chunk_info) ; |
490 | | SF_CHUNK_ITERATOR * (*next_chunk_iterator) (struct sf_private_tag*, SF_CHUNK_ITERATOR * iterator) ; |
491 | | int (*get_chunk_size) (struct sf_private_tag*, const SF_CHUNK_ITERATOR * iterator, SF_CHUNK_INFO * chunk_info) ; |
492 | | int (*get_chunk_data) (struct sf_private_tag*, const SF_CHUNK_ITERATOR * iterator, SF_CHUNK_INFO * chunk_info) ; |
493 | | |
494 | | int cpu_flags ; |
495 | | |
496 | | ID3V2_HEADER_INFO id3_header ; |
497 | | } SF_PRIVATE ; |
498 | | |
499 | | |
500 | | |
501 | | enum |
502 | | { SFE_NO_ERROR = SF_ERR_NO_ERROR, |
503 | | SFE_BAD_OPEN_FORMAT = SF_ERR_UNRECOGNISED_FORMAT, |
504 | | SFE_SYSTEM = SF_ERR_SYSTEM, |
505 | | SFE_MALFORMED_FILE = SF_ERR_MALFORMED_FILE, |
506 | | SFE_UNSUPPORTED_ENCODING = SF_ERR_UNSUPPORTED_ENCODING, |
507 | | |
508 | | SFE_ZERO_MAJOR_FORMAT, |
509 | | SFE_ZERO_MINOR_FORMAT, |
510 | | SFE_BAD_FILE, |
511 | | SFE_BAD_FILE_READ, |
512 | | SFE_OPEN_FAILED, |
513 | | SFE_BAD_SNDFILE_PTR, |
514 | | SFE_BAD_SF_INFO_PTR, |
515 | | SFE_BAD_SF_INCOMPLETE, |
516 | | SFE_BAD_FILE_PTR, |
517 | | SFE_BAD_INT_PTR, |
518 | | SFE_BAD_STAT_SIZE, |
519 | | SFE_NO_TEMP_DIR, |
520 | | SFE_MALLOC_FAILED, |
521 | | SFE_UNIMPLEMENTED, |
522 | | SFE_BAD_READ_ALIGN, |
523 | | SFE_BAD_WRITE_ALIGN, |
524 | | SFE_NOT_READMODE, |
525 | | SFE_NOT_WRITEMODE, |
526 | | SFE_BAD_MODE_RW, |
527 | | SFE_BAD_SF_INFO, |
528 | | SFE_BAD_OFFSET, |
529 | | SFE_NO_EMBED_SUPPORT, |
530 | | SFE_NO_EMBEDDED_RDWR, |
531 | | SFE_NO_PIPE_WRITE, |
532 | | |
533 | | SFE_INTERNAL, |
534 | | SFE_BAD_COMMAND_PARAM, |
535 | | SFE_BAD_ENDIAN, |
536 | | SFE_CHANNEL_COUNT_ZERO, |
537 | | SFE_CHANNEL_COUNT, |
538 | | SFE_CHANNEL_COUNT_BAD, |
539 | | |
540 | | SFE_BAD_VIRTUAL_IO, |
541 | | |
542 | | SFE_INTERLEAVE_MODE, |
543 | | SFE_INTERLEAVE_SEEK, |
544 | | SFE_INTERLEAVE_READ, |
545 | | |
546 | | SFE_BAD_SEEK, |
547 | | SFE_NOT_SEEKABLE, |
548 | | SFE_AMBIGUOUS_SEEK, |
549 | | SFE_WRONG_SEEK, |
550 | | SFE_SEEK_FAILED, |
551 | | |
552 | | SFE_BAD_OPEN_MODE, |
553 | | SFE_OPEN_PIPE_RDWR, |
554 | | SFE_RDWR_POSITION, |
555 | | SFE_RDWR_BAD_HEADER, |
556 | | SFE_CMD_HAS_DATA, |
557 | | SFE_BAD_BROADCAST_INFO_SIZE, |
558 | | SFE_BAD_BROADCAST_INFO_TOO_BIG, |
559 | | SFE_BAD_CART_INFO_SIZE, |
560 | | SFE_BAD_CART_INFO_TOO_BIG, |
561 | | |
562 | | SFE_STR_NO_SUPPORT, |
563 | | SFE_STR_NOT_WRITE, |
564 | | SFE_STR_MAX_DATA, |
565 | | SFE_STR_MAX_COUNT, |
566 | | SFE_STR_BAD_TYPE, |
567 | | SFE_STR_NO_ADD_END, |
568 | | SFE_STR_BAD_STRING, |
569 | | SFE_STR_WEIRD, |
570 | | |
571 | | SFE_WAV_NO_RIFF, |
572 | | SFE_WAV_NO_WAVE, |
573 | | SFE_WAV_NO_FMT, |
574 | | SFE_WAV_BAD_FMT, |
575 | | SFE_WAV_FMT_SHORT, |
576 | | SFE_WAV_BAD_FACT, |
577 | | SFE_WAV_BAD_PEAK, |
578 | | SFE_WAV_PEAK_B4_FMT, |
579 | | SFE_WAV_BAD_FORMAT, |
580 | | SFE_WAV_BAD_BLOCKALIGN, |
581 | | SFE_WAV_NO_DATA, |
582 | | SFE_WAV_BAD_LIST, |
583 | | SFE_WAV_ADPCM_NOT4BIT, |
584 | | SFE_WAV_ADPCM_CHANNELS, |
585 | | SFE_WAV_ADPCM_SAMPLES, |
586 | | SFE_WAV_GSM610_FORMAT, |
587 | | SFE_WAV_UNKNOWN_CHUNK, |
588 | | SFE_WAV_WVPK_DATA, |
589 | | SFE_WAV_NMS_FORMAT, |
590 | | |
591 | | SFE_AIFF_NO_FORM, |
592 | | SFE_AIFF_AIFF_NO_FORM, |
593 | | SFE_AIFF_COMM_NO_FORM, |
594 | | SFE_AIFF_SSND_NO_COMM, |
595 | | SFE_AIFF_UNKNOWN_CHUNK, |
596 | | SFE_AIFF_COMM_CHUNK_SIZE, |
597 | | SFE_AIFF_BAD_COMM_CHUNK, |
598 | | SFE_AIFF_PEAK_B4_COMM, |
599 | | SFE_AIFF_BAD_PEAK, |
600 | | SFE_AIFF_NO_SSND, |
601 | | SFE_AIFF_NO_DATA, |
602 | | SFE_AIFF_RW_SSND_NOT_LAST, |
603 | | |
604 | | SFE_AU_UNKNOWN_FORMAT, |
605 | | SFE_AU_NO_DOTSND, |
606 | | SFE_AU_EMBED_BAD_LEN, |
607 | | |
608 | | SFE_RAW_READ_BAD_SPEC, |
609 | | SFE_RAW_BAD_BITWIDTH, |
610 | | SFE_RAW_BAD_FORMAT, |
611 | | |
612 | | SFE_PAF_NO_MARKER, |
613 | | SFE_PAF_VERSION, |
614 | | SFE_PAF_UNKNOWN_FORMAT, |
615 | | SFE_PAF_SHORT_HEADER, |
616 | | SFE_PAF_BAD_CHANNELS, |
617 | | |
618 | | SFE_SVX_NO_FORM, |
619 | | SFE_SVX_NO_BODY, |
620 | | SFE_SVX_NO_DATA, |
621 | | SFE_SVX_BAD_COMP, |
622 | | SFE_SVX_BAD_NAME_LENGTH, |
623 | | |
624 | | SFE_NIST_BAD_HEADER, |
625 | | SFE_NIST_CRLF_CONVERISON, |
626 | | SFE_NIST_BAD_ENCODING, |
627 | | |
628 | | SFE_VOC_NO_CREATIVE, |
629 | | SFE_VOC_BAD_FORMAT, |
630 | | SFE_VOC_BAD_VERSION, |
631 | | SFE_VOC_BAD_MARKER, |
632 | | SFE_VOC_BAD_SECTIONS, |
633 | | SFE_VOC_MULTI_SAMPLERATE, |
634 | | SFE_VOC_MULTI_SECTION, |
635 | | SFE_VOC_MULTI_PARAM, |
636 | | SFE_VOC_SECTION_COUNT, |
637 | | SFE_VOC_NO_PIPE, |
638 | | |
639 | | SFE_IRCAM_NO_MARKER, |
640 | | SFE_IRCAM_BAD_CHANNELS, |
641 | | SFE_IRCAM_UNKNOWN_FORMAT, |
642 | | |
643 | | SFE_W64_64_BIT, |
644 | | SFE_W64_NO_RIFF, |
645 | | SFE_W64_NO_WAVE, |
646 | | SFE_W64_NO_DATA, |
647 | | SFE_W64_ADPCM_NOT4BIT, |
648 | | SFE_W64_ADPCM_CHANNELS, |
649 | | SFE_W64_GSM610_FORMAT, |
650 | | |
651 | | SFE_MAT4_BAD_NAME, |
652 | | SFE_MAT4_NO_SAMPLERATE, |
653 | | |
654 | | SFE_MAT5_BAD_ENDIAN, |
655 | | SFE_MAT5_NO_BLOCK, |
656 | | SFE_MAT5_SAMPLE_RATE, |
657 | | |
658 | | SFE_PVF_NO_PVF1, |
659 | | SFE_PVF_BAD_HEADER, |
660 | | SFE_PVF_BAD_BITWIDTH, |
661 | | |
662 | | SFE_DWVW_BAD_BITWIDTH, |
663 | | SFE_G72X_NOT_MONO, |
664 | | SFE_NMS_ADPCM_NOT_MONO, |
665 | | |
666 | | SFE_XI_BAD_HEADER, |
667 | | SFE_XI_EXCESS_SAMPLES, |
668 | | SFE_XI_NO_PIPE, |
669 | | |
670 | | SFE_HTK_NO_PIPE, |
671 | | |
672 | | SFE_SDS_NOT_SDS, |
673 | | SFE_SDS_BAD_BIT_WIDTH, |
674 | | |
675 | | SFE_SD2_FD_DISALLOWED, |
676 | | SFE_SD2_BAD_DATA_OFFSET, |
677 | | SFE_SD2_BAD_MAP_OFFSET, |
678 | | SFE_SD2_BAD_DATA_LENGTH, |
679 | | SFE_SD2_BAD_MAP_LENGTH, |
680 | | SFE_SD2_BAD_RSRC, |
681 | | SFE_SD2_BAD_SAMPLE_SIZE, |
682 | | |
683 | | SFE_FLAC_BAD_HEADER, |
684 | | SFE_FLAC_NEW_DECODER, |
685 | | SFE_FLAC_INIT_DECODER, |
686 | | SFE_FLAC_LOST_SYNC, |
687 | | SFE_FLAC_BAD_SAMPLE_RATE, |
688 | | SFE_FLAC_CHANNEL_COUNT_CHANGED, |
689 | | SFE_FLAC_UNKOWN_ERROR, |
690 | | |
691 | | SFE_WVE_NOT_WVE, |
692 | | SFE_WVE_NO_PIPE, |
693 | | |
694 | | SFE_VORBIS_ENCODER_BUG, |
695 | | |
696 | | SFE_RF64_NOT_RF64, |
697 | | SFE_RF64_PEAK_B4_FMT, |
698 | | SFE_RF64_NO_DATA, |
699 | | |
700 | | SFE_BAD_CHUNK_PTR, |
701 | | SFE_UNKNOWN_CHUNK, |
702 | | SFE_BAD_CHUNK_FORMAT, |
703 | | SFE_BAD_CHUNK_MARKER, |
704 | | SFE_BAD_CHUNK_DATA_PTR, |
705 | | SFE_ALAC_FAIL_TMPFILE, |
706 | | SFE_FILENAME_TOO_LONG, |
707 | | SFE_NEGATIVE_RW_LEN, |
708 | | |
709 | | SFE_OPUS_BAD_SAMPLERATE, |
710 | | |
711 | | SFE_CAF_NOT_CAF, |
712 | | SFE_CAF_NO_DESC, |
713 | | SFE_CAF_BAD_PEAK, |
714 | | |
715 | | SFE_AVR_NOT_AVR, |
716 | | SFE_AVR_BAD_REZ_SIGN, |
717 | | |
718 | | SFE_MPC_NO_MARKER, |
719 | | |
720 | | SFE_MPEG_BAD_SAMPLERATE, |
721 | | |
722 | | SFE_MAX_ERROR /* This must be last in list. */ |
723 | | } ; |
724 | | |
725 | | /* Allocate and initialize the SF_PRIVATE struct. */ |
726 | | SF_PRIVATE * psf_allocate (void) ; |
727 | | |
728 | | int subformat_to_bytewidth (int format) ; |
729 | | int s_bitwidth_to_subformat (int bits) ; |
730 | | int u_bitwidth_to_subformat (int bits) ; |
731 | | |
732 | | /* Functions for reading and writing floats and doubles on processors |
733 | | ** with non-IEEE floats/doubles. |
734 | | */ |
735 | | float float32_be_read (const unsigned char *cptr) ; |
736 | | float float32_le_read (const unsigned char *cptr) ; |
737 | | void float32_be_write (float in, unsigned char *out) ; |
738 | | void float32_le_write (float in, unsigned char *out) ; |
739 | | |
740 | | double double64_be_read (const unsigned char *cptr) ; |
741 | | double double64_le_read (const unsigned char *cptr) ; |
742 | | void double64_be_write (double in, unsigned char *out) ; |
743 | | void double64_le_write (double in, unsigned char *out) ; |
744 | | |
745 | | /* Functions for writing to the internal logging buffer. */ |
746 | | |
747 | | void psf_log_printf (SF_PRIVATE *psf, const char *format, ...) ; |
748 | | void psf_log_SF_INFO (SF_PRIVATE *psf) ; |
749 | | |
750 | | int32_t psf_rand_int32 (void) ; |
751 | | |
752 | | void append_snprintf (char * dest, size_t maxlen, const char * fmt, ...) ; |
753 | | void psf_strlcpy_crlf (char *dest, const char *src, size_t destmax, size_t srcmax) ; |
754 | | |
755 | | sf_count_t psf_decode_frame_count (SF_PRIVATE *psf) ; |
756 | | |
757 | | /* Functions used when writing file headers. */ |
758 | | |
759 | | int psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...) ; |
760 | | void psf_asciiheader_printf (SF_PRIVATE *psf, const char *format, ...) ; |
761 | | |
762 | | /* Functions used when reading file headers. */ |
763 | | |
764 | | int psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...) ; |
765 | | |
766 | | /* Functions used in the write function for updating the peak chunk. */ |
767 | | |
768 | | void peak_update_short (SF_PRIVATE *psf, short *ptr, size_t items) ; |
769 | | void peak_update_int (SF_PRIVATE *psf, int *ptr, size_t items) ; |
770 | | void peak_update_double (SF_PRIVATE *psf, double *ptr, size_t items) ; |
771 | | |
772 | | /* Functions defined in command.c. */ |
773 | | |
774 | | int psf_get_format_simple_count (void) ; |
775 | | int psf_get_format_simple (SF_FORMAT_INFO *data) ; |
776 | | |
777 | | int psf_get_format_info (SF_FORMAT_INFO *data) ; |
778 | | |
779 | | int psf_get_format_major_count (void) ; |
780 | | int psf_get_format_major (SF_FORMAT_INFO *data) ; |
781 | | |
782 | | int psf_get_format_subtype_count (void) ; |
783 | | int psf_get_format_subtype (SF_FORMAT_INFO *data) ; |
784 | | |
785 | | void psf_generate_format_desc (SF_PRIVATE *psf) ; |
786 | | |
787 | | double psf_calc_signal_max (SF_PRIVATE *psf, int normalize) ; |
788 | | int psf_calc_max_all_channels (SF_PRIVATE *psf, double *peaks, int normalize) ; |
789 | | |
790 | | int psf_get_signal_max (SF_PRIVATE *psf, double *peak) ; |
791 | | int psf_get_max_all_channels (SF_PRIVATE *psf, double *peaks) ; |
792 | | |
793 | | /* Functions in strings.c. */ |
794 | | |
795 | | const char* psf_get_string (SF_PRIVATE *psf, int str_type) ; |
796 | | int psf_set_string (SF_PRIVATE *psf, int str_type, const char *str) ; |
797 | | int psf_store_string (SF_PRIVATE *psf, int str_type, const char *str) ; |
798 | | int psf_location_string_count (const SF_PRIVATE * psf, int location) ; |
799 | | |
800 | | /* Default seek function. Use for PCM and float encoded data. */ |
801 | | sf_count_t psf_default_seek (SF_PRIVATE *psf, int mode, sf_count_t samples_from_start) ; |
802 | | |
803 | | int macos_guess_file_type (SF_PRIVATE *psf, const char *filename) ; |
804 | | |
805 | | /*------------------------------------------------------------------------------------ |
806 | | ** File I/O functions which will allow access to large files (> 2 Gig) on |
807 | | ** some 32 bit OSes. Implementation in file_io.c. |
808 | | */ |
809 | | |
810 | | int psf_fopen (SF_PRIVATE *psf) ; |
811 | | int psf_set_stdio (SF_PRIVATE *psf) ; |
812 | | int psf_file_valid (SF_PRIVATE *psf) ; |
813 | | void psf_set_file (SF_PRIVATE *psf, int fd) ; |
814 | | void psf_init_files (SF_PRIVATE *psf) ; |
815 | | void psf_use_rsrc (SF_PRIVATE *psf, int on_off) ; |
816 | | |
817 | | SNDFILE * psf_open_file (SF_PRIVATE *psf, SF_INFO *sfinfo) ; |
818 | | |
819 | | sf_count_t psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence) ; |
820 | | sf_count_t psf_fread (void *ptr, sf_count_t bytes, sf_count_t count, SF_PRIVATE *psf) ; |
821 | | sf_count_t psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t count, SF_PRIVATE *psf) ; |
822 | | sf_count_t psf_fgets (char *buffer, sf_count_t bufsize, SF_PRIVATE *psf) ; |
823 | | sf_count_t psf_ftell (SF_PRIVATE *psf) ; |
824 | | sf_count_t psf_get_filelen (SF_PRIVATE *psf) ; |
825 | | |
826 | | void psf_fsync (SF_PRIVATE *psf) ; |
827 | | |
828 | | int psf_is_pipe (SF_PRIVATE *psf) ; |
829 | | |
830 | | int psf_ftruncate (SF_PRIVATE *psf, sf_count_t len) ; |
831 | | int psf_fclose (SF_PRIVATE *psf) ; |
832 | | |
833 | | /* Open and close the resource fork of a file. */ |
834 | | int psf_open_rsrc (SF_PRIVATE *psf) ; |
835 | | int psf_close_rsrc (SF_PRIVATE *psf) ; |
836 | | |
837 | | int psf_copy_filename (SF_PRIVATE *psf, const char *path) ; |
838 | | |
839 | | /* |
840 | | void psf_fclearerr (SF_PRIVATE *psf) ; |
841 | | int psf_ferror (SF_PRIVATE *psf) ; |
842 | | */ |
843 | | |
844 | | /*------------------------------------------------------------------------------------ |
845 | | ** Functions for reading and writing different file formats. |
846 | | */ |
847 | | |
848 | | int aiff_open (SF_PRIVATE *psf) ; |
849 | | int au_open (SF_PRIVATE *psf) ; |
850 | | int avr_open (SF_PRIVATE *psf) ; |
851 | | int htk_open (SF_PRIVATE *psf) ; |
852 | | int ircam_open (SF_PRIVATE *psf) ; |
853 | | int mat4_open (SF_PRIVATE *psf) ; |
854 | | int mat5_open (SF_PRIVATE *psf) ; |
855 | | int nist_open (SF_PRIVATE *psf) ; |
856 | | int paf_open (SF_PRIVATE *psf) ; |
857 | | int pvf_open (SF_PRIVATE *psf) ; |
858 | | int raw_open (SF_PRIVATE *psf) ; |
859 | | int sd2_open (SF_PRIVATE *psf) ; |
860 | | int sds_open (SF_PRIVATE *psf) ; |
861 | | int svx_open (SF_PRIVATE *psf) ; |
862 | | int voc_open (SF_PRIVATE *psf) ; |
863 | | int w64_open (SF_PRIVATE *psf) ; |
864 | | int wav_open (SF_PRIVATE *psf) ; |
865 | | int xi_open (SF_PRIVATE *psf) ; |
866 | | int flac_open (SF_PRIVATE *psf) ; |
867 | | int flac_supports_pcm32 (void) ; |
868 | | int caf_open (SF_PRIVATE *psf) ; |
869 | | int mpc2k_open (SF_PRIVATE *psf) ; |
870 | | int rf64_open (SF_PRIVATE *psf) ; |
871 | | |
872 | | int ogg_vorbis_open (SF_PRIVATE *psf) ; |
873 | | int ogg_speex_open (SF_PRIVATE *psf) ; |
874 | | int ogg_pcm_open (SF_PRIVATE *psf) ; |
875 | | int ogg_opus_open (SF_PRIVATE *psf) ; |
876 | | int ogg_open (SF_PRIVATE *psf) ; |
877 | | |
878 | | int mpeg_open (SF_PRIVATE *psf) ; |
879 | | |
880 | | /* In progress. Do not currently work. */ |
881 | | |
882 | | int rx2_open (SF_PRIVATE *psf) ; |
883 | | int txw_open (SF_PRIVATE *psf) ; |
884 | | int wve_open (SF_PRIVATE *psf) ; |
885 | | int dwd_open (SF_PRIVATE *psf) ; |
886 | | |
887 | | /*------------------------------------------------------------------------------------ |
888 | | ** Init functions for a number of common data encodings. |
889 | | */ |
890 | | |
891 | | int pcm_init (SF_PRIVATE *psf) ; |
892 | | int ulaw_init (SF_PRIVATE *psf) ; |
893 | | int alaw_init (SF_PRIVATE *psf) ; |
894 | | int float32_init (SF_PRIVATE *psf) ; |
895 | | int double64_init (SF_PRIVATE *psf) ; |
896 | | int dwvw_init (SF_PRIVATE *psf, int bitwidth) ; |
897 | | int gsm610_init (SF_PRIVATE *psf) ; |
898 | | int nms_adpcm_init (SF_PRIVATE *psf) ; |
899 | | int vox_adpcm_init (SF_PRIVATE *psf) ; |
900 | | int flac_init (SF_PRIVATE *psf) ; |
901 | | int g72x_init (SF_PRIVATE * psf) ; |
902 | | int alac_init (SF_PRIVATE *psf, const ALAC_DECODER_INFO * info) ; |
903 | | int mpeg_init (SF_PRIVATE *psf, int bitrate_mode, int write_metadata) ; |
904 | | |
905 | | int dither_init (SF_PRIVATE *psf, int mode) ; |
906 | | |
907 | | int wavlike_ima_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) ; |
908 | | int wavlike_msadpcm_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) ; |
909 | | |
910 | | int aiff_ima_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) ; |
911 | | |
912 | | int interleave_init (SF_PRIVATE *psf) ; |
913 | | |
914 | | /*------------------------------------------------------------------------------------ |
915 | | ** Chunk logging functions. |
916 | | */ |
917 | | |
918 | | SF_CHUNK_ITERATOR * psf_get_chunk_iterator (SF_PRIVATE * psf, const char * marker_str) ; |
919 | | SF_CHUNK_ITERATOR * psf_next_chunk_iterator (const READ_CHUNKS * pchk , SF_CHUNK_ITERATOR *iterator) ; |
920 | | int psf_store_read_chunk_u32 (READ_CHUNKS * pchk, uint32_t marker, sf_count_t offset, uint32_t len) ; |
921 | | int psf_store_read_chunk_str (READ_CHUNKS * pchk, const char * marker, sf_count_t offset, uint32_t len) ; |
922 | | int psf_save_write_chunk (WRITE_CHUNKS * pchk, const SF_CHUNK_INFO * chunk_info) ; |
923 | | int psf_find_read_chunk_str (const READ_CHUNKS * pchk, const char * marker) ; |
924 | | int psf_find_read_chunk_m32 (const READ_CHUNKS * pchk, uint32_t marker) ; |
925 | | int psf_find_read_chunk_iterator (const READ_CHUNKS * pchk, const SF_CHUNK_ITERATOR * marker) ; |
926 | | |
927 | | int psf_find_write_chunk (WRITE_CHUNKS * pchk, const char * marker) ; |
928 | | |
929 | | /*------------------------------------------------------------------------------------ |
930 | | ** Functions that work like OpenBSD's strlcpy/strlcat to replace strncpy/strncat. |
931 | | ** |
932 | | ** See : http://www.gratisoft.us/todd/papers/strlcpy.html |
933 | | ** |
934 | | ** These functions are available on *BSD, but are not available everywhere so we |
935 | | ** implement them here. |
936 | | ** |
937 | | ** The argument order has been changed to that of strncpy/strncat to cause |
938 | | ** compiler errors if code is carelessly converted from one to the other. |
939 | | */ |
940 | | |
941 | | void psf_strlcat (char *dest, size_t n, const char *src) ; |
942 | | void psf_strlcpy (char *dest, size_t n, const char *src) ; |
943 | | |
944 | | /*------------------------------------------------------------------------------------ |
945 | | ** SIMD optimized math functions. |
946 | | */ |
947 | | |
948 | | static inline int psf_lrintf (float x) |
949 | 1.04k | { |
950 | 1.04k | #ifdef USE_SSE2 |
951 | 1.04k | return _mm_cvtss_si32 (_mm_load_ss (&x)) ; |
952 | | #else |
953 | | return lrintf (x) ; |
954 | | #endif |
955 | 1.04k | } /* psf_lrintf */ Unexecuted instantiation: sndfile.c:psf_lrintf Unexecuted instantiation: aiff.c:psf_lrintf Unexecuted instantiation: au.c:psf_lrintf Unexecuted instantiation: avr.c:psf_lrintf Unexecuted instantiation: caf.c:psf_lrintf Unexecuted instantiation: dwd.c:psf_lrintf Unexecuted instantiation: flac.c:psf_lrintf Unexecuted instantiation: g72x.c:psf_lrintf Unexecuted instantiation: htk.c:psf_lrintf Line | Count | Source | 949 | 354 | { | 950 | 354 | #ifdef USE_SSE2 | 951 | 354 | return _mm_cvtss_si32 (_mm_load_ss (&x)) ; | 952 | | #else | 953 | | return lrintf (x) ; | 954 | | #endif | 955 | 354 | } /* psf_lrintf */ |
Unexecuted instantiation: mat4.c:psf_lrintf Unexecuted instantiation: mat5.c:psf_lrintf Unexecuted instantiation: nist.c:psf_lrintf Unexecuted instantiation: paf.c:psf_lrintf Unexecuted instantiation: pvf.c:psf_lrintf Unexecuted instantiation: raw.c:psf_lrintf Unexecuted instantiation: rx2.c:psf_lrintf Unexecuted instantiation: sd2.c:psf_lrintf Unexecuted instantiation: sds.c:psf_lrintf Unexecuted instantiation: svx.c:psf_lrintf Unexecuted instantiation: txw.c:psf_lrintf Unexecuted instantiation: voc.c:psf_lrintf Unexecuted instantiation: wve.c:psf_lrintf Unexecuted instantiation: w64.c:psf_lrintf Unexecuted instantiation: wavlike.c:psf_lrintf Unexecuted instantiation: wav.c:psf_lrintf Unexecuted instantiation: xi.c:psf_lrintf Unexecuted instantiation: mpc2k.c:psf_lrintf Unexecuted instantiation: rf64.c:psf_lrintf Unexecuted instantiation: ogg.c:psf_lrintf Unexecuted instantiation: mpeg.c:psf_lrintf Unexecuted instantiation: alac.c:psf_lrintf Unexecuted instantiation: alaw.c:psf_lrintf Unexecuted instantiation: audio_detect.c:psf_lrintf Unexecuted instantiation: broadcast.c:psf_lrintf Unexecuted instantiation: cart.c:psf_lrintf Unexecuted instantiation: chanmap.c:psf_lrintf Unexecuted instantiation: chunk.c:psf_lrintf Unexecuted instantiation: command.c:psf_lrintf Unexecuted instantiation: common.c:psf_lrintf Unexecuted instantiation: dither.c:psf_lrintf Unexecuted instantiation: double64.c:psf_lrintf Unexecuted instantiation: dwvw.c:psf_lrintf Unexecuted instantiation: file_io.c:psf_lrintf Line | Count | Source | 949 | 691 | { | 950 | 691 | #ifdef USE_SSE2 | 951 | 691 | return _mm_cvtss_si32 (_mm_load_ss (&x)) ; | 952 | | #else | 953 | | return lrintf (x) ; | 954 | | #endif | 955 | 691 | } /* psf_lrintf */ |
Unexecuted instantiation: gsm610.c:psf_lrintf Unexecuted instantiation: id3.c:psf_lrintf Unexecuted instantiation: ima_adpcm.c:psf_lrintf Unexecuted instantiation: ms_adpcm.c:psf_lrintf Unexecuted instantiation: nms_adpcm.c:psf_lrintf Unexecuted instantiation: pcm.c:psf_lrintf Unexecuted instantiation: strings.c:psf_lrintf Unexecuted instantiation: ulaw.c:psf_lrintf Unexecuted instantiation: vox_adpcm.c:psf_lrintf Unexecuted instantiation: ima_oki_adpcm.c:psf_lrintf |
956 | | |
957 | | static inline int psf_lrint (double x) |
958 | 86.2k | { |
959 | 86.2k | #ifdef USE_SSE2 |
960 | 86.2k | return _mm_cvtsd_si32 (_mm_load_sd (&x)) ; |
961 | | #else |
962 | | return lrint (x) ; |
963 | | #endif |
964 | 86.2k | } /* psf_lrintf */ Unexecuted instantiation: sndfile.c:psf_lrint Unexecuted instantiation: aiff.c:psf_lrint Unexecuted instantiation: au.c:psf_lrint Unexecuted instantiation: avr.c:psf_lrint Line | Count | Source | 958 | 2.32k | { | 959 | 2.32k | #ifdef USE_SSE2 | 960 | 2.32k | return _mm_cvtsd_si32 (_mm_load_sd (&x)) ; | 961 | | #else | 962 | | return lrint (x) ; | 963 | | #endif | 964 | 2.32k | } /* psf_lrintf */ |
Unexecuted instantiation: dwd.c:psf_lrint Unexecuted instantiation: flac.c:psf_lrint Unexecuted instantiation: g72x.c:psf_lrint Unexecuted instantiation: htk.c:psf_lrint Unexecuted instantiation: ircam.c:psf_lrint Line | Count | Source | 958 | 629 | { | 959 | 629 | #ifdef USE_SSE2 | 960 | 629 | return _mm_cvtsd_si32 (_mm_load_sd (&x)) ; | 961 | | #else | 962 | | return lrint (x) ; | 963 | | #endif | 964 | 629 | } /* psf_lrintf */ |
Line | Count | Source | 958 | 107 | { | 959 | 107 | #ifdef USE_SSE2 | 960 | 107 | return _mm_cvtsd_si32 (_mm_load_sd (&x)) ; | 961 | | #else | 962 | | return lrint (x) ; | 963 | | #endif | 964 | 107 | } /* psf_lrintf */ |
Unexecuted instantiation: nist.c:psf_lrint Unexecuted instantiation: paf.c:psf_lrint Unexecuted instantiation: pvf.c:psf_lrint Unexecuted instantiation: raw.c:psf_lrint Unexecuted instantiation: rx2.c:psf_lrint Unexecuted instantiation: sd2.c:psf_lrint Unexecuted instantiation: sds.c:psf_lrint Unexecuted instantiation: svx.c:psf_lrint Unexecuted instantiation: txw.c:psf_lrint Unexecuted instantiation: voc.c:psf_lrint Unexecuted instantiation: wve.c:psf_lrint Unexecuted instantiation: w64.c:psf_lrint Unexecuted instantiation: wavlike.c:psf_lrint Unexecuted instantiation: wav.c:psf_lrint Unexecuted instantiation: xi.c:psf_lrint Unexecuted instantiation: mpc2k.c:psf_lrint Unexecuted instantiation: rf64.c:psf_lrint Unexecuted instantiation: ogg.c:psf_lrint Unexecuted instantiation: mpeg.c:psf_lrint Unexecuted instantiation: alac.c:psf_lrint Unexecuted instantiation: alaw.c:psf_lrint Unexecuted instantiation: audio_detect.c:psf_lrint Unexecuted instantiation: broadcast.c:psf_lrint Unexecuted instantiation: cart.c:psf_lrint Unexecuted instantiation: chanmap.c:psf_lrint Unexecuted instantiation: chunk.c:psf_lrint Unexecuted instantiation: command.c:psf_lrint Unexecuted instantiation: common.c:psf_lrint Unexecuted instantiation: dither.c:psf_lrint Line | Count | Source | 958 | 83.1k | { | 959 | 83.1k | #ifdef USE_SSE2 | 960 | 83.1k | return _mm_cvtsd_si32 (_mm_load_sd (&x)) ; | 961 | | #else | 962 | | return lrint (x) ; | 963 | | #endif | 964 | 83.1k | } /* psf_lrintf */ |
Unexecuted instantiation: dwvw.c:psf_lrint Unexecuted instantiation: file_io.c:psf_lrint Unexecuted instantiation: float32.c:psf_lrint Unexecuted instantiation: gsm610.c:psf_lrint Unexecuted instantiation: id3.c:psf_lrint Unexecuted instantiation: ima_adpcm.c:psf_lrint Unexecuted instantiation: ms_adpcm.c:psf_lrint Unexecuted instantiation: nms_adpcm.c:psf_lrint Unexecuted instantiation: pcm.c:psf_lrint Unexecuted instantiation: strings.c:psf_lrint Unexecuted instantiation: ulaw.c:psf_lrint Unexecuted instantiation: vox_adpcm.c:psf_lrint Unexecuted instantiation: ima_oki_adpcm.c:psf_lrint |
965 | | |
966 | | /*------------------------------------------------------------------------------------ |
967 | | ** Other helper functions. |
968 | | */ |
969 | | |
970 | | void *psf_memset (void *s, int c, sf_count_t n) ; |
971 | | |
972 | | SF_CUES * psf_cues_dup (const void * ptr, size_t datasize) ; |
973 | | SF_CUES * psf_cues_alloc (uint32_t cue_count) ; |
974 | | void psf_get_cues (SF_PRIVATE * psf, void * data, size_t datasize) ; |
975 | | |
976 | | /* The cue array is allocated with room for the actual cue count (see |
977 | | ** psf_cues_alloc()), but the public SF_CUES type declares it with a fixed |
978 | | ** length of 100. Index it through a pointer so that compilers do not flag |
979 | | ** accesses to the longer, correctly allocated array (issue #832). |
980 | | */ |
981 | | static inline SF_CUE_POINT * |
982 | | psf_cues_points (SF_CUES *cues) |
983 | 1.64k | { return cues->cue_points ; |
984 | 1.64k | } /* psf_cues_points */ Unexecuted instantiation: sndfile.c:psf_cues_points Line | Count | Source | 983 | 474 | { return cues->cue_points ; | 984 | 474 | } /* psf_cues_points */ |
Unexecuted instantiation: au.c:psf_cues_points Unexecuted instantiation: avr.c:psf_cues_points Unexecuted instantiation: caf.c:psf_cues_points Unexecuted instantiation: dwd.c:psf_cues_points Unexecuted instantiation: flac.c:psf_cues_points Unexecuted instantiation: g72x.c:psf_cues_points Unexecuted instantiation: htk.c:psf_cues_points Unexecuted instantiation: ircam.c:psf_cues_points Unexecuted instantiation: mat4.c:psf_cues_points Unexecuted instantiation: mat5.c:psf_cues_points Unexecuted instantiation: nist.c:psf_cues_points Unexecuted instantiation: paf.c:psf_cues_points Unexecuted instantiation: pvf.c:psf_cues_points Unexecuted instantiation: raw.c:psf_cues_points Unexecuted instantiation: rx2.c:psf_cues_points Unexecuted instantiation: sd2.c:psf_cues_points Unexecuted instantiation: sds.c:psf_cues_points Unexecuted instantiation: svx.c:psf_cues_points Unexecuted instantiation: txw.c:psf_cues_points Unexecuted instantiation: voc.c:psf_cues_points Unexecuted instantiation: wve.c:psf_cues_points Unexecuted instantiation: w64.c:psf_cues_points wavlike.c:psf_cues_points Line | Count | Source | 983 | 141 | { return cues->cue_points ; | 984 | 141 | } /* psf_cues_points */ |
Line | Count | Source | 983 | 1.02k | { return cues->cue_points ; | 984 | 1.02k | } /* psf_cues_points */ |
Unexecuted instantiation: xi.c:psf_cues_points Unexecuted instantiation: mpc2k.c:psf_cues_points Unexecuted instantiation: rf64.c:psf_cues_points Unexecuted instantiation: ogg.c:psf_cues_points Unexecuted instantiation: mpeg.c:psf_cues_points Unexecuted instantiation: alac.c:psf_cues_points Unexecuted instantiation: alaw.c:psf_cues_points Unexecuted instantiation: audio_detect.c:psf_cues_points Unexecuted instantiation: broadcast.c:psf_cues_points Unexecuted instantiation: cart.c:psf_cues_points Unexecuted instantiation: chanmap.c:psf_cues_points Unexecuted instantiation: chunk.c:psf_cues_points Unexecuted instantiation: command.c:psf_cues_points Unexecuted instantiation: common.c:psf_cues_points Unexecuted instantiation: dither.c:psf_cues_points Unexecuted instantiation: double64.c:psf_cues_points Unexecuted instantiation: dwvw.c:psf_cues_points Unexecuted instantiation: file_io.c:psf_cues_points Unexecuted instantiation: float32.c:psf_cues_points Unexecuted instantiation: gsm610.c:psf_cues_points Unexecuted instantiation: id3.c:psf_cues_points Unexecuted instantiation: ima_adpcm.c:psf_cues_points Unexecuted instantiation: ms_adpcm.c:psf_cues_points Unexecuted instantiation: nms_adpcm.c:psf_cues_points Unexecuted instantiation: pcm.c:psf_cues_points Unexecuted instantiation: strings.c:psf_cues_points Unexecuted instantiation: ulaw.c:psf_cues_points Unexecuted instantiation: vox_adpcm.c:psf_cues_points Unexecuted instantiation: ima_oki_adpcm.c:psf_cues_points |
985 | | |
986 | | SF_INSTRUMENT * psf_instrument_alloc (void) ; |
987 | | |
988 | | void psf_sanitize_string (char * cptr, int len) ; |
989 | | |
990 | | /* Generate the current date as a string. */ |
991 | | void psf_get_date_str (char *str, int maxlen) ; |
992 | | |
993 | | SF_BROADCAST_INFO_16K * broadcast_var_alloc (void) ; |
994 | | int broadcast_var_set (SF_PRIVATE *psf, const SF_BROADCAST_INFO * data, size_t datasize) ; |
995 | | int broadcast_var_get (SF_PRIVATE *psf, SF_BROADCAST_INFO * data, size_t datasize) ; |
996 | | |
997 | | |
998 | | SF_CART_INFO_16K * cart_var_alloc (void) ; |
999 | | int cart_var_set (SF_PRIVATE *psf, const SF_CART_INFO * date, size_t datasize) ; |
1000 | | int cart_var_get (SF_PRIVATE *psf, SF_CART_INFO * data, size_t datasize) ; |
1001 | | |
1002 | | typedef struct |
1003 | | { int channels ; |
1004 | | int endianness ; |
1005 | | } AUDIO_DETECT ; |
1006 | | |
1007 | | int audio_detect (SF_PRIVATE * psf, AUDIO_DETECT *ad, const unsigned char * data, int datalen) ; |
1008 | | int id3_skip (SF_PRIVATE * psf) ; |
1009 | | const char *id3_lookup_v1_genre (int number) ; |
1010 | | |
1011 | | void alac_get_desc_chunk_items (int subformat, uint32_t *fmt_flags, uint32_t *frames_per_packet) ; |
1012 | | |
1013 | | FILE * psf_open_tmpfile (char * fname, size_t fnamelen) ; |
1014 | | |
1015 | | /*------------------------------------------------------------------------------------ |
1016 | | ** Helper/debug functions. |
1017 | | */ |
1018 | | |
1019 | | void psf_hexdump (const void *ptr, int len) ; |
1020 | | |
1021 | | const char * str_of_major_format (int format) ; |
1022 | | const char * str_of_minor_format (int format) ; |
1023 | | const char * str_of_open_mode (int mode) ; |
1024 | | const char * str_of_endianness (int end) ; |
1025 | | |
1026 | | /*------------------------------------------------------------------------------------ |
1027 | | ** Extra commands for sf_command(). Not for public use yet. |
1028 | | */ |
1029 | | |
1030 | | enum |
1031 | | { SFC_TEST_AIFF_ADD_INST_CHUNK = 0x2000, |
1032 | | SFC_TEST_WAV_ADD_INFO_CHUNK = 0x2010 |
1033 | | } ; |
1034 | | |
1035 | | /* |
1036 | | ** Maybe, one day, make these functions or something like them, public. |
1037 | | ** |
1038 | | ** Buffer to buffer dithering. Pointer in and out are allowed to point |
1039 | | ** to the same buffer for in-place dithering. |
1040 | | */ |
1041 | | |
1042 | | #if 0 |
1043 | | int sf_dither_short (const SF_DITHER_INFO *dither, const short *in, short *out, int count) ; |
1044 | | int sf_dither_int (const SF_DITHER_INFO *dither, const int *in, int *out, int count) ; |
1045 | | int sf_dither_float (const SF_DITHER_INFO *dither, const float *in, float *out, int count) ; |
1046 | | int sf_dither_double (const SF_DITHER_INFO *dither, const double *in, double *out, int count) ; |
1047 | | #endif |
1048 | | |
1049 | | /*------------------------------------------------------------------------------------ |
1050 | | ** Data conversion functions. |
1051 | | */ |
1052 | | |
1053 | | void psf_f2s_array (const float *src, short *dest, int count, int normalize) ; |
1054 | | void psf_f2s_clip_array (const float *src, short *dest, int count, int normalize) ; |
1055 | | |
1056 | | void psf_d2s_array (const double *src, short *dest, int count, int normalize) ; |
1057 | | void psf_d2s_clip_array (const double *src, short *dest, int count, int normalize) ; |
1058 | | |
1059 | | void psf_f2i_array (const float *src, int *dest, int count, int normalize) ; |
1060 | | void psf_f2i_clip_array (const float *src, int *dest, int count, int normalize) ; |
1061 | | |
1062 | | void psf_d2i_array (const double *src, int *dest, int count, int normalize) ; |
1063 | | void psf_d2i_clip_array (const double *src, int *dest, int count, int normalize) ; |
1064 | | |
1065 | | |
1066 | | /*------------------------------------------------------------------------------------ |
1067 | | ** Left and right shift on int. According to the C standard, the left and right |
1068 | | ** shift operations applied to a negative integer results in undefined behavior. |
1069 | | ** These twp functions work around that. |
1070 | | */ |
1071 | | |
1072 | | #if __GNUC__ |
1073 | | #define ALWAYS_INLINE __attribute__ ((always_inline)) |
1074 | | #else |
1075 | | #define ALWAYS_INLINE |
1076 | | #endif |
1077 | | |
1078 | | static inline int32_t ALWAYS_INLINE |
1079 | | arith_shift_left (int32_t x, int shift) |
1080 | 54.2M | { return (int32_t) (((uint32_t) x) << shift) ; |
1081 | 54.2M | } /* arith_shift_left */ Unexecuted instantiation: sndfile.c:arith_shift_left Unexecuted instantiation: aiff.c:arith_shift_left Unexecuted instantiation: au.c:arith_shift_left Line | Count | Source | 1080 | 102 | { return (int32_t) (((uint32_t) x) << shift) ; | 1081 | 102 | } /* arith_shift_left */ |
Unexecuted instantiation: caf.c:arith_shift_left Unexecuted instantiation: dwd.c:arith_shift_left Unexecuted instantiation: flac.c:arith_shift_left Unexecuted instantiation: g72x.c:arith_shift_left Unexecuted instantiation: htk.c:arith_shift_left Unexecuted instantiation: ircam.c:arith_shift_left Unexecuted instantiation: mat4.c:arith_shift_left Unexecuted instantiation: mat5.c:arith_shift_left Unexecuted instantiation: nist.c:arith_shift_left Unexecuted instantiation: paf.c:arith_shift_left Unexecuted instantiation: pvf.c:arith_shift_left Unexecuted instantiation: raw.c:arith_shift_left Unexecuted instantiation: rx2.c:arith_shift_left Unexecuted instantiation: sd2.c:arith_shift_left Line | Count | Source | 1080 | 46.1M | { return (int32_t) (((uint32_t) x) << shift) ; | 1081 | 46.1M | } /* arith_shift_left */ |
Unexecuted instantiation: svx.c:arith_shift_left Unexecuted instantiation: txw.c:arith_shift_left Unexecuted instantiation: voc.c:arith_shift_left Unexecuted instantiation: wve.c:arith_shift_left Unexecuted instantiation: w64.c:arith_shift_left Unexecuted instantiation: wavlike.c:arith_shift_left Unexecuted instantiation: wav.c:arith_shift_left Line | Count | Source | 1080 | 770 | { return (int32_t) (((uint32_t) x) << shift) ; | 1081 | 770 | } /* arith_shift_left */ |
Unexecuted instantiation: mpc2k.c:arith_shift_left Unexecuted instantiation: rf64.c:arith_shift_left Unexecuted instantiation: ogg.c:arith_shift_left Unexecuted instantiation: mpeg.c:arith_shift_left Unexecuted instantiation: alac.c:arith_shift_left Unexecuted instantiation: alaw.c:arith_shift_left Unexecuted instantiation: audio_detect.c:arith_shift_left Unexecuted instantiation: broadcast.c:arith_shift_left Unexecuted instantiation: cart.c:arith_shift_left Unexecuted instantiation: chanmap.c:arith_shift_left Unexecuted instantiation: chunk.c:arith_shift_left Unexecuted instantiation: command.c:arith_shift_left Unexecuted instantiation: common.c:arith_shift_left Unexecuted instantiation: dither.c:arith_shift_left Unexecuted instantiation: double64.c:arith_shift_left Line | Count | Source | 1080 | 8.09M | { return (int32_t) (((uint32_t) x) << shift) ; | 1081 | 8.09M | } /* arith_shift_left */ |
Unexecuted instantiation: file_io.c:arith_shift_left Unexecuted instantiation: float32.c:arith_shift_left Unexecuted instantiation: gsm610.c:arith_shift_left Unexecuted instantiation: id3.c:arith_shift_left Unexecuted instantiation: ima_adpcm.c:arith_shift_left Unexecuted instantiation: ms_adpcm.c:arith_shift_left Unexecuted instantiation: nms_adpcm.c:arith_shift_left Unexecuted instantiation: pcm.c:arith_shift_left Unexecuted instantiation: strings.c:arith_shift_left Unexecuted instantiation: ulaw.c:arith_shift_left Unexecuted instantiation: vox_adpcm.c:arith_shift_left ima_oki_adpcm.c:arith_shift_left Line | Count | Source | 1080 | 245 | { return (int32_t) (((uint32_t) x) << shift) ; | 1081 | 245 | } /* arith_shift_left */ |
|
1082 | | |
1083 | | static inline int32_t ALWAYS_INLINE |
1084 | | arith_shift_right (int32_t x, int shift) |
1085 | 0 | { if (x >= 0) |
1086 | 0 | return x >> shift ; |
1087 | 0 | return ~ ((~x) >> shift) ; |
1088 | 0 | } /* arith_shift_right */ Unexecuted instantiation: sndfile.c:arith_shift_right Unexecuted instantiation: aiff.c:arith_shift_right Unexecuted instantiation: au.c:arith_shift_right Unexecuted instantiation: avr.c:arith_shift_right Unexecuted instantiation: caf.c:arith_shift_right Unexecuted instantiation: dwd.c:arith_shift_right Unexecuted instantiation: flac.c:arith_shift_right Unexecuted instantiation: g72x.c:arith_shift_right Unexecuted instantiation: htk.c:arith_shift_right Unexecuted instantiation: ircam.c:arith_shift_right Unexecuted instantiation: mat4.c:arith_shift_right Unexecuted instantiation: mat5.c:arith_shift_right Unexecuted instantiation: nist.c:arith_shift_right Unexecuted instantiation: paf.c:arith_shift_right Unexecuted instantiation: pvf.c:arith_shift_right Unexecuted instantiation: raw.c:arith_shift_right Unexecuted instantiation: rx2.c:arith_shift_right Unexecuted instantiation: sd2.c:arith_shift_right Unexecuted instantiation: sds.c:arith_shift_right Unexecuted instantiation: svx.c:arith_shift_right Unexecuted instantiation: txw.c:arith_shift_right Unexecuted instantiation: voc.c:arith_shift_right Unexecuted instantiation: wve.c:arith_shift_right Unexecuted instantiation: w64.c:arith_shift_right Unexecuted instantiation: wavlike.c:arith_shift_right Unexecuted instantiation: wav.c:arith_shift_right Unexecuted instantiation: xi.c:arith_shift_right Unexecuted instantiation: mpc2k.c:arith_shift_right Unexecuted instantiation: rf64.c:arith_shift_right Unexecuted instantiation: ogg.c:arith_shift_right Unexecuted instantiation: mpeg.c:arith_shift_right Unexecuted instantiation: alac.c:arith_shift_right Unexecuted instantiation: alaw.c:arith_shift_right Unexecuted instantiation: audio_detect.c:arith_shift_right Unexecuted instantiation: broadcast.c:arith_shift_right Unexecuted instantiation: cart.c:arith_shift_right Unexecuted instantiation: chanmap.c:arith_shift_right Unexecuted instantiation: chunk.c:arith_shift_right Unexecuted instantiation: command.c:arith_shift_right Unexecuted instantiation: common.c:arith_shift_right Unexecuted instantiation: dither.c:arith_shift_right Unexecuted instantiation: double64.c:arith_shift_right Unexecuted instantiation: dwvw.c:arith_shift_right Unexecuted instantiation: file_io.c:arith_shift_right Unexecuted instantiation: float32.c:arith_shift_right Unexecuted instantiation: gsm610.c:arith_shift_right Unexecuted instantiation: id3.c:arith_shift_right Unexecuted instantiation: ima_adpcm.c:arith_shift_right Unexecuted instantiation: ms_adpcm.c:arith_shift_right Unexecuted instantiation: nms_adpcm.c:arith_shift_right Unexecuted instantiation: pcm.c:arith_shift_right Unexecuted instantiation: strings.c:arith_shift_right Unexecuted instantiation: ulaw.c:arith_shift_right Unexecuted instantiation: vox_adpcm.c:arith_shift_right Unexecuted instantiation: ima_oki_adpcm.c:arith_shift_right |
1089 | | |
1090 | | #endif /* SNDFILE_COMMON_H */ |