aiff.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* This header file defines the .aiff audio file format.
*/
#ifndef _AIFF_H
#define _AIFF_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Define the on-disk audio file header for the aiff file format.
* By definition .aiff files are big endian. Macros are provided
* to make the conversion easier.
*
* As many file formats, .aiff is composed of "chunks" of data grouped
* together. The aiff specification states that chunks may be in any
* order. Thus it is not possible to create a condensed header structure
* as is possible with .aif or .wav.
*
* The first chunk is always a FORM chunk. All other chunks have the
* following form:
*
* Chunk ID
* Chunk Data Size
* Data
*
* AIFF files must have FORM, COMM, and SSND chunks. All other chunks
* can be ignored. When a chunk with an unknown ID is found then the
* application should read the next integer to get the size and then
* seek past the unknown chunk to the next chunk.
*
* When building a .aiff header the size of the data isn't always known.
* The following define is used for that situation.
*/
#define AUDIO_AIFF_UNKNOWN_SIZE (~0)
struct aiff_hdr_chunk {
};
typedef struct aiff_hdr_chunk aiff_hdr_chunk_t;
/* define for aiff_hdr_chunk.aiff_hdr_ID */
/* define for audio form type */
/*
* The COMMon chunk definitions. Due to an unfortunate layout, the integer
* aiff_comm_frames is not on a 4 byte boundary, which most compilers pad to
* put back onto an integer boundary. Thus it is implemented as 4 chars which
* gets around this. There are convenience macros to aid in getting and setting
* the value. Also, some compilers will pad the end of the data structure to
* place it on a 4 byte boundary, thus sizeof (aiff_comm_chunk_t) is off by
* 2 bytes. Use AIFF_COMM_CHUNK_SIZE instead.
*/
#define AUDIO_AIFF_COMM_SR_SIZE 10
#define AUDIO_AIFF_COMM_CHUNK_SIZE 26
struct aiff_comm_chunk {
/* SR in float */
};
typedef struct aiff_comm_chunk aiff_comm_chunk_t;
/* define for aiff_comm_chunk.aiff_comm_ID */
/* define for aiff_comm_chunk.aiff_comm_size */
#define AUDIO_AIFF_COMM_SIZE 18
/* define for aiff_comm_chunk.aiff_comm_channels */
#define AUDIO_AIFF_COMM_CHANNELS_MONO 1
#define AUDIO_AIFF_COMM_CHANNELS_STEREO 2
/* defines to get and set the frame count */
#define AUDIO_AIFF_COMM_FRAMES2INT(X) \
(((X)[0] << 24) | ((X)[1] << 16) | ((X)[2] << 8) | (X)[3])
#define AUDIO_AIFF_COMM_INT2FRAMES(X, D) \
(X)[0] = (D) >> 24; (X)[1] = (D) >> 16; (X)[2] = (D) >> 8; (X)[3] = (D);
/* define for aiff_comm_chunk.aiff_comm_sample_size */
#define AUDIO_AIFF_COMM_8_BIT_SAMPLE_SIZE 8
#define AUDIO_AIFF_COMM_16_BIT_SAMPLE_SIZE 16
/*
* The SSND chunk definitions. Sound data immediately follows this data
* structure. Use aiff_ssnd_block_size to move past the data. The size of
* audio is aiff_ssnd_size - 8.
*/
struct aiff_ssnd_chunk {
};
typedef struct aiff_ssnd_chunk aiff_ssnd_chunk_t;
/* define for aiff_ssnd_chunk.aiff_ssnd_ID */
/* byte swapping macros */
#if defined(__sparc) /* big endian */
#else
#endif /* byte swapping */
#ifdef __cplusplus
}
#endif
#endif /* _AIFF_H */