public class FileConsumer extends Object implements Constants, IPushableConsumer, IPipeConnectionListener, InitializingBean, DisposableBean
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_DATAKEY| Constructor and Description |
|---|
FileConsumer()
Default ctor
|
FileConsumer(IScope scope,
File file)
Creates file consumer
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
destroy() |
void |
doWrites()
Write all the queued items to the writer.
|
void |
doWrites(org.red5.server.stream.consumer.FileConsumer.QueuedData[] slice)
Write a slice of the queued items to the writer.
|
File |
getFile()
Returns the file.
|
int |
getQueueThreshold()
Returns the size of the delayed writing queue.
|
int |
getSchedulerThreadSize() |
boolean |
isDelayWrite()
Whether or not the queue should be utilized.
|
void |
onOOBControlMessage(IMessageComponent source,
IPipe pipe,
OOBControlMessage oobCtrlMsg)
Out-of-band control message handler
|
void |
onPipeConnectionEvent(PipeConnectionEvent event)
Pipe connection event handler
|
void |
pushMessage(IPipe pipe,
IMessage message)
Push message through pipe
|
void |
setAudioDecoderConfiguration(IRTMPEvent decoderConfig)
Sets a audio decoder configuration; some codecs require this, such as AAC.
|
void |
setDelayWrite(boolean delayWrite)
Sets whether or not to use the queue.
|
void |
setFile(File file)
Sets the file we're writing to.
|
void |
setMode(String mode)
Sets the recording mode.
|
void |
setQueueThreshold(int queueThreshold)
Sets the threshold for the queue.
|
void |
setSchedulerThreadSize(int schedulerThreadSize) |
void |
setScope(IScope scope)
Sets the scope for this consumer.
|
void |
setVideoDecoderConfiguration(IRTMPEvent decoderConfig)
Sets a video decoder configuration; some codecs require this, such as AVC.
|
void |
uninit()
Reset or uninitialize
|
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface InitializingBeanExceptionpublic void pushMessage(IPipe pipe, IMessage message) throws IOException
pushMessage in interface IPushableConsumerpipe - Pipemessage - Message to pushIOException - if message could not be writtenpublic void onOOBControlMessage(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg)
onOOBControlMessage in interface IMessageComponentsource - Source of messagepipe - Pipe that is used to transmit OOB messageoobCtrlMsg - OOB control messagepublic void onPipeConnectionEvent(PipeConnectionEvent event)
onPipeConnectionEvent in interface IPipeConnectionListenerevent - Pipe connection eventpublic void uninit()
public final void doWrites()
public final void doWrites(org.red5.server.stream.consumer.FileConsumer.QueuedData[] slice)
slice - set of queued datapublic void setVideoDecoderConfiguration(IRTMPEvent decoderConfig)
decoderConfig - video codec configurationpublic void setAudioDecoderConfiguration(IRTMPEvent decoderConfig)
decoderConfig - audio codec configurationpublic void setScope(IScope scope)
scope - scopepublic void setFile(File file)
file - filepublic File getFile()
public void setQueueThreshold(int queueThreshold)
queueThreshold - number of items to queue before spawning workerpublic int getQueueThreshold()
public boolean isDelayWrite()
public void setDelayWrite(boolean delayWrite)
delayWrite - true to use the queue, false if notpublic int getSchedulerThreadSize()
public void setSchedulerThreadSize(int schedulerThreadSize)
schedulerThreadSize - the schedulerThreadSize to setpublic void setMode(String mode)
mode - either "record" or "append" depending on the type of action to performpublic void destroy()
throws Exception
destroy in interface DisposableBeanExceptionCopyright © 2005–2017 Red5. All rights reserved.