mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-21 16:37:12 +01:00
Update libsndfile to 1.0.29pre2+git
This pulls in MANY (over 890) changes compared to our from our current 1.0.24 version.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2018 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -29,6 +29,9 @@
|
||||
#elif HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#if HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifndef SNDFILE_H
|
||||
#include "sndfile.h"
|
||||
@@ -38,7 +41,9 @@
|
||||
#error "This code is not designed to be compiled with a C++ compiler."
|
||||
#endif
|
||||
|
||||
#if (SIZEOF_LONG == 8)
|
||||
#ifdef INT64_C
|
||||
# define SF_PLATFORM_S64(x) INT64_C (x)
|
||||
#elif (SIZEOF_LONG == 8)
|
||||
# define SF_PLATFORM_S64(x) x##l
|
||||
#elif (SIZEOF_LONG_LONG == 8)
|
||||
# define SF_PLATFORM_S64(x) x##ll
|
||||
@@ -70,16 +75,14 @@
|
||||
# define WARN_UNUSED
|
||||
#endif
|
||||
|
||||
#define SF_BUFFER_LEN (8192*2)
|
||||
#define SF_FILENAME_LEN (512)
|
||||
#define SF_BUFFER_LEN (8192)
|
||||
#define SF_FILENAME_LEN (1024)
|
||||
#define SF_SYSERR_LEN (256)
|
||||
#define SF_MAX_STRINGS (32)
|
||||
#define SF_STR_BUFFER_LEN (8192)
|
||||
#define SF_HEADER_LEN (4100 + SF_STR_BUFFER_LEN)
|
||||
#define SF_PARSELOG_LEN (2048)
|
||||
|
||||
#define PSF_SEEK_ERROR ((sf_count_t) -1)
|
||||
|
||||
|
||||
#define BITWIDTH2BYTES(x) (((x) + 7) / 8)
|
||||
|
||||
/* For some reason sizeof returns an unsigned value which causes
|
||||
@@ -92,42 +95,65 @@
|
||||
|
||||
#define NOT(x) (! (x))
|
||||
|
||||
#if (COMPILER_IS_GCC == 1)
|
||||
#define SF_MAX(x,y) ({ \
|
||||
#if COMPILER_IS_GCC
|
||||
#define SF_MAX(x, y) ({ \
|
||||
typeof (x) sf_max_x1 = (x) ; \
|
||||
typeof (y) sf_max_y1 = (y) ; \
|
||||
(void) (&sf_max_x1 == &sf_max_y1) ; \
|
||||
sf_max_x1 > sf_max_y1 ? sf_max_x1 : sf_max_y1 ; })
|
||||
|
||||
#define SF_MIN(x,y) ({ \
|
||||
#define SF_MIN(x, y) ({ \
|
||||
typeof (x) sf_min_x2 = (x) ; \
|
||||
typeof (y) sf_min_y2 = (y) ; \
|
||||
(void) (&sf_min_x2 == &sf_min_y2) ; \
|
||||
sf_min_x2 < sf_min_y2 ? sf_min_x2 : sf_min_y2 ; })
|
||||
#else
|
||||
#define SF_MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
#define SF_MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#define SF_MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define SF_MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
|
||||
#define SF_MAX_CHANNELS 256
|
||||
#define COMPILE_TIME_ASSERT(e) (sizeof (struct { int : - !! (e) ; }))
|
||||
|
||||
|
||||
#define SF_ASSERT(expr) \
|
||||
{ if (! (expr)) \
|
||||
{ printf ("%s %d : assert '" #expr "' failed!\n", __FILE__, __LINE__) ;\
|
||||
exit (1) ; \
|
||||
} ;\
|
||||
}
|
||||
#define SF_MAX_CHANNELS 1024
|
||||
|
||||
|
||||
/*
|
||||
* Macros for spliting the format file of SF_INFI into contrainer type,
|
||||
* Macros for spliting the format file of SF_INFO into container type,
|
||||
** codec type and endian-ness.
|
||||
*/
|
||||
#define SF_CONTAINER(x) ((x) & SF_FORMAT_TYPEMASK)
|
||||
#define SF_CODEC(x) ((x) & SF_FORMAT_SUBMASK)
|
||||
#define SF_ENDIAN(x) ((x) & SF_FORMAT_ENDMASK)
|
||||
|
||||
/*
|
||||
** Binheader cast macros.
|
||||
*/
|
||||
|
||||
#define BHW1(x) ((uint8_t) (x))
|
||||
#define BHW2(x) ((uint16_t) (x))
|
||||
#define BHW3(x) ((uint32_t) (x))
|
||||
#define BHW4(x) ((uint32_t) (x))
|
||||
#define BHW8(x) ((uint64_t) (x))
|
||||
|
||||
#define BHWm(x) ((uint32_t) (x))
|
||||
#define BHWS(x) ((char *) (x))
|
||||
|
||||
#define BHWf(x) ((double) (x))
|
||||
#define BHWd(x) ((double) (x))
|
||||
|
||||
#define BHWh(x) ((void *) (x))
|
||||
#define BHWj(x) ((size_t) (x))
|
||||
#define BHWp(x) ((char *) (x))
|
||||
#define BHWo(x) ((size_t) (x))
|
||||
#define BHWs(x) ((char *) (x))
|
||||
#define BHWv(x) ((const void *) (x))
|
||||
#define BHWz(x) ((size_t) (x))
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
enum
|
||||
{ /* PEAK chunk location. */
|
||||
SF_PEAK_START = 42,
|
||||
@@ -158,6 +184,8 @@ enum
|
||||
|
||||
enum
|
||||
{ /* Work in progress. */
|
||||
SF_FORMAT_SPEEX = 0x5000000,
|
||||
SF_FORMAT_OGGFLAC = 0x5000001,
|
||||
|
||||
/* Formats supported read only. */
|
||||
SF_FORMAT_TXW = 0x4030000, /* Yamaha TX16 sampler file */
|
||||
@@ -177,6 +205,22 @@ enum
|
||||
SF_FORMAT_PCM_N = 0x1030
|
||||
} ;
|
||||
|
||||
/*---------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{ unsigned kuki_offset ;
|
||||
unsigned pakt_offset ;
|
||||
|
||||
unsigned bits_per_sample ;
|
||||
unsigned frames_per_packet ;
|
||||
|
||||
int64_t packets ;
|
||||
int64_t valid_frames ;
|
||||
int32_t priming_frames ;
|
||||
int32_t remainder_frames ;
|
||||
} ALAC_DECODER_INFO ;
|
||||
|
||||
/*---------------------------------------------------------------------------------------
|
||||
** PEAK_CHUNK - This chunk type is common to both AIFF and WAVE files although their
|
||||
** endian encodings are different.
|
||||
@@ -198,19 +242,8 @@ typedef struct
|
||||
/* CAF */
|
||||
unsigned int edit_number ;
|
||||
|
||||
#if HAVE_FLEXIBLE_ARRAY
|
||||
/* the per channel peak info */
|
||||
PEAK_POS peaks [] ;
|
||||
#else
|
||||
/*
|
||||
** This is not ISO compliant C. It works on some compilers which
|
||||
** don't support the ISO standard flexible struct array which is
|
||||
** used above. If your compiler doesn't like this I suggest you find
|
||||
** youself a 1999 ISO C standards compilant compiler. GCC-3.X is
|
||||
** highly recommended.
|
||||
*/
|
||||
PEAK_POS peaks [0] ;
|
||||
#endif
|
||||
} PEAK_INFO ;
|
||||
|
||||
static inline PEAK_INFO *
|
||||
@@ -221,22 +254,66 @@ peak_info_calloc (int channels)
|
||||
typedef struct
|
||||
{ int type ;
|
||||
int flags ;
|
||||
char *str ;
|
||||
size_t offset ;
|
||||
} STR_DATA ;
|
||||
|
||||
typedef struct
|
||||
{ uint64_t hash ;
|
||||
char id [64] ;
|
||||
unsigned id_size ;
|
||||
uint32_t mark32 ;
|
||||
sf_count_t offset ;
|
||||
uint32_t len ;
|
||||
} READ_CHUNK ;
|
||||
|
||||
typedef struct
|
||||
{ uint64_t hash ;
|
||||
uint32_t mark32 ;
|
||||
uint32_t len ;
|
||||
void *data ;
|
||||
} WRITE_CHUNK ;
|
||||
|
||||
typedef struct
|
||||
{ uint32_t count ;
|
||||
uint32_t used ;
|
||||
READ_CHUNK *chunks ;
|
||||
} READ_CHUNKS ;
|
||||
typedef struct
|
||||
{ uint32_t count ;
|
||||
uint32_t used ;
|
||||
WRITE_CHUNK *chunks ;
|
||||
} WRITE_CHUNKS ;
|
||||
|
||||
struct SF_CHUNK_ITERATOR
|
||||
{ uint32_t current ;
|
||||
int64_t hash ;
|
||||
char id [64] ;
|
||||
unsigned id_size ;
|
||||
SNDFILE *sndfile ;
|
||||
} ;
|
||||
|
||||
static inline size_t
|
||||
make_size_t (int x)
|
||||
{ return (size_t) x ;
|
||||
} /* size_t_of_int */
|
||||
} /* make_size_t */
|
||||
|
||||
typedef SF_BROADCAST_INFO_VAR (16 * 1024) SF_BROADCAST_INFO_16K ;
|
||||
|
||||
typedef SF_CART_INFO_VAR (16 * 1024) SF_CART_INFO_16K ;
|
||||
|
||||
#if SIZEOF_WCHAR_T == 2
|
||||
typedef wchar_t sfwchar_t ;
|
||||
#else
|
||||
typedef int16_t sfwchar_t ;
|
||||
#endif
|
||||
|
||||
|
||||
static inline void *
|
||||
psf_memdup (const void *src, size_t n)
|
||||
{ void * mem = calloc (1, n & 3 ? n + 4 - (n & 3) : n) ;
|
||||
return memcpy (mem, src, n) ;
|
||||
} /* psf_memdup */
|
||||
|
||||
/*
|
||||
** This version of isprint specifically ignores any locale info. Its used for
|
||||
** determining which characters can be printed in things like hexdumps.
|
||||
@@ -287,6 +364,24 @@ typedef struct
|
||||
} PSF_FILE ;
|
||||
|
||||
|
||||
|
||||
typedef union
|
||||
{ double dbuf [SF_BUFFER_LEN / sizeof (double)] ;
|
||||
#if (defined (SIZEOF_INT64_T) && (SIZEOF_INT64_T == 8))
|
||||
int64_t lbuf [SF_BUFFER_LEN / sizeof (int64_t)] ;
|
||||
#else
|
||||
long lbuf [SF_BUFFER_LEN / sizeof (double)] ;
|
||||
#endif
|
||||
float fbuf [SF_BUFFER_LEN / sizeof (float)] ;
|
||||
int ibuf [SF_BUFFER_LEN / sizeof (int)] ;
|
||||
short sbuf [SF_BUFFER_LEN / sizeof (short)] ;
|
||||
char cbuf [SF_BUFFER_LEN / sizeof (char)] ;
|
||||
signed char scbuf [SF_BUFFER_LEN / sizeof (signed char)] ;
|
||||
unsigned char ucbuf [SF_BUFFER_LEN / sizeof (signed char)] ;
|
||||
} BUF_UNION ;
|
||||
|
||||
|
||||
|
||||
typedef struct sf_private_tag
|
||||
{
|
||||
/* Canary in a coal mine. */
|
||||
@@ -296,52 +391,42 @@ typedef struct sf_private_tag
|
||||
char c [16] ;
|
||||
} canary ;
|
||||
|
||||
/* Force the compiler to double align the start of buffer. */
|
||||
union
|
||||
{ double dbuf [SF_BUFFER_LEN / sizeof (double)] ;
|
||||
#if (defined (SIZEOF_INT64_T) && (SIZEOF_INT64_T == 8))
|
||||
int64_t lbuf [SF_BUFFER_LEN / sizeof (int64_t)] ;
|
||||
#else
|
||||
long lbuf [SF_BUFFER_LEN / sizeof (double)] ;
|
||||
#endif
|
||||
float fbuf [SF_BUFFER_LEN / sizeof (float)] ;
|
||||
int ibuf [SF_BUFFER_LEN / sizeof (int)] ;
|
||||
short sbuf [SF_BUFFER_LEN / sizeof (short)] ;
|
||||
char cbuf [SF_BUFFER_LEN / sizeof (char)] ;
|
||||
signed char scbuf [SF_BUFFER_LEN / sizeof (signed char)] ;
|
||||
unsigned char ucbuf [SF_BUFFER_LEN / sizeof (signed char)] ;
|
||||
} u ;
|
||||
|
||||
|
||||
PSF_FILE file, rsrc ;
|
||||
|
||||
char syserr [SF_SYSERR_LEN] ;
|
||||
|
||||
/* logbuffer and logindex should only be changed within the logging functions
|
||||
/* parselog and indx should only be changed within the logging functions
|
||||
** of common.c
|
||||
*/
|
||||
char logbuffer [SF_BUFFER_LEN] ;
|
||||
unsigned char header [SF_HEADER_LEN] ; /* Must be unsigned */
|
||||
struct
|
||||
{ char buf [SF_PARSELOG_LEN] ;
|
||||
int indx ;
|
||||
} parselog ;
|
||||
|
||||
|
||||
struct
|
||||
{ unsigned char * ptr ;
|
||||
sf_count_t indx, end, len ;
|
||||
} header ;
|
||||
|
||||
int rwf_endian ; /* Header endian-ness flag. */
|
||||
|
||||
/* Storage and housekeeping data for adding/reading strings from
|
||||
** sound files.
|
||||
*/
|
||||
STR_DATA strings [SF_MAX_STRINGS] ;
|
||||
char str_storage [SF_STR_BUFFER_LEN] ;
|
||||
char *str_end ;
|
||||
int str_flags ;
|
||||
struct
|
||||
{ STR_DATA data [SF_MAX_STRINGS] ;
|
||||
char *storage ;
|
||||
size_t storage_len ;
|
||||
size_t storage_used ;
|
||||
uint32_t flags ;
|
||||
} strings ;
|
||||
|
||||
/* Guard value. If this changes the buffers above have overflowed. */
|
||||
int Magick ;
|
||||
|
||||
unsigned unique_id ;
|
||||
|
||||
/* Index variables for maintaining logbuffer and header above. */
|
||||
int logindex ;
|
||||
int headindex, headend ;
|
||||
int has_text ;
|
||||
|
||||
int error ;
|
||||
|
||||
int endian ; /* File endianness : SF_ENDIAN_LITTLE or SF_ENDIAN_BIG. */
|
||||
@@ -368,6 +453,9 @@ typedef struct sf_private_tag
|
||||
int have_written ; /* Has a single write been done to the file? */
|
||||
PEAK_INFO *peak_info ;
|
||||
|
||||
/* Cue Marker Info */
|
||||
SF_CUES *cues ;
|
||||
|
||||
/* Loop Info */
|
||||
SF_LOOP_INFO *loop_info ;
|
||||
SF_INSTRUMENT *instrument ;
|
||||
@@ -375,6 +463,9 @@ typedef struct sf_private_tag
|
||||
/* Broadcast (EBU) Info */
|
||||
SF_BROADCAST_INFO_16K *broadcast_16k ;
|
||||
|
||||
/* Cart (AES46) Info */
|
||||
SF_CART_INFO_16K *cart_16k ;
|
||||
|
||||
/* Channel map data (if present) : an array of ints. */
|
||||
int *channel_map ;
|
||||
|
||||
@@ -429,6 +520,7 @@ typedef struct sf_private_tag
|
||||
sf_count_t (*seek) (struct sf_private_tag*, int mode, sf_count_t samples_from_start) ;
|
||||
int (*write_header) (struct sf_private_tag*, int calc_length) ;
|
||||
int (*command) (struct sf_private_tag*, int command, void *data, int datasize) ;
|
||||
int (*byterate) (struct sf_private_tag*) ;
|
||||
|
||||
/*
|
||||
** Separate close functions for the codec and the container.
|
||||
@@ -443,6 +535,17 @@ typedef struct sf_private_tag
|
||||
int virtual_io ;
|
||||
SF_VIRTUAL_IO vio ;
|
||||
void *vio_user_data ;
|
||||
|
||||
/* Chunk get/set. */
|
||||
SF_CHUNK_ITERATOR *iterator ;
|
||||
|
||||
READ_CHUNKS rchunks ;
|
||||
WRITE_CHUNKS wchunks ;
|
||||
|
||||
int (*set_chunk) (struct sf_private_tag*, const SF_CHUNK_INFO * chunk_info) ;
|
||||
SF_CHUNK_ITERATOR * (*next_chunk_iterator) (struct sf_private_tag*, SF_CHUNK_ITERATOR * iterator) ;
|
||||
int (*get_chunk_size) (struct sf_private_tag*, const SF_CHUNK_ITERATOR * iterator, SF_CHUNK_INFO * chunk_info) ;
|
||||
int (*get_chunk_data) (struct sf_private_tag*, const SF_CHUNK_ITERATOR * iterator, SF_CHUNK_INFO * chunk_info) ;
|
||||
} SF_PRIVATE ;
|
||||
|
||||
|
||||
@@ -465,11 +568,11 @@ enum
|
||||
SFE_BAD_FILE_PTR,
|
||||
SFE_BAD_INT_PTR,
|
||||
SFE_BAD_STAT_SIZE,
|
||||
SFE_NO_TEMP_DIR,
|
||||
SFE_MALLOC_FAILED,
|
||||
SFE_UNIMPLEMENTED,
|
||||
SFE_BAD_READ_ALIGN,
|
||||
SFE_BAD_WRITE_ALIGN,
|
||||
SFE_UNKNOWN_FORMAT,
|
||||
SFE_NOT_READMODE,
|
||||
SFE_NOT_WRITEMODE,
|
||||
SFE_BAD_MODE_RW,
|
||||
@@ -484,6 +587,7 @@ enum
|
||||
SFE_BAD_ENDIAN,
|
||||
SFE_CHANNEL_COUNT_ZERO,
|
||||
SFE_CHANNEL_COUNT,
|
||||
SFE_CHANNEL_COUNT_BAD,
|
||||
|
||||
SFE_BAD_VIRTUAL_IO,
|
||||
|
||||
@@ -504,6 +608,8 @@ enum
|
||||
SFE_CMD_HAS_DATA,
|
||||
SFE_BAD_BROADCAST_INFO_SIZE,
|
||||
SFE_BAD_BROADCAST_INFO_TOO_BIG,
|
||||
SFE_BAD_CART_INFO_SIZE,
|
||||
SFE_BAD_CART_INFO_TOO_BIG,
|
||||
|
||||
SFE_STR_NO_SUPPORT,
|
||||
SFE_STR_NOT_WRITE,
|
||||
@@ -528,9 +634,11 @@ enum
|
||||
SFE_WAV_BAD_LIST,
|
||||
SFE_WAV_ADPCM_NOT4BIT,
|
||||
SFE_WAV_ADPCM_CHANNELS,
|
||||
SFE_WAV_ADPCM_SAMPLES,
|
||||
SFE_WAV_GSM610_FORMAT,
|
||||
SFE_WAV_UNKNOWN_CHUNK,
|
||||
SFE_WAV_WVPK_DATA,
|
||||
SFE_WAV_NMS_FORMAT,
|
||||
|
||||
SFE_AIFF_NO_FORM,
|
||||
SFE_AIFF_AIFF_NO_FORM,
|
||||
@@ -557,6 +665,7 @@ enum
|
||||
SFE_PAF_VERSION,
|
||||
SFE_PAF_UNKNOWN_FORMAT,
|
||||
SFE_PAF_SHORT_HEADER,
|
||||
SFE_PAF_BAD_CHANNELS,
|
||||
|
||||
SFE_SVX_NO_FORM,
|
||||
SFE_SVX_NO_BODY,
|
||||
@@ -604,6 +713,7 @@ enum
|
||||
|
||||
SFE_DWVW_BAD_BITWIDTH,
|
||||
SFE_G72X_NOT_MONO,
|
||||
SFE_NMS_ADPCM_NOT_MONO,
|
||||
|
||||
SFE_XI_BAD_HEADER,
|
||||
SFE_XI_EXCESS_SAMPLES,
|
||||
@@ -627,6 +737,7 @@ enum
|
||||
SFE_FLAC_INIT_DECODER,
|
||||
SFE_FLAC_LOST_SYNC,
|
||||
SFE_FLAC_BAD_SAMPLE_RATE,
|
||||
SFE_FLAC_CHANNEL_COUNT_CHANGED,
|
||||
SFE_FLAC_UNKOWN_ERROR,
|
||||
|
||||
SFE_WVE_NOT_WVE,
|
||||
@@ -635,10 +746,26 @@ enum
|
||||
SFE_VORBIS_ENCODER_BUG,
|
||||
|
||||
SFE_RF64_NOT_RF64,
|
||||
SFE_RF64_PEAK_B4_FMT,
|
||||
SFE_RF64_NO_DATA,
|
||||
|
||||
SFE_BAD_CHUNK_PTR,
|
||||
SFE_UNKNOWN_CHUNK,
|
||||
SFE_BAD_CHUNK_FORMAT,
|
||||
SFE_BAD_CHUNK_MARKER,
|
||||
SFE_BAD_CHUNK_DATA_PTR,
|
||||
SFE_ALAC_FAIL_TMPFILE,
|
||||
SFE_FILENAME_TOO_LONG,
|
||||
SFE_NEGATIVE_RW_LEN,
|
||||
|
||||
SFE_OPUS_BAD_SAMPLERATE,
|
||||
|
||||
SFE_MAX_ERROR /* This must be last in list. */
|
||||
} ;
|
||||
|
||||
/* Allocate and initialize the SF_PRIVATE struct. */
|
||||
SF_PRIVATE * psf_allocate (void) ;
|
||||
|
||||
int subformat_to_bytewidth (int format) ;
|
||||
int s_bitwidth_to_subformat (int bits) ;
|
||||
int u_bitwidth_to_subformat (int bits) ;
|
||||
@@ -646,13 +773,13 @@ int u_bitwidth_to_subformat (int bits) ;
|
||||
/* Functions for reading and writing floats and doubles on processors
|
||||
** with non-IEEE floats/doubles.
|
||||
*/
|
||||
float float32_be_read (unsigned char *cptr) ;
|
||||
float float32_le_read (unsigned char *cptr) ;
|
||||
float float32_be_read (const unsigned char *cptr) ;
|
||||
float float32_le_read (const unsigned char *cptr) ;
|
||||
void float32_be_write (float in, unsigned char *out) ;
|
||||
void float32_le_write (float in, unsigned char *out) ;
|
||||
|
||||
double double64_be_read (unsigned char *cptr) ;
|
||||
double double64_le_read (unsigned char *cptr) ;
|
||||
double double64_be_read (const unsigned char *cptr) ;
|
||||
double double64_le_read (const unsigned char *cptr) ;
|
||||
void double64_be_write (double in, unsigned char *out) ;
|
||||
void double64_le_write (double in, unsigned char *out) ;
|
||||
|
||||
@@ -666,6 +793,8 @@ int32_t psf_rand_int32 (void) ;
|
||||
void append_snprintf (char * dest, size_t maxlen, const char * fmt, ...) ;
|
||||
void psf_strlcpy_crlf (char *dest, const char *src, size_t destmax, size_t srcmax) ;
|
||||
|
||||
sf_count_t psf_decode_frame_count (SF_PRIVATE *psf) ;
|
||||
|
||||
/* Functions used when writing file headers. */
|
||||
|
||||
int psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...) ;
|
||||
@@ -778,17 +907,21 @@ int caf_open (SF_PRIVATE *psf) ;
|
||||
int mpc2k_open (SF_PRIVATE *psf) ;
|
||||
int rf64_open (SF_PRIVATE *psf) ;
|
||||
|
||||
int ogg_vorbis_open (SF_PRIVATE *psf) ;
|
||||
int ogg_speex_open (SF_PRIVATE *psf) ;
|
||||
int ogg_pcm_open (SF_PRIVATE *psf) ;
|
||||
int ogg_opus_open (SF_PRIVATE *psf) ;
|
||||
int ogg_open (SF_PRIVATE *psf) ;
|
||||
|
||||
|
||||
/* In progress. Do not currently work. */
|
||||
|
||||
int mpeg_open (SF_PRIVATE *psf) ;
|
||||
int ogg_open (SF_PRIVATE *psf) ;
|
||||
int rx2_open (SF_PRIVATE *psf) ;
|
||||
int txw_open (SF_PRIVATE *psf) ;
|
||||
int wve_open (SF_PRIVATE *psf) ;
|
||||
int dwd_open (SF_PRIVATE *psf) ;
|
||||
|
||||
int macbinary3_open (SF_PRIVATE *psf) ;
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
** Init functions for a number of common data encodings.
|
||||
*/
|
||||
@@ -800,14 +933,16 @@ int float32_init (SF_PRIVATE *psf) ;
|
||||
int double64_init (SF_PRIVATE *psf) ;
|
||||
int dwvw_init (SF_PRIVATE *psf, int bitwidth) ;
|
||||
int gsm610_init (SF_PRIVATE *psf) ;
|
||||
int nms_adpcm_init (SF_PRIVATE *psf) ;
|
||||
int vox_adpcm_init (SF_PRIVATE *psf) ;
|
||||
int flac_init (SF_PRIVATE *psf) ;
|
||||
int g72x_init (SF_PRIVATE * psf) ;
|
||||
int alac_init (SF_PRIVATE *psf, const ALAC_DECODER_INFO * info) ;
|
||||
|
||||
int dither_init (SF_PRIVATE *psf, int mode) ;
|
||||
|
||||
int wav_w64_ima_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) ;
|
||||
int wav_w64_msadpcm_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) ;
|
||||
int wavlike_ima_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) ;
|
||||
int wavlike_msadpcm_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) ;
|
||||
|
||||
int aiff_ima_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) ;
|
||||
|
||||
@@ -817,18 +952,27 @@ int interleave_init (SF_PRIVATE *psf) ;
|
||||
** Chunk logging functions.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{ struct
|
||||
{ int chunk ;
|
||||
sf_count_t offset ;
|
||||
sf_count_t len ;
|
||||
} l [100] ;
|
||||
SF_CHUNK_ITERATOR * psf_get_chunk_iterator (SF_PRIVATE * psf, const char * marker_str) ;
|
||||
SF_CHUNK_ITERATOR * psf_next_chunk_iterator (const READ_CHUNKS * pchk , SF_CHUNK_ITERATOR *iterator) ;
|
||||
int psf_store_read_chunk_u32 (READ_CHUNKS * pchk, uint32_t marker, sf_count_t offset, uint32_t len) ;
|
||||
int psf_store_read_chunk_str (READ_CHUNKS * pchk, const char * marker, sf_count_t offset, uint32_t len) ;
|
||||
int psf_save_write_chunk (WRITE_CHUNKS * pchk, const SF_CHUNK_INFO * chunk_info) ;
|
||||
int psf_find_read_chunk_str (const READ_CHUNKS * pchk, const char * marker) ;
|
||||
int psf_find_read_chunk_m32 (const READ_CHUNKS * pchk, uint32_t marker) ;
|
||||
int psf_find_read_chunk_iterator (const READ_CHUNKS * pchk, const SF_CHUNK_ITERATOR * marker) ;
|
||||
|
||||
int count ;
|
||||
} PRIV_CHUNK4 ;
|
||||
int psf_find_write_chunk (WRITE_CHUNKS * pchk, const char * marker) ;
|
||||
|
||||
void pchk4_store (PRIV_CHUNK4 * pchk, int marker, sf_count_t offset, sf_count_t len) ;
|
||||
int pchk4_find (PRIV_CHUNK4 * pchk, int marker) ;
|
||||
static inline int
|
||||
fourcc_to_marker (const SF_CHUNK_INFO * chunk_info)
|
||||
{ const unsigned char * cptr ;
|
||||
|
||||
if (chunk_info->id_size != 4)
|
||||
return 0 ;
|
||||
|
||||
cptr = (const unsigned char *) chunk_info->id ;
|
||||
return (cptr [3] << 24) + (cptr [2] << 16) + (cptr [1] << 8) + cptr [0] ;
|
||||
} /* fourcc_to_marker */
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
** Functions that work like OpenBSD's strlcpy/strlcat to replace strncpy/strncat.
|
||||
@@ -860,6 +1004,10 @@ psf_strlcpy (char *dest, size_t n, const char *src)
|
||||
|
||||
void *psf_memset (void *s, int c, sf_count_t n) ;
|
||||
|
||||
SF_CUES * psf_cues_dup (const void * ptr, size_t datasize) ;
|
||||
SF_CUES * psf_cues_alloc (uint32_t cue_count) ;
|
||||
void psf_get_cues (SF_PRIVATE * psf, void * data, size_t datasize) ;
|
||||
|
||||
SF_INSTRUMENT * psf_instrument_alloc (void) ;
|
||||
|
||||
void psf_sanitize_string (char * cptr, int len) ;
|
||||
@@ -872,6 +1020,10 @@ int broadcast_var_set (SF_PRIVATE *psf, const SF_BROADCAST_INFO * data, size_t
|
||||
int broadcast_var_get (SF_PRIVATE *psf, SF_BROADCAST_INFO * data, size_t datasize) ;
|
||||
|
||||
|
||||
SF_CART_INFO_16K * cart_var_alloc (void) ;
|
||||
int cart_var_set (SF_PRIVATE *psf, const SF_CART_INFO * date, size_t datasize) ;
|
||||
int cart_var_get (SF_PRIVATE *psf, SF_CART_INFO * data, size_t datasize) ;
|
||||
|
||||
typedef struct
|
||||
{ int channels ;
|
||||
int endianness ;
|
||||
@@ -880,6 +1032,10 @@ typedef struct
|
||||
int audio_detect (SF_PRIVATE * psf, AUDIO_DETECT *ad, const unsigned char * data, int datalen) ;
|
||||
int id3_skip (SF_PRIVATE * psf) ;
|
||||
|
||||
void alac_get_desc_chunk_items (int subformat, uint32_t *fmt_flags, uint32_t *frames_per_packet) ;
|
||||
|
||||
FILE * psf_open_tmpfile (char * fname, size_t fnamelen) ;
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
** Helper/debug functions.
|
||||
*/
|
||||
@@ -914,5 +1070,45 @@ int sf_dither_float (const SF_DITHER_INFO *dither, const float *in, float *out,
|
||||
int sf_dither_double (const SF_DITHER_INFO *dither, const double *in, double *out, int count) ;
|
||||
#endif
|
||||
|
||||
#endif /* SNDFILE_COMMON_H */
|
||||
/*------------------------------------------------------------------------------------
|
||||
** Data conversion functions.
|
||||
*/
|
||||
|
||||
void psf_f2s_array (const float *src, short *dest, int count, int normalize) ;
|
||||
void psf_f2s_clip_array (const float *src, short *dest, int count, int normalize) ;
|
||||
|
||||
void psf_d2s_array (const double *src, short *dest, int count, int normalize) ;
|
||||
void psf_d2s_clip_array (const double *src, short *dest, int count, int normalize) ;
|
||||
|
||||
void psf_f2i_array (const float *src, int *dest, int count, int normalize) ;
|
||||
void psf_f2i_clip_array (const float *src, int *dest, int count, int normalize) ;
|
||||
|
||||
void psf_d2i_array (const double *src, int *dest, int count, int normalize) ;
|
||||
void psf_d2i_clip_array (const double *src, int *dest, int count, int normalize) ;
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
** Left and right shift on int. According to the C standard, the left and right
|
||||
** shift operations applied to a negative integer results in undefined behavior.
|
||||
** These twp functions work around that.
|
||||
*/
|
||||
|
||||
#if __GNUC__
|
||||
#define ALWAYS_INLINE __attribute__ ((always_inline))
|
||||
#else
|
||||
#define ALWAYS_INLINE
|
||||
#endif
|
||||
|
||||
static inline int32_t ALWAYS_INLINE
|
||||
arith_shift_left (int32_t x, int shift)
|
||||
{ return (int32_t) (((uint32_t) x) << shift) ;
|
||||
} /* arith_shift_left */
|
||||
|
||||
static inline int32_t ALWAYS_INLINE
|
||||
arith_shift_right (int32_t x, int shift)
|
||||
{ if (x >= 0)
|
||||
return x >> shift ;
|
||||
return ~ ((~x) >> shift) ;
|
||||
} /* arith_shift_right */
|
||||
|
||||
#endif /* SNDFILE_COMMON_H */
|
||||
|
||||
Reference in New Issue
Block a user