Class DePacketizer

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

    public class DePacketizer
    extends AbstractCodec2
    Implements Codec to represent a depacketizer of H.264 RTP packets into NAL units.
    Author:
    Lyubomir Marinov, Damian Minkov
    • Constructor Detail

      • DePacketizer

        public DePacketizer()
        Initializes a new DePacketizer instance which is to depacketize H.264 RTP packets into NAL units.
    • Method Detail

      • 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.
        Specified by:
        doOpen in class AbstractCodec2
        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 inBuffer,
                                javax.media.Buffer outBuffer)
        Processes (depacketizes) a buffer.
        Specified by:
        doProcess in class AbstractCodec2
        Parameters:
        inBuffer - input buffer
        outBuffer - output buffer
        Returns:
        BUFFER_PROCESSED_OK if buffer has been successfully processed
      • isKeyFrame

        public static boolean isKeyFrame​(byte[] buf,
                                         int off,
                                         int len)
        Returns true if the buffer contains a H264 key frame at offset offset.
        Parameters:
        buf - the byte buffer to check
        off - the offset in the byte buffer where the actuall data starts
        len - the length of the data in the byte buffer
        Returns:
        true if the buffer contains a H264 key frame at offset offset.
      • getMatchingOutputFormats

        protected javax.media.Format[] getMatchingOutputFormats​(javax.media.Format inputFormat)
        Gets the Formats which are supported by this Codec as output when the input is in a specific Format. Makes sure that the format parameters of a ParameterizedVideoFormat input which are of no concern to this DePacketizer get passed on through the output to the next Codec in the codec chain (i.e. JNIDecoder).
        Overrides:
        getMatchingOutputFormats in class AbstractCodec2
        Parameters:
        inputFormat - the Format of the input for which the supported output Formats are to be returned
        Returns:
        an array of Formats supported by this Codec as output when the input is in the specified inputFormat
      • requestKeyFrame

        public boolean requestKeyFrame​(boolean urgent)
        Requests a key frame from the remote peer associated with this DePacketizer using the logic of DePacketizer.
        Parameters:
        urgent - true if the caller has determined that the need for a key frame is urgent and should not obey all constraints with respect to time between two subsequent requests for key frames
        Returns:
        true if a key frame was indeed requested in response to the call; otherwise, false
      • 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