Package org.red5.server.stream.consumer
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)
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.red5.server.net.rtmp.message.Constants
Constants.DataType
-
Field Summary
Fields inherited from interface org.red5.server.net.rtmp.message.Constants
HANDSHAKE_SIZE, HEADER_CONTINUE, HEADER_NEW, HEADER_SAME_SOURCE, HEADER_TIMER_CHANGE, MEDIUM_INT_MAX, SO_CLIENT_CLEAR_DATA, SO_CLIENT_DELETE_DATA, SO_CLIENT_INITIAL_DATA, SO_CLIENT_SEND_MESSAGE, SO_CLIENT_STATUS, SO_CLIENT_UPDATE_ATTRIBUTE, SO_CLIENT_UPDATE_DATA, SO_CONNECT, SO_DELETE_ATTRIBUTE, SO_DISCONNECT, SO_SEND_MESSAGE, SO_SET_ATTRIBUTE, SOURCE_TYPE_LIVE, SOURCE_TYPE_VOD, TYPE_ABORT, TYPE_AGGREGATE, TYPE_AUDIO_DATA, TYPE_BYTES_READ, TYPE_CHUNK_SIZE, TYPE_CLIENT_BANDWIDTH, TYPE_EDGE_ORIGIN, TYPE_FLEX_MESSAGE, TYPE_FLEX_SHARED_OBJECT, TYPE_FLEX_STREAM_SEND, TYPE_INVOKE, TYPE_NOTIFY, TYPE_PING, TYPE_SERVER_BANDWIDTH, TYPE_SHARED_OBJECT, TYPE_STREAM_METADATA, TYPE_VIDEO_DATA
Fields inherited from interface org.red5.server.messaging.IPushableConsumer
KEY
-
Constructor Summary
ConstructorsConstructorDescriptionDefault ctorFileConsumer
(IScope scope, File file) Creates file consumerFileConsumer
(IScope scope, String fileName, String mode) Creates file consumer -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
getFile()
Returns the file.void
onOOBControlMessage
(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg) onOOBControlMessage.void
Pipe connection event handlervoid
pushMessage
(IPipe pipe, IMessage message) Pushes message through pipevoid
setAudioDecoderConfiguration
(IRTMPEvent audioConfig) setAudioDecoderConfiguration.void
setDelayWrite
(boolean delayWrite) Deprecated.void
Sets the file we're writing to.void
Sets the recording mode.void
setOfferTimeout
(long offerTimeout) Amount of time in milliseconds to wait for an offer to be accepted.void
setQueueThreshold
(int queueThreshold) Sets the threshold for the queue.void
Sets the scope for this consumer.void
setupOutputPath
(String name) Sets up the output file path for writing.void
setUsePriority
(boolean usePriority) Whether or not to use a PriorityBlockingQueue or LinkedBlockingQueue for data queue.void
setVideoDecoderConfiguration
(IRTMPEvent videoConfig) setVideoDecoderConfiguration.void
setWaitForVideoKeyframe
(boolean waitForVideoKeyframe) Whether or not to wait for the first keyframe before processing video frames.void
uninit()
Reset or uninitialize
-
Constructor Details
-
FileConsumer
public FileConsumer()Default ctor -
FileConsumer
Creates file consumer- Parameters:
scope
- Scope of consumerfile
- File
-
FileConsumer
Creates file consumer- Parameters:
scope
- Scope of consumerfileName
- The file name without the extensionmode
- The recording mode
-
-
Method Details
-
pushMessage
Pushes message through pipe Push message through pipe- Specified by:
pushMessage
in interfaceIPushableConsumer
- Parameters:
pipe
- Pipemessage
- Message- Throws:
IOException
- if message could not be written
-
onOOBControlMessage
onOOBControlMessage.
Out-of-band control message handler- Specified by:
onOOBControlMessage
in interfaceIMessageComponent
- Parameters:
source
- Message component sourcepipe
- Connection pipeoobCtrlMsg
- Out-of-band control message
-
onPipeConnectionEvent
Pipe connection event handler Pipe connection event handler- Specified by:
onPipeConnectionEvent
in interfaceIPipeConnectionListener
- Parameters:
event
- Pipe connection event
-
uninit
public void uninit()Reset or uninitialize -
setupOutputPath
Sets up the output file path for writing.- Parameters:
name
- output filename to use
-
setScope
Sets the scope for this consumer.- Parameters:
scope
- scope
-
setFile
Sets the file we're writing to.- Parameters:
file
- 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.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
Sets the recording mode.- Parameters:
mode
- either "record" or "append" depending on the type of action to perform
-
setAudioDecoderConfiguration
setAudioDecoderConfiguration.
- Specified by:
setAudioDecoderConfiguration
in interfaceIFileConsumer
- Parameters:
audioConfig
- aIRTMPEvent
object
-
setVideoDecoderConfiguration
setVideoDecoderConfiguration.
- Specified by:
setVideoDecoderConfiguration
in interfaceIFileConsumer
- Parameters:
videoConfig
- aIRTMPEvent
object
-
destroy
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
Exception
-