Package com.wowza.wms.stream
Class MediaStreamMap
Object
com.wowza.wms.stream.MediaStreamMap
MediaStreamMap: collection of IMediaStream object. This collection is usually attached to an IApplicationInstance object.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IApplicationInstance
boolean
protected Map<String,
ILiveStreamDvrRecorder> protected Map<String,
ILiveStreamPacketizer> static final int
protected List<IMediaStreamNotify>
protected long
protected int
protected List<com.wowza.wms.stream.MediaStreamMapGroup>
protected AtomicLong
protected Map<ILiveStreamPacketizer,
Map<Integer, com.wowza.wms.client.LicenseHolder>> protected edu.emory.mathcs.backport.java.util.concurrent.locks.WMSReadWriteLock
protected Map<String,
IMediaStream> protected edu.emory.mathcs.backport.java.util.concurrent.locks.WMSReadWriteLock
protected Map<Long,
IMediaStream> -
Constructor Summary
ConstructorsConstructorDescriptionMediaStreamMap
(IApplicationInstance appInstance) Create empty MediaStreamMap collection -
Method Summary
Modifier and TypeMethodDescriptioncom.wowza.wms.client.LicenseHolder
addLicense
(IMediaStream stream, int licenseType) com.wowza.wms.client.LicenseHolder
addLicense
(ILiveStreamPacketizer liveStreamPacketizer, int licenseType) void
addMediaStreamListener
(IMediaStreamNotify mediaStreamListener) Add a media stream listener.com.wowza.wms.stream.MediaStreamMapGroup
addNameGroup
(com.wowza.wms.stream.MediaStreamMapGroup newGroup) void
broadcasePlayMessage
(IMediaStream stream, long timecode, ByteBuffer msg, int objectEncoding) Send a broadcast message to all play stream that are listening to this live published stream.int
Get the minimum object encoding level for the clients playing this stream.void
clearStreamName
(String name) Unregister a published live media stream name.void
clearStreamName
(String name, IMediaStream stream) Unregister a published live media stream name.void
closeLiveStreamPacketizer
(String streamName, String packetizerName) Close live stream packetizer by sending the last data receivedvoid
Get the parent applicationInstance.Get the name of the parent applicationInstance.Get the name of the parent application.int
getCount()
Get the total number of streams stored in the mediaStreamMapgetDvrRecorder
(String streamName, String recorderName, boolean doCreate) Get a DVR recorder by name and recorder nameReturns a list of ILiveStreamDvrRecorder objectsgetLiveStreamPacketizer
(String streamName, String packetizerName, boolean doCreate) Get a live stream packetizer by name and packetizer idGet the lock to the live stream packetizer systemcom.wowza.wms.stream.MediaStreamMapGroup
getNameGroupByGroupName
(String groupName) int
Set<com.wowza.wms.stream.MediaStreamMapGroup>
Set<com.wowza.wms.stream.MediaStreamMapGroup>
getNameGroups
(String streamName) getNameGroupStreamNames
(String streamName) long
getNextNameGroupId
(com.wowza.wms.stream.MediaStreamMapGroup newGroup) int
Reserve a clientless stream id for a new media stream.int
getNextStreamIndex
(IClient client) Reserve a stream for a client connection.int
getNextStreamIndex
(INetConnection netConnection) Reserve a stream for a netConnection connection.Returns a List of published stream namesGet a media stream reference by stream id.Get a media stream reference by stream id.getStream
(INetConnection netConnection, int index) Get a media stream object that is owned by a server to server netConnection object (not yet implemented).getStream
(INetConnection netConnection, int index, boolean doCreate) Get a media stream reference by stream id.Get a media stream by stream name.getStreamClientless
(int index, String streamTypeStr) Get a media stream reference by stream id.edu.emory.mathcs.backport.java.util.concurrent.locks.WMSReadWriteLock
Get the underlying read/write lock associated with the list of streamsedu.emory.mathcs.backport.java.util.concurrent.locks.WMSReadWriteLock
Get the underlying read/write lock associated with the stream names listReturns a list of IMediaStream objectsgetVHost()
Get the parent vHost.void
notifyMediaStreamCreate
(IMediaStream mediaStream) Notify all media stream listeners that a new media stream object has been created.void
notifyMediaStreamDestroy
(IMediaStream mediaStream) Notify all media stream listeners that a media stream object is being destroyed.void
notifyPlayPublish
(IMediaStream stream) Notify all play streams that are listening to this stream that the stream is going into a state of publish (NetStream.Play.PublishNotify).void
notifyPlayUnpublish
(IMediaStream stream) Notify all play streams that are listening to this stream that the stream is going into a state of unpublished (NetStream.Play.UnpublishNotify).void
notifyPlayUnpublish
(String streamName) Notify all play streams that are listening to this stream name that the stream is going into a state of unpublished (NetStream.Play.UnpublishNotify).void
removeDvrRecorder
(String streamName) removeDvrRecorder
(String streamName, String recorderName) Remove DVR Recordervoid
removeLiveStreamPacketizer
(String streamName) Remove all live stream packetizers for this stream nameremoveLiveStreamPacketizer
(String streamName, String packetizerName) Remove live stream packetizervoid
removeMediaStreamListener
(IMediaStreamNotify mediaStreamListener) Remove a media stream listener.com.wowza.wms.stream.MediaStreamMapGroup
removeNameGroup
(int groupId) com.wowza.wms.stream.MediaStreamMapGroup
removeNameGroup
(com.wowza.wms.stream.MediaStreamMapGroup nameGroup) void
removeStream
(int index) Remove a clientless media streamvoid
removeStream
(IClient client, int index) Remove a stream associated with a client connectionvoid
removeStream
(INetConnection netConnection, int index) Remove a stream associated with a netConnection objectvoid
setNameGroupRemoveDelayTime
(int nameGroupRemoveDelayTime) void
setStreamName
(IMediaStream stream, String name) Insert live media stream into the mediaStreamMap by name.long
streamToIndex
(IMediaStream stream) Get the unique stream identifier for a given stream
-
Field Details
-
MAXSTREAMINDEX
public static final int MAXSTREAMINDEX- See Also:
-
debugDVRShutdown
public boolean debugDVRShutdown -
streams
-
streamNames
-
streamLicenses
-
packetizerLicenses
protected Map<ILiveStreamPacketizer,Map<Integer, packetizerLicensescom.wowza.wms.client.LicenseHolder>> -
streamNameToGroup
-
nameGroups
-
nameGroupId
protected long nameGroupId -
nameGroupRemoveDelayTime
protected int nameGroupRemoveDelayTime -
nameGroupDelayRemoveMap
-
streamLock
protected edu.emory.mathcs.backport.java.util.concurrent.locks.WMSReadWriteLock streamLock -
streamNamesLock
protected edu.emory.mathcs.backport.java.util.concurrent.locks.WMSReadWriteLock streamNamesLock -
appInstance
-
mediaStreamListeners
-
nextStreamId
-
liveStreamPacketizers
-
dvrRecorders
-
-
Constructor Details
-
MediaStreamMap
Create empty MediaStreamMap collection- Parameters:
appInstance
- parent applicationInstance
-
-
Method Details
-
getStreamListLock
public edu.emory.mathcs.backport.java.util.concurrent.locks.WMSReadWriteLock getStreamListLock()Get the underlying read/write lock associated with the list of streams- Returns:
- underlying read/write lock associated with the list of streams
-
getStreamNameLock
public edu.emory.mathcs.backport.java.util.concurrent.locks.WMSReadWriteLock getStreamNameLock()Get the underlying read/write lock associated with the stream names list- Returns:
- underlying read/write lock associated with the stream names list
-
getPublishStreamNames
Returns a List of published stream names- Returns:
- List of published stream names
-
getStreams
Returns a list of IMediaStream objects- Returns:
- list of IMediaStream objects
-
getStream
Get a media stream reference by stream id.- Parameters:
client
- clientindex
- stream id- Returns:
- media stream object or null if does not exist.
-
getStreamClientless
Get a media stream reference by stream id. If it does not exist, create a new one with the given id. This is a clientless stream that is served by the backend of the server. If creating a new media stream object, its id must first be obtained by callinggetNextStreamIndex()
.- Parameters:
index
- stream idstreamTypeStr
- stream type- Returns:
- media stream object
-
getStream
Get a media stream reference by stream id. If it does not exist, create a new one with the given id. If creating a new media stream object, its id must first be obtained by callinggetNextStreamIndex(IClient)
.- Parameters:
client
- clientindex
- stream iddoCreate
- true to create if it does not exist- Returns:
- media stream object
-
getStream
Get a media stream object that is owned by a server to server netConnection object (not yet implemented).- Parameters:
netConnection
- netConnection to remote serverindex
- stream id- Returns:
- media stream object or null if does not exist
-
getStream
Get a media stream reference by stream id. If it does not exist, create a new one with the given id. If creating a new media stream object, its id must first be obtained by callinggetNextStreamIndex(INetConnection)
.- Parameters:
netConnection
- netConnection to remote serverindex
- stream iddoCreate
- true to create if it does not exist- Returns:
- media stream object
-
getStream
Get a media stream by stream name. Only published live streams are stored in the mediaStreamMap by name. This method is used to lookup a published live stream by name.- Parameters:
name
- stream name- Returns:
- media stream object or null if does not exist
-
setStreamName
Insert live media stream into the mediaStreamMap by name.- Parameters:
stream
- mediea stream objectname
- media stream name
-
clearStreamName
Unregister a published live media stream name.- Parameters:
name
- stream name
-
streamToIndex
Get the unique stream identifier for a given stream- Parameters:
stream
- stream- Returns:
- unique stream identifier
-
clearStreamName
Unregister a published live media stream name.- Parameters:
name
- stream namestream
- stream
-
getNextStreamIndex
Reserve a stream for a netConnection connection. UsegetStream(INetConnection, int, boolean)
to create stream.- Parameters:
netConnection
-- Returns:
- next stream index
-
getNextStreamIndex
Reserve a stream for a client connection. UsegetStream(IClient, int, boolean)
to create stream.- Parameters:
client
- parent client- Returns:
- stream index
-
getNextStreamIndex
public int getNextStreamIndex()Reserve a clientless stream id for a new media stream. Use this method to obtain a stream id for a new media stream object that is then created with a call to getClientlessStream().- Returns:
- new reserved stream id
-
getCount
public int getCount()Get the total number of streams stored in the mediaStreamMap- Returns:
- total number of streams stored in the mediaStreamMap
-
removeStream
Remove a stream associated with a netConnection object- Parameters:
netConnection
- net connectionindex
- stream index
-
removeStream
Remove a stream associated with a client connection- Parameters:
client
- clientindex
- stream index
-
removeStream
public void removeStream(int index) Remove a clientless media stream- Parameters:
index
- stream index
-
getAppName
Get the name of the parent application.- Returns:
- parent application name.
-
getAppInstanceName
Get the name of the parent applicationInstance.- Returns:
- parent applicationInstance name
-
getVHost
Get the parent vHost.- Returns:
- parent vHost
-
getAppInstance
Get the parent applicationInstance.- Returns:
- parent applicationInstance
-
notifyPlayUnpublish
Notify all play streams that are listening to this stream that the stream is going into a state of unpublished (NetStream.Play.UnpublishNotify).- Parameters:
stream
- live published stream that is being unpublished
-
notifyPlayUnpublish
Notify all play streams that are listening to this stream name that the stream is going into a state of unpublished (NetStream.Play.UnpublishNotify).- Parameters:
streamName
- live published stream that is being unpublished
-
broadcastGetObjectEncoding
Get the minimum object encoding level for the clients playing this stream.- Parameters:
stream
- publish stream- Returns:
- object encoding level (AMF0 or AMF3)
-
broadcasePlayMessage
public void broadcasePlayMessage(IMediaStream stream, long timecode, ByteBuffer msg, int objectEncoding) Send a broadcast message to all play stream that are listening to this live published stream.- Parameters:
stream
- media streamtimecode
- timecode (milliseconds)msg
- byte[] of data that will be deserialized as an AMFData object.objectEncoding
- object encoding (AMF0 or AMF3)
-
notifyPlayPublish
Notify all play streams that are listening to this stream that the stream is going into a state of publish (NetStream.Play.PublishNotify).- Parameters:
stream
- live published stream that is being published
-
addMediaStreamListener
Add a media stream listener. A media stream listener will receive the following events: onMediaStreamCreate, onMediaStreamDestroy.- Parameters:
mediaStreamListener
- media stream listener
-
removeMediaStreamListener
Remove a media stream listener.- Parameters:
mediaStreamListener
- media stream listener
-
notifyMediaStreamCreate
Notify all media stream listeners that a new media stream object has been created.- Parameters:
mediaStream
- new media stream object
-
notifyMediaStreamDestroy
Notify all media stream listeners that a media stream object is being destroyed.- Parameters:
mediaStream
- media stream object being destroyed
-
removeLiveStreamPacketizer
Remove all live stream packetizers for this stream name- Parameters:
streamName
- streamName
-
closeLiveStreamPacketizer
Close live stream packetizer by sending the last data received- Parameters:
streamName
- stream name
-
removeLiveStreamPacketizer
Remove live stream packetizer- Parameters:
streamName
- stream namepacketizerName
- packetizer id- Returns:
- live stream packetizer
-
getLiveStreamPacketizerLock
Get the lock to the live stream packetizer system- Returns:
- lock to the live stream packetizer system
-
getLiveStreamPacketizer
public ILiveStreamPacketizer getLiveStreamPacketizer(String streamName, String packetizerName, boolean doCreate) Get a live stream packetizer by name and packetizer id- Parameters:
streamName
- stream namepacketizerName
- packetizer iddoCreate
- create if does not exist- Returns:
- live stream packetizer
-
getNextNameGroupId
public long getNextNameGroupId(com.wowza.wms.stream.MediaStreamMapGroup newGroup) -
addNameGroup
public com.wowza.wms.stream.MediaStreamMapGroup addNameGroup(com.wowza.wms.stream.MediaStreamMapGroup newGroup) -
removeNameGroup
public com.wowza.wms.stream.MediaStreamMapGroup removeNameGroup(int groupId) -
removeNameGroup
public com.wowza.wms.stream.MediaStreamMapGroup removeNameGroup(com.wowza.wms.stream.MediaStreamMapGroup nameGroup) -
getNameGroups
-
getNameGroupByGroupName
-
getNameGroups
-
getNameGroupStreamNames
-
getDvrRecorder
public ILiveStreamDvrRecorder getDvrRecorder(String streamName, String recorderName, boolean doCreate) Get a DVR recorder by name and recorder name- Parameters:
streamName
- stream namerecorderName
- packetizer iddoCreate
- create if does not exist- Returns:
- dvr recorder
-
removeDvrRecorder
-
removeDvrRecorder
Remove DVR Recorder- Parameters:
streamName
- stream namerecorderName
- recorder name- Returns:
- DVR Recorder
-
getDvrRecorders
Returns a list of ILiveStreamDvrRecorder objects- Returns:
- list of ILiveStreamDvrRecorder objects
-
addLicense
-
addLicense
public com.wowza.wms.client.LicenseHolder addLicense(ILiveStreamPacketizer liveStreamPacketizer, int licenseType) -
doWatchdog
public void doWatchdog() -
getNameGroupRemoveDelayTime
public int getNameGroupRemoveDelayTime() -
setNameGroupRemoveDelayTime
public void setNameGroupRemoveDelayTime(int nameGroupRemoveDelayTime)
-