Package org.red5.server.stream.provider
Class FileProvider
java.lang.Object
org.red5.server.stream.provider.FileProvider
- All Implemented Interfaces:
IMessageComponent,IPassive,IPipeConnectionListener,IProvider,IPullableProvider,ISeekableProvider,IStreamTypeAwareProvider
public class FileProvider
extends Object
implements IPassive, ISeekableProvider, IPullableProvider, IPipeConnectionListener, IStreamTypeAwareProvider
Pullable provider for files
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FileSource filestatic final StringClass nameKeyframe metadataprivate static final org.slf4j.LoggerLoggerprivate IPipeConsumer pipeprivate ITagReaderTag readerprivate IScopeProvider scopeprivate intPosition at start -
Constructor Summary
ConstructorsConstructorDescriptionFileProvider(IScope scope, File file) Create file provider for given file and scope -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasVideo()Check if the provider contains video tags.private voidinit()Initializes file provider.voidonOOBControlMessage(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg) voidPipe connection event handlerpullMessage(IPipe pipe) pullMessage(IPipe pipe, long wait) intseek(int ts) Seek the provider to timestamp ts (in milliseconds).voidsetStart(int start) Setter for start positionprivate voiduninit()Reset
-
Field Details
-
log
private static final org.slf4j.Logger logLogger -
KEY
Class name -
scope
Provider scope -
file
Source file -
pipe
Consumer pipe -
reader
Tag reader -
keyFrameMeta
Keyframe metadata -
start
private int startPosition at start
-
-
Constructor Details
-
FileProvider
Create file provider for given file and scope- Parameters:
scope- Scopefile- File
-
-
Method Details
-
setStart
public void setStart(int start) Setter for start position- Parameters:
start- Start position
-
hasVideo
public boolean hasVideo()Check if the provider contains video tags.- Specified by:
hasVideoin interfaceIStreamTypeAwareProvider- Returns:
- provider has video
-
pullMessage
- Specified by:
pullMessagein interfaceIPullableProvider- Throws:
IOException
-
pullMessage
- Specified by:
pullMessagein interfaceIPullableProvider- Throws:
IOException
-
onPipeConnectionEvent
Pipe connection event handler- Specified by:
onPipeConnectionEventin interfaceIPipeConnectionListener- Parameters:
event- Pipe connection event
-
onOOBControlMessage
- Specified by:
onOOBControlMessagein interfaceIMessageComponent- Parameters:
source- Message component sourcepipe- Connection pipeoobCtrlMsg- Out-of-band control message
-
init
Initializes file provider. Creates streamable file factory and service, seeks to start position- Throws:
IOException
-
uninit
private void uninit()Reset -
seek
public int seek(int ts) Seek the provider to timestamp ts (in milliseconds).- Specified by:
seekin interfaceISeekableProvider- Parameters:
ts- Timestamp to seek to- Returns:
- Actual timestamp seeked to
-