diff --git a/.circleci/config.yml b/.circleci/config.yml index 5dfb9df..acad432 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,15 +1,38 @@ version: 2.0 jobs: - build: + test: docker: - - image: membrane/membrane:latest - environment: - MIX_ENV: test - working_directory: '~/app' + - image: membraneframeworklabs/docker_membrane:latest + environment: + MIX_ENV: test + + working_directory: ~/app steps: - checkout - run: mix deps.get - - run: mix format --check-formatted - - run: mix + - run: mix compile --force --warnings-as-errors - run: mix test + + lint: + docker: + - image: membraneframeworklabs/docker_membrane:latest + environment: + MIX_ENV: dev + + working_directory: ~/app + + steps: + - checkout + - run: mix deps.get + - run: mix format --check-formatted + - run: mix compile + - run: mix credo + - run: mix docs && mix docs 2>&1 | (! grep -q "warning:") + +workflows: + version: 2 + build: + jobs: + - test + - lint diff --git a/.credo.exs b/.credo.exs new file mode 100644 index 0000000..917f7b7 --- /dev/null +++ b/.credo.exs @@ -0,0 +1,187 @@ +# This file contains the configuration for Credo and you are probably reading +# this after creating it with `mix credo.gen.config`. +# +# If you find anything wrong or unclear in this file, please report an +# issue on GitHub: https://github.com/rrrene/credo/issues +# +%{ + # + # You can have as many configs as you like in the `configs:` field. + configs: [ + %{ + # + # Run any config using `mix credo -C `. If no config name is given + # "default" is used. + # + name: "default", + # + # These are the files included in the analysis: + files: %{ + # + # You can give explicit globs or simply directories. + # In the latter case `**/*.{ex,exs}` will be used. + # + included: [ + "lib/", + "src/", + "test/", + "web/", + "apps/*/lib/", + "apps/*/src/", + "apps/*/test/", + "apps/*/web/" + ], + excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"] + }, + # + # Load and configure plugins here: + # + plugins: [], + # + # If you create your own checks, you must specify the source files for + # them here, so they can be loaded by Credo before running the analysis. + # + requires: [], + # + # If you want to enforce a style guide and need a more traditional linting + # experience, you can change `strict` to `true` below: + # + strict: false, + # + # To modify the timeout for parsing files, change this value: + # + parse_timeout: 5000, + # + # If you want to use uncolored output by default, you can change `color` + # to `false` below: + # + color: true, + # + # You can customize the parameters of any check by adding a second element + # to the tuple. + # + # To disable a check put `false` as second element: + # + # {Credo.Check.Design.DuplicatedCode, false} + # + checks: [ + # + ## Consistency Checks + # + {Credo.Check.Consistency.ExceptionNames, []}, + {Credo.Check.Consistency.LineEndings, []}, + {Credo.Check.Consistency.ParameterPatternMatching, []}, + {Credo.Check.Consistency.SpaceAroundOperators, []}, + {Credo.Check.Consistency.SpaceInParentheses, []}, + {Credo.Check.Consistency.TabsOrSpaces, []}, + + # + ## Design Checks + # + # You can customize the priority of any check + # Priority values are: `low, normal, high, higher` + # + {Credo.Check.Design.AliasUsage, + [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]}, + # You can also customize the exit_status of each check. + # If you don't want TODO comments to cause `mix credo` to fail, just + # set this value to 0 (zero). + # + {Credo.Check.Design.TagTODO, [exit_status: 0]}, + {Credo.Check.Design.TagFIXME, []}, + + # + ## Readability Checks + # + {Credo.Check.Readability.AliasOrder, []}, + {Credo.Check.Readability.FunctionNames, []}, + {Credo.Check.Readability.LargeNumbers, []}, + {Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]}, + {Credo.Check.Readability.ModuleAttributeNames, []}, + {Credo.Check.Readability.ModuleDoc, []}, + {Credo.Check.Readability.ModuleNames, []}, + {Credo.Check.Readability.ParenthesesInCondition, []}, + {Credo.Check.Readability.ParenthesesOnZeroArityDefs, parens: true}, + {Credo.Check.Readability.PredicateFunctionNames, []}, + {Credo.Check.Readability.PreferImplicitTry, []}, + {Credo.Check.Readability.RedundantBlankLines, []}, + {Credo.Check.Readability.Semicolons, []}, + {Credo.Check.Readability.SpaceAfterCommas, []}, + {Credo.Check.Readability.StringSigils, []}, + {Credo.Check.Readability.TrailingBlankLine, []}, + {Credo.Check.Readability.TrailingWhiteSpace, []}, + {Credo.Check.Readability.UnnecessaryAliasExpansion, []}, + {Credo.Check.Readability.VariableNames, []}, + {Credo.Check.Readability.WithSingleClause, false}, + + # + ## Refactoring Opportunities + # + {Credo.Check.Refactor.CondStatements, []}, + {Credo.Check.Refactor.CyclomaticComplexity, []}, + {Credo.Check.Refactor.FunctionArity, []}, + {Credo.Check.Refactor.LongQuoteBlocks, []}, + {Credo.Check.Refactor.MapInto, false}, + {Credo.Check.Refactor.MatchInCondition, []}, + {Credo.Check.Refactor.NegatedConditionsInUnless, []}, + {Credo.Check.Refactor.NegatedConditionsWithElse, []}, + {Credo.Check.Refactor.Nesting, []}, + {Credo.Check.Refactor.UnlessWithElse, []}, + {Credo.Check.Refactor.WithClauses, []}, + + # + ## Warnings + # + {Credo.Check.Warning.BoolOperationOnSameValues, []}, + {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, + {Credo.Check.Warning.IExPry, []}, + {Credo.Check.Warning.IoInspect, []}, + {Credo.Check.Warning.LazyLogging, false}, + {Credo.Check.Warning.MixEnv, []}, + {Credo.Check.Warning.OperationOnSameValues, []}, + {Credo.Check.Warning.OperationWithConstantResult, []}, + {Credo.Check.Warning.RaiseInsideRescue, []}, + {Credo.Check.Warning.UnusedEnumOperation, []}, + {Credo.Check.Warning.UnusedFileOperation, []}, + {Credo.Check.Warning.UnusedKeywordOperation, []}, + {Credo.Check.Warning.UnusedListOperation, []}, + {Credo.Check.Warning.UnusedPathOperation, []}, + {Credo.Check.Warning.UnusedRegexOperation, []}, + {Credo.Check.Warning.UnusedStringOperation, []}, + {Credo.Check.Warning.UnusedTupleOperation, []}, + {Credo.Check.Warning.UnsafeExec, []}, + + # + # Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`) + + # + # Controversial and experimental checks (opt-in, just replace `false` with `[]`) + # + {Credo.Check.Readability.StrictModuleLayout, + priority: :normal, order: ~w/shortdoc moduledoc behaviour use import require alias/a}, + {Credo.Check.Consistency.MultiAliasImportRequireUse, false}, + {Credo.Check.Consistency.UnusedVariableNames, force: :meaningful}, + {Credo.Check.Design.DuplicatedCode, false}, + {Credo.Check.Readability.AliasAs, false}, + {Credo.Check.Readability.MultiAlias, false}, + {Credo.Check.Readability.Specs, []}, + {Credo.Check.Readability.SinglePipe, false}, + {Credo.Check.Readability.WithCustomTaggedTuple, false}, + {Credo.Check.Refactor.ABCSize, false}, + {Credo.Check.Refactor.AppendSingleItem, false}, + {Credo.Check.Refactor.DoubleBooleanNegation, false}, + {Credo.Check.Refactor.ModuleDependencies, false}, + {Credo.Check.Refactor.NegatedIsNil, false}, + {Credo.Check.Refactor.PipeChainStart, false}, + {Credo.Check.Refactor.VariableRebinding, false}, + {Credo.Check.Warning.LeakyEnvironment, false}, + {Credo.Check.Warning.MapGetUnsafePass, false}, + {Credo.Check.Warning.UnsafeToAtom, false} + + # + # Custom checks can be created using `mix credo.gen.check`. + # + ] + } + ] +} diff --git a/lib/membrane_ffmpeg_swresample.ex b/lib/membrane_ffmpeg_swresample.ex deleted file mode 100644 index 6d879f6..0000000 --- a/lib/membrane_ffmpeg_swresample.ex +++ /dev/null @@ -1,13 +0,0 @@ -defmodule Membrane.FFmpeg.SWResample do - @moduledoc false - use Application - - def start(_type, _args) do - import Supervisor.Spec, warn: false - - children = [] - - opts = [strategy: :one_for_one, name: Membrane.FFmpeg.SWResample] - Supervisor.start_link(children, opts) - end -end diff --git a/lib/membrane_ffmpeg_swresample_plugin/converter.ex b/lib/membrane_ffmpeg_swresample_plugin/converter.ex index 974fba9..b3a9a90 100644 --- a/lib/membrane_ffmpeg_swresample_plugin/converter.ex +++ b/lib/membrane_ffmpeg_swresample_plugin/converter.ex @@ -3,14 +3,17 @@ defmodule Membrane.FFmpeg.SWResample.Converter do This element performs audio conversion/resampling/channel mixing, using SWResample module of FFmpeg library. """ + use Membrane.Filter - alias Membrane.Caps.Audio.Raw, as: Caps + + import Mockery.Macro + + alias Membrane.Caps.Audio.Raw, as: RawAudio alias Membrane.Buffer alias Membrane.Caps.Matcher alias __MODULE__.Native - import Mockery.Macro - @supported_caps {Caps, + @supported_caps {RawAudio, format: Matcher.one_of([:u8, :s16le, :s32le, :f32le, :f64le]), channels: Matcher.one_of([1, 2])} @@ -18,11 +21,11 @@ defmodule Membrane.FFmpeg.SWResample.Converter do def_input_pad :input, demand_unit: :bytes, - caps: [@supported_caps, {Caps, format: :s24le, channels: one_of([1, 2])}] + caps: [@supported_caps, {RawAudio, format: :s24le, channels: one_of([1, 2])}] def_options input_caps: [ type: :caps, - spec: Caps.t() | nil, + spec: RawAudio.t() | nil, default: nil, description: """ Caps for the input pad. If set to nil (default value), @@ -32,7 +35,7 @@ defmodule Membrane.FFmpeg.SWResample.Converter do ], output_caps: [ type: :caps, - spec: Caps.t(), + spec: RawAudio.t(), description: """ Audio caps for souce pad (output) """ @@ -98,21 +101,21 @@ defmodule Membrane.FFmpeg.SWResample.Converter do def handle_demand(:output, size, :bytes, ctx, state) do size = size - |> Caps.bytes_to_time(ctx.pads.output.caps) - |> Caps.time_to_bytes(state.input_caps) + |> RawAudio.bytes_to_time(ctx.pads.output.caps) + |> RawAudio.time_to_bytes(state.input_caps) {{:ok, demand: {:input, size}}, state} end def handle_demand(:output, n_buffers, :buffers, _ctx, state) do - size = n_buffers * Caps.frames_to_bytes(state.frames_per_buffer, state.input_caps) + size = n_buffers * RawAudio.frames_to_bytes(state.frames_per_buffer, state.input_caps) {{:ok, demand: {:input, size}}, state} end @impl true def handle_process(:input, %Buffer{payload: payload}, _ctx, state) do conversion_result = - convert(state.native, Caps.frame_size(state.input_caps), payload, state.queue) + convert(state.native, RawAudio.frame_size(state.input_caps), payload, state.queue) with {:ok, {result, queue}} when byte_size(result) > 0 <- conversion_result do {{:ok, buffer: {:output, %Buffer{payload: result}}, redemand: :output}, @@ -129,14 +132,14 @@ defmodule Membrane.FFmpeg.SWResample.Converter do end defp mk_native( - %Caps{format: input_format, sample_rate: input_rate, channels: input_channels}, - %Caps{format: out_format, sample_rate: out_rate, channels: out_channels} + %RawAudio{format: input_format, sample_rate: input_rate, channels: input_channels}, + %RawAudio{format: out_format, sample_rate: out_rate, channels: out_channels} ) do mockable(Native).create( - input_format |> Caps.Format.serialize(), + input_format |> RawAudio.Format.serialize(), input_rate, input_channels, - out_format |> Caps.Format.serialize(), + out_format |> RawAudio.Format.serialize(), out_rate, out_channels ) diff --git a/mix.exs b/mix.exs index bf44b37..076f066 100644 --- a/mix.exs +++ b/mix.exs @@ -2,17 +2,19 @@ defmodule Membrane.FFmpeg.SWResample.Mixfile do use Mix.Project @github_url "https://github.com/membraneframework/membrane_ffmpeg_swresample_plugin" - @version "0.10.0" + @version "0.11.0" def project do [ app: :membrane_ffmpeg_swresample_plugin, compilers: [:unifex, :bundlex] ++ Mix.compilers(), version: @version, - elixir: "~> 1.10", + elixir: "~> 1.12", elixirc_paths: elixirc_paths(Mix.env()), - description: - "Plugin performing audio conversion, resampling and channel mixing, using SWResample module of [FFmpeg](https://www.ffmpeg.org/) library.", + description: """ + Plugin performing audio conversion, resampling and channel mixing. + Uses SWResample module of [FFmpeg](https://www.ffmpeg.org/) library. + """, package: package(), name: "Membrane FFmpeg SWResample plugin", output_url: @github_url, @@ -23,8 +25,7 @@ defmodule Membrane.FFmpeg.SWResample.Mixfile do def application do [ - extra_applications: [], - mod: {Membrane.FFmpeg.SWResample, []} + extra_applications: [] ] end @@ -35,14 +36,16 @@ defmodule Membrane.FFmpeg.SWResample.Mixfile do [ main: "readme", extras: ["README.md", "LICENSE"], - source_ref: "v#{@version}" + formatters: ["html"], + source_ref: "v#{@version}", + nest_modules_by_prefix: [Membrane.FFmpeg.SWResample] ] end defp package do [ maintainers: ["Membrane Team"], - licenses: ["Apache 2.0"], + licenses: ["Apache-2.0"], links: %{ "GitHub" => @github_url, "Membrane Framework Homepage" => "https://membraneframework.org" @@ -62,14 +65,18 @@ defmodule Membrane.FFmpeg.SWResample.Mixfile do defp deps do [ - {:ex_doc, "~> 0.23", only: :dev, runtime: false}, - {:membrane_core, "~> 0.8.0"}, - {:membrane_caps_audio_raw, "~> 0.5.0"}, + {:membrane_core, "~> 0.9.0"}, + {:membrane_caps_audio_raw, "~> 0.6.0"}, {:bunch, "~> 1.3.0"}, {:unifex, "~> 0.7.0"}, - {:membrane_common_c, "~> 0.10.0"}, + {:membrane_common_c, "~> 0.11.0"}, {:bundlex, "~> 0.5.0"}, - {:mockery, "~> 2.1", runtime: false} + # Testing + {:mockery, "~> 2.1", runtime: false}, + # Development + {:ex_doc, "~> 0.28", only: :dev, runtime: false}, + {:dialyxir, "~> 1.1", only: :dev, runtime: false}, + {:credo, "~> 1.6", only: :dev, runtime: false} ] end end diff --git a/mix.lock b/mix.lock index ea95c26..c034234 100644 --- a/mix.lock +++ b/mix.lock @@ -1,25 +1,30 @@ %{ - "bimap": {:hex, :bimap, "1.2.0", "a10b7138b75747a8ad7b602493b1fd1b221c1b73995e47dc8a7698d50d76ae98", [:mix], [], "hexpm", "f3b5a1e276c439ad35da15e7bd3b60e1f907767f1bf2155fb1690c4f10aed488"}, + "bimap": {:hex, :bimap, "1.2.1", "cbfd21894abc15b82018df906594fbc40aca8a2d5e6511473acc6ded12f6d7e2", [:mix], [], "hexpm", "635488554b5db7554aa3379bc219c5d75575a1126a1e94ea0818a20c626fd03e"}, "bunch": {:hex, :bunch, "1.3.0", "51b4423088b7fb9e21eae6d6bc5e5d219d955ea5556fbd6130bfb6213df4be32", [:mix], [], "hexpm", "9ad233a2bacc0dae8aa6553a9b9057f27446443b1c5903c3479b6f9f3820ce2d"}, "bunch_native": {:hex, :bunch_native, "0.4.0", "9214f73b753c7c4201fc0a1145d9720a15e45effa02d9eea8237d98ae53b36e5", [:mix], [{:bundlex, "~> 0.5.0", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm", "4bf7e84250614994383870092e883bc8b7e213c3854506b1a03493bd9a6a1ba2"}, "bundlex": {:hex, :bundlex, "0.5.1", "a164ba822102476db7a11db8bb7e8adca0630bdff448e00e5ba1138e3df27839", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:qex, "~> 0.5", [hex: :qex, repo: "hexpm", optional: false]}, {:secure_random, "~> 0.5", [hex: :secure_random, repo: "hexpm", optional: false]}], "hexpm", "b3348db967dfa880c9e3d311af7e366ab515202429264334baeeaef04fa7a4e2"}, + "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "coerce": {:hex, :coerce, "1.0.1", "211c27386315dc2894ac11bc1f413a0e38505d808153367bd5c6e75a4003d096", [:mix], [], "hexpm", "b44a691700f7a1a15b4b7e2ff1fa30bebd669929ac8aa43cffe9e2f8bf051cf1"}, - "earmark": {:hex, :earmark, "1.4.1", "07bb382826ee8d08d575a1981f971ed41bd5d7e86b917fd012a93c51b5d28727", [:mix], [], "hexpm"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.17", "6f3c7e94170377ba45241d394389e800fb15adc5de51d0a3cd52ae766aafd63f", [:mix], [], "hexpm", "f93ac89c9feca61c165b264b5837bf82344d13bebc634cd575cb711e2e342023"}, - "ex_doc": {:hex, :ex_doc, "0.25.5", "ac3c5425a80b4b7c4dfecdf51fa9c23a44877124dd8ca34ee45ff608b1c6deb9", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "688cfa538cdc146bc4291607764a7f1fcfa4cce8009ecd62de03b27197528350"}, - "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.15.2", "dc72dfe17eb240552857465cc00cce390960d9a0c055c4ccd38b70629227e97c", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "fd23ae48d09b32eff49d4ced2b43c9f086d402ee4fd4fcb2d7fad97fa8823e75"}, + "credo": {:hex, :credo, "1.6.4", "ddd474afb6e8c240313f3a7b0d025cc3213f0d171879429bf8535d7021d9ad78", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "c28f910b61e1ff829bffa056ef7293a8db50e87f2c57a9b5c3f57eee124536b7"}, + "dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.21", "7299db854f6d63730c15c8a781862889bb0fbf4432d7c306b3e63ce825d64baa", [:mix], [], "hexpm", "60664e1bdf7a02d8cbec2ac1d5b6fe0a68cf1d749ba955990d647346fac421e4"}, + "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, + "ex_doc": {:hex, :ex_doc, "0.28.2", "e031c7d1a9fc40959da7bf89e2dc269ddc5de631f9bd0e326cbddf7d8085a9da", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "51ee866993ffbd0e41c084a7677c570d0fc50cb85c6b5e76f8d936d9587fa719"}, + "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, + "jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"}, + "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"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"}, "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, - "membrane_caps_audio_raw": {:hex, :membrane_caps_audio_raw, "0.5.0", "b30696d81018717327510a2da87bce423c41618098a92ce26d8f16f3ded36716", [:mix], [{:bimap, "~> 1.0", [hex: :bimap, repo: "hexpm", optional: false]}, {:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:membrane_core, "~> 0.8.0", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "c6f310f100b55ab8214e01c8512329bbda7176ef7209a46bda5eb333518426b6"}, - "membrane_common_c": {:hex, :membrane_common_c, "0.10.0", "9db4fa2964039e3cd518b333d27ff7492c9746cd6af5ebd217a101fa1bccbdcd", [:mix], [{:membrane_core, "~> 0.8.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:shmex, "~> 0.4.0", [hex: :shmex, repo: "hexpm", optional: false]}, {:unifex, "~> 0.7.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "bb3312f1b25d9eae3226b49d1f0daa6535fe38ac72d8742adb60b4373c531566"}, - "membrane_core": {:hex, :membrane_core, "0.8.1", "33df0e4c76c05a2be57042893b05516886462baefdf95b7299e4d2f5db32dea3", [:mix], [{:bunch, "~> 1.3", [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", "5574db35f08de1e95648f9c3acce38c5f318216c5a5ae5e3f253f7edad8fdc1b"}, + "membrane_caps_audio_raw": {:hex, :membrane_caps_audio_raw, "0.6.1", "f5772ef28c086d0950b16f85e913b1ea35a4c240cb7d2f42fef3388394b58d5a", [:mix], [{:bimap, "~> 1.1", [hex: :bimap, repo: "hexpm", optional: false]}, {:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:membrane_core, "~> 0.9.0", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "ff827313b18e38f647264c46b0486682a1fbf84c2e43242cea0f127691c748dd"}, + "membrane_common_c": {:hex, :membrane_common_c, "0.11.0", "1706631a80b065725bddb34cf182e17af04aa1a753efc47a0043fa20715ac57b", [:mix], [{:membrane_core, "~> 0.9.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:shmex, "~> 0.4.0", [hex: :shmex, repo: "hexpm", optional: false]}, {:unifex, "~> 0.7.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "2c0f5a21116466bfa3242fe00aea56097c6336029d1d7558e6bd1dd2c02b4b09"}, + "membrane_core": {:hex, :membrane_core, "0.9.0", "91a79636c6b2fcc6ae2e611670cdca33a0b38ff4dabe8fb7c1d56cba426db787", [:mix], [{:bunch, "~> 1.3", [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", "ab252e7aa944d23fbb22ce0e8bc75b088cfe3ed1c2c7ba203b1cc2fd794a85ed"}, "mockery": {:hex, :mockery, "2.3.1", "a02fd60b10ac9ed37a7a2ecf6786c1f1dd5c75d2b079a60594b089fba32dc087", [:mix], [], "hexpm", "1d0971d88ebf084e962da3f2cfee16f0ea8e04ff73a7710428500d4500b947fa"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.2.0", "b44d75e2a6542dcb6acf5d71c32c74ca88960421b6874777f79153bbbbd7dccc", [:mix], [], "hexpm", "52b2871a7515a5ac49b00f214e4165a40724cf99798d8e4a65e4fd64ebd002c1"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, "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"}, - "qex": {:hex, :qex, "0.5.0", "5a3a9becf67d4006377c4c247ffdaaa8ae5b3634a0caadb788dc24d6125068f4", [:mix], [], "hexpm", "4ad6f6421163cd8204509a119a5c9813cbb969cfb8d802a9dc49b968bffbac2a"}, + "qex": {:hex, :qex, "0.5.1", "0d82c0f008551d24fffb99d97f8299afcb8ea9cf99582b770bd004ed5af63fd6", [:mix], [], "hexpm", "935a39fdaf2445834b95951456559e9dc2063d0a055742c558a99987b38d6bab"}, "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"}, "secure_random": {:hex, :secure_random, "0.5.1", "c5532b37c89d175c328f5196a0c2a5680b15ebce3e654da37129a9fe40ebf51b", [:mix], [], "hexpm", "1b9754f15e3940a143baafd19da12293f100044df69ea12db5d72878312ae6ab"}, "shmex": {:hex, :shmex, "0.4.0", "8a074a984bbd45808d80eddfa0f037d7dfb4d4046e6566cd40adf41e13decf74", [:mix], [{:bunch_native, "~> 0.4.0", [hex: :bunch_native, repo: "hexpm", optional: false]}, {:bundlex, "~> 0.5.0", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm", "1018c4eca1db5352ed4dec4813e1ee212b98fc851e1edd302906892538bbfaa8"}, "telemetry": {:hex, :telemetry, "1.0.0", "0f453a102cdf13d506b7c0ab158324c337c41f1cc7548f0bc0e130bbf0ae9452", [:rebar3], [], "hexpm", "73bc09fa59b4a0284efb4624335583c528e07ec9ae76aca96ea0673850aec57a"}, - "unifex": {:hex, :unifex, "0.7.0", "43b876f19a6f9e1849762d90ac2242698a8318199e4b6b92d18274873c733bec", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:bundlex, "~> 0.5.0", [hex: :bundlex, repo: "hexpm", optional: false]}, {:shmex, "~> 0.4.0", [hex: :shmex, repo: "hexpm", optional: false]}], "hexpm", "dac9366611d82d647df5c604638caac0c26951d62892e19cacff3bf7d37556f8"}, + "unifex": {:hex, :unifex, "0.7.3", "6a6948e7f07766a76624621698c546bbf9fb5acd7fc5770eba650f220288f80d", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:bundlex, "~> 0.5.0", [hex: :bundlex, repo: "hexpm", optional: false]}, {:shmex, "~> 0.4.0", [hex: :shmex, repo: "hexpm", optional: false]}], "hexpm", "a6467834eae67b03e0ebc358bdc95c29dc034597c53c5afde4c88e3832f04fcc"}, } diff --git a/test/membrane_ffmpeg_swresample_plugin/converter_native_test.exs b/test/membrane_ffmpeg_swresample_plugin/converter_native_test.exs index 11088de..a84b2fd 100644 --- a/test/membrane_ffmpeg_swresample_plugin/converter_native_test.exs +++ b/test/membrane_ffmpeg_swresample_plugin/converter_native_test.exs @@ -4,7 +4,7 @@ defmodule Membrane.FFmpeg.SWResample.Converter.NativeTest do @module Membrane.FFmpeg.SWResample.Converter.Native - def valid_inputs(_) do + defp valid_inputs(_ctx) do formats = [:u8, :s16le, :s32le, :f32le, :f64le] rates = [44_100, 48_000] channels = [1, 2] @@ -29,7 +29,7 @@ defmodule Membrane.FFmpeg.SWResample.Converter.NativeTest do [valid_inputs: inputs] end - def serialize_input(input) do + defp serialize_input(input) do [ input_fmt, input_rate, @@ -49,7 +49,7 @@ defmodule Membrane.FFmpeg.SWResample.Converter.NativeTest do ] end - def mk_simple_converter(out_fmt, dst_fmt) do + defp mk_simple_converter(out_fmt, dst_fmt) do @module.create( out_fmt |> Raw.Format.serialize(), 48_000, @@ -142,7 +142,7 @@ defmodule Membrane.FFmpeg.SWResample.Converter.NativeTest do 1 ) - input = for _ <- 1..size, do: <<:rand.uniform(255)>>, into: <<>> + input = for _i <- 1..size, do: <<:rand.uniform(255)>>, into: <<>> assert {:ok, res_head} = @module.convert(input, handle) assert {:ok, res_tail} = @module.convert(<<>>, handle) result = res_head <> res_tail @@ -163,7 +163,7 @@ defmodule Membrane.FFmpeg.SWResample.Converter.NativeTest do ) # 2 channels, n * 480 samples per channel, 32 bits (4 bytes) each - input = for _ <- 1..(2 * n * 480), do: <<:rand.uniform()::size(32)-float>>, into: <<>> + input = for _i <- 1..(2 * n * 480), do: <<:rand.uniform()::size(32)-float>>, into: <<>> assert byte_size(input) == 2 * n * 480 * 4 assert {:ok, res_head} = @module.convert(input, handle) diff --git a/test/membrane_ffmpeg_swresample_plugin/converter_test.exs b/test/membrane_ffmpeg_swresample_plugin/converter_test.exs index 27f0ba5..7b2a9ae 100644 --- a/test/membrane_ffmpeg_swresample_plugin/converter_test.exs +++ b/test/membrane_ffmpeg_swresample_plugin/converter_test.exs @@ -19,7 +19,7 @@ defmodule Membrane.FFmpeg.SWResample.ConverterTest do sample_rate: 44_100 } - def initial_state(_) do + defp initial_state(_ctx) do %{ state: %{ input_caps: nil, @@ -32,7 +32,7 @@ defmodule Membrane.FFmpeg.SWResample.ConverterTest do } end - def test_handle_caps(state) do + defp test_handle_caps(state) do Mockery.History.enable_history() mock(@native, [create: 6], {:ok, :mock_handle})