View Source Membrane.RTMP.SourceBin (Membrane RTMP plugin v0.23.3)

Bin responsible for demuxing and parsing an RTMP stream.

Outputs single audio and video which are ready for further processing with Membrane Elements. At this moment only AAC and H264 codecs are supported.

Usage

The bin requires the RTMP client to be already connected to the socket. The socket passed to the bin must be in non-active mode (active set to false).

When the Membrane.RTMP.Source is initialized the bin sends Membrane.RTMP.Source.socket_control_needed_t/0 notification. Then, the control of the socket should be immediately granted to the Source with the pass_control/2, and the Source will start reading packets from the socket.

The bin allows for providing custom validator module, that verifies some of the RTMP messages. The module has to implement the Membrane.RTMP.MessageValidator protocol. If the validation fails, a Membrane.RTMP.Source.stream_validation_failed_t/0 notification is sent.

Bin options

Passed via struct Membrane.RTMP.SourceBin.t/0

  • socket

    :gen_tcp.socket() | :ssl.sslsocket()

    Required
    Socket, on which the bin will receive RTMP or RTMPS stream. The socket will be passed to the RTMP.Source. The socket must be already connected to the RTMP client and be in non-active mode (active set to false).

    In case of RTMPS the use_ssl? options must be set to true.

  • use_ssl?

    boolean()

    Default value: false
    Tells whether the passed socket is a regular TCP socket or SSL one.

  • validator

    Membrane.RTMP.MessageValidator.t()

    Default value: %Membrane.RTMP.MessageValidator.Default{}
    A Membrane.RTMP.MessageValidator implementation, used for validating the stream. By default allows every incoming stream.

Pads

:audio

Accepted formats:

AAC
Direction::output
Availability::always

:video

Accepted formats:

H264
Direction::output
Availability::always

Summary

Types

t()

Struct containing options for Membrane.RTMP.SourceBin

Functions

Returns description of options available for this module

Passes the control of the socket to the source.

Passes the control of the ssl socket to the source.

Types

@type t() :: %Membrane.RTMP.SourceBin{
  socket: :gen_tcp.socket() | :ssl.sslsocket(),
  use_ssl?: boolean(),
  validator: Membrane.RTMP.MessageValidator.t()
}

Struct containing options for Membrane.RTMP.SourceBin

Functions

@spec options() :: keyword()

Returns description of options available for this module

Link to this function

pass_control(socket, source)

View Source
@spec pass_control(:gen_tcp.socket(), pid()) :: :ok | {:error, atom()}

Passes the control of the socket to the source.

To succeed, the executing process must be in control of the socket, otherwise {:error, :not_owner} is returned.

Link to this function

secure_pass_control(socket, source)

View Source
@spec secure_pass_control(:ssl.sslsocket(), pid()) :: :ok | {:error, any()}

Passes the control of the ssl socket to the source.

To succeed, the executing process must be in control of the socket, otherwise {:error, :not_owner} is returned.