Class FileConsumer

java.lang.Object
org.red5.server.stream.consumer.FileConsumer
All Implemented Interfaces:
IFileConsumer, IConsumer, IMessageComponent, IPipeConnectionListener, IPushableConsumer, Constants, org.springframework.beans.factory.DisposableBean

public class FileConsumer extends Object implements Constants, IPushableConsumer, IPipeConnectionListener, org.springframework.beans.factory.DisposableBean, IFileConsumer
Consumer that pushes messages to a writer using priority / comparison.
Author:
The Red5 Project, Paul Gregoire (mondain@gmail.com)
  • Constructor Details

    • FileConsumer

      public FileConsumer()
      Default ctor
    • FileConsumer

      public FileConsumer(IScope scope, File file)
      Creates file consumer
      Parameters:
      scope - Scope of consumer
      file - File
    • FileConsumer

      public FileConsumer(IScope scope, String fileName, String mode)
      Creates file consumer
      Parameters:
      scope - Scope of consumer
      fileName - The file name without the extension
      mode - The recording mode
  • Method Details

    • pushMessage

      public void pushMessage(IPipe pipe, IMessage message) throws IOException
      Pushes message through pipe Push message through pipe
      Specified by:
      pushMessage in interface IPushableConsumer
      Parameters:
      pipe - Pipe
      message - Message
      Throws:
      IOException - if message could not be written
    • onOOBControlMessage

      public void onOOBControlMessage(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg)

      onOOBControlMessage.

      Out-of-band control message handler
      Specified by:
      onOOBControlMessage in interface IMessageComponent
      Parameters:
      source - Message component source
      pipe - Connection pipe
      oobCtrlMsg - Out-of-band control message
    • onPipeConnectionEvent

      public void onPipeConnectionEvent(PipeConnectionEvent event)
      Pipe connection event handler Pipe connection event handler
      Specified by:
      onPipeConnectionEvent in interface IPipeConnectionListener
      Parameters:
      event - Pipe connection event
    • uninit

      public void uninit()
      Reset or uninitialize
    • setupOutputPath

      public void setupOutputPath(String name)
      Sets up the output file path for writing.
      Parameters:
      name - output filename to use
    • setScope

      public void setScope(IScope scope)
      Sets the scope for this consumer.
      Parameters:
      scope - scope
    • setFile

      public void setFile(File file)
      Sets the file we're writing to.
      Parameters:
      file - file
    • getFile

      public File getFile()
      Returns the file.
      Returns:
      file
    • setQueueThreshold

      public void setQueueThreshold(int queueThreshold)
      Sets the threshold for the queue. When the threshold is met a worker is spawned to empty the sorted queue to the writer.
      Parameters:
      queueThreshold - number of items to queue before spawning worker
    • setDelayWrite

      @Deprecated public void setDelayWrite(boolean delayWrite)
      Deprecated.
      Sets whether or not to use the queue.
      Parameters:
      delayWrite - true to use the queue, false if not
    • setWaitForVideoKeyframe

      public void setWaitForVideoKeyframe(boolean waitForVideoKeyframe)
      Whether or not to wait for the first keyframe before processing video frames.
      Parameters:
      waitForVideoKeyframe - wait for key frame or not
    • setUsePriority

      public void setUsePriority(boolean usePriority)
      Whether or not to use a PriorityBlockingQueue or LinkedBlockingQueue for data queue.
      Parameters:
      usePriority - priority queue or blocking queue
    • setOfferTimeout

      public void setOfferTimeout(long offerTimeout)
      Amount of time in milliseconds to wait for an offer to be accepted.
      Parameters:
      offerTimeout - how long to wait for offer acceptance
    • setMode

      public void setMode(String mode)
      Sets the recording mode.
      Parameters:
      mode - either "record" or "append" depending on the type of action to perform
    • setAudioDecoderConfiguration

      public void setAudioDecoderConfiguration(IRTMPEvent audioConfig)

      setAudioDecoderConfiguration.

      Specified by:
      setAudioDecoderConfiguration in interface IFileConsumer
      Parameters:
      audioConfig - a IRTMPEvent object
    • setVideoDecoderConfiguration

      public void setVideoDecoderConfiguration(IRTMPEvent videoConfig)

      setVideoDecoderConfiguration.

      Specified by:
      setVideoDecoderConfiguration in interface IFileConsumer
      Parameters:
      videoConfig - a IRTMPEvent object
    • destroy

      public void destroy() throws Exception
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Throws:
      Exception