public class JavaEncoder
extends com.ibm.media.codec.audio.AudioCodec
Modifier and Type | Field and Description |
---|---|
static int |
MAX
maximum that can be held in 15 bits
|
static int |
MAX_USHORT
65535
|
DEBUG, defaultOutputFormats, inputFormat, outputFormat, PLUGIN_NAME, supportedInputFormats, supportedOutputFormats
Constructor and Description |
---|
JavaEncoder()
Constructs the encoder and init the supported formats.
|
Modifier and Type | Method and Description |
---|---|
static void |
aLawEncode(boolean bigEndian,
byte[] data,
int offset,
int length,
byte[] target)
Encode an array of pcm values into a pre-allocated target array
|
static byte |
aLawEncode(int pcm)
Encode a pcm value into a a-law byte
|
static void |
aLawEncodeBigEndian(byte[] data,
int offset,
int length,
byte[] target)
Encode big endian data.
|
static void |
aLawEncodeLittleEndian(byte[] data,
int offset,
int length,
byte[] target)
Encode little endian data.
|
void |
close()
No resources used to be cleared.
|
protected javax.media.Format[] |
getMatchingOutputFormats(javax.media.Format in)
Returns the output formats according to the input.
|
void |
open()
No resources to be opened.
|
int |
process(javax.media.Buffer inputBuffer,
javax.media.Buffer outputBuffer)
Encodes the input buffer passing it to the output one
|
static int |
uShortToInt(short value)
Unsigned short to integer.
|
checkFormat, getInputFormat, getName, getOutputFormat, getSupportedInputFormats, getSupportedOutputFormats, setInputFormat, setOutputFormat
checkEOM, checkInputBuffer, getArrayElementSize, isEOM, processAtEOM, propagateEOM, reset, updateOutput, updateRGBFormat
error, getClassForName, getControl, getControls, getInputData, getNativeData, getOutputData, matches, plugInExists, validateByteArraySize, validateData, validateIntArraySize, validateShortArraySize
public static final int MAX
public static final int MAX_USHORT
public JavaEncoder()
protected javax.media.Format[] getMatchingOutputFormats(javax.media.Format in)
getMatchingOutputFormats
in class com.ibm.media.codec.audio.AudioCodec
in
- the input format.public void open() throws javax.media.ResourceUnavailableException
open
in interface javax.media.PlugIn
open
in class net.sf.fmj.media.BasicCodec
javax.media.ResourceUnavailableException
- if open failed (which cannot
happend for this codec since no resources are to be opened)public void close()
close
in interface javax.media.PlugIn
close
in class net.sf.fmj.media.BasicCodec
public int process(javax.media.Buffer inputBuffer, javax.media.Buffer outputBuffer)
inputBuffer
- BufferoutputBuffer
- Bufferpublic static int uShortToInt(short value)
value
- unsigned short.public static void aLawEncode(boolean bigEndian, byte[] data, int offset, int length, byte[] target)
bigEndian
- the data byte order.data
- An array of bytes in Little-Endian formattarget
- A pre-allocated array to receive the A-law bytes.
This array must be at least half the size of the source.offset
- of the input.length
- of the input.public static void aLawEncodeLittleEndian(byte[] data, int offset, int length, byte[] target)
data
- the input data.offset
- the input offset.length
- the input length.target
- the target array to fill.public static void aLawEncodeBigEndian(byte[] data, int offset, int length, byte[] target)
data
- the input data.offset
- the input offset.length
- the input length.target
- the target array to fill.public static byte aLawEncode(int pcm)
pcm
- A 16-bit pcm value
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.