annotate src/libmad-0.15.1b/frame.h @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents 545efbb81310
children
rev   line source
cannam@85 1 /*
cannam@85 2 * libmad - MPEG audio decoder library
cannam@85 3 * Copyright (C) 2000-2004 Underbit Technologies, Inc.
cannam@85 4 *
cannam@85 5 * This program is free software; you can redistribute it and/or modify
cannam@85 6 * it under the terms of the GNU General Public License as published by
cannam@85 7 * the Free Software Foundation; either version 2 of the License, or
cannam@85 8 * (at your option) any later version.
cannam@85 9 *
cannam@85 10 * This program is distributed in the hope that it will be useful,
cannam@85 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cannam@85 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cannam@85 13 * GNU General Public License for more details.
cannam@85 14 *
cannam@85 15 * You should have received a copy of the GNU General Public License
cannam@85 16 * along with this program; if not, write to the Free Software
cannam@85 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
cannam@85 18 *
cannam@85 19 * $Id: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp $
cannam@85 20 */
cannam@85 21
cannam@85 22 # ifndef LIBMAD_FRAME_H
cannam@85 23 # define LIBMAD_FRAME_H
cannam@85 24
cannam@85 25 # include "fixed.h"
cannam@85 26 # include "timer.h"
cannam@85 27 # include "stream.h"
cannam@85 28
cannam@85 29 enum mad_layer {
cannam@85 30 MAD_LAYER_I = 1, /* Layer I */
cannam@85 31 MAD_LAYER_II = 2, /* Layer II */
cannam@85 32 MAD_LAYER_III = 3 /* Layer III */
cannam@85 33 };
cannam@85 34
cannam@85 35 enum mad_mode {
cannam@85 36 MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
cannam@85 37 MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
cannam@85 38 MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
cannam@85 39 MAD_MODE_STEREO = 3 /* normal LR stereo */
cannam@85 40 };
cannam@85 41
cannam@85 42 enum mad_emphasis {
cannam@85 43 MAD_EMPHASIS_NONE = 0, /* no emphasis */
cannam@85 44 MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
cannam@85 45 MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
cannam@85 46 MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
cannam@85 47 };
cannam@85 48
cannam@85 49 struct mad_header {
cannam@85 50 enum mad_layer layer; /* audio layer (1, 2, or 3) */
cannam@85 51 enum mad_mode mode; /* channel mode (see above) */
cannam@85 52 int mode_extension; /* additional mode info */
cannam@85 53 enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
cannam@85 54
cannam@85 55 unsigned long bitrate; /* stream bitrate (bps) */
cannam@85 56 unsigned int samplerate; /* sampling frequency (Hz) */
cannam@85 57
cannam@85 58 unsigned short crc_check; /* frame CRC accumulator */
cannam@85 59 unsigned short crc_target; /* final target CRC checksum */
cannam@85 60
cannam@85 61 int flags; /* flags (see below) */
cannam@85 62 int private_bits; /* private bits (see below) */
cannam@85 63
cannam@85 64 mad_timer_t duration; /* audio playing time of frame */
cannam@85 65 };
cannam@85 66
cannam@85 67 struct mad_frame {
cannam@85 68 struct mad_header header; /* MPEG audio header */
cannam@85 69
cannam@85 70 int options; /* decoding options (from stream) */
cannam@85 71
cannam@85 72 mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
cannam@85 73 mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
cannam@85 74 };
cannam@85 75
cannam@85 76 # define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1)
cannam@85 77 # define MAD_NSBSAMPLES(header) \
cannam@85 78 ((header)->layer == MAD_LAYER_I ? 12 : \
cannam@85 79 (((header)->layer == MAD_LAYER_III && \
cannam@85 80 ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36))
cannam@85 81
cannam@85 82 enum {
cannam@85 83 MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
cannam@85 84 MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
cannam@85 85
cannam@85 86 MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
cannam@85 87 MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
cannam@85 88 MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
cannam@85 89 MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
cannam@85 90
cannam@85 91 MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
cannam@85 92 MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
cannam@85 93 MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
cannam@85 94
cannam@85 95 MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
cannam@85 96 MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
cannam@85 97 MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
cannam@85 98 };
cannam@85 99
cannam@85 100 enum {
cannam@85 101 MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
cannam@85 102 MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
cannam@85 103 };
cannam@85 104
cannam@85 105 void mad_header_init(struct mad_header *);
cannam@85 106
cannam@85 107 # define mad_header_finish(header) /* nothing */
cannam@85 108
cannam@85 109 int mad_header_decode(struct mad_header *, struct mad_stream *);
cannam@85 110
cannam@85 111 void mad_frame_init(struct mad_frame *);
cannam@85 112 void mad_frame_finish(struct mad_frame *);
cannam@85 113
cannam@85 114 int mad_frame_decode(struct mad_frame *, struct mad_stream *);
cannam@85 115
cannam@85 116 void mad_frame_mute(struct mad_frame *);
cannam@85 117
cannam@85 118 # endif