Class 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 Detail

      • prevInLen

        protected int prevInLen
        The length of the valid audio data in prevIn.
    • 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 instance
        codecID - the AVCodecID of the FFmpeg codec to be represented by the new instance
        supportedOutputFormats - 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 in AbstractFFmpegAudioCodec.doOpen() prior to invoking one of the FFmpeg functions in the avcodec_open family. Allows extenders to override and provide additional, optional configuration.
        Overrides:
        configureAVCodecContext in class AbstractFFmpegAudioCodec
        Parameters:
        avctx - the AVCodecContext to configure
        format - the AudioFormat with which avctx is being configured
      • doProcess

        protected int doProcess​(javax.media.Buffer inBuf,
                                javax.media.Buffer outBuf)
        Specified by:
        doProcess in class AbstractCodec2
      • findAVCodec

        protected long findAVCodec​(int codecID)
        Finds an AVCodec with a specific AVCodecID. The method is invoked by AbstractFFmpegAudioCodec.doOpen() in order to (eventually) open a new AVCodecContext.
        Specified by:
        findAVCodec in class AbstractFFmpegAudioCodec
        Parameters:
        codecID - the AVCodecID of the AVCodec to find
        Returns:
        an AVCodec with the specified codecID or 0