Skip to content

Commit

Permalink
Fix examples (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Noarkhh authored Feb 29, 2024
1 parent 3bbb0e5 commit bd07a30
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
5 changes: 2 additions & 3 deletions examples/sink.exs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ defmodule Example do
@impl true
def handle_init(_ctx, destination: destination) do
structure = [
child(:rtmp_sink, %Membrane.RTMP.Sink{rtmp_url: destination}),
child(:video_source, %Membrane.Hackney.Source{
location: @video_url,
hackney_opts: [follow_redirect: true]
Expand All @@ -34,7 +33,7 @@ defmodule Example do
})
|> child(:video_realtimer, Membrane.Realtimer)
|> via_in(Pad.ref(:video, 0))
|> get_child(:rtmp_sink),
|> child(:rtmp_sink, %Membrane.RTMP.Sink{rtmp_url: destination}),
child(:audio_source, %Membrane.Hackney.Source{
location: @audio_url,
hackney_opts: [follow_redirect: true]
Expand Down Expand Up @@ -70,7 +69,7 @@ end
destination = System.get_env("RTMP_URL", "rtmp://localhost:1935")

# Initialize the pipeline and start it
{:ok, _supervisor, pipeline} = Example.start_link(destination: destination)
{:ok, _supervisor, pipeline} = Membrane.Pipeline.start_link(Example, destination: destination)

monitor_ref = Process.monitor(pipeline)

Expand Down
2 changes: 1 addition & 1 deletion examples/sink_video.exs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ end
destination = System.get_env("RTMP_URL", "rtmp://localhost:1935")

# Initialize the pipeline and start it
{:ok, _supervisor, pipeline} = Example.start_link(destination: destination)
{:ok, _supervisor, pipeline} = Membrane.Pipeline.start_link(Example, destination: destination)

monitor_ref = Process.monitor(pipeline)

Expand Down
25 changes: 14 additions & 11 deletions examples/source.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,22 @@ defmodule Pipeline do
structure = [
child(:source, %Membrane.RTMP.SourceBin{
socket: socket
}),
child(:video_payloader, %Membrane.H264.Parser{
output_stream_structure: :avc3
}),
child(:muxer, Membrane.FLV.Muxer),
child(:sink, %Membrane.File.Sink{location: @output_file}),
get_child(:source) |> via_out(:audio) |> via_in(Pad.ref(:audio, 0)) |> get_child(:muxer),
})
|> via_out(:audio)
|> child(:audio_parser, %Membrane.AAC.Parser{
out_encapsulation: :none,
output_config: :audio_specific_config
})
|> via_in(Pad.ref(:audio, 0))
|> child(:muxer, Membrane.FLV.Muxer)
|> child(:sink, %Membrane.File.Sink{location: @output_file}),
get_child(:source)
|> via_out(:video)
|> get_child(:video_payloader)
|> child(:video_parser, %Membrane.H264.Parser{
output_stream_structure: :avc1
})
|> via_in(Pad.ref(:video, 0))
|> get_child(:muxer),
get_child(:muxer) |> get_child(:sink)
|> get_child(:muxer)
]

{[spec: structure], %{}}
Expand Down Expand Up @@ -97,7 +100,7 @@ defmodule Example do
],
socket_handler: fn socket ->
# On new connection a pipeline is started
{:ok, _supervisor, pipeline} = Pipeline.start_link(socket: socket)
{:ok, _supervisor, pipeline} = Membrane.Pipeline.start_link(Pipeline, socket: socket)
send(parent, {:pipeline_spawned, pipeline})
{:ok, pipeline}
end
Expand Down

0 comments on commit bd07a30

Please sign in to comment.