Package org.xiph.speex.ant
Class JSpeexEncoderTask
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.xiph.speex.ant.JSpeexEncoderTask
- All Implemented Interfaces:
Cloneable
public class JSpeexEncoderTask
extends org.apache.tools.ant.Task
Ant
Task to Encode an audio file from PCM Wave to Speex.
Here is an usage example:
- Version:
- $Revision: 1.2 $
- Author:
- Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intDefines the desired bitrate for the encoded audio.protected intDefines the number of channels of the audio input (1=mono, 2=stereo).protected intDefines the encoders algorithmic complexity.static final StringCopyright display Stringstatic final intPrint level for messages : Print debug informationprivate FileDirectory to place destination filesprivate FileDestination file of decoded audioprotected intDefines File format for output audio file (Raw or Wave).protected booleanDefines whether or not to use DTX (Discontinuous Transmission).static final intPrint level for messages : Print only errorsprivate booleanstatic final intFile format for input or output audio file: Oggstatic final intFile format for input or output audio file: Rawstatic final intFile format for input or output audio file: Wavestatic final intPrint level for messages : Print basic informationprotected intDefines the encoder mode (0=NB, 1=WB and 2-UWB).protected booleanWhether the mode is manualy set or automatically determined.protected intDefines the number of frames per speex packet.private intPrint level for messagesprotected intDefines the encoder quality setting (integer from 0 to 10).private booleanTells the task to suppress all but the most important outputprotected intDefines the sampling rate of the audio input.private FileSource file to decodeprivate final VectorList of source files to decodeprotected intDefines File format for input audio file (Raw, Ogg or Wave).protected booleanDefines whether or not to use VAD (Voice Activity Detection).protected booleanDefines whether or not to use VBR (Variable Bit Rate).protected floatDefines the encoder VBR quality setting (float from 0 to 10).private booleanTells the task to output as much information as possiblestatic final StringVersion of the Speex Encoderstatic final intPrint level for messages : Print only warnings and errorsFields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapperFields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFileset(org.apache.tools.ant.types.FileSet set) Handles thefilesetchild element.private FilebuildDestFile(File srcFile) Builds and returns the destination file.voidEncodes a PCM file to Speex.voidexecute()The method executing the task.protected static intreadInt(byte[] data, int offset) Converts Little Endian (Windows) bytes to an int (Java uses Big Endian).protected static intreadShort(byte[] data, int offset) Converts Little Endian (Windows) bytes to an short (Java uses Big Endian).voidsetComplexity(int complexity) Handles thecomplexityattribute.voidsetDestdir(File dir) Handles thedestdirattribute.voidsetDestfile(File file) Handles thedestfileattribute.voidsetDtx(boolean dtx) Handles thedtxattribute.voidsetFailonerror(boolean failOnError) Handles thefailonerrorattribute.voidHandles themodeattribute.voidsetNframes(int nframes) Handles thenframesattribute.voidsetQuality(float quality) Handles thequalityattribute.voidsetQuiet(boolean quiet) Handles thequietattribute.voidsetSrcfile(File file) Handles thesrcfileattribute.private voidSetup some task variables.voidsetVad(boolean vad) Handles thevadattribute.voidsetVbr(boolean vbr) Handles thevbrattribute.voidsetVerbose(boolean verbose) Handles theverboseattribute.voidversion()Prints the version.Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
-
Field Details
-
VERSION
Version of the Speex Encoder- See Also:
-
COPYRIGHT
Copyright display String- See Also:
-
DEBUG
public static final int DEBUGPrint level for messages : Print debug information- See Also:
-
INFO
public static final int INFOPrint level for messages : Print basic information- See Also:
-
WARN
public static final int WARNPrint level for messages : Print only warnings and errors- See Also:
-
ERROR
public static final int ERRORPrint level for messages : Print only errors- See Also:
-
FILE_FORMAT_RAW
public static final int FILE_FORMAT_RAWFile format for input or output audio file: Raw- See Also:
-
FILE_FORMAT_OGG
public static final int FILE_FORMAT_OGGFile format for input or output audio file: Ogg- See Also:
-
FILE_FORMAT_WAVE
public static final int FILE_FORMAT_WAVEFile format for input or output audio file: Wave- See Also:
-
srcFile
Source file to decode -
srcFileset
List of source files to decode -
destFile
Destination file of decoded audio -
destDir
Directory to place destination files -
failOnError
private boolean failOnError -
printlevel
private int printlevelPrint level for messages -
quiet
private boolean quietTells the task to suppress all but the most important output -
verbose
private boolean verboseTells the task to output as much information as possible -
srcFormat
protected int srcFormatDefines File format for input audio file (Raw, Ogg or Wave). -
destFormat
protected int destFormatDefines File format for output audio file (Raw or Wave). -
modeset
protected boolean modesetWhether the mode is manualy set or automatically determined. -
mode
protected int modeDefines the encoder mode (0=NB, 1=WB and 2-UWB). -
quality
protected int qualityDefines the encoder quality setting (integer from 0 to 10). -
complexity
protected int complexityDefines the encoders algorithmic complexity. -
nframes
protected int nframesDefines the number of frames per speex packet. -
bitrate
protected int bitrateDefines the desired bitrate for the encoded audio. -
sampleRate
protected int sampleRateDefines the sampling rate of the audio input. -
channels
protected int channelsDefines the number of channels of the audio input (1=mono, 2=stereo). -
vbr_quality
protected float vbr_qualityDefines the encoder VBR quality setting (float from 0 to 10). -
vbr
protected boolean vbrDefines whether or not to use VBR (Variable Bit Rate). -
vad
protected boolean vadDefines whether or not to use VAD (Voice Activity Detection). -
dtx
protected boolean dtxDefines whether or not to use DTX (Discontinuous Transmission).
-
-
Constructor Details
-
JSpeexEncoderTask
public JSpeexEncoderTask()
-
-
Method Details
-
execute
public void execute() throws org.apache.tools.ant.BuildExceptionThe method executing the task.- Overrides:
executein classorg.apache.tools.ant.Task- Throws:
org.apache.tools.ant.BuildException
-
buildDestFile
Builds and returns the destination file.- Parameters:
srcFile-- Returns:
- the destination file.
-
setupTask
Setup some task variables.- Parameters:
srcPath- the Speex encoded source file.destPath- the destination file.
-
addFileset
public void addFileset(org.apache.tools.ant.types.FileSet set) Handles thefilesetchild element.- Parameters:
set-
-
setSrcfile
Handles thesrcfileattribute.- Parameters:
file- the attribute value converted to a File.
-
setDestfile
Handles thedestfileattribute.- Parameters:
file- the attribute value converted to a File.
-
setDestdir
Handles thedestdirattribute.- Parameters:
dir- the attribute value converted to a File.
-
setFailonerror
public void setFailonerror(boolean failOnError) Handles thefailonerrorattribute.- Parameters:
failOnError- the attribute value converted to a boolean.
-
setQuiet
public void setQuiet(boolean quiet) Handles thequietattribute.- Parameters:
quiet- the attribute value converted to a boolean.
-
setVerbose
public void setVerbose(boolean verbose) Handles theverboseattribute.- Parameters:
verbose- the attribute value converted to a boolean.
-
setQuality
public void setQuality(float quality) Handles thequalityattribute.- Parameters:
quality- the attribute value converted to a float.
-
setComplexity
public void setComplexity(int complexity) Handles thecomplexityattribute.- Parameters:
complexity- the attribute value converted to an integer.
-
setNframes
public void setNframes(int nframes) Handles thenframesattribute.- Parameters:
nframes- the attribute value converted to an integer.
-
setVbr
public void setVbr(boolean vbr) Handles thevbrattribute.- Parameters:
vbr- the attribute value converted to a boolean.
-
setVad
public void setVad(boolean vad) Handles thevadattribute.- Parameters:
vad- the attribute value converted to a boolean.
-
setDtx
public void setDtx(boolean dtx) Handles thedtxattribute.- Parameters:
dtx- the attribute value converted to a boolean.
-
setMode
Handles themodeattribute.- Parameters:
mode- the attribute value converted to a String.
-
version
public void version()Prints the version. -
encode
Encodes a PCM file to Speex.- Parameters:
srcPath-destPath-- Throws:
IOException
-
readInt
protected static int readInt(byte[] data, int offset) Converts Little Endian (Windows) bytes to an int (Java uses Big Endian).- Parameters:
data- the data to read.offset- the offset from which to start reading.- Returns:
- the integer value of the reassembled bytes.
-
readShort
protected static int readShort(byte[] data, int offset) Converts Little Endian (Windows) bytes to an short (Java uses Big Endian).- Parameters:
data- the data to read.offset- the offset from which to start reading.- Returns:
- the integer value of the reassembled bytes.
-