Class JNIDecoder

  • All Implemented Interfaces:
    javax.media.Codec, javax.media.Controls, javax.media.PlugIn

    public class JNIDecoder
    extends net.sf.fmj.media.AbstractCodec
    Decodes H.264 NAL units and returns the resulting frames as FFmpeg AVFrames (i.e. in YUV format).
    Author:
    Damian Minkov, Lyubomir Marinov, Sebastien Vincent
    • Field Summary

      • Fields inherited from class net.sf.fmj.media.AbstractCodec

        inputFormat, inputFormats, opened, outputFormat
      • Fields inherited from interface javax.media.PlugIn

        BUFFER_PROCESSED_FAILED, BUFFER_PROCESSED_OK, INPUT_BUFFER_NOT_CONSUMED, OUTPUT_BUFFER_NOT_FILLED, PLUGIN_TERMINATED
    • Constructor Summary

      Constructors 
      Constructor Description
      JNIDecoder()
      Initializes a new JNIDecoder instance which is to decode H.264 NAL units into frames in YUV format.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean checkFormat​(javax.media.Format format)
      Check Format.
      void close()
      Close Codec.
      protected javax.media.Format[] getMatchingOutputFormats​(javax.media.Format inputFormat)
      Get matching outputs for a specified input Format.
      String getName()
      Get plugin name.
      javax.media.Format[] getSupportedOutputFormats​(javax.media.Format inputFormat)
      Get all supported output Formats.
      void open()
      Inits the codec instances.
      int process​(javax.media.Buffer in, javax.media.Buffer out)
      Decodes H.264 media data read from a specific input Buffer into a specific output Buffer.
      javax.media.Format setInputFormat​(javax.media.Format format)
      Sets the Format of the media data to be input for processing in this Codec.
      void setKeyFrameControl​(KeyFrameControl keyFrameControl)
      Sets the KeyFrameControl to be used by this DePacketizer as a means of control over its key frame-related logic.
      • Methods inherited from class net.sf.fmj.media.AbstractCodec

        checkInputBuffer, dump, getInputFormat, getOutputFormat, getSupportedInputFormats, isEOM, propagateEOM, setOutputFormat
      • Methods inherited from class net.sf.fmj.media.AbstractPlugIn

        reset
      • Methods inherited from class net.sf.fmj.media.AbstractControls

        addControl, getControl, getControls, removeControl
      • Methods inherited from interface javax.media.Controls

        getControl, getControls
      • Methods inherited from interface javax.media.PlugIn

        reset
    • Constructor Detail

      • JNIDecoder

        public JNIDecoder()
        Initializes a new JNIDecoder instance which is to decode H.264 NAL units into frames in YUV format.
    • Method Detail

      • checkFormat

        public boolean checkFormat​(javax.media.Format format)
        Check Format.
        Parameters:
        format - Format to check
        Returns:
        true if Format is H264_RTP
      • close

        public void close()
        Close Codec.
        Specified by:
        close in interface javax.media.PlugIn
        Overrides:
        close in class net.sf.fmj.media.AbstractPlugIn
      • getMatchingOutputFormats

        protected javax.media.Format[] getMatchingOutputFormats​(javax.media.Format inputFormat)
        Get matching outputs for a specified input Format.
        Parameters:
        inputFormat - input Format
        Returns:
        array of matching outputs or null if there are no matching outputs.
      • getName

        public String getName()
        Get plugin name.
        Specified by:
        getName in interface javax.media.PlugIn
        Overrides:
        getName in class net.sf.fmj.media.AbstractPlugIn
        Returns:
        "H.264 Decoder"
      • getSupportedOutputFormats

        public javax.media.Format[] getSupportedOutputFormats​(javax.media.Format inputFormat)
        Get all supported output Formats.
        Specified by:
        getSupportedOutputFormats in interface javax.media.Codec
        Specified by:
        getSupportedOutputFormats in class net.sf.fmj.media.AbstractCodec
        Parameters:
        inputFormat - input Format to determine corresponding output Formats
        Returns:
        an array of supported output Formats
      • open

        public void open()
                  throws javax.media.ResourceUnavailableException
        Inits the codec instances.
        Specified by:
        open in interface javax.media.PlugIn
        Overrides:
        open in class net.sf.fmj.media.AbstractPlugIn
        Throws:
        javax.media.ResourceUnavailableException - if codec initialization failed
      • process

        public int process​(javax.media.Buffer in,
                           javax.media.Buffer out)
        Decodes H.264 media data read from a specific input Buffer into a specific output Buffer.
        Specified by:
        process in interface javax.media.Codec
        Specified by:
        process in class net.sf.fmj.media.AbstractCodec
        Parameters:
        in - input Buffer
        out - output Buffer
        Returns:
        BUFFER_PROCESSED_OK if in has been successfully processed
      • setInputFormat

        public javax.media.Format setInputFormat​(javax.media.Format format)
        Sets the Format of the media data to be input for processing in this Codec.
        Specified by:
        setInputFormat in interface javax.media.Codec
        Overrides:
        setInputFormat in class net.sf.fmj.media.AbstractCodec
        Parameters:
        format - the Format of the media data to be input for processing in this Codec
        Returns:
        the Format of the media data to be input for processing in this Codec if format is compatible with this Codec; otherwise, null
      • setKeyFrameControl

        public void setKeyFrameControl​(KeyFrameControl keyFrameControl)
        Sets the KeyFrameControl to be used by this DePacketizer as a means of control over its key frame-related logic.
        Parameters:
        keyFrameControl - the KeyFrameControl to be used by this DePacketizer as a means of control over its key frame-related logic