Skip to content

Commit 4960c7c

Browse files
committed
Format code snippets from guide
1 parent 8d30f92 commit 4960c7c

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

guides/useful_concepts/manual_demands.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ defmodule MySource do
5353

5454
@impl true
5555
def handle_demand(:output, demand_size, :buffers, _ctx, state) do
56-
buffers = Enum.map(1..demand_size, fn _ ->
57-
%Membrane.Buffer{payload: :crypto.strong_rand_bytes(256)}
58-
end)
56+
buffers =
57+
Enum.map(1..demand_size, fn _ ->
58+
%Membrane.Buffer{payload: :crypto.strong_rand_bytes(256)}
59+
end)
60+
5961
{[buffer: {:output, buffers}], state}
6062
end
6163
end
@@ -133,8 +135,7 @@ defmodule MyDemoSink do
133135

134136
@impl true
135137
def handle_playing(_ctx, state) do
136-
{[start_timer: {:demand_timer, Membrane.Time.seconds(1)},
137-
demand: {:input, 5}], state}
138+
{[start_timer: {:demand_timer, Membrane.Time.seconds(1)}, demand: {:input, 5}], state}
138139
end
139140

140141
@impl true
@@ -165,8 +166,7 @@ defmodule MyBytesDemoSink do
165166

166167
@impl true
167168
def handle_playing(_ctx, state) do
168-
{[start_timer: {:demand_timer, Membrane.Time.seconds(1)},
169-
demand: {:input, 100}], state}
169+
{[start_timer: {:demand_timer, Membrane.Time.seconds(1)}, demand: {:input, 100}], state}
170170
end
171171

172172
@impl true
@@ -297,9 +297,10 @@ defmodule MyTimestampSink do
297297

298298
@impl true
299299
def handle_playing(_ctx, state) do
300-
{[start_timer: {:demand_timer, Membrane.Time.seconds(1)},
301-
demand: {:input, Membrane.Time.seconds(1)}],
302-
%{state | next_demand: Membrane.Time.seconds(2)}}
300+
{[
301+
start_timer: {:demand_timer, Membrane.Time.seconds(1)},
302+
demand: {:input, Membrane.Time.seconds(1)}
303+
], %{state | next_demand: Membrane.Time.seconds(2)}}
303304
end
304305

305306
@impl true
@@ -368,6 +369,7 @@ defmodule MyFilter do
368369
dts: first.dts,
369370
metadata: first.metadata
370371
}
372+
371373
{[buffer: {:output, output}], %{state | pending: nil}}
372374
end
373375
end

0 commit comments

Comments
 (0)