Package org.red5.server.net.rtmp.event
Class BaseEvent
- java.lang.Object
-
- org.red5.server.net.rtmp.event.BaseEvent
-
- All Implemented Interfaces:
Externalizable
,Serializable
,IEvent
,IRTMPEvent
,Constants
- Direct Known Subclasses:
Abort
,Aggregate
,AudioData
,BytesRead
,ChunkSize
,ClientBW
,ClientInvokeEvent
,ClientNotifyEvent
,Notify
,Ping
,ServerBW
,SharedObjectMessage
,Unknown
,VideoData
public abstract class BaseEvent extends Object implements Constants, IRTMPEvent, Externalizable
Base abstract class for all RTMP events- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.red5.server.net.rtmp.message.Constants
Constants.DataType
-
Nested classes/interfaces inherited from interface org.red5.server.api.event.IEvent
IEvent.Type
-
-
Field Summary
Fields Modifier and Type Field Description protected Header
header
Event RTMP packet headerprotected org.slf4j.Logger
log
protected Object
object
Event target objectprotected AtomicInteger
refcount
Event references countprotected IEventListener
source
Event listenerprotected byte
sourceType
Source typeprotected int
timestamp
Event timestamp-
Fields inherited from interface org.red5.server.net.rtmp.message.Constants
HANDSHAKE_SIZE, HEADER_CONTINUE, HEADER_NEW, HEADER_SAME_SOURCE, HEADER_TIMER_CHANGE, MEDIUM_INT_MAX, SO_CLIENT_CLEAR_DATA, SO_CLIENT_DELETE_DATA, SO_CLIENT_INITIAL_DATA, SO_CLIENT_SEND_MESSAGE, SO_CLIENT_STATUS, SO_CLIENT_UPDATE_ATTRIBUTE, SO_CLIENT_UPDATE_DATA, SO_CONNECT, SO_DELETE_ATTRIBUTE, SO_DISCONNECT, SO_SEND_MESSAGE, SO_SET_ATTRIBUTE, SOURCE_TYPE_LIVE, SOURCE_TYPE_VOD, TYPE_ABORT, TYPE_AGGREGATE, TYPE_AUDIO_DATA, TYPE_BYTES_READ, TYPE_CHUNK_SIZE, TYPE_CLIENT_BANDWIDTH, TYPE_EDGE_ORIGIN, TYPE_FLEX_MESSAGE, TYPE_FLEX_SHARED_OBJECT, TYPE_FLEX_STREAM_SEND, TYPE_INVOKE, TYPE_NOTIFY, TYPE_PING, TYPE_SERVER_BANDWIDTH, TYPE_SHARED_OBJECT, TYPE_STREAM_METADATA, TYPE_VIDEO_DATA
-
-
Constructor Summary
Constructors Constructor Description BaseEvent()
BaseEvent(IEvent.Type type)
Create new event of given typeBaseEvent(IEvent.Type type, IEventListener source)
Create new event of given type
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract byte
getDataType()
Getter for data typeHeader
getHeader()
Getter for headerObject
getObject()
Returns event context objectIEventListener
getSource()
Returns event listenerbyte
getSourceType()
Getter for source typeint
getTimestamp()
Getter for timestampIEvent.Type
getType()
Returns even typeboolean
hasSource()
Whether event has source (event listener(s))void
readExternal(ObjectInput in)
void
release()
Hook to free buffers allocated by the event.protected abstract void
releaseInternal()
Release eventvoid
retain()
Retain eventvoid
setHeader(Header header)
Setter for headervoid
setSource(IEventListener source)
Setter for sourcevoid
setSourceType(byte sourceType)
Setter for source typevoid
setTimestamp(int timestamp)
Setter for timestampvoid
setType(IEvent.Type type)
void
writeExternal(ObjectOutput out)
-
-
-
Field Detail
-
log
protected org.slf4j.Logger log
-
sourceType
protected byte sourceType
Source type
-
object
protected Object object
Event target object
-
source
protected IEventListener source
Event listener
-
timestamp
protected int timestamp
Event timestamp
-
header
protected Header header
Event RTMP packet header
-
refcount
protected AtomicInteger refcount
Event references count
-
-
Constructor Detail
-
BaseEvent
public BaseEvent()
-
BaseEvent
public BaseEvent(IEvent.Type type)
Create new event of given type- Parameters:
type
- Event type
-
BaseEvent
public BaseEvent(IEvent.Type type, IEventListener source)
Create new event of given type- Parameters:
type
- Event typesource
- Event source
-
-
Method Detail
-
getType
public IEvent.Type getType()
Returns even type
-
setType
public void setType(IEvent.Type type)
-
getSourceType
public byte getSourceType()
Description copied from interface:IRTMPEvent
Getter for source type- Specified by:
getSourceType
in interfaceIRTMPEvent
- Returns:
- Source type
-
setSourceType
public void setSourceType(byte sourceType)
Description copied from interface:IRTMPEvent
Setter for source type- Specified by:
setSourceType
in interfaceIRTMPEvent
- Parameters:
sourceType
- source type
-
getObject
public Object getObject()
Returns event context object
-
getHeader
public Header getHeader()
Getter for header- Specified by:
getHeader
in interfaceIRTMPEvent
- Returns:
- RTMP packet header
-
setHeader
public void setHeader(Header header)
Setter for header- Specified by:
setHeader
in interfaceIRTMPEvent
- Parameters:
header
- RTMP packet header
-
hasSource
public boolean hasSource()
Whether event has source (event listener(s))
-
getSource
public IEventListener getSource()
Returns event listener
-
setSource
public void setSource(IEventListener source)
Setter for source- Specified by:
setSource
in interfaceIRTMPEvent
- Parameters:
source
- Source
-
getDataType
public abstract byte getDataType()
Getter for data type- Specified by:
getDataType
in interfaceIRTMPEvent
- Returns:
- Data type
-
getTimestamp
public int getTimestamp()
Getter for timestamp- Specified by:
getTimestamp
in interfaceIRTMPEvent
- Returns:
- Event timestamp
-
setTimestamp
public void setTimestamp(int timestamp)
Setter for timestamp- Specified by:
setTimestamp
in interfaceIRTMPEvent
- Parameters:
timestamp
- New event timestamp
-
retain
public void retain()
Retain event- Specified by:
retain
in interfaceIRTMPEvent
-
release
public void release()
Hook to free buffers allocated by the event.- Specified by:
release
in interfaceIRTMPEvent
-
releaseInternal
protected abstract void releaseInternal()
Release event
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
-