public class JSpeexEncoderTask
extends org.apache.tools.ant.Task
Task
to Encode an audio file from PCM Wave to Speex.
Here is an usage example:
Modifier and Type | Field and Description |
---|---|
protected int |
bitrate
Defines the desired bitrate for the encoded audio.
|
protected int |
channels
Defines the number of channels of the audio input (1=mono, 2=stereo).
|
protected int |
complexity
Defines the encoders algorithmic complexity.
|
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
|
protected int |
destFormat
Defines File format for output audio file (Raw or Wave).
|
protected boolean |
dtx
Defines whether or not to use DTX (Discontinuous Transmission).
|
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
|
protected int |
mode
Defines the encoder mode (0=NB, 1=WB and 2-UWB).
|
protected boolean |
modeset
Whether the mode is manualy set or automatically determined.
|
protected int |
nframes
Defines the number of frames per speex packet.
|
private int |
printlevel
Print level for messages
|
protected int |
quality
Defines the encoder quality setting (integer from 0 to 10).
|
private boolean |
quiet
Tells the task to suppress all but the most important output
|
protected int |
sampleRate
Defines the sampling rate of the audio input.
|
private java.io.File |
srcFile
Source file to decode
|
private java.util.Vector |
srcFileset
List of source files to decode
|
protected int |
srcFormat
Defines File format for input audio file (Raw, Ogg or Wave).
|
protected boolean |
vad
Defines whether or not to use VAD (Voice Activity Detection).
|
protected boolean |
vbr
Defines whether or not to use VBR (Variable Bit Rate).
|
protected float |
vbr_quality
Defines the encoder VBR quality setting (float from 0 to 10).
|
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 |
---|
JSpeexEncoderTask() |
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 |
encode(java.io.File srcPath,
java.io.File destPath)
Encodes a PCM file to Speex.
|
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).
|
void |
setComplexity(int complexity)
Handles the
complexity attribute. |
void |
setDestdir(java.io.File dir)
Handles the
destdir attribute. |
void |
setDestfile(java.io.File file)
Handles the
destfile attribute. |
void |
setDtx(boolean dtx)
Handles the
dtx attribute. |
void |
setFailonerror(boolean failOnError)
Handles the
failonerror attribute. |
void |
setMode(java.lang.String mode)
Handles the
mode attribute. |
void |
setNframes(int nframes)
Handles the
nframes attribute. |
void |
setQuality(float quality)
Handles the
quality 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 |
setVad(boolean vad)
Handles the
vad attribute. |
void |
setVbr(boolean vbr)
Handles the
vbr attribute. |
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
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
protected int srcFormat
protected int destFormat
protected boolean modeset
protected int mode
protected int quality
protected int complexity
protected int nframes
protected int bitrate
protected int sampleRate
protected int channels
protected float vbr_quality
protected boolean vbr
protected boolean vad
protected boolean dtx
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 setQuality(float quality)
quality
attribute.quality
- the attribute value converted to a float.public void setComplexity(int complexity)
complexity
attribute.complexity
- the attribute value converted to an integer.public void setNframes(int nframes)
nframes
attribute.nframes
- the attribute value converted to an integer.public void setVbr(boolean vbr)
vbr
attribute.vbr
- the attribute value converted to a boolean.public void setVad(boolean vad)
vad
attribute.vad
- the attribute value converted to a boolean.public void setDtx(boolean dtx)
dtx
attribute.dtx
- the attribute value converted to a boolean.public void setMode(java.lang.String mode)
mode
attribute.mode
- the attribute value converted to a String.public void version()
public void encode(java.io.File srcPath, java.io.File destPath) throws java.io.IOException
srcPath
- destPath
- java.io.IOException
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.