Class RtmpProvider

java.lang.Object
io.antmedia.muxer.Muxer
io.antmedia.muxer.RtmpProvider
All Implemented Interfaces:
IMessageComponent, IProvider

public class RtmpProvider extends Muxer implements IProvider
Lightweight provider that converts encoded H.264 / AAC AVPackets coming from PacketFeeder into Red5 RTMP messages and pushes them to an InMemoryPushPushPipe.
  • Field Details

    • broadcastScope

      private IBroadcastScope broadcastScope
    • videoTb

      private final org.bytedeco.ffmpeg.avutil.AVRational videoTb
    • audioTb

      private final org.bytedeco.ffmpeg.avutil.AVRational audioTb
    • firstVideoTs

      private final AtomicInteger firstVideoTs
  • Constructor Details

    • RtmpProvider

      public RtmpProvider(IScope appScope, io.vertx.core.Vertx vertx, String streamId, org.bytedeco.ffmpeg.avutil.AVRational videoTimebase, org.bytedeco.ffmpeg.avutil.AVRational audioTimebase)
  • Method Details

    • setBroadcastScope

      public void setBroadcastScope(IBroadcastScope broadcastScope)
    • getBroadcastScope

      public IBroadcastScope getBroadcastScope()
    • addStream

      public boolean addStream(org.bytedeco.ffmpeg.avcodec.AVCodecParameters codecParameters, org.bytedeco.ffmpeg.avutil.AVRational timebase, int streamIndex)
      Description copied from class: Muxer
      Add stream to the muxer. This method is called by direct muxing. For instance from RTMP, SRT ingest & Stream Pull to HLS, MP4, HLS, DASH WebRTC Muxing
      Overrides:
      addStream in class Muxer
      streamIndex - , is the stream index of the source. Sometimes source and target stream index do not match
      Returns:
    • writePacket

      public void writePacket(org.bytedeco.ffmpeg.avcodec.AVPacket packet, org.bytedeco.ffmpeg.avutil.AVRational inputTimebase, org.bytedeco.ffmpeg.avutil.AVRational outputTimebase, int codecType)
      Description copied from class: Muxer
      All other writePacket functions call this function to make the job
      Overrides:
      writePacket in class Muxer
      Parameters:
      packet - Content of the data in AVPacket class
      inputTimebase - input time base is required to calculate the correct dts and pts values for the container
      outputTimebase - output time base is required to calculate the correct dts and pts values for the container
    • attachRtmpPublisher

      public IBroadcastScope attachRtmpPublisher(String streamId)
    • detachRtmpPublisher

      public void detachRtmpPublisher(String streamId)
    • isCodecSupported

      public boolean isCodecSupported(int codecId)
      Specified by:
      isCodecSupported in class Muxer
    • getOutputFormatContext

      public org.bytedeco.ffmpeg.avformat.AVFormatContext getOutputFormatContext()
      Specified by:
      getOutputFormatContext in class Muxer
    • writeHeader

      public boolean writeHeader()
      Overrides:
      writeHeader in class Muxer
    • writeTrailer

      public void writeTrailer()
      Description copied from class: Muxer
      This function may be called by multiple encoders. Make sure that it is called once. See the sample implementations how it is being protected Implement this function with synchronized keyword as the subclass
      Overrides:
      writeTrailer in class Muxer
    • onOOBControlMessage

      public void onOOBControlMessage(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg)
      Specified by:
      onOOBControlMessage in interface IMessageComponent
      Parameters:
      source - Message component source
      pipe - Connection pipe
      oobCtrlMsg - Out-of-band control message