public class WaveModule extends ModuleBase
Modifier and Type | Field and Description |
---|---|
protected AESAudioMetadata |
_aesMetadata |
protected int |
_blockAlign |
protected Checksummer |
_ckSummer
PRIVATE INSTANCE FIELDS.
|
protected ChecksumInputStream |
_cstream |
protected DataInputStream |
_dstream |
protected ExifInfo |
_exifInfo |
protected List<Property> |
_labeledText |
protected List<Property> |
_labels |
protected Property |
_metadata |
protected List<Property> |
_notes |
protected List<Property> |
_propList |
protected List<Property> |
_samples |
protected boolean |
broadcastExtChunkSeen |
protected int |
broadcastVersion |
protected long |
bytesRemaining |
protected boolean |
cartChunkSeen |
protected int |
compressionCode |
protected boolean |
cueChunkSeen |
protected boolean |
dataChunkSeen |
protected boolean |
factChunkSeen |
protected boolean |
firstSampleOffsetMarked |
protected boolean |
flagBroadcastWave |
protected boolean |
flagPCMWaveFormat |
protected boolean |
flagWaveFormatEx |
protected boolean |
flagWaveFormatExtensible |
protected boolean |
formatChunkSeen |
protected boolean |
instrumentChunkSeen |
protected boolean |
linkChunkSeen |
protected boolean |
mpegChunkSeen |
protected long |
numSamples |
protected boolean |
peakChunkSeen |
protected long |
sampleRate |
_app, _bigEndian, _checksumFinished, _countStream, _coverage, _crc32, _date, _defaultParams, _features, _format, _init, _isRandomAccess, _je, _logger, _md5, _mimeType, _name, _nByte, _note, _param, _release, _repInfoNote, _rights, _sha1, _signature, _specification, _validityNote, _vendor, _verbosity, _wellFormedNote
MAXIMUM_VERBOSITY, MINIMUM_VERBOSITY
Constructor and Description |
---|
WaveModule()
Instantiates an WaveModule object.
|
Modifier and Type | Method and Description |
---|---|
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)
Add 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) |
AESAudioMetadata |
getAESMetadata()
Returns the module's AES metadata.
|
int |
getBlockAlign()
Returns the number of bytes needed per aligned sample.
|
int |
getCompressionCode()
Returns the compression code.
|
ExifInfo |
getExifInfo()
Returns the ExifInfo object.
|
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)
Set the number of bytes that holds an aligned sample.
|
void |
setBroadcastVersion(int version)
Set the version from the Broadcast Extension chunk.
|
void |
setBroadcastWave(boolean b)
Set the profile flag for Broadcast Wave.
|
void |
setCompressionCode(int cf)
Set the compression format.
|
void |
setExifInfo(ExifInfo exifInfo)
Sets an ExifInfo object for the module.
|
void |
setPCMWaveFormat(boolean b)
Set the profile flag for PCMWAVEFORMAT.
|
void |
setSampleRate(long rate)
Set the sample rate.
|
void |
setWaveFormatEx(boolean b)
Set the profile flag for WAVEFORMATEX.
|
void |
setWaveFormatExtensible(boolean b)
Set the profile flag for WAVEFORMATEXTENSIBLE.
|
addIntegerProperty, addIntegerProperty, applyDefaultParams, calcRAChecksum, checkSignatures, checkSignatures, getApp, getBase, getBufferedDataStream, getCoverage, getCRC32, getDate, getDefaultParams, getFeatures, getFormat, getMimeType, getName, getNByte, getNote, getRelease, getRepInfoNote, getRights, getSignature, getSpecification, getValidityNote, getVendor, getWellFormedNote, hasFeature, init, initFeatures, isBigEndian, 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, setValidityNote, setVerbosity, show, skipBytes, skipBytes, vectorToPropArray
protected Checksummer _ckSummer
protected ChecksumInputStream _cstream
protected DataInputStream _dstream
protected Property _metadata
protected AESAudioMetadata _aesMetadata
protected long bytesRemaining
protected int _blockAlign
protected ExifInfo _exifInfo
protected int compressionCode
protected long numSamples
protected long sampleRate
protected boolean formatChunkSeen
protected boolean factChunkSeen
protected boolean dataChunkSeen
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 flagBroadcastWave
protected int broadcastVersion
protected boolean firstSampleOffsetMarked
public int parse(InputStream stream, RepInfo info, int parseIndex) throws IOException
parse
in interface Module
parse
in class ModuleBase
stream
- 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.IOException
public void markFirstSampleOffset()
public void setExifInfo(ExifInfo exifInfo)
public void setBlockAlign(int align)
public ExifInfo getExifInfo()
public int getCompressionCode()
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 readSignedInt can unambiguously drop its endian
argument.IOException
public long readUnsignedInt(DataInputStream stream) throws IOException
readUnsignedInt
. WAVE is always
little-endian, so readUnsignedInt can unambiguously drop its endian
argument.IOException
public int readSignedInt(DataInputStream stream) throws IOException
readSignedInt
. WAVE is always
little-endian, so readSignedInt can unambiguously drop its endian
argument.IOException
public int readUnsignedShort(DataInputStream stream) throws IOException
readUnsignedShort
. WAVE is always
little-endian, so readUnsignedShort can unambiguously drop its endian
argument.IOException
public int readSignedShort(DataInputStream stream) throws IOException
readSignedShort
. WAVE is always
little-endian, so readSignedShort can unambiguously drop its endian
argument.IOException
public String read4Chars(DataInputStream stream) throws IOException
IOException
public void setCompressionCode(int cf)
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)
public void setBroadcastWave(boolean b)
public void setBroadcastVersion(int version)
protected void initParse()
initParse
in class ModuleBase
protected boolean readChunk(RepInfo info) throws IOException
IOException
public AESAudioMetadata getAESMetadata()
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' valuesCopyright © 2008–2017 The Open Preservation Foundation. All rights reserved.