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 Details

    • log

      protected static org.slf4j.Logger log
    • cache

      private static ICacheStore cache
    • writePostProcessors

      private static LinkedList<Class<IPostProcessor>> writePostProcessors
    • file

      private File file
    • generateMetadata

      private boolean generateMetadata
    • metaService

      private IMetaService metaService
    • metaData

      private IMetaData<?,?> metaData
  • Constructor Details

    • 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 source
      generateMetadata - Metadata generation option
  • Method Details

    • setCache

      public void setCache(ICacheStore cache)
      Sets the cache implementation to be used.
      Specified by:
      setCache in interface IFLV
      Parameters:
      cache - Cache store
    • 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:
      hasMetaData in interface IFLV
      Returns:
      boolean true if file has injected metadata, false otherwise
    • getMetaData

      public IMetaData getMetaData() throws FileNotFoundException
      Returns a map of the metadata
      Specified by:
      getMetaData in interface IFLV
      Returns:
      metadata File metadata
      Throws:
      FileNotFoundException - File not found
    • hasKeyFrameData

      public boolean hasKeyFrameData()
      Returns a boolean stating whether a flv has keyframedata
      Specified by:
      hasKeyFrameData in interface IFLV
      Returns:
      boolean true if file has keyframe metadata, false otherwise
    • setKeyFrameData

      public void setKeyFrameData(Map keyframedata)
      Sets the keyframe data of a flv file
      Specified by:
      setKeyFrameData in interface IFLV
      Parameters:
      keyframedata - Keyframe metadata
    • getKeyFrameData

      public Map getKeyFrameData()
      Gets the keyframe data
      Specified by:
      getKeyFrameData in interface IFLV
      Returns:
      keyframedata Keyframe metadata
    • refreshHeaders

      public void refreshHeaders() throws IOException
      Refreshes the headers. Usually used after data is added to the flv file
      Specified by:
      refreshHeaders in interface IFLV
      Throws:
      IOException - Any I/O exception
    • flushHeaders

      public void flushHeaders() throws IOException
      Flushes Header
      Specified by:
      flushHeaders in interface IFLV
      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:
      getReader in interface IStreamableFile
      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:
      readerFromNearestKeyFrame in interface IFLV
      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:
      getWriter in interface IStreamableFile
      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:
      getAppendWriter in interface IStreamableFile
      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:
      writerFromNearestKeyFrame in interface IFLV
      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:
      setMetaData in interface IFLV
      Parameters:
      meta - Metadata object
      Throws:
      FileNotFoundException - File not found
      IOException - Any other I/O exception
    • setMetaService

      public void setMetaService(IMetaService service)
      Sets the MetaService through Spring
      Specified by:
      setMetaService in interface IFLV
      Parameters:
      service - Metadata service