Package org.red5.codec
Class AVCVideo
java.lang.Object
org.red5.codec.AbstractVideo
org.red5.codec.AVCVideo
- All Implemented Interfaces:
IVideoStreamCodec,IoConstants
- Direct Known Subclasses:
HEVCVideo,HEVCVideoEnhancedRTMP
Red5 video codec for the AVC (h264) video format. Stores DecoderConfigurationRecord and last keyframe.
- Author:
- Tiago Jacobs ([email protected]), Paul Gregoire ([email protected])
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.red5.codec.IVideoStreamCodec
IVideoStreamCodec.FrameData -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether or not to buffer interframes(package private) static final StringAVC video codec constantprotected IVideoStreamCodec.FrameDataVideo decoder configuration dataprotected final CopyOnWriteArrayList<IVideoStreamCodec.FrameData>Storage for frames buffered since last key frameprivate static org.slf4j.Loggerprotected final AtomicIntegerNumber of frames buffered since last key frameFields inherited from class org.red5.codec.AbstractVideo
keyframes, keyframeTimestampFields inherited from interface org.red5.io.IoConstants
AVC_PACKET_TYPE_END_OF_SEQUENCE, AVC_PACKET_TYPE_NALU, AVC_PACKET_TYPE_SEQUENCE_HEADER, FLAG_CODEC_H263, FLAG_CODEC_SCREEN, FLAG_CODEC_VP6, FLAG_FORMAT_ADPCM, FLAG_FORMAT_MP3, FLAG_FORMAT_NELLYMOSER, FLAG_FORMAT_NELLYMOSER_8_KHZ, FLAG_FORMAT_RAW, FLAG_FRAMETYPE_DISPOSABLE, FLAG_FRAMETYPE_GENERATED_KEYFRAME, FLAG_FRAMETYPE_INFO, FLAG_FRAMETYPE_INTERFRAME, FLAG_FRAMETYPE_KEYFRAME, FLAG_RATE_11_KHZ, FLAG_RATE_22_KHZ, FLAG_RATE_44_KHZ, FLAG_RATE_48_KHZ, FLAG_RATE_5_5_KHZ, FLAG_SIZE_16_BIT, FLAG_SIZE_8_BIT, FLAG_TYPE_MONO, FLAG_TYPE_STEREO, INFO_PACKET_SEEK_END, INFO_PACKET_SEEK_START, MASK_SOUND_FORMAT, MASK_SOUND_RATE, MASK_SOUND_SIZE, MASK_SOUND_TYPE, MASK_VIDEO_CODEC, MASK_VIDEO_FRAMETYPE, TYPE_AUDIO, TYPE_ENCRYPTED, TYPE_ENCRYPTED_AUDIO, TYPE_ENCRYPTED_METADATA, TYPE_ENCRYPTED_VIDEO, TYPE_METADATA, TYPE_VIDEOFields inherited from interface org.red5.codec.IVideoStreamCodec
FLV_FRAME_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddData(org.apache.mina.core.buffer.IoBuffer data) Update the state of the codec with the passed data.booleanaddData(org.apache.mina.core.buffer.IoBuffer data, int timestamp) Update the state of the codec with the passed data.booleanCheck if the codec supports frame dropping.booleancanHandleData(org.apache.mina.core.buffer.IoBuffer data) Returns true if the codec knows how to handle the passed stream data.org.apache.mina.core.buffer.IoBufferReturns information used to configure the decoder.getInterframe(int index) Gets data of interframe with the specified index.getName()intReturns the number of interframes collected from last keyframe.booleanvoidreset()Reset the codec to its initial state.voidsetBufferInterframes(boolean bufferInterframes) protected voidsetFrames(org.apache.mina.core.buffer.IoBuffer data, int timestamp, byte avcType) protected voidsetInterFrame(org.apache.mina.core.buffer.IoBuffer data) protected voidMethods inherited from class org.red5.codec.AbstractVideo
getKeyframe, getKeyframes
-
Field Details
-
log
private static org.slf4j.Logger log -
CODEC_NAME
AVC video codec constant- See Also:
-
decoderConfiguration
Video decoder configuration data -
interframes
Storage for frames buffered since last key frame -
numInterframes
Number of frames buffered since last key frame -
bufferInterframes
protected boolean bufferInterframesWhether or not to buffer interframes
-
-
Constructor Details
-
AVCVideo
public AVCVideo()Constructs a new AVCVideo.
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceIVideoStreamCodec- Overrides:
getNamein classAbstractVideo- Returns:
- the name of the video codec.
-
canDropFrames
public boolean canDropFrames()Check if the codec supports frame dropping.- Specified by:
canDropFramesin interfaceIVideoStreamCodec- Overrides:
canDropFramesin classAbstractVideo- Returns:
- if the codec supports frame dropping.
-
reset
public void reset()Reset the codec to its initial state.- Specified by:
resetin interfaceIVideoStreamCodec- Overrides:
resetin classAbstractVideo
-
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:
canHandleDatain interfaceIVideoStreamCodec- Overrides:
canHandleDatain classAbstractVideo- 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:
addDatain interfaceIVideoStreamCodec- Overrides:
addDatain classAbstractVideo- 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:
addDatain interfaceIVideoStreamCodec- Overrides:
addDatain classAbstractVideo- Parameters:
data- data to tell the codec we're addingtimestamp- 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:
getDecoderConfigurationin interfaceIVideoStreamCodec- Overrides:
getDecoderConfigurationin classAbstractVideo- Returns:
- the data for decoder setup
-
getNumInterframes
public int getNumInterframes()Returns the number of interframes collected from last keyframe.- Specified by:
getNumInterframesin interfaceIVideoStreamCodec- Overrides:
getNumInterframesin classAbstractVideo- Returns:
- number of interframes
-
getInterframe
Gets data of interframe with the specified index.- Specified by:
getInterframein interfaceIVideoStreamCodec- Overrides:
getInterframein classAbstractVideo- 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)
-