Class JavaEncoder
- java.lang.Object
-
- net.sf.fmj.media.BasicPlugIn
-
- net.sf.fmj.media.BasicCodec
-
- com.sun.media.BasicCodec
-
- com.ibm.media.codec.audio.AudioCodec
-
- org.jitsi.impl.neomedia.codec.audio.alaw.JavaEncoder
-
- All Implemented Interfaces:
javax.media.Codec,javax.media.Controls,javax.media.PlugIn
public class JavaEncoder extends com.ibm.media.codec.audio.AudioCodecThe ALAW Encoder. Used the FMJ ALawEncoderUtil.- Author:
- Damian Minkov
-
-
Field Summary
Fields Modifier and Type Field Description static intMAXmaximum that can be held in 15 bitsstatic intMAX_USHORT65535-
Fields inherited from class com.ibm.media.codec.audio.AudioCodec
DEBUG, defaultOutputFormats, inputFormat, outputFormat, PLUGIN_NAME, supportedInputFormats, supportedOutputFormats
-
-
Constructor Summary
Constructors Constructor Description JavaEncoder()Constructs the encoder and init the supported formats.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaLawEncode(boolean bigEndian, byte[] data, int offset, int length, byte[] target)Encode an array of pcm values into a pre-allocated target arraystatic byteaLawEncode(int pcm)Encode a pcm value into a a-law bytestatic voidaLawEncodeBigEndian(byte[] data, int offset, int length, byte[] target)Encode big endian data.static voidaLawEncodeLittleEndian(byte[] data, int offset, int length, byte[] target)Encode little endian data.voidclose()No resources used to be cleared.protected javax.media.Format[]getMatchingOutputFormats(javax.media.Format in)Returns the output formats according to the input.voidopen()No resources to be opened.intprocess(javax.media.Buffer inputBuffer, javax.media.Buffer outputBuffer)Encodes the input buffer passing it to the output onestatic intuShortToInt(short value)Unsigned short to integer.-
Methods inherited from class com.ibm.media.codec.audio.AudioCodec
checkFormat, getInputFormat, getName, getOutputFormat, getSupportedInputFormats, getSupportedOutputFormats, setInputFormat, setOutputFormat
-
Methods inherited from class net.sf.fmj.media.BasicCodec
checkEOM, checkInputBuffer, getArrayElementSize, isEOM, processAtEOM, propagateEOM, reset, updateOutput, updateRGBFormat
-
Methods inherited from class net.sf.fmj.media.BasicPlugIn
error, getClassForName, getControl, getControls, getInputData, getNativeData, getOutputData, matches, plugInExists, validateByteArraySize, validateData, validateIntArraySize, validateShortArraySize
-
-
-
-
Field Detail
-
MAX
public static final int MAX
maximum that can be held in 15 bits- See Also:
- Constant Field Values
-
MAX_USHORT
public static final int MAX_USHORT
65535- See Also:
- Constant Field Values
-
-
Method Detail
-
getMatchingOutputFormats
protected javax.media.Format[] getMatchingOutputFormats(javax.media.Format in)
Returns the output formats according to the input.- Overrides:
getMatchingOutputFormatsin classcom.ibm.media.codec.audio.AudioCodec- Parameters:
in- the input format.- Returns:
- the possible output formats.
-
open
public void open() throws javax.media.ResourceUnavailableExceptionNo resources to be opened.- Specified by:
openin interfacejavax.media.PlugIn- Overrides:
openin classnet.sf.fmj.media.BasicCodec- Throws:
javax.media.ResourceUnavailableException- if open failed (which cannot happend for this codec since no resources are to be opened)
-
close
public void close()
No resources used to be cleared.- Specified by:
closein interfacejavax.media.PlugIn- Overrides:
closein classnet.sf.fmj.media.BasicCodec
-
process
public int process(javax.media.Buffer inputBuffer, javax.media.Buffer outputBuffer)Encodes the input buffer passing it to the output one- Parameters:
inputBuffer- BufferoutputBuffer- Buffer- Returns:
- int
-
uShortToInt
public static int uShortToInt(short value)
Unsigned short to integer.- Parameters:
value- unsigned short.- Returns:
- integer.
-
aLawEncode
public 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- Parameters:
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.
-
aLawEncodeLittleEndian
public static void aLawEncodeLittleEndian(byte[] data, int offset, int length, byte[] target)Encode little endian data.- Parameters:
data- the input data.offset- the input offset.length- the input length.target- the target array to fill.
-
aLawEncodeBigEndian
public static void aLawEncodeBigEndian(byte[] data, int offset, int length, byte[] target)Encode big endian data.- Parameters:
data- the input data.offset- the input offset.length- the input length.target- the target array to fill.
-
aLawEncode
public static byte aLawEncode(int pcm)
Encode a pcm value into a a-law byte- Parameters:
pcm- A 16-bit pcm value- Returns:
- A a-law encoded byte
-
-