Class AbstractFFmpegAudioCodec
- 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
-
- All Implemented Interfaces:
javax.media.Codec,javax.media.Controls,javax.media.PlugIn
- Direct Known Subclasses:
FFmpegAudioDecoder,FFmpegAudioEncoder
public abstract class AbstractFFmpegAudioCodec extends AbstractCodec2
Implements an audio Codec using the FFmpeg library.- Author:
- Lyubomir Marinov
-
-
Field Summary
Fields Modifier and Type Field Description protected longavctxThe AVCodecContext which performs the actual encoding/decoding and which is the native counterpart of this open AbstractFFmpegAudioCodec.protected intcodecIDThe AVCodecID ofavctx.protected intframeSizeInBytesThe number of bytes of audio data to be encoded with a single call toFFmpeg.avcodec_encode_audio(long, byte[], int, int, byte[], int)based on the frame_size ofavctx.-
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 protectedAbstractFFmpegAudioCodec(String name, int codecID, javax.media.Format[] supportedOutputFormats)Initializes a new AbstractFFmpegAudioCodec 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 Abstract Methods Concrete Methods Modifier and Type Method Description static StringcodecIDToString(int codecID)Returns a String representation of a specific AVCodecID.protected voidconfigureAVCodecContext(long avctx, javax.media.format.AudioFormat format)Configures the AVCodecContext initialized indoOpen()prior to invoking one of the FFmpeg functions in the avcodec_open family.protected voiddoClose()protected voiddoOpen()Opens this Codec and acquires the resources that it needs to operate.protected abstract longfindAVCodec(int codecID)Finds an AVCodec with a specific AVCodecID.protected abstract javax.media.format.AudioFormatgetAVCodecContextFormat()-
Methods inherited from class org.jitsi.impl.neomedia.codec.AbstractCodec2
calculateLostSeqNoCount, close, discardOutputBuffer, doProcess, 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
-
avctx
protected long avctx
The AVCodecContext which performs the actual encoding/decoding and which is the native counterpart of this open AbstractFFmpegAudioCodec.
-
codecID
protected final int codecID
The AVCodecID ofavctx.
-
frameSizeInBytes
protected int frameSizeInBytes
The number of bytes of audio data to be encoded with a single call toFFmpeg.avcodec_encode_audio(long, byte[], int, int, byte[], int)based on the frame_size ofavctx.
-
-
Constructor Detail
-
AbstractFFmpegAudioCodec
protected AbstractFFmpegAudioCodec(String name, int codecID, javax.media.Format[] supportedOutputFormats)
Initializes a new AbstractFFmpegAudioCodec 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
-
codecIDToString
public static String codecIDToString(int codecID)
Returns a String representation of a specific AVCodecID.- Parameters:
codecID- the AVCodecID to represent as a String- Returns:
- a String representation of the specified codecID
-
configureAVCodecContext
protected void configureAVCodecContext(long avctx, javax.media.format.AudioFormat format)Configures the AVCodecContext initialized indoOpen()prior to invoking one of the FFmpeg functions in the avcodec_open family. Allows extenders to override and provide additional, optional configuration.- Parameters:
avctx- the AVCodecContext to configureformat- the AudioFormat with which avctx is being configured
-
doClose
protected void doClose()
- Specified by:
doClosein classAbstractCodec2
-
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
-
findAVCodec
protected abstract long findAVCodec(int codecID)
Finds an AVCodec with a specific AVCodecID. The method is invoked bydoOpen()in order to (eventually) open a new AVCodecContext.- Parameters:
codecID- the AVCodecID of the AVCodec to find- Returns:
- an AVCodec with the specified codecID or 0
-
getAVCodecContextFormat
protected abstract javax.media.format.AudioFormat getAVCodecContextFormat()
- Returns:
- the AudioFormat with which avctx is to be configured and opened by doOpen()
-
-