Skip to content

Commit

Permalink
Merge pull request #17 from membraneframework/release/v0.5.0
Browse files Browse the repository at this point in the history
Release membrane_matroska_plugin v0.5.0
  • Loading branch information
FelonEkonom authored Nov 15, 2023
2 parents 18fa618 + 8356afa commit caed354
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 49 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The package can be installed by adding `membrane_matroska_plugin` to your list o
```elixir
def deps do
[
{:membrane_matroska_plugin, "~> 0.4.0"}
{:membrane_matroska_plugin, "~> 0.5.0"}
]
end
```
Expand Down
2 changes: 1 addition & 1 deletion examples/demuxer_h264.exs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule Example do
})
|> child(:demuxer, Membrane.Matroska.Demuxer)

{[spec: structure, playback: :playing], %{tracks: 2}}
{[spec: structure], %{tracks: 2}}
end

@impl true
Expand Down
2 changes: 1 addition & 1 deletion examples/muxer_h264.exs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defmodule Example do
|> child(:file_sink, %Membrane.File.Sink{location: @output_file})
]

{[spec: structure, playback: :playing], %{}}
{[spec: structure], %{}}
end

# Next two functions are only a logic for terminating a pipeline when it's done, you don't need to worry
Expand Down
7 changes: 3 additions & 4 deletions lib/membrane_matroska/demuxer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ defmodule Membrane.Matroska.Demuxer do
alias Membrane.Pipeline.Action

def_input_pad :input,
availability: :always,
mode: :pull,
flow_control: :manual,
demand_unit: :buffers,
accepted_format:
%RemoteStream{content_format: format, type: :bytestream}
when format in [nil, :WEBM, Matroska]

def_output_pad :output,
availability: :on_request,
mode: :pull,
flow_control: :manual,
accepted_format:
any_of(
%H264{stream_structure: {:avc3, _dcr}},
Expand Down Expand Up @@ -145,7 +144,7 @@ defmodule Membrane.Matroska.Demuxer do
end

@impl true
def handle_process(:input, %Buffer{payload: bytes}, context, state) do
def handle_buffer(:input, %Buffer{payload: bytes}, context, state) do
unparsed = state.parser_acc <> bytes

{parsed, unparsed} = Matroska.Parser.Helper.parse(unparsed)
Expand Down
7 changes: 3 additions & 4 deletions lib/membrane_matroska/muxer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ defmodule Membrane.Matroska.Muxer do

def_input_pad :input,
availability: :on_request,
mode: :pull,
flow_control: :manual,
demand_unit: :buffers,
accepted_format:
any_of(
Expand All @@ -40,8 +40,7 @@ defmodule Membrane.Matroska.Muxer do
)

def_output_pad :output,
availability: :always,
mode: :pull,
flow_control: :manual,
accepted_format: %RemoteStream{content_format: Matroska}

# 5 mb
Expand Down Expand Up @@ -164,7 +163,7 @@ defmodule Membrane.Matroska.Muxer do
end

@impl true
def handle_process(pad_ref, buffer, _ctx, state) do
def handle_buffer(pad_ref, buffer, _ctx, state) do
state = ingest_buffer(state, pad_ref, buffer)
process_next_block_or_redemand(state)
end
Expand Down
20 changes: 10 additions & 10 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Membrane.Matroska.Plugin.Mixfile do
use Mix.Project

@version "0.4.0"
@version "0.5.0"
@github_url "https://github.com/membraneframework/membrane_matroska_plugin"

def project do
Expand Down Expand Up @@ -38,27 +38,27 @@ defmodule Membrane.Matroska.Plugin.Mixfile do

defp deps do
[
{:membrane_core, "~> 0.12.3"},
{:membrane_core, "~> 1.0"},
{:membrane_matroska_format, "~> 0.1.0"},
{:membrane_h264_format, "~> 0.6.1"},
{:membrane_vp8_format, "~> 0.4.0"},
{:membrane_vp9_format, "~> 0.4.0"},
{:membrane_opus_format, "~> 0.3.0"},
{:membrane_common_c, "~> 0.15.0"},
{:membrane_file_plugin, "~> 0.15.0", runtime: false},
{:membrane_common_c, "~> 0.16.0"},
{:membrane_file_plugin, "~> 0.16.0", runtime: false},
{:qex, "~> 0.5.1"},
{:bimap, "~> 1.2"},
# Test dependencies
{:membrane_opus_plugin, "~> 0.17.0", only: :test, runtime: false},
{:membrane_flv_plugin, "~> 0.9.0", only: :test, runtime: false},
{:membrane_ivf_plugin, "~> 0.6.0", only: :test, runtime: false},
{:membrane_opus_plugin, "~> 0.19.0", only: :test, runtime: false},
{:membrane_flv_plugin, "~> 0.11.0", only: :test, runtime: false},
{:membrane_ivf_plugin, "~> 0.7.0", only: :test, runtime: false},
{:membrane_ogg_plugin,
github: "membraneframework-labs/membrane_libogg_plugin",
tag: "v0.3.0",
tag: "v0.4.0",
only: :test,
runtime: false},
{:membrane_h264_plugin, "~> 0.7.0", only: :test, runtime: false},
{:membrane_ffmpeg_swresample_plugin, "~> 0.17.3", only: :test, runtime: false},
{:membrane_h264_plugin, "~> 0.9.0", only: :test, runtime: false},
{:membrane_ffmpeg_swresample_plugin, "~> 0.19.0", only: :test, runtime: false},
# Credo
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:dialyxir, ">= 0.0.0", only: :dev, runtime: false},
Expand Down
45 changes: 27 additions & 18 deletions mix.lock

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions test/demuxer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defmodule Membrane.Matroska.DemuxerTest do

state = %{output_dir: options.output_dir, track_id_to_file: options.track_id_to_output_file}

{[spec: structure, playback: :playing], state}
{[spec: structure], state}
end

@impl true
Expand Down Expand Up @@ -92,8 +92,6 @@ defmodule Membrane.Matroska.DemuxerTest do
]
|> Testing.Pipeline.start_link()

assert_pipeline_play(pipeline)

references = Map.values(track_id_to_reference)

if Enum.count(references) == 1 do
Expand All @@ -103,7 +101,7 @@ defmodule Membrane.Matroska.DemuxerTest do
assert_end_of_stream(pipeline, {:sink, 2}, :input, 5_000)
end

Testing.Pipeline.terminate(pipeline, blocking?: true)
Testing.Pipeline.terminate(pipeline)

for reference <- Map.values(track_id_to_reference) do
reference_file = File.read!(Path.join(@fixtures_dir, reference))
Expand Down
11 changes: 5 additions & 6 deletions test/muxer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ defmodule Membrane.Matroska.MuxerTest do
})
]

{:ok, _supervisor, pipeline} = Testing.Pipeline.start_link(structure: structure)
{:ok, _supervisor, pipeline} = Testing.Pipeline.start_link(spec: structure)

play_and_validate(pipeline, reference_file, output_file)
end
Expand All @@ -67,7 +67,7 @@ defmodule Membrane.Matroska.MuxerTest do
})
]

{:ok, _supervisor, pipeline} = Testing.Pipeline.start_link(structure: structure)
{:ok, _supervisor, pipeline} = Testing.Pipeline.start_link(spec: structure)

play_and_validate(pipeline, reference_file, output_file)
end
Expand Down Expand Up @@ -129,7 +129,7 @@ defmodule Membrane.Matroska.MuxerTest do

structure = get_test_many_structure(input_file, output_file, buffers, codec)

{:ok, _supervisor, pipeline} = Testing.Pipeline.start_link(structure: structure)
{:ok, _supervisor, pipeline} = Testing.Pipeline.start_link(spec: structure)

play_and_validate(pipeline, reference_file, output_file)
end
Expand All @@ -147,16 +147,15 @@ defmodule Membrane.Matroska.MuxerTest do

structure = get_test_many_structure(input_file, output_file, buffers, :h264)

{:ok, _supervisor, pipeline} = Testing.Pipeline.start_link(structure: structure)
{:ok, _supervisor, pipeline} = Testing.Pipeline.start_link(spec: structure)

play_and_validate(pipeline, reference_file, output_file)
end

defp play_and_validate(pipeline, reference_file, output_file) do
assert_pipeline_play(pipeline)
assert_start_of_stream(pipeline, :sink)
assert_end_of_stream(pipeline, :sink, :input, 5_000)
Testing.Pipeline.terminate(pipeline, blocking?: true)
Testing.Pipeline.terminate(pipeline)

reference_file = File.read!(reference_file)
result_file = File.read!(output_file)
Expand Down

0 comments on commit caed354

Please sign in to comment.