~ubuntu-branches/debian/jessie/libsndfile/jessie

« back to all changes in this revision

Viewing changes to src/sndfile.h.in

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2009-02-17 19:21:03 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090217192103-7rhu1n8p79jnbzy3
Tags: 1.0.18-2
Add missing build-dependencies on pkg-config and libvorbis-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
 
2
** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
3
3
**
4
4
** This program is free software; you can redistribute it and/or modify
5
5
** it under the terms of the GNU Lesser General Public License as published by
30
30
#define SNDFILE_1
31
31
 
32
32
#include <stdio.h>
33
 
 
34
 
/* For the Metrowerks CodeWarrior Pro Compiler (mainly MacOS) */
35
 
 
36
 
#if     (defined (__MWERKS__))
37
 
#include        <unix.h>
38
 
#else
39
 
#include        <sys/types.h>
40
 
#endif
 
33
#include <sys/types.h>
41
34
 
42
35
#ifdef __cplusplus
43
36
extern "C" {
73
66
        SF_FORMAT_SD2                   = 0x160000,             /* Sound Designer 2 */
74
67
        SF_FORMAT_FLAC                  = 0x170000,             /* FLAC lossless file format */
75
68
        SF_FORMAT_CAF                   = 0x180000,             /* Core Audio File format */
 
69
        SF_FORMAT_WVE                   = 0x190000,             /* Psion WVE format */
 
70
        SF_FORMAT_OGG                   = 0x200000,             /* Xiph OGG container */
 
71
        SF_FORMAT_MPC2K                 = 0x210000,             /* Akai MPC 2000 sampler */
 
72
        SF_FORMAT_RF64                  = 0x220000,             /* RF64 WAV file */
76
73
 
77
74
        /* Subtypes from here on. */
78
75
 
106
103
        SF_FORMAT_DPCM_8                = 0x0050,               /* 8 bit differential PCM (XI only) */
107
104
        SF_FORMAT_DPCM_16               = 0x0051,               /* 16 bit differential PCM (XI only) */
108
105
 
 
106
        SF_FORMAT_VORBIS                = 0x0060,               /* Xiph Vorbis encoding. */
 
107
 
109
108
        /* Endian-ness options. */
110
109
 
111
110
        SF_ENDIAN_FILE                  = 0x00000000,   /* Default file endian-ness. */
127
126
enum
128
127
{       SFC_GET_LIB_VERSION                             = 0x1000,
129
128
        SFC_GET_LOG_INFO                                = 0x1001,
 
129
        SFC_GET_CURRENT_SF_INFO                 = 0x1002,
 
130
 
130
131
 
131
132
        SFC_GET_NORM_DOUBLE                             = 0x1010,
132
133
        SFC_GET_NORM_FLOAT                              = 0x1011,
133
134
        SFC_SET_NORM_DOUBLE                             = 0x1012,
134
135
        SFC_SET_NORM_FLOAT                              = 0x1013,
135
136
        SFC_SET_SCALE_FLOAT_INT_READ    = 0x1014,
 
137
        SFC_SET_SCALE_INT_FLOAT_WRITE   = 0x1015,
136
138
 
137
139
        SFC_GET_SIMPLE_FORMAT_COUNT             = 0x1020,
138
140
        SFC_GET_SIMPLE_FORMAT                   = 0x1021,
152
154
        SFC_GET_MAX_ALL_CHANNELS                = 0x1045,
153
155
 
154
156
        SFC_SET_ADD_PEAK_CHUNK                  = 0x1050,
 
157
        SFC_SET_ADD_HEADER_PAD_CHUNK    = 0x1051,
155
158
 
156
159
        SFC_UPDATE_HEADER_NOW                   = 0x1060,
157
160
        SFC_SET_UPDATE_HEADER_AUTO              = 0x1061,
179
182
        SFC_GET_BROADCAST_INFO                  = 0x10F0,
180
183
        SFC_SET_BROADCAST_INFO                  = 0x10F1,
181
184
 
 
185
        SFC_GET_CHANNEL_MAP_INFO                = 0x1100,
 
186
        SFC_SET_CHANNEL_MAP_INFO                = 0x1101,
 
187
 
 
188
        SFC_RAW_DATA_NEEDS_ENDSWAP              = 0x1110,
 
189
 
 
190
        /* Support for Wavex Ambisonics Format */
 
191
        SFC_WAVEX_SET_AMBISONIC                 = 0x1200,
 
192
        SFC_WAVEX_GET_AMBISONIC                 = 0x1201,
 
193
 
 
194
        SFC_SET_VBR_ENCODING_QUALITY    = 0x1300,
 
195
 
182
196
        /* Following commands for testing only. */
183
197
        SFC_TEST_IEEE_FLOAT_REPLACE             = 0x6001,
184
198
 
205
219
        SF_STR_SOFTWARE                                 = 0x03,
206
220
        SF_STR_ARTIST                                   = 0x04,
207
221
        SF_STR_COMMENT                                  = 0x05,
208
 
        SF_STR_DATE                                             = 0x06
 
222
        SF_STR_DATE                                             = 0x06,
 
223
        SF_STR_ALBUM                                    = 0x07,
 
224
        SF_STR_LICENSE                                  = 0x08
209
225
} ;
210
226
 
211
227
/*
214
230
*/
215
231
 
216
232
#define SF_STR_FIRST    SF_STR_TITLE
217
 
#define SF_STR_LAST             SF_STR_DATE
 
233
#define SF_STR_LAST             SF_STR_LICENSE
218
234
 
219
235
enum
220
236
{       /* True and false */
224
240
        /* Modes for opening files. */
225
241
        SFM_READ        = 0x10,
226
242
        SFM_WRITE       = 0x20,
227
 
        SFM_RDWR        = 0x30
 
243
        SFM_RDWR        = 0x30,
 
244
 
 
245
        SF_AMBISONIC_NONE               = 0x40,
 
246
        SF_AMBISONIC_B_FORMAT   = 0x41
228
247
} ;
229
248
 
230
249
/* Public error values. These are guaranteed to remain unchanged for the duration
241
260
        SF_ERR_UNSUPPORTED_ENCODING     = 4
242
261
} ;
243
262
 
 
263
 
 
264
/* Channel map values (used with SFC_SET/GET_CHANNEL_MAP).
 
265
*/
 
266
 
 
267
enum
 
268
{       SF_CHANNEL_MAP_INVALID = 0,
 
269
        SF_CHANNEL_MAP_MONO = 1,
 
270
        SF_CHANNEL_MAP_LEFT,
 
271
        SF_CHANNEL_MAP_RIGHT,
 
272
        SF_CHANNEL_MAP_CENTER,
 
273
        SF_CHANNEL_MAP_FRONT_LEFT,
 
274
        SF_CHANNEL_MAP_FRONT_RIGHT,
 
275
        SF_CHANNEL_MAP_FRONT_CENTER,
 
276
        SF_CHANNEL_MAP_REAR_CENTER,
 
277
        SF_CHANNEL_MAP_REAR_LEFT,
 
278
        SF_CHANNEL_MAP_REAR_RIGHT,
 
279
        SF_CHANNEL_MAP_LFE,
 
280
        SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER,
 
281
        SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER,
 
282
        SF_CHANNEL_MAP_SIDE_LEFT,
 
283
        SF_CHANNEL_MAP_SIDE_RIGHT,
 
284
        SF_CHANNEL_MAP_TOP_CENTER,
 
285
        SF_CHANNEL_MAP_TOP_FRONT_LEFT,
 
286
        SF_CHANNEL_MAP_TOP_FRONT_RIGHT,
 
287
        SF_CHANNEL_MAP_TOP_FRONT_CENTER,
 
288
        SF_CHANNEL_MAP_TOP_REAR_LEFT,
 
289
        SF_CHANNEL_MAP_TOP_REAR_RIGHT,
 
290
        SF_CHANNEL_MAP_TOP_REAR_CENTER
 
291
} ;
 
292
 
 
293
 
244
294
/* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */
245
295
 
246
296
typedef struct SNDFILE_tag      SNDFILE ;
247
297
 
248
 
/* The following typedef is system specific and is defined when libsndfile is.
249
 
** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD),
250
 
** off64_t (Solaris), __int64_t (Win32) etc.
 
298
/* The following typedef is system specific and is defined when libsndfile is
 
299
** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD), off64_t 
 
300
** (Solaris), __int64_t (Win32) etc. On windows, we need to allow the same
 
301
** header file to be compiler by both GCC and the microsoft compiler.
251
302
*/
252
303
 
 
304
#ifdef _MSCVER
 
305
typedef __int64_t       sf_count_t ;
 
306
#define SF_COUNT_MAX            0x7fffffffffffffffi64
 
307
#else
253
308
typedef @TYPEOF_SF_COUNT_T@     sf_count_t ;
254
 
 
255
309
#define SF_COUNT_MAX            @SF_COUNT_MAX@
 
310
#endif
 
311
 
256
312
 
257
313
/* A pointer to a SF_INFO structure is passed to sf_open_read () and filled in.
258
314
** On write, the SF_INFO structure is filled in by the user and passed into
368
424
} SF_LOOP_INFO ;
369
425
 
370
426
 
371
 
/*      Struct used to retrieve broadcast (EBU) information from a file. 
 
427
/*      Struct used to retrieve broadcast (EBU) information from a file.
372
428
**      Strongly (!) based on EBU "bext" chunk format used in Broadcast WAVE.
373
429
*/
374
 
typedef struct
375
 
{       char                    description [256] ;
376
 
        char                    originator [32] ;
377
 
        char                    originator_reference [32] ;
378
 
        char                    origination_date [10] ;
379
 
        char                    origination_time [8] ;
380
 
        int                             time_reference_low ;
381
 
        int                             time_reference_high ;
382
 
        short                   version ;
383
 
        char                    umid [64] ;
384
 
        char                    reserved [190] ;
385
 
        unsigned int    coding_history_size ;
386
 
        char                    coding_history [256] ;
387
 
} SF_BROADCAST_INFO ;
 
430
#define SF_BROADCAST_INFO_VAR(coding_hist_size) \
 
431
                        struct \
 
432
                        {       char                    description [256] ; \
 
433
                                char                    originator [32] ; \
 
434
                                char                    originator_reference [32] ; \
 
435
                                char                    origination_date [10] ; \
 
436
                                char                    origination_time [8] ; \
 
437
                                unsigned int    time_reference_low ; \
 
438
                                unsigned int    time_reference_high ; \
 
439
                                short                   version ; \
 
440
                                char                    umid [64] ; \
 
441
                                char                    reserved [190] ; \
 
442
                                unsigned int    coding_history_size ; \
 
443
                                char                    coding_history [coding_hist_size] ; \
 
444
                        }
 
445
 
 
446
/* SF_BROADCAST_INFO is the above struct with coding_history field of 256 bytes. */
 
447
typedef SF_BROADCAST_INFO_VAR (256) SF_BROADCAST_INFO ;
 
448
 
 
449
 
 
450
/*      Virtual I/O functionality. */
388
451
 
389
452
typedef sf_count_t              (*sf_vio_get_filelen)   (void *user_data) ;
390
453
typedef sf_count_t              (*sf_vio_seek)          (sf_count_t offset, int whence, void *user_data) ;
404
467
 
405
468
/* Open the specified file for read, write or both. On error, this will
406
469
** return a NULL pointer. To find the error number, pass a NULL SNDFILE
407
 
** to sf_perror () or sf_error_str ().
 
470
** to sf_strerror ().
408
471
** All calls to sf_open() should be matched with a call to sf_close().
409
472
*/
410
473
 
417
480
** of file header is at the current file offset. This allows sound files within
418
481
** larger container files to be read and/or written.
419
482
** On error, this will return a NULL pointer. To find the error number, pass a
420
 
** NULL SNDFILE to sf_perror () or sf_error_str ().
 
483
** NULL SNDFILE to sf_strerror ().
421
484
** All calls to sf_open_fd() should be matched with a call to sf_close().
422
485
 
423
486
*/
445
508
 
446
509
const char*     sf_error_number (int errnum) ;
447
510
 
448
 
/* The following three error functions are deprecated but they will remain in the
 
511
/* The following two error functions are deprecated but they will remain in the
449
512
** library for the forseeable future. The function sf_strerror() should be used
450
513
** in their place.
451
514
*/