Skip to content

Commit b203ba3

Browse files
authored
Merge pull request #17 from membraneframework/release/v0.7.0
Release membrane_ivf_plugin v0.7.0
2 parents f842410 + 3d6906a commit b203ba3

File tree

8 files changed

+24
-30
lines changed

8 files changed

+24
-30
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The package can be installed by adding `membrane_ivf_plugin` to your list of dep
1515
```elixir
1616
def deps do
1717
[
18-
{:membrane_ivf_plugin, "~> 0.6.0"}
18+
{:membrane_ivf_plugin, "~> 0.7.0"}
1919
]
2020
end
2121
```

lib/deserializer.ex

+6-7
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@ defmodule Membrane.Element.IVF.Deserializer do
55
Membrane timebase (it is 1 nanosecond = 1/(10^9)[s])
66
"""
77
use Membrane.Filter
8-
use Ratio
8+
use Numbers, overload_operators: true
99

1010
alias Membrane.Element.IVF.Headers
1111
alias Membrane.Element.IVF.Headers.FrameHeader
1212
alias Membrane.{Buffer, RemoteStream, Time}
1313
alias Membrane.{VP8, VP9}
1414

15-
def_input_pad :input, accepted_format: _any, demand_mode: :auto, demand_unit: :buffers
15+
def_input_pad :input, accepted_format: _any
1616

1717
def_output_pad :output,
1818
accepted_format:
19-
%RemoteStream{content_format: format, type: :packetized} when format in [VP9, VP8],
20-
demand_mode: :auto
19+
%RemoteStream{content_format: format, type: :packetized} when format in [VP9, VP8]
2120

2221
defmodule State do
2322
@moduledoc false
@@ -37,12 +36,12 @@ defmodule Membrane.Element.IVF.Deserializer do
3736
@impl true
3837
def handle_stream_format(_pad, _stream_format, _ctx, state) do
3938
# ignore incoming stream_format, we will send our own
40-
# in handle_process
39+
# in handle_buffer
4140
{[], state}
4241
end
4342

4443
@impl true
45-
def handle_process(:input, buffer, _ctx, %State{start_of_stream?: true} = state) do
44+
def handle_buffer(:input, buffer, _ctx, %State{start_of_stream?: true} = state) do
4645
state = %State{state | frame_acc: state.frame_acc <> buffer.payload}
4746

4847
with {:ok, file_header, rest} <- Headers.parse_ivf_header(state.frame_acc),
@@ -68,7 +67,7 @@ defmodule Membrane.Element.IVF.Deserializer do
6867
end
6968
end
7069

71-
def handle_process(:input, buffer, _ctx, state) do
70+
def handle_buffer(:input, buffer, _ctx, state) do
7271
state = %State{state | frame_acc: state.frame_acc <> buffer.payload}
7372

7473
case flush_acc(state, []) do

lib/membrane_element_ivf/headers.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ defmodule Membrane.Element.IVF.Headers do
5454

5555
@spec create_ivf_frame_header(integer, number | Ratio.t(), number | Ratio.t()) :: binary
5656
def create_ivf_frame_header(size, timestamp, timebase) do
57-
ivf_timestamp = Membrane.Time.round_to_timebase(timestamp, Membrane.Time.seconds(timebase))
57+
ivf_timestamp = Membrane.Time.divide_by_timebase(timestamp, Membrane.Time.seconds(timebase))
5858
# conversion to little-endian binary strings
5959
size_le = <<size::32-little>>
6060
timestamp_le = <<ivf_timestamp::64-little>>

lib/serializer.ex

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ defmodule Membrane.Element.IVF.Serializer do
1818
def_input_pad :input,
1919
accepted_format:
2020
%RemoteStream{content_format: format, type: :packetized} when format in [VP9, VP8],
21+
flow_control: :manual,
2122
demand_unit: :buffers
2223

23-
def_output_pad :output, accepted_format: _any
24+
def_output_pad :output, flow_control: :manual, accepted_format: _any
2425

2526
defmodule State do
2627
@moduledoc false
@@ -29,7 +30,7 @@ defmodule Membrane.Element.IVF.Serializer do
2930

3031
@impl true
3132
def handle_init(_ctx, options) do
32-
use Ratio
33+
use Numbers, overload_operators: true
3334

3435
{[],
3536
%State{
@@ -47,7 +48,7 @@ defmodule Membrane.Element.IVF.Serializer do
4748
end
4849

4950
@impl true
50-
def handle_process(:input, buffer, ctx, state) do
51+
def handle_buffer(:input, buffer, ctx, state) do
5152
%Buffer{payload: frame, pts: timestamp} = buffer
5253

5354
ivf_frame =

mix.exs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule Membrane.IVF.Plugin.MixProject do
22
use Mix.Project
33

4-
@version "0.6.0"
4+
@version "0.7.0"
55
@github_url "https://github.com/membraneframework/membrane_ivf_plugin"
66

77
def project do
@@ -37,11 +37,11 @@ defmodule Membrane.IVF.Plugin.MixProject do
3737

3838
defp deps do
3939
[
40-
{:membrane_core, "~> 0.12.0"},
40+
{:membrane_core, "~> 1.0"},
4141
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
4242
{:dialyxir, ">= 0.0.0", only: :dev, runtime: false},
4343
{:credo, ">= 0.0.0", only: :dev, runtime: false},
44-
{:membrane_file_plugin, "~> 0.13.0", only: :test}
44+
{:membrane_file_plugin, "~> 0.16.0", only: :test}
4545
]
4646
end
4747

mix.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
"makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
1313
"makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"},
1414
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
15-
"membrane_core": {:hex, :membrane_core, "0.12.1", "aa98c9ef66d109ea9f0395df8d12434d255941cbfe51c154e5fd49d3488a1dfc", [:mix], [{:bunch, "~> 1.6", [hex: :bunch, repo: "hexpm", optional: false]}, {:qex, "~> 0.3", [hex: :qex, repo: "hexpm", optional: false]}, {:ratio, "~> 2.0", [hex: :ratio, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "94469345cd55c3bca98c5aa14e56812d1e8aad2eaa63f217be45a51c556bbc3f"},
16-
"membrane_file_plugin": {:hex, :membrane_file_plugin, "0.13.3", "aaf40a72e5fccf6da47ec85ef525234acbec828425f1300f74c464bca1487f40", [:mix], [{:membrane_core, "~> 0.11", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "1c1acf610d4fc0279b7fd65a5db06c8bc3ef6a276bf40fb033c2c735c25839ba"},
15+
"membrane_core": {:hex, :membrane_core, "1.0.0", "1b543aefd952283be1f2a215a1db213aa4d91222722ba03cd35280622f1905ee", [:mix], [{:bunch, "~> 1.6", [hex: :bunch, repo: "hexpm", optional: false]}, {:qex, "~> 0.3", [hex: :qex, repo: "hexpm", optional: false]}, {:ratio, "~> 3.0", [hex: :ratio, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "352c90fd0a29942143c4bf7a727cc05c632e323f50a1a4e99321b1e8982f1533"},
16+
"membrane_file_plugin": {:hex, :membrane_file_plugin, "0.16.0", "7917f6682c22b9bcfc2ca20ed960eee0f7d03ad31fd5f59ed850f1fe3ddd545a", [:mix], [{:membrane_core, "~> 1.0", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "b0727998f75a9b4dab8a2baefdfc13c3eac00a04e061ab1b0e61dc5566927acc"},
1717
"nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"},
1818
"numbers": {:hex, :numbers, "5.2.4", "f123d5bb7f6acc366f8f445e10a32bd403c8469bdbce8ce049e1f0972b607080", [:mix], [{:coerce, "~> 1.0", [hex: :coerce, repo: "hexpm", optional: false]}, {:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "eeccf5c61d5f4922198395bf87a465b6f980b8b862dd22d28198c5e6fab38582"},
1919
"qex": {:hex, :qex, "0.5.1", "0d82c0f008551d24fffb99d97f8299afcb8ea9cf99582b770bd004ed5af63fd6", [:mix], [], "hexpm", "935a39fdaf2445834b95951456559e9dc2063d0a055742c558a99987b38d6bab"},
20-
"ratio": {:hex, :ratio, "2.4.2", "c8518f3536d49b1b00d88dd20d49f8b11abb7819638093314a6348139f14f9f9", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:numbers, "~> 5.2.0", [hex: :numbers, repo: "hexpm", optional: false]}], "hexpm", "441ef6f73172a3503de65ccf1769030997b0d533b1039422f1e5e0e0b4cbf89e"},
20+
"ratio": {:hex, :ratio, "3.0.2", "60a5976872a4dc3d873ecc57eed1738589e99d1094834b9c935b118231297cfb", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:numbers, "~> 5.2.0", [hex: :numbers, repo: "hexpm", optional: false]}], "hexpm", "3a13ed5a30ad0bfd7e4a86bf86d93d2b5a06f5904417d38d3f3ea6406cdfc7bb"},
2121
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
2222
}

test/integration_test.exs

+2-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ defmodule Membrane.Element.IVF.IntegrationTest do
2929
|> child(:file_sink, %Membrane.File.Sink{location: options.result_file})
3030
]
3131

32-
{[spec: spec, playback: :playing], %{}}
32+
{[spec: spec], %{}}
3333
end
3434

3535
@impl true
@@ -63,11 +63,9 @@ defmodule Membrane.Element.IVF.IntegrationTest do
6363
]
6464
|> Testing.Pipeline.start_link_supervised!()
6565

66-
assert_pipeline_play(pipeline)
67-
6866
assert_end_of_stream(pipeline, :file_sink)
6967

70-
Testing.Pipeline.terminate(pipeline, blocking?: true)
68+
Testing.Pipeline.terminate(pipeline)
7169

7270
assert File.read!(input.path) ==
7371
File.read!(result_file)

test/serializer_test.exs

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
defmodule Membrane.Element.IVF.SerializerTest do
22
use ExUnit.Case
3-
use Ratio
3+
use Numbers, overload_operators: true
44

55
import Membrane.Testing.Assertions
66

@@ -33,7 +33,7 @@ defmodule Membrane.Element.IVF.SerializerTest do
3333
|> child(:sink, sink)
3434
]
3535

36-
{[spec: spec, playback: :playing], %{}}
36+
{[spec: spec], %{}}
3737
end
3838

3939
@impl true
@@ -64,8 +64,6 @@ defmodule Membrane.Element.IVF.SerializerTest do
6464
]
6565
|> Testing.Pipeline.start_supervised!()
6666

67-
assert_pipeline_play(pipeline)
68-
6967
assert_start_of_stream(pipeline, :sink)
7068

7169
assert_sink_buffer(pipeline, :sink, ivf_buffer)
@@ -107,7 +105,7 @@ defmodule Membrane.Element.IVF.SerializerTest do
107105

108106
assert_end_of_stream(pipeline, :sink)
109107

110-
Testing.Pipeline.terminate(pipeline, blocking?: true)
108+
Testing.Pipeline.terminate(pipeline)
111109
end
112110

113111
test "serialize real vp9 buffers" do
@@ -124,15 +122,13 @@ defmodule Membrane.Element.IVF.SerializerTest do
124122
]
125123
|> Testing.Pipeline.start_supervised!()
126124

127-
assert_pipeline_play(pipeline)
128-
129125
assert_start_of_stream(pipeline, :sink)
130126

131127
assert_end_of_stream(pipeline, :sink)
132128

133129
assert File.read!(@results_dir <> @result_file) ==
134130
File.read!(@fixtures_dir <> @input_file)
135131

136-
Testing.Pipeline.terminate(pipeline, blocking?: true)
132+
Testing.Pipeline.terminate(pipeline)
137133
end
138134
end

0 commit comments

Comments
 (0)