20
20
** sndfile.h -- system-wide definitions
21
21
**
22
22
** API documentation is in the doc/ directory of the source code tarball
23
- ** and at http://www.mega-nerd.com /libsndfile/api.html.
23
+ ** and at http://libsndfile.github.io /libsndfile/api.html.
24
24
*/
25
25
26
26
#ifndef SNDFILE_H
71
71
SF_FORMAT_OGG = 0x200000 , /* Xiph OGG container */
72
72
SF_FORMAT_MPC2K = 0x210000 , /* Akai MPC 2000 sampler */
73
73
SF_FORMAT_RF64 = 0x220000 , /* RF64 WAV file */
74
+ SF_FORMAT_MPEG = 0x230000 , /* MPEG-1/2 audio stream */
74
75
75
76
/* Subtypes from here on. */
76
77
92
93
SF_FORMAT_GSM610 = 0x0020 , /* GSM 6.10 encoding. */
93
94
SF_FORMAT_VOX_ADPCM = 0x0021 , /* OKI / Dialogix ADPCM */
94
95
96
+ SF_FORMAT_NMS_ADPCM_16 = 0x0022 , /* 16kbs NMS G721-variant encoding. */
97
+ SF_FORMAT_NMS_ADPCM_24 = 0x0023 , /* 24kbs NMS G721-variant encoding. */
98
+ SF_FORMAT_NMS_ADPCM_32 = 0x0024 , /* 32kbs NMS G721-variant encoding. */
99
+
95
100
SF_FORMAT_G721_32 = 0x0030 , /* 32kbs G721 ADPCM encoding. */
96
101
SF_FORMAT_G723_24 = 0x0031 , /* 24kbs G723 ADPCM encoding. */
97
102
SF_FORMAT_G723_40 = 0x0032 , /* 40kbs G723 ADPCM encoding. */
@@ -105,12 +110,17 @@ enum
105
110
SF_FORMAT_DPCM_16 = 0x0051 , /* 16 bit differential PCM (XI only) */
106
111
107
112
SF_FORMAT_VORBIS = 0x0060 , /* Xiph Vorbis encoding. */
113
+ SF_FORMAT_OPUS = 0x0064 , /* Xiph/Skype Opus encoding. */
108
114
109
115
SF_FORMAT_ALAC_16 = 0x0070 , /* Apple Lossless Audio Codec (16 bit). */
110
116
SF_FORMAT_ALAC_20 = 0x0071 , /* Apple Lossless Audio Codec (20 bit). */
111
117
SF_FORMAT_ALAC_24 = 0x0072 , /* Apple Lossless Audio Codec (24 bit). */
112
118
SF_FORMAT_ALAC_32 = 0x0073 , /* Apple Lossless Audio Codec (32 bit). */
113
119
120
+ SF_FORMAT_MPEG_LAYER_I = 0x0080 , /* MPEG-1 Audio Layer I */
121
+ SF_FORMAT_MPEG_LAYER_II = 0x0081 , /* MPEG-1 Audio Layer II */
122
+ SF_FORMAT_MPEG_LAYER_III = 0x0082 , /* MPEG-2 Audio Layer III */
123
+
114
124
/* Endian-ness options. */
115
125
116
126
SF_ENDIAN_FILE = 0x00000000 , /* Default file endian-ness. */
160
170
SFC_GET_MAX_ALL_CHANNELS = 0x1045 ,
161
171
162
172
SFC_SET_ADD_PEAK_CHUNK = 0x1050 ,
163
- SFC_SET_ADD_HEADER_PAD_CHUNK = 0x1051 ,
164
173
165
174
SFC_UPDATE_HEADER_NOW = 0x1060 ,
166
175
SFC_SET_UPDATE_HEADER_AUTO = 0x1061 ,
169
178
170
179
SFC_SET_RAW_START_OFFSET = 0x1090 ,
171
180
181
+ /* Commands reserved for dithering, which is not implemented. */
172
182
SFC_SET_DITHER_ON_WRITE = 0x10A0 ,
173
183
SFC_SET_DITHER_ON_READ = 0x10A1 ,
174
184
@@ -211,19 +221,33 @@ enum
211
221
SFC_SET_VBR_ENCODING_QUALITY = 0x1300 ,
212
222
SFC_SET_COMPRESSION_LEVEL = 0x1301 ,
213
223
224
+ /* Ogg format commands */
225
+ SFC_SET_OGG_PAGE_LATENCY_MS = 0x1302 ,
226
+ SFC_SET_OGG_PAGE_LATENCY = 0x1303 ,
227
+ SFC_GET_OGG_STREAM_SERIALNO = 0x1306 ,
228
+
229
+ SFC_GET_BITRATE_MODE = 0x1304 ,
230
+ SFC_SET_BITRATE_MODE = 0x1305 ,
231
+
214
232
/* Cart Chunk support */
215
233
SFC_SET_CART_INFO = 0x1400 ,
216
234
SFC_GET_CART_INFO = 0x1401 ,
217
235
236
+ /* Opus files original samplerate metadata */
237
+ SFC_SET_ORIGINAL_SAMPLERATE = 0x1500 ,
238
+ SFC_GET_ORIGINAL_SAMPLERATE = 0x1501 ,
239
+
218
240
/* Following commands for testing only. */
219
241
SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001 ,
220
242
221
243
/*
222
- ** SFC_SET_ADD_* values are deprecated and will disappear at some
244
+ ** These SFC_SET_ADD_* values are deprecated and will disappear at some
223
245
** time in the future. They are guaranteed to be here up to and
224
246
** including version 1.0.8 to avoid breakage of existing software.
225
247
** They currently do nothing and will continue to do nothing.
226
248
*/
249
+ SFC_SET_ADD_HEADER_PAD_CHUNK = 0x1051 ,
250
+
227
251
SFC_SET_ADD_DITHER_ON_WRITE = 0x1070 ,
228
252
SFC_SET_ADD_DITHER_ON_READ = 0x1071
229
253
} ;
@@ -321,10 +345,18 @@ enum
321
345
SF_CHANNEL_MAP_MAX
322
346
} ;
323
347
348
+ /* Bitrate mode values (for use with SFC_GET/SET_BITRATE_MODE)
349
+ */
350
+ enum
351
+ { SF_BITRATE_MODE_CONSTANT = 0 ,
352
+ SF_BITRATE_MODE_AVERAGE ,
353
+ SF_BITRATE_MODE_VARIABLE
354
+ } ;
355
+
324
356
325
357
/* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */
326
358
327
- typedef struct SNDFILE_tag SNDFILE ;
359
+ typedef struct sf_private_tag SNDFILE ;
328
360
329
361
/* The following typedef is system specific and is defined when libsndfile is
330
362
** compiled. sf_count_t will be a 64 bit value when the underlying OS allows
@@ -333,12 +365,9 @@ typedef struct SNDFILE_tag SNDFILE ;
333
365
** and the Microsoft compiler.
334
366
*/
335
367
336
- #if (defined (_MSCVER ) || defined (_MSC_VER ) && (_MSC_VER < 1310 ))
337
- typedef __int64 sf_count_t ;
338
- #define SF_COUNT_MAX 0x7fffffffffffffffi64
339
- #else
340
- typedef __int64 sf_count_t ;
341
- #define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFLL
368
+ typedef int64_t sf_count_t ;
369
+ #ifndef SF_COUNT_MAX
370
+ #define SF_COUNT_MAX INT64_MAX
342
371
#endif
343
372
344
373
@@ -377,8 +406,7 @@ typedef struct
377
406
378
407
/*
379
408
** Enums and typedefs for adding dither on read and write.
380
- ** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE
381
- ** and SFC_SET_DITHER_ON_READ.
409
+ ** Reserved for future implementation.
382
410
*/
383
411
384
412
enum
@@ -492,7 +520,12 @@ typedef struct
492
520
uint32_t time_reference_high ; \
493
521
short version ; \
494
522
char umid [64] ; \
495
- char reserved [190] ; \
523
+ int16_t loudness_value ; \
524
+ int16_t loudness_range ; \
525
+ int16_t max_true_peak_level ; \
526
+ int16_t max_momentary_loudness ; \
527
+ int16_t max_shortterm_loudness ; \
528
+ char reserved [180] ; \
496
529
uint32_t coding_history_size ; \
497
530
char coding_history [coding_hist_size] ; \
498
531
}
@@ -610,7 +643,9 @@ int sf_perror (SNDFILE *sndfile) ;
610
643
int sf_error_str (SNDFILE * sndfile , char * str , size_t len ) ;
611
644
612
645
613
- /* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */
646
+ /* Allow the caller to retrieve information from or change aspects of the
647
+ ** library behaviour.
648
+ */
614
649
615
650
int sf_command (SNDFILE * sndfile , int command , void * data , int datasize ) ;
616
651
@@ -739,16 +774,10 @@ void sf_write_sync (SNDFILE *sndfile) ;
739
774
/* The function sf_wchar_open() is Windows Only!
740
775
** Open a file passing in a Windows Unicode filename. Otherwise, this is
741
776
** the same as sf_open().
742
- **
743
- ** In order for this to work, you need to do the following:
744
- **
745
- ** #include <windows.h>
746
- ** #define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
747
- ** #including <sndfile.h>
748
777
*/
749
778
750
- #if (defined ( ENABLE_SNDFILE_WINDOWS_PROTOTYPES ) && ENABLE_SNDFILE_WINDOWS_PROTOTYPES )
751
- SNDFILE * sf_wchar_open (LPCWSTR wpath , int mode , SF_INFO * sfinfo ) ;
779
+ #ifdef _WIN32
780
+ SNDFILE * sf_wchar_open (const wchar_t * wpath , int mode , SF_INFO * sfinfo ) ;
752
781
#endif
753
782
754
783
@@ -854,4 +883,3 @@ sf_get_chunk_data (const SF_CHUNK_ITERATOR * it, SF_CHUNK_INFO * chunk_info) ;
854
883
#endif /* __cplusplus */
855
884
856
885
#endif /* SNDFILE_H */
857
-
0 commit comments