Class JNIEncoder
- java.lang.Object
-
- net.sf.fmj.media.AbstractControls
-
- net.sf.fmj.media.AbstractPlugIn
-
- net.sf.fmj.media.AbstractCodec
-
- org.jitsi.impl.neomedia.codec.AbstractCodec2
-
- org.jitsi.impl.neomedia.codec.audio.opus.JNIEncoder
-
- All Implemented Interfaces:
javax.media.Codec,javax.media.Control,javax.media.Controls,javax.media.PlugIn,AdvancedAttributesAwareCodec,FormatParametersAwareCodec,PacketLossAwareEncoder
public class JNIEncoder extends AbstractCodec2 implements FormatParametersAwareCodec, PacketLossAwareEncoder, AdvancedAttributesAwareCodec
Implements an Opus encoder.- Author:
- Boris Grozev, Lyubomir Marinov
-
-
Field Summary
-
Fields inherited from class org.jitsi.impl.neomedia.codec.AbstractCodec2
BUFFER_FLAG_FEC, BUFFER_FLAG_PLC, EMPTY_FORMATS, features, MAX_AUDIO_SEQUENCE_NUMBERS_TO_PLC, SEQUENCE_MAX, SEQUENCE_MIN
-
-
Constructor Summary
Constructors Constructor Description JNIEncoder()Initializes a new JNIEncoder instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoClose()protected voiddoOpen()Opens this Codec and acquires the resources that it needs to operate.protected intdoProcess(javax.media.Buffer inBuffer, javax.media.Buffer outBuffer)Processes (i.e.ComponentgetControlComponent()ImplementsControl.getControlComponent().javax.media.FormatgetOutputFormat()Gets the Format of the media output by this Codec.voidsetAdvancedAttributes(Map<String,String> attributes)Sets the additional attributes to attributesvoidsetExpectedPacketLoss(int percentage)Updates the encoder's expected packet loss percentage to the bigger of percentage and this.minPacketLoss.voidsetFormatParameters(Map<String,String> fmtps)Sets the format parameters.javax.media.FormatsetInputFormat(javax.media.Format format)Automatically tracks and calculates the size in bytes of an audio frame (to be) output by this instance.-
Methods inherited from class org.jitsi.impl.neomedia.codec.AbstractCodec2
calculateLostSeqNoCount, close, discardOutputBuffer, getMatchingOutputFormats, getName, getSupportedOutputFormats, incrementSeqNo, matches, open, process, setOutputFormat, specialize, updateOutput, validateByteArraySize, validateShortArraySize
-
Methods inherited from class net.sf.fmj.media.AbstractCodec
checkInputBuffer, dump, getInputFormat, getSupportedInputFormats, isEOM, propagateEOM
-
Methods inherited from class net.sf.fmj.media.AbstractControls
addControl, getControl, getControls, removeControl
-
-
-
-
Method Detail
-
doClose
protected void doClose()
- Specified by:
doClosein classAbstractCodec2- See Also:
AbstractCodec2.doClose()
-
doOpen
protected void doOpen() throws javax.media.ResourceUnavailableExceptionOpens this Codec and acquires the resources that it needs to operate. A call toPlugIn.open()on this instance will result in a call to doOpen only ifAbstractCodec.openedis false. All required input and/or output formats are assumed to have been set on this Codec before doOpen is called.- Specified by:
doOpenin classAbstractCodec2- Throws:
javax.media.ResourceUnavailableException- if any of the resources that this Codec needs to operate cannot be acquired- See Also:
AbstractCodec2.doOpen()
-
doProcess
protected int doProcess(javax.media.Buffer inBuffer, javax.media.Buffer outBuffer)Processes (i.e. encodes) a specific input Buffer.- Specified by:
doProcessin classAbstractCodec2- Parameters:
inBuffer- the Buffer from which the media to be encoded is to be readoutBuffer- the Buffer into which the encoded media is to be written- Returns:
- BUFFER_PROCESSED_OK if the specified inBuffer has been processed successfully
- See Also:
AbstractCodec2.doProcess(Buffer, Buffer)
-
getControlComponent
public Component getControlComponent()
ImplementsControl.getControlComponent(). JNIEncoder does not provide user interface of its own.- Specified by:
getControlComponentin interfacejavax.media.Control- Returns:
- null to signify that JNIEncoder does not provide user interface of its own
-
getOutputFormat
public javax.media.Format getOutputFormat()
Gets the Format of the media output by this Codec.- Overrides:
getOutputFormatin classnet.sf.fmj.media.AbstractCodec- Returns:
- the Format of the media output by this Codec
- See Also:
AbstractCodec.getOutputFormat()
-
setExpectedPacketLoss
public void setExpectedPacketLoss(int percentage)
Updates the encoder's expected packet loss percentage to the bigger of percentage and this.minPacketLoss.- Specified by:
setExpectedPacketLossin interfacePacketLossAwareEncoder- Parameters:
percentage- the expected packet loss percentage to set
-
setFormatParameters
public void setFormatParameters(Map<String,String> fmtps)
Sets the format parameters.- Specified by:
setFormatParametersin interfaceFormatParametersAwareCodec- Parameters:
fmtps- the format parameters to set
-
setInputFormat
public javax.media.Format setInputFormat(javax.media.Format format)
Automatically tracks and calculates the size in bytes of an audio frame (to be) output by this instance.- Specified by:
setInputFormatin interfacejavax.media.Codec- Overrides:
setInputFormatin classAbstractCodec2
-
setAdvancedAttributes
public void setAdvancedAttributes(Map<String,String> attributes)
Sets the additional attributes to attributes- Specified by:
setAdvancedAttributesin interfaceAdvancedAttributesAwareCodec- Parameters:
attributes- The additional attributes to set
-
-