Package org.red5.server.stream
Class AbstractStream
java.lang.Object
org.red5.server.stream.AbstractStream
- All Implemented Interfaces:
IStream
- Direct Known Subclasses:
AbstractClientStream
,ServerStream
Abstract base implementation of IStream. Contains codec information, stream name, scope, event handling, and provides stream start and
stop operations.
- Author:
- mondain
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IStreamCodecInfo
Stream audio and video codec informationprotected long
Timestamp the stream was created.protected boolean
protected boolean
protected org.slf4j.Logger
protected AtomicReference
<Notify> Stores the streams metadataprotected long
Timestamp the stream was started.protected final AtomicReference
<StreamState> Current stateprotected CopyOnWriteArraySet
<PropertyChangeListener> ContainsPropertyChangeListener
s registered with this stream and following its changes of state. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addStateChangeListener
(PropertyChangeListener listener) Adds to the list of listeners tracking changes of theStreamState
of this stream.protected void
fireStateChange
(StreamState oldState, StreamState newState) Creates a newPropertyChangeEvent
and delivers it to all currently registered state listeners.Return codec information.long
Returns timestamp at which the stream was created.Returns a copy of the metadata for the associated stream, if it exists.getName()
Return stream name.getScope()
Return scope.long
Returns timestamp at which the stream was started.getState()
Return stream state.protected IStreamAwareScopeHandler
Return stream aware scope handler or null if scope is null.void
Removes from the list of listeners tracking changes of theStreamState
of this stream.void
setCodecInfo
(IStreamCodecInfo codecInfo) Setter for codec info.void
setMetaData
(Notify metaData) Set the metadata.void
Setter for name.void
Setter for scope.void
setState
(StreamState newState) Sets the stream state.
-
Field Details
-
log
protected org.slf4j.Logger log -
isTrace
protected boolean isTrace -
isDebug
protected boolean isDebug -
codecInfo
Stream audio and video codec information -
metaData
Stores the streams metadata -
stateListeners
ContainsPropertyChangeListener
s registered with this stream and following its changes of state. -
creationTime
protected long creationTimeTimestamp the stream was created. -
startTime
protected long startTimeTimestamp the stream was started. -
state
Current state
-
-
Constructor Details
-
AbstractStream
public AbstractStream()
-
-
Method Details
-
fireStateChange
Creates a newPropertyChangeEvent
and delivers it to all currently registered state listeners.- Parameters:
oldState
- theStreamState
we had before the changenewState
- theStreamState
we had after the change
-
addStateChangeListener
Adds to the list of listeners tracking changes of theStreamState
of this stream.- Parameters:
listener
- the listener to register
-
removeStateChangeListener
Removes from the list of listeners tracking changes of theStreamState
of this stream.- Parameters:
listener
- the listener to remove
-
getName
Return stream name. -
getCodecInfo
Return codec information.- Specified by:
getCodecInfo
in interfaceIStream
- Returns:
- Stream codec information
-
getMetaData
Returns a copy of the metadata for the associated stream, if it exists.- Returns:
- stream meta data
-
setMetaData
Set the metadata.- Parameters:
metaData
- stream meta data
-
getScope
Return scope. -
getCreationTime
public long getCreationTime()Returns timestamp at which the stream was created.- Specified by:
getCreationTime
in interfaceIStream
- Returns:
- creation timestamp
-
getStartTime
public long getStartTime()Returns timestamp at which the stream was started.- Specified by:
getStartTime
in interfaceIStream
- Returns:
- started timestamp
-
setName
Setter for name.- Parameters:
name
- Stream name
-
setCodecInfo
Setter for codec info.- Parameters:
codecInfo
- Codec info
-
setScope
Setter for scope.- Parameters:
scope
- Scope
-
getState
Return stream state.- Returns:
- StreamState
-
setState
Sets the stream state.- Parameters:
newState
- stream state
-
getStreamAwareHandler
Return stream aware scope handler or null if scope is null.- Returns:
- IStreamAwareScopeHandler implementation
-