public class WaveModule extends ModuleBase
| Modifier and Type | Field and Description |
|---|---|
protected AESAudioMetadata |
_aesMetadata
AES audio metadata to go into WAVE metadata
|
protected int |
_blockAlign
Bytes needed to store a file
|
protected ExifInfo |
_exifInfo
Exif data from file
|
protected List<Property> |
_labeledText
List of Labeled Text properties
|
protected List<Property> |
_labels
List of Label properties
|
protected Property |
_metadata
Top-level metadata property
|
protected List<Property> |
_notes
List of Note properties
|
protected List<Property> |
_propList
Top-level property list
|
protected List<Property> |
_samples
List of Sample properties
|
protected boolean |
broadcastExtChunkSeen
Flag to check for not more than one Broadcast Audio Extension chunk
|
protected boolean |
cartChunkSeen
Flag to check for not more than one Cart chunk
|
protected boolean |
cueChunkSeen
Flag to check for not more than one Cue chunk
|
protected boolean |
dataChunkSeen
Flag to check for not more than one Data chunk
|
protected boolean |
dataSize64ChunkSeen
Flag to check for a Data Size 64 chunk
|
protected Map<String,Long> |
extendedChunkSizes
Map of 64-bit chunk sizes found in the Data Size 64 chunk.
|
protected long |
extendedRiffSize
Extended (and unsigned) RIFF size as found in Data Size 64 chunk
|
protected long |
extendedSampleLength
Extended (and unsigned) sample length as found in Data Size 64 chunk
|
protected boolean |
factChunkSeen
Flag to check for presence of a Fact chunk
|
protected boolean |
firstSampleOffsetMarked
Flag to note that first sample offset has been recorded
|
protected boolean |
flagPCMWaveFormat
Profile flag for PCMWAVEFORMAT
|
protected boolean |
flagRF64
Profile flag for RF64
|
protected boolean |
flagWaveFormatEx
Profile flag for WAVEFORMATEX
|
protected boolean |
flagWaveFormatExtensible
Profile flag for WAVEFORMATEXTENSIBLE
|
protected boolean |
formatChunkSeen
Flag to check for exactly one Format chunk
|
protected boolean |
instrumentChunkSeen
Flag to check for not more than one Instrument chunk
|
protected boolean |
linkChunkSeen
Flag to check for not more than one Link chunk
|
static long |
LOOKUP_EXTENDED_DATA_SIZE
Value indicating a required 64-bit data size lookup
|
protected boolean |
mpegChunkSeen
Flag to check for not more than one MPEG chunk
|
protected boolean |
peakChunkSeen
Flag to check for not more than one Peak Envelope chunk
|
protected long |
riffSize
RIFF size as found in the RIFF chunk header.
|
protected long |
sampleCount
Number of samples in the file.
|
protected long |
sampleRate
Sample rate from file
|
protected int |
waveCodec
WAVE codec, used for profile verification
|
_app, _bigEndian, _checksumFinished, _ckSummer, _countStream, _coverage, _crc32, _cstream, _date, _defaultParams, _dstream, _features, _format, _init, _isRandomAccess, _je, _logger, _md5, _mimeType, _name, _nByte, _note, _param, _release, _repInfoNote, _rights, _sha1, _sha256, _signature, _specification, _validityNote, _vendor, _verbosity, _wellFormedNoteMAXIMUM_VERBOSITY, MINIMUM_VERBOSITY| Constructor and Description |
|---|
WaveModule()
Class constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addExtendedChunkSize(String chunkId,
Long chunkSize)
Adds a chunk's extended chunk size to the map of extended sizes.
|
void |
addLabel(Property p)
Adds a Label property
|
void |
addLabeledText(Property p)
Adds a LabeledText property
|
void |
addListInfo(List l)
Adds the ListInfo property, which is a List of String Properties.
|
void |
addNote(Property p)
Adds a Note string
|
void |
addSample(Property p)
Adds a Sample property
|
void |
addSamples(long samples)
Adds to the number of data bytes.
|
void |
addWaveProperty(Property prop)
Adds a Property to the WAVE metadata.
|
Property |
buildBitmaskProperty(int val,
String name,
String[] oneValueNames,
String[] zeroValueNames)
General function for adding a property with a 32-bit value, with two
arrays of Strings to interpret 0 and 1 values as a bitmask.
|
protected void |
dupChunkError(RepInfo info,
String chunkName)
Reports a duplicate chunk.
|
AESAudioMetadata |
getAESMetadata()
Returns the module's AES metadata.
|
int |
getBlockAlign()
Returns the number of bytes needed per aligned sample.
|
ExifInfo |
getExifInfo()
Returns the ExifInfo object.
|
long |
getExtendedSampleLength()
Returns the extended sample length.
|
int |
getWaveCodec()
Returns the WAVE codec value.
|
boolean |
hasExtendedDataSizes()
Returns whether or not the module has parsed the chunks required to
provide extended data sizes, namely RF64's Data Size 64 chunk.
|
protected void |
initParse()
Initializes the state of the module for parsing.
|
void |
markFirstSampleOffset()
Marks the first sample offset as the current byte position, if it hasn't
already been marked.
|
int |
parse(InputStream stream,
RepInfo info,
int parseIndex)
Parses the content of a purported WAVE digital object and stores the
results in RepInfo.
|
String |
read4Chars(DataInputStream stream)
Reads 4 bytes and concatenates them into a String.
|
protected boolean |
readChunk(RepInfo info)
Reads a WAVE chunk.
|
int |
readSignedInt(DataInputStream stream)
One-argument version of
readSignedInt. |
long |
readSignedLong(DataInputStream stream)
One-argument version of
readSignedLong. |
int |
readSignedShort(DataInputStream stream)
One-argument version of
readSignedShort. |
long |
readUnsignedInt(DataInputStream stream)
One-argument version of
readUnsignedInt. |
int |
readUnsignedShort(DataInputStream stream)
One-argument version of
readUnsignedShort. |
void |
setBlockAlign(int align)
Sets the number of bytes that holds an aligned sample.
|
void |
setExifInfo(ExifInfo exifInfo)
Sets an ExifInfo object for the module.
|
void |
setExtendedRiffSize(long size)
Sets the extended RIFF size.
|
void |
setExtendedSampleLength(long length)
Sets the extended sample length.
|
void |
setPCMWaveFormat(boolean b)
Sets the profile flag for PCMWAVEFORMAT.
|
void |
setSampleRate(long rate)
Sets the sample rate.
|
void |
setWaveCodec(int value)
Sets the WAVE codec.
|
void |
setWaveFormatEx(boolean b)
Sets the profile flag for WAVEFORMATEX.
|
void |
setWaveFormatExtensible(boolean b)
Sets the profile flag for WAVEFORMATEXTENSIBLE.
|
addIntegerProperty, addIntegerProperty, applyDefaultParams, calcRAChecksum, checkSignatures, checkSignatures, checksumIfRafNotCopied, getApp, getBase, getBufferedDataStream, getCoverage, getCRC32, getDate, getDefaultParams, getFeatures, getFormat, getMimeType, getName, getNByte, getNote, getRelease, getRepInfoNote, getRights, getSignature, getSpecification, getValidityNote, getVendor, getWellFormedNote, hasFeature, init, initFeatures, initInfo, isBigEndian, isParamInDefaults, isRandomAccess, param, parse, readByteBuf, readDouble, readDouble, readDouble, readFloat, readFloat, readSignedByte, readSignedByte, readSignedByte, readSignedInt, readSignedInt, readSignedInt, readSignedLong, readSignedRational, readSignedRational, readSignedShort, readSignedShort, readSignedShort, readUnsignedByte, readUnsignedByte, readUnsignedByte, readUnsignedInt, readUnsignedInt, readUnsignedInt, readUnsignedRational, readUnsignedRational, readUnsignedRational, readUnsignedShort, readUnsignedShort, readUnsignedShort, resetParams, setApp, setBase, setChecksums, setCRC32, setDefaultParams, setMD5, setNByte, setSHA1, setSHA256, setupDataStream, setValidityNote, setVerbosity, show, skipBytes, skipBytes, skipDstreamToEnd, vectorToPropArraypublic static final long LOOKUP_EXTENDED_DATA_SIZE
protected Map<String,Long> extendedChunkSizes
Long size values should be treated as unsigned.protected Property _metadata
protected AESAudioMetadata _aesMetadata
protected long riffSize
protected int _blockAlign
protected ExifInfo _exifInfo
protected int waveCodec
protected long extendedRiffSize
protected long extendedSampleLength
protected long sampleCount
protected long sampleRate
protected boolean formatChunkSeen
protected boolean factChunkSeen
protected boolean dataChunkSeen
protected boolean dataSize64ChunkSeen
protected boolean instrumentChunkSeen
protected boolean mpegChunkSeen
protected boolean cartChunkSeen
protected boolean broadcastExtChunkSeen
protected boolean peakChunkSeen
protected boolean linkChunkSeen
protected boolean cueChunkSeen
protected boolean flagPCMWaveFormat
protected boolean flagWaveFormatEx
protected boolean flagWaveFormatExtensible
protected boolean flagRF64
protected boolean firstSampleOffsetMarked
public WaveModule()
WaveModule object.public int parse(InputStream stream, RepInfo info, int parseIndex)
parse in interface Moduleparse in class ModuleBasestream - An InputStream, positioned at its beginning, which is
generated from the object to be parsedinfo - A fresh RepInfo object which will be modified to reflect the
results of the parsingparseIndex - Must be 0 in first call to parse. If
parse returns a nonzero value, it must be called
again with parseIndex equal to that return value.public void markFirstSampleOffset()
public void setExifInfo(ExifInfo exifInfo)
public void setBlockAlign(int align)
public ExifInfo getExifInfo()
null.public int getWaveCodec()
public int getBlockAlign()
public void addWaveProperty(Property prop)
public void addLabel(Property p)
public void addLabeledText(Property p)
public void addSample(Property p)
public void addNote(Property p)
public void addListInfo(List l)
public long readSignedLong(DataInputStream stream) throws IOException
readSignedLong. WAVE is always
little-endian, so we can unambiguously drop its endian argument.IOExceptionpublic long readUnsignedInt(DataInputStream stream) throws IOException
readUnsignedInt. WAVE is always
little-endian, so we can unambiguously drop its endian argument.IOExceptionpublic int readSignedInt(DataInputStream stream) throws IOException
readSignedInt. WAVE is always
little-endian, so we can unambiguously drop its endian argument.IOExceptionpublic int readUnsignedShort(DataInputStream stream) throws IOException
readUnsignedShort. WAVE is always
little-endian, so we can unambiguously drop its endian argument.IOExceptionpublic int readSignedShort(DataInputStream stream) throws IOException
readSignedShort. WAVE is always
little-endian, so we can unambiguously drop its endian argument.IOExceptionpublic String read4Chars(DataInputStream stream) throws IOException
IOExceptionpublic void setWaveCodec(int value)
public void addSamples(long samples)
public void setSampleRate(long rate)
public void setPCMWaveFormat(boolean b)
public void setWaveFormatEx(boolean b)
public void setWaveFormatExtensible(boolean b)
protected void initParse()
initParse in class ModuleBaseprotected boolean readChunk(RepInfo info) throws IOException
IOExceptionpublic AESAudioMetadata getAESMetadata()
protected void dupChunkError(RepInfo info, String chunkName)
public Property buildBitmaskProperty(int val, String name, String[] oneValueNames, String[] zeroValueNames)
val - The bitmaskname - The name for the PropertyoneValueNames - Array of names to use for '1' valueszeroValueNames - Array of names to use for '0' valuespublic boolean hasExtendedDataSizes()
public void setExtendedRiffSize(long size)
public void setExtendedSampleLength(long length)
public long getExtendedSampleLength()
Copyright © 2008–2021 The Open Preservation Foundation. All rights reserved.