Skip to content

Commit

Permalink
taking deps from hex, readme improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-hek committed Jun 6, 2018
1 parent 0ebb080 commit d1c1e36
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 17 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Membrane.Element.FFmpeg.SWResample

This element performs audio conversion, resampling and channel mixing, using SWResample module of FFmpeg library.
Element of [Membrane Multimedia Framework](https://membraneframework.org) performing audio conversion, resampling and channel mixing, using SWResample module of [FFmpeg](https://www.ffmpeg.org/) library.

Documentation is available at [HexDocs](https://hexdocs.pm/membrane_element_portaudio/)

## Installation

Add the following line to your `deps` in `mix.exs`. Run `mix deps.get`.

```elixir
{:membrane_element_ffmpeg_swresample, "~> 0.1"}
```

You also need to have [FFmpeg](https://www.ffmpeg.org/) library installed.
For usage on windows, see `Using on Windows` section below.

## Sample usage

Expand Down Expand Up @@ -46,4 +59,4 @@ It is possible to compile and use this element on Windows platform. That require
* adding directory with DLLs to `PATH` environment variable
* placing them in current directory (where you start `mix run`)
* placing them in the directory where erlang executable is located
* making them available system-wide by placing in system (`C:\Windows\System32`, `C:\Windows\SysWOW64`) or Windows (`C:\Windows`) directory
* making them available system-wide by placing in system (`C:\Windows\System32`, `C:\Windows\SysWOW64`) or Windows (`C:\Windows`) directory
8 changes: 7 additions & 1 deletion lib/membrane_element_ffmpeg_swresample/converter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,18 @@ defmodule Membrane.Element.FFmpeg.SWResample.Converter do
when byte_size(queue) + byte_size(payload) > 2 * frame_size do
{payload, q} =
(queue <> payload)
|> Helper.Binary.int_rem(frame_size)
|> binary_int_rem(frame_size)

with {:ok, result} <- @native.convert(native, payload) do
{:ok, {result, q}}
end
end

defp convert(_native, _frame_size, payload, queue), do: {:ok, {<<>>, queue <> payload}}

defp binary_int_rem(b, d) when is_binary(b) and is_integer(d) do
len = b |> byte_size |> int_part(d)
<<b::binary-size(len), r::binary>> = b
{b, r}
end
end
37 changes: 27 additions & 10 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ defmodule Membrane.Element.FFmpeg.SWResample.Mixfile do
use Mix.Project
Application.put_env(:bundlex, :membrane_element_ffmpeg_swresample, __ENV__)

@github_url "https://github.com/membraneframework/membrane-element-ffmpeg-swresample"

def project do
[
app: :membrane_element_ffmpeg_swresample,
Expand All @@ -12,8 +14,8 @@ defmodule Membrane.Element.FFmpeg.SWResample.Mixfile do
description: "Membrane Multimedia Framework (FFmpeg SWResample Element)",
package: package(),
name: "Membrane Element: FFmpeg SWResample",
source_url: link(),
homepage_url: "https://membraneframework.org",
source_url: @github_url,
docs: docs(),
deps: deps()
]
end
Expand All @@ -28,26 +30,41 @@ defmodule Membrane.Element.FFmpeg.SWResample.Mixfile do
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]

defp link do
"https://github.com/membraneframework/membrane-element-ffmpeg-swresample"
defp docs do
[
main: "readme",
extras: ["README.md"]
]
end

defp package do
[
maintainers: ["Membrane Team"],
licenses: ["Apache 2.0"],
links: %{"GitHub" => link()}
links: %{
"GitHub" => @github_url,
"Membrane Framework Homepage" => "https://membraneframework.org"
},
files: [
"lib",
"c_src",
"ext",
"mix.exs",
"README*",
"LICENSE*",
".formatter.exs",
"bundlex.exs"
]
]
end

defp deps do
[
{:ex_doc, "~> 0.18", only: :dev, runtime: false},
{:membrane_core, git: "[email protected]:membraneframework/membrane-core.git"},
{:membrane_caps_audio_raw,
git: "[email protected]:membraneframework/membrane-caps-audio-raw.git"},
{:membrane_common_c, git: "[email protected]:membraneframework/membrane-common-c.git"},
{:bundlex, git: "[email protected]:radiokit/bundlex.git"},
{:membrane_core, "~> 0.1"},
{:membrane_caps_audio_raw, "~> 0.1"},
{:membrane_common_c, "~> 0.1"},
{:bundlex, "~> 0.1"},
{:mockery, "~> 2.1", runtime: false}
]
end
Expand Down
8 changes: 4 additions & 4 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
%{
"bimap": {:hex, :bimap, "0.1.1", "f0406e59f65ba903af678383d2356d0a6e59fb794adc1a7dd32bd8fabe0f028f", [:mix], [], "hexpm"},
"bundlex": {:git, "[email protected]:radiokit/bundlex.git", "78f8f42f8c3ec497680dd2f036619961b64d47f3", []},
"bundlex": {:hex, :bundlex, "0.1.0", "fa28a7f5b5605f0c788b0e8ada69fa9aa6ab8d0fadf03a519f43f780e160e3cc", [:mix], [{:porcelain, "~> 2.0", [hex: :porcelain, repo: "hexpm", optional: false]}], "hexpm"},
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], []},
"earmark": {:hex, :earmark, "1.2.5", "4d21980d5d2862a2e13ec3c49ad9ad783ffc7ca5769cf6ff891a4553fbaae761", [:mix], [], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.18.3", "f4b0e4a2ec6f333dccf761838a4b253d75e11f714b85ae271c9ae361367897b7", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
"membrane_caps_audio_mpeg": {:git, "[email protected]:membraneframework/membrane-caps-audio-mpeg.git", "4f29dec1b3058cdf1d113484240569b64d4334b2", []},
"membrane_caps_audio_raw": {:git, "[email protected]:membraneframework/membrane-caps-audio-raw.git", "a9fa796731424ee36dd6af1ea0a4456677e85caf", []},
"membrane_common_c": {:git, "[email protected]:membraneframework/membrane-common-c.git", "a2f5a600de77bec6f3ec42392e6205daf8797e6b", []},
"membrane_core": {:git, "[email protected]:membraneframework/membrane-core.git", "c30d56d1dc1dda34b82eb13af6cf83aee8d8984f", []},
"membrane_caps_audio_raw": {:hex, :membrane_caps_audio_raw, "0.1.0", "e56c154ac91ed42a429982120f1bd2f55ec411cf5cc4b45d39788ce792346575", [:mix], [{:bimap, "~> 0.1", [hex: :bimap, repo: "hexpm", optional: false]}, {:membrane_core, "~> 0.1", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm"},
"membrane_common_c": {:hex, :membrane_common_c, "0.1.0", "1ca2ca66b9244a8f08efa2d43ca56d149c91e63b198f386857ec1b25c91119ec", [:mix], [{:bundlex, "~> 0.1", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm"},
"membrane_core": {:hex, :membrane_core, "0.1.0", "f9cd2f35e910a1ba050b6af68871e94e699d060da710a301551c28671857f0ca", [:mix], [{:qex, "~> 0.3", [hex: :qex, repo: "hexpm", optional: false]}], "hexpm"},
"mockery": {:hex, :mockery, "2.1.0", "75f2ae11f1f1ebd006d9e80fa4d2a181ed1bd45c7d48c4e501644c3f5c0012e5", [:mix], [], "hexpm"},
"porcelain": {:hex, :porcelain, "2.0.3", "2d77b17d1f21fed875b8c5ecba72a01533db2013bd2e5e62c6d286c029150fdc", [:mix], [], "hexpm"},
"qex": {:hex, :qex, "0.3.4", "92fba2ca8fa162d4619d572ec6d9124f47564a5c8dd1e252147c29d3435d2608", [:mix], [], "hexpm"},
Expand Down

0 comments on commit d1c1e36

Please sign in to comment.