Class Packetizer

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

    public class Packetizer
    extends net.sf.fmj.media.AbstractPacketizer
    Packetizes H.264 encoded data/NAL units into RTP packets in accord with RFC 3984 "RTP Payload Format for H.264 Video".
    Author:
    Damian Minkov, Lyubomir Marinov
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int MAX_PAYLOAD_SIZE
      Maximum payload size without the headers.
      • 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
      Packetizer()
      Initializes a new Packetizer instance which is to packetize H.264 encoded data/NAL units into RTP packets in accord with RFC 3984 "RTP Payload Format for H.264 Video".
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close this Packetizer.
      String getName()
      Gets the name of this PlugIn.
      javax.media.Format[] getSupportedOutputFormats​(javax.media.Format in)
      Return the list of formats supported at the output.
      void open()
      Open this Packetizer.
      int process​(javax.media.Buffer inBuffer, javax.media.Buffer outBuffer)
      Processes (packetize) a buffer.
      javax.media.Format setInputFormat​(javax.media.Format in)
      Sets the input format.
      javax.media.Format setOutputFormat​(javax.media.Format format)
      Sets the Format in which this Codec is to output media data.
      • Methods inherited from class net.sf.fmj.media.AbstractPacketizer

        doBuildPacketHeader, setDoNotSpanInputBuffers, setPacketSize, setPacketSizeImpl
      • Methods inherited from class net.sf.fmj.media.AbstractCodec

        checkInputBuffer, dump, getInputFormat, getOutputFormat, getSupportedInputFormats, isEOM, propagateEOM
      • 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
    • Field Detail

      • MAX_PAYLOAD_SIZE

        public static final int MAX_PAYLOAD_SIZE
        Maximum payload size without the headers.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Packetizer

        public Packetizer()
        Initializes a new Packetizer instance which is to packetize H.264 encoded data/NAL units into RTP packets in accord with RFC 3984 "RTP Payload Format for H.264 Video".
    • Method Detail

      • close

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

        public String getName()
        Gets the name of this PlugIn.
        Specified by:
        getName in interface javax.media.PlugIn
        Overrides:
        getName in class net.sf.fmj.media.AbstractPlugIn
        Returns:
        the name of this PlugIn
      • getSupportedOutputFormats

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

        public void open()
                  throws javax.media.ResourceUnavailableException
        Open this Packetizer.
        Specified by:
        open in interface javax.media.PlugIn
        Overrides:
        open in class net.sf.fmj.media.AbstractPlugIn
        Throws:
        javax.media.ResourceUnavailableException - if something goes wrong during initialization of the Packetizer.
      • process

        public int process​(javax.media.Buffer inBuffer,
                           javax.media.Buffer outBuffer)
        Processes (packetize) a buffer.
        Specified by:
        process in interface javax.media.Codec
        Overrides:
        process in class net.sf.fmj.media.AbstractPacketizer
        Parameters:
        inBuffer - input buffer
        outBuffer - output buffer
        Returns:
        BUFFER_PROCESSED_OK if buffer has been successfully processed
      • setInputFormat

        public javax.media.Format setInputFormat​(javax.media.Format in)
        Sets the input format.
        Specified by:
        setInputFormat in interface javax.media.Codec
        Overrides:
        setInputFormat in class net.sf.fmj.media.AbstractCodec
        Parameters:
        in - format to set
        Returns:
        format
      • setOutputFormat

        public javax.media.Format setOutputFormat​(javax.media.Format format)
        Sets the Format in which this Codec is to output media data.
        Specified by:
        setOutputFormat in interface javax.media.Codec
        Overrides:
        setOutputFormat in class net.sf.fmj.media.AbstractCodec
        Parameters:
        format - the Format in which this Codec is to output media data
        Returns:
        the Format in which this Codec is currently configured to output media data or null if format was found to be incompatible with this Codec