Class FFmpegAudioDecoder

  • All Implemented Interfaces:
    javax.media.Codec, javax.media.Controls, javax.media.PlugIn
    Direct Known Subclasses:
    JNIDecoder

    public class FFmpegAudioDecoder
    extends AbstractFFmpegAudioCodec
    Implements an audio Codec using the FFmpeg library.
    Author:
    Lyubomir Marinov
    • Constructor Detail

      • FFmpegAudioDecoder

        protected FFmpegAudioDecoder​(String name,
                                     int codecID,
                                     javax.media.Format[] supportedOutputFormats)
        Initializes a new FFmpegAudioDecoder 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 decoder with a specific AVCodecID is found by FFmpeg.
        Parameters:
        codecID - the AVCodecID of the decoder to find
        Throws:
        RuntimeException - if no decoder with the specified codecID is found by FFmpeg
      • doOpen

        protected void doOpen()
                       throws javax.media.ResourceUnavailableException
        Opens this Codec and acquires the resources that it needs to operate. A call to 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.
        Overrides:
        doOpen in class AbstractFFmpegAudioCodec
        Throws:
        javax.media.ResourceUnavailableException - if any of the resources that this Codec needs to operate cannot be acquired
      • 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