Class AVCVideo

All Implemented Interfaces:
IVideoStreamCodec, IoConstants
Direct Known Subclasses:
HEVCVideo, HEVCVideoEnhancedRTMP

public class AVCVideo extends AbstractVideo
Red5 video codec for the AVC (h264) video format. Stores DecoderConfigurationRecord and last keyframe.
Author:
Tiago Jacobs (tiago@imdt.com.br), Paul Gregoire (mondain@gmail.com)
  • Field Details

    • log

      private static org.slf4j.Logger log
    • CODEC_NAME

      static final String CODEC_NAME
      AVC video codec constant
      See Also:
    • decoderConfiguration

      protected IVideoStreamCodec.FrameData decoderConfiguration
      Video decoder configuration data
    • interframes

      protected final CopyOnWriteArrayList<IVideoStreamCodec.FrameData> interframes
      Storage for frames buffered since last key frame
    • numInterframes

      protected final AtomicInteger numInterframes
      Number of frames buffered since last key frame
    • bufferInterframes

      protected boolean bufferInterframes
      Whether or not to buffer interframes
  • Constructor Details

    • AVCVideo

      public AVCVideo()
      Constructs a new AVCVideo.
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface IVideoStreamCodec
      Overrides:
      getName in class AbstractVideo
      Returns:
      the name of the video codec.
    • canDropFrames

      public boolean canDropFrames()
      Check if the codec supports frame dropping.
      Specified by:
      canDropFrames in interface IVideoStreamCodec
      Overrides:
      canDropFrames in class AbstractVideo
      Returns:
      if the codec supports frame dropping.
    • reset

      public void reset()
      Reset the codec to its initial state.
      Specified by:
      reset in interface IVideoStreamCodec
      Overrides:
      reset in class AbstractVideo
    • softReset

      protected void softReset()
    • canHandleData

      public boolean canHandleData(org.apache.mina.core.buffer.IoBuffer data)
      Returns true if the codec knows how to handle the passed stream data.
      Specified by:
      canHandleData in interface IVideoStreamCodec
      Overrides:
      canHandleData in class AbstractVideo
      Parameters:
      data - some sample data to see if this codec can handle it
      Returns:
      can this code handle the data.
    • addData

      public boolean addData(org.apache.mina.core.buffer.IoBuffer data)
      Update the state of the codec with the passed data.
      Specified by:
      addData in interface IVideoStreamCodec
      Overrides:
      addData in class AbstractVideo
      Parameters:
      data - data to tell the codec we're adding
      Returns:
      true for success. false for error
    • addData

      public boolean addData(org.apache.mina.core.buffer.IoBuffer data, int timestamp)
      Update the state of the codec with the passed data.
      Specified by:
      addData in interface IVideoStreamCodec
      Overrides:
      addData in class AbstractVideo
      Parameters:
      data - data to tell the codec we're adding
      timestamp - time associated with the data
      Returns:
      true for success. false for error
    • setInterFrame

      protected void setInterFrame(org.apache.mina.core.buffer.IoBuffer data)
    • setFrames

      protected void setFrames(org.apache.mina.core.buffer.IoBuffer data, int timestamp, byte avcType)
    • getDecoderConfiguration

      public org.apache.mina.core.buffer.IoBuffer getDecoderConfiguration()
      Returns information used to configure the decoder.
      Specified by:
      getDecoderConfiguration in interface IVideoStreamCodec
      Overrides:
      getDecoderConfiguration in class AbstractVideo
      Returns:
      the data for decoder setup
    • getNumInterframes

      public int getNumInterframes()
      Returns the number of interframes collected from last keyframe.
      Specified by:
      getNumInterframes in interface IVideoStreamCodec
      Overrides:
      getNumInterframes in class AbstractVideo
      Returns:
      number of interframes
    • getInterframe

      public IVideoStreamCodec.FrameData getInterframe(int index)
      Gets data of interframe with the specified index.
      Specified by:
      getInterframe in interface IVideoStreamCodec
      Overrides:
      getInterframe in class AbstractVideo
      Parameters:
      index - of interframe
      Returns:
      data of the interframe or null if index is not valid
    • isBufferInterframes

      public boolean isBufferInterframes()
    • setBufferInterframes

      public void setBufferInterframes(boolean bufferInterframes)