Package org.red5.io.mp4.impl
Class MP4
- java.lang.Object
-
- org.red5.io.mp4.impl.MP4
-
- All Implemented Interfaces:
IStreamableFile,IMP4
public class MP4 extends Object implements IMP4
A MP4Impl implements the MP4 api- Author:
- The Red5 Project, Paul Gregoire, (mondain@gmail.com)
-
-
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 voidflushHeaders()Flushes HeaderITagWritergetAppendWriter()Returns a Writer which is setup to append to the file.Map<?,?>getKeyFrameData()Gets the keyframe dataIMetaData<?,?>getMetaData()Returns a map of the metadataITagReadergetReader()Returns a reader to parse and read the tags inside the file.ITagWritergetWriter()Returns a writer that creates a new file or truncates existing contents.booleanhasKeyFrameData()Returns a boolean stating whether a mp4 has keyframedatabooleanhasMetaData()Returns a boolean stating whether the mp4 has metadataITagReaderreaderFromNearestKeyFrame(int seekPoint)Returns a Reader closest to the nearest keyframevoidrefreshHeaders()Refreshes the headers.voidsetKeyFrameData(Map<?,?> keyframedata)Sets the keyframe data of a mp4 filevoidsetMetaData(IMetaData<?,?> meta)Sets the metadatavoidsetMetaService(IMetaService service)Sets the MetaService through SpringITagWriterwriterFromNearestKeyFrame(int seekPoint)Returns a Writer based on the nearest key frame
-
-
-
Constructor Detail
-
MP4
public MP4()
Default constructor, used by Spring so that parameters may be injected.
-
MP4
public MP4(File file)
Create MP4 from given file source.- Parameters:
file- File source
-
-
Method Detail
-
hasMetaData
public boolean hasMetaData()
Returns a boolean stating whether the mp4 has metadata- Specified by:
hasMetaDatain interfaceIMP4- Returns:
- boolean
trueif file has injected metadata,falseotherwise
-
getMetaData
public IMetaData<?,?> getMetaData() throws FileNotFoundException
Returns a map of the metadata- Specified by:
getMetaDatain interfaceIMP4- Returns:
- metadata File metadata
- Throws:
FileNotFoundException- File not found
-
hasKeyFrameData
public boolean hasKeyFrameData()
Returns a boolean stating whether a mp4 has keyframedata- Specified by:
hasKeyFrameDatain interfaceIMP4- Returns:
- boolean
trueif file has keyframe metadata,falseotherwise
-
setKeyFrameData
public void setKeyFrameData(Map<?,?> keyframedata)
Sets the keyframe data of a mp4 file- Specified by:
setKeyFrameDatain interfaceIMP4- Parameters:
keyframedata- Keyframe metadata
-
getKeyFrameData
public Map<?,?> getKeyFrameData()
Gets the keyframe data- Specified by:
getKeyFrameDatain interfaceIMP4- Returns:
- keyframedata Keyframe metadata
-
refreshHeaders
public void refreshHeaders() throws IOExceptionRefreshes the headers. Usually used after data is added to the mp4 file- Specified by:
refreshHeadersin interfaceIMP4- Throws:
IOException- Any I/O exception
-
flushHeaders
public void flushHeaders() throws IOExceptionFlushes Header- Specified by:
flushHeadersin interfaceIMP4- Throws:
IOException- Any I/O exception
-
getReader
public ITagReader getReader() throws IOException
Returns a reader to parse and read the tags inside the file.- Specified by:
getReaderin interfaceIStreamableFile- Returns:
- the reader Tag reader
- Throws:
IOException- I/O exception
-
readerFromNearestKeyFrame
public ITagReader readerFromNearestKeyFrame(int seekPoint)
Returns a Reader closest to the nearest keyframe- Specified by:
readerFromNearestKeyFramein interfaceIMP4- Parameters:
seekPoint- Point in file we are seeking around- Returns:
- reader Tag reader closest to that point
-
getWriter
public ITagWriter getWriter() throws IOException
Returns a writer that creates a new file or truncates existing contents.- Specified by:
getWriterin interfaceIStreamableFile- Returns:
- the writer Tag writer
- Throws:
IOException- I/O exception
-
writerFromNearestKeyFrame
public ITagWriter writerFromNearestKeyFrame(int seekPoint)
Returns a Writer based on the nearest key frame- Specified by:
writerFromNearestKeyFramein interfaceIMP4- Parameters:
seekPoint- Point in file we are seeking around- Returns:
- writer Tag writer closest to that point
-
setMetaData
public void setMetaData(IMetaData<?,?> meta) throws IOException
Sets the metadata- Specified by:
setMetaDatain interfaceIMP4- Parameters:
meta- Metadata object- Throws:
FileNotFoundException- File not foundIOException- Any other I/O exception
-
setMetaService
public void setMetaService(IMetaService service)
Sets the MetaService through Spring- Specified by:
setMetaServicein interfaceIMP4- Parameters:
service- Metadata service
-
getAppendWriter
public ITagWriter getAppendWriter() throws IOException
Description copied from interface:IStreamableFileReturns a Writer which is setup to append to the file.- Specified by:
getAppendWriterin interfaceIStreamableFile- Returns:
- the writer Tag writer used for append mode
- Throws:
IOException- I/O exception
-
-