Package org.red5.io.flv.impl
Class FLV
- java.lang.Object
-
- org.red5.io.flv.impl.FLV
-
- All Implemented Interfaces:
IFLV,IStreamableFile
public class FLV extends Object implements IFLV
A FLVImpl implements the FLV api- Author:
- The Red5 Project, Dominick Accattato (daccattato@gmail.com), Luke Hubbard, Codegent Ltd (luke@codegent.com), Paul Gregoire (mondain@gmail.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description FLV()Default constructor, used by Spring so that parameters may be injected.FLV(File file)Create FLV from given file sourceFLV(File file, boolean generateMetadata)Create FLV from given file source and with specified metadata generation option
-
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.MapgetKeyFrameData()Gets the keyframe dataIMetaDatagetMetaData()Returns a map of the metadataITagReadergetReader()Returns a reader to parse and read the tags inside the file.LinkedList<Class<IPostProcessor>>getWritePostProcessors()ITagWritergetWriter()Returns a writer that creates a new file or truncates existing contents.booleanhasKeyFrameData()Returns a boolean stating whether a flv has keyframedatabooleanhasMetaData()Returns a boolean stating whether the flv has metadataITagReaderreaderFromNearestKeyFrame(int seekPoint)Returns a Reader closest to the nearest keyframevoidrefreshHeaders()Refreshes the headers.voidsetCache(ICacheStore cache)Sets the cache implementation to be used.voidsetKeyFrameData(Map keyframedata)Sets the keyframe data of a flv filevoidsetMetaData(IMetaData meta)Sets the metadatavoidsetMetaService(IMetaService service)Sets the MetaService through SpringvoidsetWriterPostProcessor(String writerPostProcessor)Sets a writer post processor.voidsetWriterPostProcessors(Set<String> writerPostProcessors)Sets a group of writer post processors.ITagWriterwriterFromNearestKeyFrame(int seekPoint)Returns a Writer based on the nearest key frame
-
-
-
Constructor Detail
-
FLV
public FLV()
Default constructor, used by Spring so that parameters may be injected.
-
FLV
public FLV(File file)
Create FLV from given file source- Parameters:
file- File source
-
FLV
public FLV(File file, boolean generateMetadata)
Create FLV from given file source and with specified metadata generation option- Parameters:
file- File sourcegenerateMetadata- Metadata generation option
-
-
Method Detail
-
setCache
public void setCache(ICacheStore cache)
Sets the cache implementation to be used.
-
setWriterPostProcessor
public void setWriterPostProcessor(String writerPostProcessor)
Sets a writer post processor.- Parameters:
writerPostProcessor- IPostProcess implementation class name
-
setWriterPostProcessors
public void setWriterPostProcessors(Set<String> writerPostProcessors)
Sets a group of writer post processors.- Parameters:
writerPostProcessors- IPostProcess implementation class names
-
getWritePostProcessors
public LinkedList<Class<IPostProcessor>> getWritePostProcessors()
-
hasMetaData
public boolean hasMetaData()
Returns a boolean stating whether the flv has metadata- Specified by:
hasMetaDatain interfaceIFLV- Returns:
- boolean
trueif file has injected metadata,falseotherwise
-
getMetaData
public IMetaData getMetaData() throws FileNotFoundException
Returns a map of the metadata- Specified by:
getMetaDatain interfaceIFLV- Returns:
- metadata File metadata
- Throws:
FileNotFoundException- File not found
-
hasKeyFrameData
public boolean hasKeyFrameData()
Returns a boolean stating whether a flv has keyframedata- Specified by:
hasKeyFrameDatain interfaceIFLV- Returns:
- boolean
trueif file has keyframe metadata,falseotherwise
-
setKeyFrameData
public void setKeyFrameData(Map keyframedata)
Sets the keyframe data of a flv file- Specified by:
setKeyFrameDatain interfaceIFLV- Parameters:
keyframedata- Keyframe metadata
-
getKeyFrameData
public Map getKeyFrameData()
Gets the keyframe data- Specified by:
getKeyFrameDatain interfaceIFLV- Returns:
- keyframedata Keyframe metadata
-
refreshHeaders
public void refreshHeaders() throws IOExceptionRefreshes the headers. Usually used after data is added to the flv file- Specified by:
refreshHeadersin interfaceIFLV- Throws:
IOException- Any I/O exception
-
flushHeaders
public void flushHeaders() throws IOExceptionFlushes Header- Specified by:
flushHeadersin interfaceIFLV- 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 interfaceIFLV- 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
-
getAppendWriter
public ITagWriter getAppendWriter() throws IOException
Returns 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
-
writerFromNearestKeyFrame
public ITagWriter writerFromNearestKeyFrame(int seekPoint)
Returns a Writer based on the nearest key frame- Specified by:
writerFromNearestKeyFramein interfaceIFLV- 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 interfaceIFLV- 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 interfaceIFLV- Parameters:
service- Metadata service
-
-