public abstract class AbstractCodec2
extends net.sf.fmj.media.AbstractCodec
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_FLAG_FEC
The Buffer flag which indicates that the respective
Buffer contains audio data which has been decoded as a result of
the operation of FEC.
|
static int |
BUFFER_FLAG_PLC
The Buffer flag which indicates that the respective
Buffer contains audio data which has been decoded as a result of
the operation of PLC.
|
static javax.media.Format[] |
EMPTY_FORMATS
An empty array of Format element type.
|
protected int |
features
The bitmap/flag mask of optional features supported by this
AbstractCodec2 such as
BUFFER_FLAG_FEC and
BUFFER_FLAG_PLC . |
static int |
MAX_AUDIO_SEQUENCE_NUMBERS_TO_PLC
The maximum number of lost sequence numbers to conceal with packet loss
mitigation techniques such as Forward Error Correction (FEC) and Packet
Loss Concealment (PLC) when dealing with audio.
|
static int |
SEQUENCE_MAX
The maximum (RTP) sequence number value.
|
static int |
SEQUENCE_MIN
The minimum (RTP) sequence number value.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractCodec2(java.lang.String name,
java.lang.Class<? extends javax.media.Format> formatClass,
javax.media.Format[] supportedOutputFormats)
Initializes a new AbstractCodec2 instance with a specific
PlugIn name, a specific Class of input and output
Formats and a specific list of Formats supported as
output.
|
Modifier and Type | Method and Description |
---|---|
static int |
calculateLostSeqNoCount(long lastSeqNo,
long seqNo)
Calculates the number of sequences which have been lost i.e.
|
void |
close() |
protected void |
discardOutputBuffer(javax.media.Buffer outputBuffer) |
protected abstract void |
doClose() |
protected abstract void |
doOpen()
Opens this Codec and acquires the resources that it needs to
operate.
|
protected abstract int |
doProcess(javax.media.Buffer inBuf,
javax.media.Buffer outBuf) |
protected javax.media.Format[] |
getMatchingOutputFormats(javax.media.Format inputFormat)
Gets the Formats which are supported by this Codec as
output when the input is in a specific Format.
|
java.lang.String |
getName() |
javax.media.Format[] |
getSupportedOutputFormats(javax.media.Format inputFormat)
Implements
AbstractCodec.getSupportedOutputFormats(Format) . |
static long |
incrementSeqNo(long seqNo)
Increments a specific sequence number and makes sure that the result
stays within the range of valid RTP sequence number values.
|
static javax.media.Format |
matches(javax.media.Format in,
javax.media.Format[] outs)
Utility to perform format matching.
|
void |
open()
Opens this PlugIn software or hardware component and acquires
the resources that it needs to operate.
|
int |
process(javax.media.Buffer inBuf,
javax.media.Buffer outBuf)
Implements AbstractCodec#process(Buffer, Buffer).
|
javax.media.Format |
setInputFormat(javax.media.Format format) |
javax.media.Format |
setOutputFormat(javax.media.Format format) |
static javax.media.format.YUVFormat |
specialize(javax.media.format.YUVFormat yuvFormat,
java.lang.Class<?> dataType) |
protected void |
updateOutput(javax.media.Buffer outputBuffer,
javax.media.Format format,
int length,
int offset)
Updates the format, length and offset of a
specific output Buffer to specific values.
|
static byte[] |
validateByteArraySize(javax.media.Buffer buffer,
int newSize,
boolean arraycopy)
Ensures that the value of the data property of a specific
Buffer is an array of bytes whose length is at least a
specific number of bytes.
|
protected short[] |
validateShortArraySize(javax.media.Buffer buffer,
int newSize) |
checkInputBuffer, dump, getInputFormat, getOutputFormat, getSupportedInputFormats, isEOM, propagateEOM
addControl, getControl, getControls, removeControl
public static final int BUFFER_FLAG_FEC
public static final int BUFFER_FLAG_PLC
public static final javax.media.Format[] EMPTY_FORMATS
public static final int MAX_AUDIO_SEQUENCE_NUMBERS_TO_PLC
public static final int SEQUENCE_MAX
public static final int SEQUENCE_MIN
protected int features
BUFFER_FLAG_FEC
and
BUFFER_FLAG_PLC
.protected AbstractCodec2(java.lang.String name, java.lang.Class<? extends javax.media.Format> formatClass, javax.media.Format[] supportedOutputFormats)
name
- the PlugIn name of the new instanceformatClass
- the Class of input and output
Formats supported by the new instancesupportedOutputFormats
- the list of Formats supported by
the new instance as outputpublic static int calculateLostSeqNoCount(long lastSeqNo, long seqNo)
lastSeqNo
- the last received sequence number (prior to the current
sequence number represented by seqNo.) May be
Buffer.SEQUENCE_UNKNOWN
. May be equal to seqNo for the
purposes of Codec implementations which repeatedly process one and the
same input Buffer multiple times.seqNo
- the current sequence number. May be equal to
lastSeqNo for the purposes of Codec implementations which
repeatedly process one and the same input Buffer multiple times.public static long incrementSeqNo(long seqNo)
seqNo
- the sequence number to incrementpublic static javax.media.Format matches(javax.media.Format in, javax.media.Format[] outs)
in
- input formatouts
- array of output formatspublic static javax.media.format.YUVFormat specialize(javax.media.format.YUVFormat yuvFormat, java.lang.Class<?> dataType)
public static byte[] validateByteArraySize(javax.media.Buffer buffer, int newSize, boolean arraycopy)
buffer
- the Buffer whose data property value is
to be validatednewSize
- the minimum length of the array of byte which is
to be the value of the data property of bufferarraycopy
- true to copy the bytes which are in the
value of the data property of buffer at the time of the
invocation of the method if the value of the data property of
buffer is an array of byte whose length is less than
newSize; otherwise, falsepublic void close()
close
in interface javax.media.PlugIn
close
in class net.sf.fmj.media.AbstractPlugIn
protected void discardOutputBuffer(javax.media.Buffer outputBuffer)
protected abstract void doClose()
protected abstract void doOpen() throws javax.media.ResourceUnavailableException
PlugIn.open()
on this instance will result in
a call to doOpen only if AbstractCodec.opened
is
false. All required input and/or output formats are assumed to
have been set on this Codec before doOpen is called.javax.media.ResourceUnavailableException
- if any of the resources that this
Codec needs to operate cannot be acquiredprotected abstract int doProcess(javax.media.Buffer inBuf, javax.media.Buffer outBuf)
protected javax.media.Format[] getMatchingOutputFormats(javax.media.Format inputFormat)
inputFormat
- the Format of the input for which the
supported output Formats are to be returnedpublic java.lang.String getName()
getName
in interface javax.media.PlugIn
getName
in class net.sf.fmj.media.AbstractPlugIn
public javax.media.Format[] getSupportedOutputFormats(javax.media.Format inputFormat)
AbstractCodec.getSupportedOutputFormats(Format)
.getSupportedOutputFormats
in interface javax.media.Codec
getSupportedOutputFormats
in class net.sf.fmj.media.AbstractCodec
inputFormat
- input formatAbstractCodec.getSupportedOutputFormats(Format)
public void open() throws javax.media.ResourceUnavailableException
open
in interface javax.media.PlugIn
open
in class net.sf.fmj.media.AbstractPlugIn
javax.media.ResourceUnavailableException
- if any of the resources that this
PlugIn needs to operate cannot be acquiredAbstractPlugIn.open()
public int process(javax.media.Buffer inBuf, javax.media.Buffer outBuf)
process
in interface javax.media.Codec
process
in class net.sf.fmj.media.AbstractCodec
inBuf
- outBuf
- AbstractCodec.process(Buffer, Buffer)
public javax.media.Format setInputFormat(javax.media.Format format)
setInputFormat
in interface javax.media.Codec
setInputFormat
in class net.sf.fmj.media.AbstractCodec
public javax.media.Format setOutputFormat(javax.media.Format format)
setOutputFormat
in interface javax.media.Codec
setOutputFormat
in class net.sf.fmj.media.AbstractCodec
protected void updateOutput(javax.media.Buffer outputBuffer, javax.media.Format format, int length, int offset)
outputBuffer
- the output Buffer to update the properties
offormat
- the Format to set on outputBufferlength
- the length to set on outputBufferoffset
- the offset to set on outputBufferprotected short[] validateShortArraySize(javax.media.Buffer buffer, int newSize)
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.