public class MP4Reader extends Object implements IoConstants, ITagReader, IKeyFrameDataAnalyzer
IKeyFrameDataAnalyzer.KeyFrameMeta| Modifier and Type | Field and Description |
|---|---|
static byte[] |
EMPTY_AAC
Blank AAC data
|
static byte[] |
PREFIX_AUDIO_CONFIG_FRAME
Audio packet prefix for the decoder frame
|
static byte[] |
PREFIX_AUDIO_FRAME
Audio packet prefix
|
static byte[] |
PREFIX_VIDEO_CONFIG_FRAME
Video packet prefix for the decoder frame
|
static byte[] |
PREFIX_VIDEO_FRAME
Video packet prefix for standard frames (interframe)
|
static byte[] |
PREFIX_VIDEO_KEYFRAME
Video packet prefix for key frames
|
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_VIDEO| Constructor and Description |
|---|
MP4Reader(File f)
Creates MP4 reader from file input stream, sets up metadata generation flag.
|
| Modifier and Type | Method and Description |
|---|---|
void |
analyzeFrames()
Performs frame analysis and generates metadata for use in seeking.
|
IKeyFrameDataAnalyzer.KeyFrameMeta |
analyzeKeyFrames()
Analyze and return keyframe metadata.
|
void |
close()
Closes the reader and free any allocated memory.
|
void |
decodeHeader()
This handles the moov atom being at the beginning or end of the file, so the mdat may also be before or after the moov atom.
|
static void |
dumpBox(org.mp4parser.Container box)
Dumps the children of a container box.
|
String |
getAudioCodecId() |
long |
getBytesRead()
Returns the amount of bytes read
|
long |
getDuration()
Return length in seconds
|
IStreamableFile |
getFile()
Return the file that is loaded.
|
org.apache.mina.core.buffer.IoBuffer |
getFileData()
Returns the file buffer.
|
int |
getOffset()
Returns the offet length
|
long |
getTotalBytes()
Get the total readable bytes in a file or IoBuffer.
|
String |
getVideoCodecId() |
boolean |
hasMoreTags()
Returns a boolean stating whether the FLV has more tags
|
boolean |
hasVideo()
Check if the reader also has video tags.
|
void |
position(long pos)
Put the current position to pos.
|
ITag |
readTag()
Packages media data for return to providers
|
ITag |
readTagHeader() |
void |
setAudioCodecId(String audioCodecId) |
void |
setVideoCodecId(String videoCodecId) |
public static final byte[] PREFIX_AUDIO_CONFIG_FRAME
public static final byte[] PREFIX_AUDIO_FRAME
public static final byte[] EMPTY_AAC
public static final byte[] PREFIX_VIDEO_CONFIG_FRAME
public static final byte[] PREFIX_VIDEO_KEYFRAME
public static final byte[] PREFIX_VIDEO_FRAME
public MP4Reader(File f) throws IOException
f - File input streamIOException - on IO exceptionpublic void decodeHeader()
decodeHeader in interface ITagReaderpublic static void dumpBox(org.mp4parser.Container box)
box - mp4 boxpublic long getTotalBytes()
getTotalBytes in interface ITagReaderpublic boolean hasVideo()
hasVideo in interface ITagReaderpublic org.apache.mina.core.buffer.IoBuffer getFileData()
public IStreamableFile getFile()
getFile in interface ITagReaderpublic int getOffset()
getOffset in interface ITagReaderpublic long getBytesRead()
getBytesRead in interface ITagReaderpublic long getDuration()
getDuration in interface ITagReaderpublic String getVideoCodecId()
public String getAudioCodecId()
public boolean hasMoreTags()
hasMoreTags in interface ITagReaderpublic ITag readTag()
readTag in interface ITagReaderpublic void analyzeFrames()
public void position(long pos)
position in interface ITagReaderpos - position to move to in file / channelpublic void close()
close in interface ITagReaderpublic void setVideoCodecId(String videoCodecId)
public void setAudioCodecId(String audioCodecId)
public ITag readTagHeader()
public IKeyFrameDataAnalyzer.KeyFrameMeta analyzeKeyFrames()
IKeyFrameDataAnalyzeranalyzeKeyFrames in interface IKeyFrameDataAnalyzerCopyright © 2005–2017 Red5. All rights reserved.