From f971f6074fbfda32e731968c52d7325ac35d3755 Mon Sep 17 00:00:00 2001 From: Billal Ghilas <84322223+gBillal@users.noreply.github.com> Date: Sat, 16 Sep 2023 22:24:20 +0100 Subject: [PATCH] Release v0.3.0 (#8) --- README.md | 34 ++++++++++++++++++- lib/membrane_h265_plugin/parser.ex | 2 +- mix.exs | 2 +- test/integration/modes_test.exs | 2 +- test/parser/au_splitter_test.exs | 2 +- test/parser/process_all_test.exs | 2 +- test/parser/skip_until_test.exs | 4 ++- .../stream_structure_conversion_test.exs | 2 +- 8 files changed, 42 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b414604..26764a4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Membrane H265 Plugin +[![Hex.pm](https://img.shields.io/hexpm/v/membrane_h265_plugin.svg)](https://hex.pm/packages/membrane_h265_plugin) +[![API Docs](https://img.shields.io/badge/api-docs-yellow.svg?style=flat)](https://hexdocs.pm/membrane_h265_plugin) + + Membrane H265 parser. It is the Membrane element responsible for parsing the incoming h265 stream. The parsing is done as a sequence of the following steps: * Splitting the h265 stream into stream NAL units, based on the "Annex B" of the "ITU-T Rec. H.265 (08/2021)" @@ -16,7 +20,35 @@ The package can be installed by adding `membrane_h265_plugin` to your list of de ```elixir def deps do [ - {:membrane_h265_plugin, "~> 0.1.0"} + {:membrane_h265_plugin, "~> 0.3.0"} ] end ``` + +## Usage + +The following pipeline takes H265 file, parses it, and then decodes it to the raw video. + +```elixir +defmodule Decoding.Pipeline do + use Membrane.Pipeline + + alias Membrane.{File, H265} + + @impl true + def handle_init(_ctx, _opts) do + structure = + child(:source, %File.Source{location: "test/fixtures/input-10-1920x1080.h265"}) + |> child(:parser, H265.Parser) + |> child(:decoder, H265.FFmpeg.Decoder) + |> child(:sink, %File.Sink{location: "output.raw"}) + + {[spec: structure], nil} + end + + @impl true + def handle_element_end_of_stream(:sink, _ctx_, state) do + {[terminate: :normal], state} + end +end +``` diff --git a/lib/membrane_h265_plugin/parser.ex b/lib/membrane_h265_plugin/parser.ex index aea1dc7..6bb705e 100644 --- a/lib/membrane_h265_plugin/parser.ex +++ b/lib/membrane_h265_plugin/parser.ex @@ -163,7 +163,7 @@ defmodule Membrane.H265.Parser do By default, the parser adds negative DTS offset to the timestamps, so that in case of frame reorder (which always happens when B frames - are present) the DTS was always bigger than PTS. If that is not desired, + are present) the DTS is always bigger than PTS. If that is not desired, you can set `add_dts_offset: false`. The calculated DTS/PTS may be wrong since we base it on access units' POC (Picture Order Count). diff --git a/mix.exs b/mix.exs index e3f6a87..b321e07 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Membrane.H265.Plugin.Mixfile do use Mix.Project - @version "0.2.0" + @version "0.3.0" @github_url "https://github.com/gBillal/membrane_h265_plugin" def project do diff --git a/test/integration/modes_test.exs b/test/integration/modes_test.exs index 442c1dd..8d8252f 100644 --- a/test/integration/modes_test.exs +++ b/test/integration/modes_test.exs @@ -1,6 +1,6 @@ defmodule Membrane.H265.ModesTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true import Membrane.ChildrenSpec import Membrane.H265.Support.Common diff --git a/test/parser/au_splitter_test.exs b/test/parser/au_splitter_test.exs index 3e6b20e..1161858 100644 --- a/test/parser/au_splitter_test.exs +++ b/test/parser/au_splitter_test.exs @@ -1,7 +1,7 @@ defmodule AUSplitterTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true @test_files_names ["10-1920x1080", "10-480x320-mainstillpicture"] diff --git a/test/parser/process_all_test.exs b/test/parser/process_all_test.exs index f19fd89..0a5707c 100644 --- a/test/parser/process_all_test.exs +++ b/test/parser/process_all_test.exs @@ -1,7 +1,7 @@ defmodule Membrane.H265.ProcessAllTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true import Membrane.ChildrenSpec import Membrane.Testing.Assertions diff --git a/test/parser/skip_until_test.exs b/test/parser/skip_until_test.exs index 802bc9c..bbed5c4 100644 --- a/test/parser/skip_until_test.exs +++ b/test/parser/skip_until_test.exs @@ -1,9 +1,11 @@ defmodule Membrane.H265.SkipUntilTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true + import Membrane.ChildrenSpec import Membrane.Testing.Assertions + alias Membrane.H265 alias Membrane.Testing.Pipeline diff --git a/test/parser/stream_structure_conversion_test.exs b/test/parser/stream_structure_conversion_test.exs index 5e8531e..c17447c 100644 --- a/test/parser/stream_structure_conversion_test.exs +++ b/test/parser/stream_structure_conversion_test.exs @@ -1,7 +1,7 @@ defmodule Membrane.H265.StreamStructureConversionTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true import Membrane.ChildrenSpec import Membrane.Testing.Assertions