View Source Membrane.RTMP.SourceBin (Membrane RTMP plugin v0.12.1)
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
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
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 theRTMP.Source
. The socket must be already connected to the RTMP client and be in non-active mode (active
set tofalse
).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{}
AMembrane.RTMP.MessageValidator
implementation, used for validating the stream. By default allows every incoming stream.
pads
Pads
audio
:audio
Accepted formats:
AAC
Direction: | :output |
Availability: | :always |
Mode: | :pull |
Demand unit: | :buffers |
video
:video
Accepted formats:
H264
Direction: | :output |
Availability: | :always |
Mode: | :pull |
Demand unit: | :buffers |
Link to this section Summary
Types
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
.
Link to this section 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
Link to this section Functions
@spec options() :: keyword()
Returns description of options available for this module
@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.
@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.