Class FFmpegAudioEncoder
- 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.AbstractFFmpegAudioCodec
-
- org.jitsi.impl.neomedia.codec.audio.FFmpegAudioEncoder
-
- All Implemented Interfaces:
javax.media.Codec,javax.media.Controls,javax.media.PlugIn
- Direct Known Subclasses:
JNIEncoder,JNIEncoder
public class FFmpegAudioEncoder extends AbstractFFmpegAudioCodec
Implements an audio Codec using the FFmpeg library.- Author:
- Lyubomir Marinov
-
-
Field Summary
Fields Modifier and Type Field Description protected intprevInLenThe length of the valid audio data inprevIn.-
Fields inherited from class org.jitsi.impl.neomedia.codec.audio.AbstractFFmpegAudioCodec
avctx, codecID, frameSizeInBytes
-
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 Modifier Constructor Description protectedFFmpegAudioEncoder(String name, int codecID, javax.media.Format[] supportedOutputFormats)Initializes a new FFmpegAudioEncoder instance with a specific PlugIn name, a specific AVCodecID, and a specific list of Formats supported as output.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidassertFindAVCodec(int codecID)Asserts that an encoder with a specific AVCodecID is found by FFmpeg.protected voidconfigureAVCodecContext(long avctx, javax.media.format.AudioFormat format)Configures the AVCodecContext initialized inAbstractFFmpegAudioCodec.doOpen()prior to invoking one of the FFmpeg functions in the avcodec_open family.protected voiddoClose()protected intdoProcess(javax.media.Buffer inBuf, javax.media.Buffer outBuf)protected longfindAVCodec(int codecID)Finds an AVCodec with a specific AVCodecID.protected javax.media.format.AudioFormatgetAVCodecContextFormat()Gets the AudioFormat with whichAbstractFFmpegAudioCodec.avctxis to be configured and opened byAbstractFFmpegAudioCodec.doOpen().-
Methods inherited from class org.jitsi.impl.neomedia.codec.audio.AbstractFFmpegAudioCodec
codecIDToString, doOpen
-
Methods inherited from class org.jitsi.impl.neomedia.codec.AbstractCodec2
calculateLostSeqNoCount, close, discardOutputBuffer, getMatchingOutputFormats, getName, getSupportedOutputFormats, incrementSeqNo, matches, open, process, setInputFormat, setOutputFormat, specialize, updateOutput, validateByteArraySize, validateShortArraySize
-
Methods inherited from class net.sf.fmj.media.AbstractCodec
checkInputBuffer, dump, getInputFormat, getOutputFormat, getSupportedInputFormats, isEOM, propagateEOM
-
Methods inherited from class net.sf.fmj.media.AbstractControls
addControl, getControl, getControls, removeControl
-
-
-
-
Field Detail
-
prevInLen
protected int prevInLen
The length of the valid audio data inprevIn.
-
-
Constructor Detail
-
FFmpegAudioEncoder
protected FFmpegAudioEncoder(String name, int codecID, javax.media.Format[] supportedOutputFormats)
Initializes a new FFmpegAudioEncoder instance with a specific PlugIn name, a specific AVCodecID, and a specific list of Formats supported as output.- Parameters:
name- the PlugIn name of the new instancecodecID- the AVCodecID of the FFmpeg codec to be represented by the new instancesupportedOutputFormats- the list of Formats supported by the new instance as output
-
-
Method Detail
-
assertFindAVCodec
public static void assertFindAVCodec(int codecID)
Asserts that an encoder with a specific AVCodecID is found by FFmpeg.- Parameters:
codecID- the AVCodecID of the encoder to find- Throws:
RuntimeException- if no encoder with the specified codecID is found by FFmpeg
-
configureAVCodecContext
protected void configureAVCodecContext(long avctx, javax.media.format.AudioFormat format)Configures the AVCodecContext initialized inAbstractFFmpegAudioCodec.doOpen()prior to invoking one of the FFmpeg functions in the avcodec_open family. Allows extenders to override and provide additional, optional configuration.- Overrides:
configureAVCodecContextin classAbstractFFmpegAudioCodec- Parameters:
avctx- the AVCodecContext to configureformat- the AudioFormat with which avctx is being configured
-
doClose
protected void doClose()
- Overrides:
doClosein classAbstractFFmpegAudioCodec
-
doProcess
protected int doProcess(javax.media.Buffer inBuf, javax.media.Buffer outBuf)- Specified by:
doProcessin classAbstractCodec2
-
findAVCodec
protected long findAVCodec(int codecID)
Finds an AVCodec with a specific AVCodecID. The method is invoked byAbstractFFmpegAudioCodec.doOpen()in order to (eventually) open a new AVCodecContext.- Specified by:
findAVCodecin classAbstractFFmpegAudioCodec- Parameters:
codecID- the AVCodecID of the AVCodec to find- Returns:
- an AVCodec with the specified codecID or 0
-
getAVCodecContextFormat
protected javax.media.format.AudioFormat getAVCodecContextFormat()
Gets the AudioFormat with whichAbstractFFmpegAudioCodec.avctxis to be configured and opened byAbstractFFmpegAudioCodec.doOpen().- Specified by:
getAVCodecContextFormatin classAbstractFFmpegAudioCodec- Returns:
- the AudioFormat with which avctx is to be configured and opened by doOpen()
-
-