public class JSpeexDecoderTask
extends org.apache.tools.ant.Task
Task
to Decode an audio file from Speex to PCM Wave.
Here is an usage example:
Modifier and Type | Field and Description |
---|---|
private int |
channels
If input is raw, defines th number of channels (1=mono, 2=stereo).
|
static java.lang.String |
COPYRIGHT
Copyright display String
|
static int |
DEBUG
Print level for messages : Print debug information
|
private java.io.File |
destDir
Directory to place destination files
|
private java.io.File |
destFile
Destination file of decoded audio
|
private int |
destFormat
Defines File format for output audio file (Raw or Wave).
|
private boolean |
enhanced
Defines whether or not the perceptual enhancement is used.
|
static int |
ERROR
Print level for messages : Print only errors
|
private boolean |
failOnError |
static int |
FILE_FORMAT_OGG
File format for input or output audio file: Ogg
|
static int |
FILE_FORMAT_RAW
File format for input or output audio file: Raw
|
static int |
FILE_FORMAT_WAVE
File format for input or output audio file: Wave
|
static int |
INFO
Print level for messages : Print basic information
|
private int |
loss
The percentage of packets to lose in the packet loss simulation.
|
private int |
mode
If input is raw, defines the decoder mode (0=NB, 1=WB and 2-UWB).
|
private int |
nframes
If input is raw, defines the number of frmaes per packet.
|
private int |
printlevel
Print level for messages
|
private int |
quality
If input is raw, defines the quality setting used by the encoder.
|
private boolean |
quiet
Tells the task to suppress all but the most important output
|
protected static java.util.Random |
random
Random number generator for packet loss simulation.
|
private int |
sampleRate
If input is raw, defines the sample rate of the audio.
|
protected SpeexDecoder |
speexDecoder
Speex Decoder
|
private java.io.File |
srcFile
Source file to decode
|
private java.util.Vector |
srcFileset
List of source files to decode
|
private int |
srcFormat
Defines File format for input audio file (Raw, Ogg or Wave).
|
private boolean |
vbr |
private float |
vbr_quality |
private boolean |
verbose
Tells the task to output as much information as possible
|
static java.lang.String |
VERSION
Version of the Speex Encoder
|
static int |
WARN
Print level for messages : Print only warnings and errors
|
Constructor and Description |
---|
JSpeexDecoderTask() |
Modifier and Type | Method and Description |
---|---|
void |
addFileset(org.apache.tools.ant.types.FileSet set)
Handles the
fileset child element. |
private java.io.File |
buildDestFile(java.io.File srcFile)
Builds and returns the destination file.
|
void |
decode(java.io.File srcPath,
java.io.File destPath)
Decodes a spx file to wave.
|
void |
execute()
The method executing the task.
|
protected static int |
readInt(byte[] data,
int offset)
Converts Little Endian (Windows) bytes to an int (Java uses Big Endian).
|
protected static int |
readShort(byte[] data,
int offset)
Converts Little Endian (Windows) bytes to an short (Java uses Big Endian).
|
private boolean |
readSpeexHeader(byte[] packet,
int offset,
int bytes)
Reads the header packet.
|
void |
setDestdir(java.io.File dir)
Handles the
destdir attribute. |
void |
setDestfile(java.io.File file)
Handles the
destfile attribute. |
void |
setEnhanced(boolean enhanced)
Handles the
enhanced attribute. |
void |
setFailonerror(boolean failOnError)
Handles the
failonerror attribute. |
void |
setQuiet(boolean quiet)
Handles the
quiet attribute. |
void |
setSrcfile(java.io.File file)
Handles the
srcfile attribute. |
private void |
setupTask(java.io.File srcPath,
java.io.File destPath)
Setup some task variables.
|
void |
setVerbose(boolean verbose)
Handles the
verbose attribute. |
void |
version()
Prints the version.
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
public static final java.lang.String VERSION
public static final java.lang.String COPYRIGHT
public static final int DEBUG
public static final int INFO
public static final int WARN
public static final int ERROR
public static final int FILE_FORMAT_RAW
public static final int FILE_FORMAT_OGG
public static final int FILE_FORMAT_WAVE
protected static java.util.Random random
protected SpeexDecoder speexDecoder
private java.io.File srcFile
private final java.util.Vector srcFileset
private java.io.File destFile
private java.io.File destDir
private boolean failOnError
private int printlevel
private boolean quiet
private boolean verbose
private int srcFormat
private int destFormat
private boolean enhanced
private int mode
private int quality
private int nframes
private int sampleRate
private float vbr_quality
private boolean vbr
private int channels
private int loss
public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
private java.io.File buildDestFile(java.io.File srcFile)
srcFile
- private void setupTask(java.io.File srcPath, java.io.File destPath)
srcPath
- the Speex encoded source file.destPath
- the destination file.public void addFileset(org.apache.tools.ant.types.FileSet set)
fileset
child element.set
- public void setSrcfile(java.io.File file)
srcfile
attribute.file
- the attribute value converted to a File.public void setDestfile(java.io.File file)
destfile
attribute.file
- the attribute value converted to a File.public void setDestdir(java.io.File dir)
destdir
attribute.dir
- the attribute value converted to a File.public void setFailonerror(boolean failOnError)
failonerror
attribute.failOnError
- the attribute value converted to a boolean.public void setQuiet(boolean quiet)
quiet
attribute.quiet
- the attribute value converted to a boolean.public void setVerbose(boolean verbose)
verbose
attribute.verbose
- the attribute value converted to a boolean.public void setEnhanced(boolean enhanced)
enhanced
attribute.enhanced
- the attribute value converted to a boolean.public void version()
public void decode(java.io.File srcPath, java.io.File destPath) throws java.io.IOException
srcPath
- the Speex encoded source file.destPath
- the destination file.java.io.IOException
private boolean readSpeexHeader(byte[] packet, int offset, int bytes)
0 - 7: speex_string: "Speex " 8 - 27: speex_version: "speex-1.0" 28 - 31: speex_version_id: 1 32 - 35: header_size: 80 36 - 39: rate 40 - 43: mode: 0=narrowband, 1=wb, 2=uwb 44 - 47: mode_bitstream_version: 4 48 - 51: nb_channels 52 - 55: bitrate: -1 56 - 59: frame_size: 160 60 - 63: vbr 64 - 67: frames_per_packet 68 - 71: extra_headers: 0 72 - 75: reserved1 76 - 79: reserved2
packet
- offset
- bytes
- protected static int readInt(byte[] data, int offset)
data
- the data to read.offset
- the offset from which to start reading.protected static int readShort(byte[] data, int offset)
data
- the data to read.offset
- the offset from which to start reading.Copyright © 1999-2004 Wimba S.A. All Rights Reserved.