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
Modifier and TypeFieldDescriptionprivate File
Source filestatic final String
Class nameKeyframe metadataprivate static final org.slf4j.Logger
Loggerprivate IPipe
Consumer pipeprivate ITagReader
Tag readerprivate IScope
Provider scopeprivate int
Position at start -
Constructor Summary
ConstructorDescriptionFileProvider
(IScope scope, File file) Create file provider for given file and scope -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasVideo()
Check if the provider contains video tags.private void
init()
Initializes file provider.void
onOOBControlMessage
(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg) void
Pipe connection event handlerpullMessage
(IPipe pipe) pullMessage
(IPipe pipe, long wait) int
seek
(int ts) Seek the provider to timestamp ts (in milliseconds).void
setStart
(int start) Setter for start positionprivate void
uninit()
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:
hasVideo
in interfaceIStreamTypeAwareProvider
- Returns:
- provider has video
-
pullMessage
- Specified by:
pullMessage
in interfaceIPullableProvider
- Throws:
IOException
-
pullMessage
- Specified by:
pullMessage
in interfaceIPullableProvider
- Throws:
IOException
-
onPipeConnectionEvent
Pipe connection event handler- Specified by:
onPipeConnectionEvent
in interfaceIPipeConnectionListener
- Parameters:
event
- Pipe connection event
-
onOOBControlMessage
- Specified by:
onOOBControlMessage
in 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:
seek
in interfaceISeekableProvider
- Parameters:
ts
- Timestamp to seek to- Returns:
- Actual timestamp seeked to
-