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_DATAFields 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 TypeMethodDescriptionvoiddestroy()getFile()Returns the file.voidonOOBControlMessage(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg) onOOBControlMessage.voidPipe connection event handlervoidpushMessage(IPipe pipe, IMessage message) Pushes message through pipevoidsetAudioDecoderConfiguration(IRTMPEvent audioConfig) setAudioDecoderConfiguration.voidsetDelayWrite(boolean delayWrite) Deprecated.voidSets the file we're writing to.voidSets the recording mode.voidsetOfferTimeout(long offerTimeout) Amount of time in milliseconds to wait for an offer to be accepted.voidsetQueueThreshold(int queueThreshold) Sets the threshold for the queue.voidSets the scope for this consumer.voidsetupOutputPath(String name) Sets up the output file path for writing.voidsetUsePriority(boolean usePriority) Whether or not to use a PriorityBlockingQueue or LinkedBlockingQueue for data queue.voidsetVideoDecoderConfiguration(IRTMPEvent videoConfig) setVideoDecoderConfiguration.voidsetWaitForVideoKeyframe(boolean waitForVideoKeyframe) Whether or not to wait for the first keyframe before processing video frames.voiduninit()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:
pushMessagein interfaceIPushableConsumer- Parameters:
pipe- Pipemessage- Message- Throws:
IOException- if message could not be written
-
onOOBControlMessage
onOOBControlMessage.
Out-of-band control message handler- Specified by:
onOOBControlMessagein interfaceIMessageComponent- Parameters:
source- Message component sourcepipe- Connection pipeoobCtrlMsg- Out-of-band control message
-
onPipeConnectionEvent
Pipe connection event handler Pipe connection event handler- Specified by:
onPipeConnectionEventin 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:
setAudioDecoderConfigurationin interfaceIFileConsumer- Parameters:
audioConfig- aIRTMPEventobject
-
setVideoDecoderConfiguration
setVideoDecoderConfiguration.
- Specified by:
setVideoDecoderConfigurationin interfaceIFileConsumer- Parameters:
videoConfig- aIRTMPEventobject
-
destroy
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Throws:
Exception
-