Showing the changes to java/pkg/com/sun/media/sound/AiffFileFormat.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,97 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.media.sound; | ||
| 27 | |||
| 28 | import javax.sound.sampled.AudioFileFormat; | ||
| 29 | import javax.sound.sampled.AudioFormat; | ||
| 30 | |||
| 31 | |||
| 32 | /** | ||
| 33 | * AIFF file format. | ||
| 34 | * | ||
| 35 | * @author Jan Borgersen | ||
| 36 | */ | ||
| 37 | |||
| 38 | class AiffFileFormat extends AudioFileFormat { | ||
| 39 | |||
| 40 | static final int AIFF_MAGIC = 1179603533; | ||
| 41 | |||
| 42 | // for writing AIFF | ||
| 43 | static final int AIFC_MAGIC = 0x41494643; // 'AIFC' | ||
| 44 | static final int AIFF_MAGIC2 = 0x41494646; // 'AIFF' | ||
| 45 | static final int FVER_MAGIC = 0x46564552; // 'FVER' | ||
| 46 | static final int FVER_TIMESTAMP = 0xA2805140; // timestamp of last AIFF-C update | ||
| 47 | static final int COMM_MAGIC = 0x434f4d4d; // 'COMM' | ||
| 48 | static final int SSND_MAGIC = 0x53534e44; // 'SSND' | ||
| 49 | |||
| 50 | // compression codes | ||
| 51 | static final int AIFC_PCM = 0x4e4f4e45; // 'NONE' PCM | ||
| 52 | static final int AIFC_ACE2 = 0x41434532; // 'ACE2' ACE 2:1 compression | ||
| 53 | static final int AIFC_ACE8 = 0x41434538; // 'ACE8' ACE 8:3 compression | ||
| 54 | static final int AIFC_MAC3 = 0x4d414333; // 'MAC3' MACE 3:1 compression | ||
| 55 | static final int AIFC_MAC6 = 0x4d414336; // 'MAC6' MACE 6:1 compression | ||
| 56 | static final int AIFC_ULAW = 0x756c6177; // 'ulaw' ITU G.711 u-Law | ||
| 57 | static final int AIFC_IMA4 = 0x696d6134; // 'ima4' IMA ADPCM | ||
| 58 | |||
| 59 | // $$fb static approach not good, but needed for estimation | ||
| 60 | static final int AIFF_HEADERSIZE = 54; | ||
| 61 | |||
| 62 | //$$fb 2001-07-13: added management of header size in this class | ||
| 63 | |||
| 64 | /** header size in bytes */ | ||
| 65 | private int headerSize=AIFF_HEADERSIZE; | ||
| 66 | |||
| 67 | /** comm chunk size in bytes, inclusive magic and length field */ | ||
| 68 | private int commChunkSize=26; | ||
| 69 | |||
| 70 | /** FVER chunk size in bytes, inclusive magic and length field */ | ||
| 71 | private int fverChunkSize=0; | ||
| 72 | |||
| 73 | AiffFileFormat( AudioFileFormat aff ) { | ||
| 74 | this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() ); | ||
| 75 | } | ||
| 76 | |||
| 77 | AiffFileFormat(Type type, int byteLength, AudioFormat format, int frameLength) { | ||
| 78 | super(type, byteLength, format, frameLength); | ||
| 79 | } | ||
| 80 | |||
| 81 | int getHeaderSize() { | ||
| 82 | return headerSize; | ||
| 83 | } | ||
| 84 | |||
| 85 | int getCommChunkSize() { | ||
| 86 | return commChunkSize; | ||
| 87 | } | ||
| 88 | |||
| 89 | int getFverChunkSize() { | ||
| 90 | return fverChunkSize; | ||
| 91 | } | ||
| 92 | |||
| 93 | int getSsndChunkOffset() { | ||
| 94 | return getHeaderSize()-16; | ||
| 95 | } | ||
| 96 | |||
| 97 | } | ||