|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.red5.io.mp4.impl.MP4Reader
public class MP4Reader
This reader is used to read the contents of an MP4 file. NOTE: This class is not implemented as thread-safe, the caller should ensure the thread-safety.
New NetStream notifications
Two new notifications facilitate the implementation of the playback components:
| Field Summary | |
|---|---|
static byte[] |
AUDIO_CONFIG_FRAME_AAC_LC
Audio config aac lc |
static byte[] |
AUDIO_CONFIG_FRAME_AAC_MAIN
Audio config aac main |
static byte[] |
AUDIO_CONFIG_FRAME_SBR
Audio config sbr |
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 |
| Constructor Summary | |
|---|---|
MP4Reader(File f)
Creates MP4 reader from file input stream, sets up metadata generation flag. |
|
| Method Summary | |
|---|---|
void |
analyzeFrames()
Performs frame analysis and generates metadata for use in seeking. |
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. |
String |
getAudioCodecId()
|
long |
getBytesRead()
Returns the amount of bytes read |
long |
getDuration()
Return length in seconds |
IStreamableFile |
getFile()
Return the file that is loaded. |
IoBuffer |
getFileData()
Returns the file buffer. |
long |
getFramePosition(int timestamp)
Returns the position of a frame given the timestamp. |
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)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final byte[] PREFIX_AUDIO_FRAME
public static final byte[] AUDIO_CONFIG_FRAME_AAC_MAIN
public static final byte[] AUDIO_CONFIG_FRAME_AAC_LC
public static final byte[] AUDIO_CONFIG_FRAME_SBR
public static final byte[] PREFIX_VIDEO_CONFIG_FRAME
public static final byte[] PREFIX_VIDEO_KEYFRAME
public static final byte[] PREFIX_VIDEO_FRAME
| Constructor Detail |
|---|
public MP4Reader(File f)
throws IOException
f - File input stream
IOException| Method Detail |
|---|
public void decodeHeader()
decodeHeader in interface ITagReaderpublic long getTotalBytes()
getTotalBytes in interface ITagReaderpublic boolean hasVideo()
hasVideo in interface ITagReaderpublic 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 long getFramePosition(int timestamp)
timestamp -
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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||