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 IStreamCodecInfoStream audio and video codec informationprotected longTimestamp the stream was created.protected booleanprotected booleanprotected org.slf4j.Loggerprotected AtomicReference<Notify> Stores the streams metadataprotected longTimestamp the stream was started.protected final AtomicReference<StreamState> Current stateprotected CopyOnWriteArraySet<PropertyChangeListener> ContainsPropertyChangeListeners registered with this stream and following its changes of state. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStateChangeListener(PropertyChangeListener listener) Adds to the list of listeners tracking changes of theStreamStateof this stream.protected voidfireStateChange(StreamState oldState, StreamState newState) Creates a newPropertyChangeEventand delivers it to all currently registered state listeners.Return codec information.longReturns 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.longReturns timestamp at which the stream was started.getState()Return stream state.protected IStreamAwareScopeHandlerReturn stream aware scope handler or null if scope is null.voidRemoves from the list of listeners tracking changes of theStreamStateof this stream.voidsetCodecInfo(IStreamCodecInfo codecInfo) Setter for codec info.voidsetMetaData(Notify metaData) Set the metadata.voidSetter for name.voidSetter for scope.voidsetState(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
ContainsPropertyChangeListeners 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 newPropertyChangeEventand delivers it to all currently registered state listeners.- Parameters:
oldState- theStreamStatewe had before the changenewState- theStreamStatewe had after the change
-
addStateChangeListener
Adds to the list of listeners tracking changes of theStreamStateof this stream.- Parameters:
listener- the listener to register
-
removeStateChangeListener
Removes from the list of listeners tracking changes of theStreamStateof this stream.- Parameters:
listener- the listener to remove
-
getName
Return stream name. -
getCodecInfo
Return codec information.- Specified by:
getCodecInfoin 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:
getCreationTimein interfaceIStream- Returns:
- creation timestamp
-
getStartTime
public long getStartTime()Returns timestamp at which the stream was started.- Specified by:
getStartTimein 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
-