Package org.red5.io.mp3.impl
Class MP3Reader
- java.lang.Object
-
- org.red5.io.mp3.impl.MP3Reader
-
- All Implemented Interfaces:
IKeyFrameDataAnalyzer,ITagReader
public class MP3Reader extends Object implements ITagReader, IKeyFrameDataAnalyzer
Read MP3 files
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.red5.io.flv.IKeyFrameDataAnalyzer
IKeyFrameDataAnalyzer.KeyFrameMeta
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Loggerlog
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IKeyFrameDataAnalyzer.KeyFrameMetaanalyzeKeyFrames()Analyze and return keyframe metadata.voidclose()Closes the reader and free any allocated memory.voiddecodeHeader()Decode the header of the stream;longgetBytesRead()Returns the amount of bytes readlonggetDuration()Return length in secondsIStreamableFilegetFile()Return the file that is loaded.intgetOffset()Returns the offet lengthlonggetTotalBytes()Get the total readable bytes in a file or ByteBuffer.booleanhasMoreTags()Returns a boolean stating whether the FLV has more tagsbooleanhasVideo()A MP3 stream never has video.voidposition(long pos)Move the reader pointer to given position in file.ITagreadTag()Returns a Tag objectvoidsetFrameCache(IKeyFrameMetaCache frameCache)
-
-
-
Constructor Detail
-
MP3Reader
public MP3Reader(File file) throws IOException
Creates reader from file input stream- Parameters:
file- file input- Throws:
IOException- on IO error
-
-
Method Detail
-
hasVideo
public boolean hasVideo()
A MP3 stream never has video.- Specified by:
hasVideoin interfaceITagReader- Returns:
- always returns
false
-
setFrameCache
public void setFrameCache(IKeyFrameMetaCache frameCache)
-
getFile
public IStreamableFile getFile()
Return the file that is loaded.- Specified by:
getFilein interfaceITagReader- Returns:
- the file to be loaded
-
getOffset
public int getOffset()
Returns the offet length- Specified by:
getOffsetin interfaceITagReader- Returns:
- int
-
getBytesRead
public long getBytesRead()
Returns the amount of bytes read- Specified by:
getBytesReadin interfaceITagReader- Returns:
- long
-
getDuration
public long getDuration()
Return length in seconds- Specified by:
getDurationin interfaceITagReader- Returns:
- length in seconds
-
getTotalBytes
public long getTotalBytes()
Get the total readable bytes in a file or ByteBuffer.- Specified by:
getTotalBytesin interfaceITagReader- Returns:
- Total readable bytes
-
hasMoreTags
public boolean hasMoreTags()
Returns a boolean stating whether the FLV has more tags- Specified by:
hasMoreTagsin interfaceITagReader- Returns:
- boolean
-
readTag
public ITag readTag()
Returns a Tag object- Specified by:
readTagin interfaceITagReader- Returns:
- Tag
-
close
public void close()
Closes the reader and free any allocated memory.- Specified by:
closein interfaceITagReader
-
decodeHeader
public void decodeHeader()
Decode the header of the stream;- Specified by:
decodeHeaderin interfaceITagReader
-
position
public void position(long pos)
Move the reader pointer to given position in file.- Specified by:
positionin interfaceITagReader- Parameters:
pos- File position to move to
-
analyzeKeyFrames
public IKeyFrameDataAnalyzer.KeyFrameMeta analyzeKeyFrames()
Analyze and return keyframe metadata.- Specified by:
analyzeKeyFramesin interfaceIKeyFrameDataAnalyzer- Returns:
- Metadata object
-
-