Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
Task
org.xiph.speex.ant.JSpeexDecoderTask
public class JSpeexDecoderTask
extends Task
Task
to Decode an audio file from Speex to PCM Wave.
Here is an usage example:
Field Summary | |
static String |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static String |
|
static int |
|
private int |
|
private File |
|
private File |
|
private int |
|
private boolean |
|
private boolean | |
private int |
|
private int |
|
private int |
|
private int |
|
private int |
|
private boolean |
|
protected static Random |
|
private int |
|
protected SpeexDecoder |
|
private File |
|
private Vector |
|
private int |
|
private boolean | |
private float | |
private boolean |
|
Method Summary | |
void |
|
private File |
|
void |
|
void |
|
protected static int |
|
protected static int |
|
private boolean |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
private void |
|
void |
|
public static final String COPYRIGHT
Copyright display String
public static final int DEBUG
Print level for messages : Print debug information
- Field Value:
- 0
public static final int ERROR
Print level for messages : Print only errors
- Field Value:
- 3
public static final int FILE_FORMAT_OGG
File format for input or output audio file: Ogg
- Field Value:
- 1
public static final int FILE_FORMAT_RAW
File format for input or output audio file: Raw
- Field Value:
- 0
public static final int FILE_FORMAT_WAVE
File format for input or output audio file: Wave
- Field Value:
- 2
public static final int INFO
Print level for messages : Print basic information
- Field Value:
- 1
public static final String VERSION
Version of the Speex Encoder
public static final int WARN
Print level for messages : Print only warnings and errors
- Field Value:
- 2
private int channels
If input is raw, defines th number of channels (1=mono, 2=stereo).
private File destDir
Directory to place destination files
private 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.
private boolean failOnError
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 Random random
Random number generator for packet loss simulation.
private int sampleRate
If input is raw, defines the sample rate of the audio.
private File srcFile
Source file to decode
private final 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
public void addFileset(FileSet set)
Handles thefileset
child element.
- Parameters:
set
-
private File buildDestFile(File srcFile)
Builds and returns the destination file.
- Parameters:
srcFile
-
- Returns:
- the destination file.
public void decode(File srcPath, File destPath) throws IOException
Decodes a spx file to wave.
- Parameters:
srcPath
- the Speex encoded source file.destPath
- the destination file.
public void execute() throws BuildException
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).
- Parameters:
data
- the data to read.offset
- the offset from which to start reading.
- Returns:
- the integer value of the reassembled bytes.
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.
private boolean readSpeexHeader(byte[] packet, int offset, int bytes)
Reads the header packet.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
- Parameters:
packet
-offset
-bytes
-
- Returns:
- true if the Speex header was successfully parsed, false otherwise.
public void setDestdir(File dir)
Handles thedestdir
attribute.
- Parameters:
dir
- the attribute value converted to a File.
public void setDestfile(File file)
Handles thedestfile
attribute.
- Parameters:
file
- the attribute value converted to a File.
public void setEnhanced(boolean enhanced)
Handles theenhanced
attribute.
- Parameters:
enhanced
- the attribute value converted to a boolean.
public void setFailonerror(boolean failOnError)
Handles thefailonerror
attribute.
- Parameters:
failOnError
- the attribute value converted to a boolean.
public void setQuiet(boolean quiet)
Handles thequiet
attribute.
- Parameters:
quiet
- the attribute value converted to a boolean.
public void setSrcfile(File file)
Handles thesrcfile
attribute.
- Parameters:
file
- the attribute value converted to a File.
public void setVerbose(boolean verbose)
Handles theverbose
attribute.
- Parameters:
verbose
- the attribute value converted to a boolean.
private void setupTask(File srcPath, File destPath)
Setup some task variables.
- Parameters:
srcPath
- the Speex encoded source file.destPath
- the destination file.
public void version()
Prints the version.