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, Unknown, VideoData

public abstract class BaseEvent extends Object implements Constants, IRTMPEvent, Externalizable
Base abstract class for all RTMP events
See Also:
  • Field Details

    • log

      protected org.slf4j.Logger log
    • allocationDebugging

      private static final boolean allocationDebugging
      See Also:
    • type

      private IEvent.Type type
      Event type
    • sourceType

      private byte sourceType
      Source type
    • object

      protected Object object
      Event target object
    • source

      protected IEventListener source
      Event listener
    • timestamp

      protected int timestamp
      Event timestamp
    • refcount

      protected AtomicInteger refcount
      Event references count
  • Constructor Details

    • 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 type
      source - Event source
  • Method Details

    • getType

      public IEvent.Type getType()
      Returns even type
      Specified by:
      getType in interface IEvent
      Returns:
      Event type enumeration
    • setType

      public void setType(IEvent.Type type)
    • getSourceType

      public byte getSourceType()
      Description copied from interface: IRTMPEvent
      Getter for source type
      Specified by:
      getSourceType in interface IRTMPEvent
      Returns:
      Source type
    • setSourceType

      public void setSourceType(byte sourceType)
      Description copied from interface: IRTMPEvent
      Setter for source type
      Specified by:
      setSourceType in interface IRTMPEvent
      Parameters:
      sourceType - source type
    • getObject

      public Object getObject()
      Returns event context object
      Specified by:
      getObject in interface IEvent
      Returns:
      Event context object
    • getHeader

      public Header getHeader()
      Getter for header
      Specified by:
      getHeader in interface IRTMPEvent
      Returns:
      RTMP packet header
    • setHeader

      public void setHeader(Header header)
      Setter for header
      Specified by:
      setHeader in interface IRTMPEvent
      Parameters:
      header - RTMP packet header
    • hasSource

      public boolean hasSource()
      Whether event has source (event listener(s))
      Specified by:
      hasSource in interface IEvent
      Returns:
       true
       
      if so,
       false
       
      otherwise
    • getSource

      public IEventListener getSource()
      Returns event listener
      Specified by:
      getSource in interface IEvent
      Returns:
      Event listener object
    • setSource

      public void setSource(IEventListener source)
      Setter for source
      Specified by:
      setSource in interface IRTMPEvent
      Parameters:
      source - Source
    • getDataType

      public abstract byte getDataType()
      Getter for data type
      Specified by:
      getDataType in interface IRTMPEvent
      Returns:
      Data type
    • getTimestamp

      public int getTimestamp()
      Getter for timestamp
      Specified by:
      getTimestamp in interface IRTMPEvent
      Returns:
      Event timestamp
    • setTimestamp

      public void setTimestamp(int timestamp)
      Setter for timestamp
      Specified by:
      setTimestamp in interface IRTMPEvent
      Parameters:
      timestamp - New event timestamp
    • retain

      public void retain()
      Retain event
      Specified by:
      retain in interface IRTMPEvent
    • release

      public void release()
      Hook to free buffers allocated by the event.
      Specified by:
      release in interface IRTMPEvent
    • releaseInternal

      protected abstract void releaseInternal()
      Release event
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException