Skip to content

Commit 34ea384

Browse files
authored
Use old channel layout API if new is unavailable. Release 0.1.1 (#6)
* Use old channel layout API if new is unavailable * Bump cache, bump deps, release 0.1.1 * Fix incorrect field being set in AVFrame * Bump bundlex, move to membrane_PDP
1 parent 18df138 commit 34ea384

File tree

7 files changed

+29
-32
lines changed

7 files changed

+29
-32
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ workflows:
2424
build:
2525
jobs:
2626
- elixir/build_test:
27+
cache-version: 2
2728
filters: &filters
2829
tags:
2930
only: /v.*/
3031
- elixir/test:
32+
cache-version: 2
3133
filters:
3234
<<: *filters
3335
- elixir/lint:
36+
cache-version: 2
3437
filters:
3538
<<: *filters
3639
- run-examples:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The package can be installed by adding `membrane_g711_ffmpeg_plugin` to your lis
1717
```elixir
1818
def deps do
1919
[
20-
{:membrane_g711_ffmpeg_plugin, "~> 0.1.0"}
20+
{:membrane_g711_ffmpeg_plugin, "~> 0.1.1"}
2121
]
2222
end
2323
```

bundlex.exs

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,6 @@
11
defmodule Membrane.G711.FFmpeg.BundlexProject do
22
use Bundlex.Project
33

4-
defp get_ffmpeg_url() do
5-
membrane_precompiled_url_prefix =
6-
"https://github.com/membraneframework-precompiled/precompiled_ffmpeg/releases/latest/download/ffmpeg"
7-
8-
case Bundlex.get_target() do
9-
%{architecture: "aarch64", os: "linux"} ->
10-
"https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n6.0-latest-linuxarm64-gpl-shared-6.0.tar.xz"
11-
12-
%{os: "linux"} ->
13-
"https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n6.0-latest-linux64-gpl-shared-6.0.tar.xz"
14-
15-
%{architecture: "x86_64", os: "darwin" <> _rest_of_os_name} ->
16-
"#{membrane_precompiled_url_prefix}_macos_intel.tar.gz"
17-
18-
%{architecture: "aarch64", os: "darwin" <> _rest_of_os_name} ->
19-
"#{membrane_precompiled_url_prefix}_macos_arm.tar.gz"
20-
21-
_other ->
22-
nil
23-
end
24-
end
25-
264
def project() do
275
[
286
natives: natives()
@@ -36,7 +14,8 @@ defmodule Membrane.G711.FFmpeg.BundlexProject do
3614
sources: ["decoder.c"],
3715
os_deps: [
3816
ffmpeg: [
39-
{:precompiled, get_ffmpeg_url(), ["libavcodec", "libavutil"]},
17+
{:precompiled, Membrane.PrecompiledDependencyProvider.get_dependency_url(:ffmpeg),
18+
["libavcodec", "libavutil"]},
4019
{:pkg_config, ["libavcodec", "libavutil"]}
4120
]
4221
],
@@ -47,7 +26,8 @@ defmodule Membrane.G711.FFmpeg.BundlexProject do
4726
sources: ["encoder.c"],
4827
os_deps: [
4928
ffmpeg: [
50-
{:precompiled, get_ffmpeg_url(), ["libavcodec", "libavutil"]},
29+
{:precompiled, Membrane.PrecompiledDependencyProvider.get_dependency_url(:ffmpeg),
30+
["libavcodec", "libavutil"]},
5131
{:pkg_config, ["libavcodec", "libavutil"]}
5232
]
5333
],

c_src/membrane_g711_ffmpeg_plugin/decoder.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ UNIFEX_TERM create(UnifexEnv *env) {
3131
}
3232

3333
state->codec_ctx->sample_rate = G711_SAMPLE_RATE;
34+
#if (LIBAVCODEC_VERSION_MAJOR < 59 || (LIBAVCODEC_VERSION_MAJOR == 59 && LIBAVCODEC_VERSION_MINOR < 24))
35+
state->codec_ctx->channels = G711_NUM_CHANNELS;
36+
#else
3437
state->codec_ctx->ch_layout.nb_channels = G711_NUM_CHANNELS;
38+
#endif
3539

3640
if (avcodec_open2(state->codec_ctx, codec, NULL) < 0) {
3741
res = create_result_error(env, "codec_open");

c_src/membrane_g711_ffmpeg_plugin/encoder.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ UNIFEX_TERM create(UnifexEnv *env, char *sample_fmt) {
3131
}
3232

3333
state->codec_ctx->sample_rate = G711_SAMPLE_RATE;
34+
#if (LIBAVCODEC_VERSION_MAJOR < 59 || (LIBAVCODEC_VERSION_MAJOR == 59 && LIBAVCODEC_VERSION_MINOR < 24))
35+
state->codec_ctx->channels = G711_NUM_CHANNELS;
36+
#else
3437
state->codec_ctx->ch_layout.nb_channels = G711_NUM_CHANNELS;
38+
#endif
3539

3640
if (strcmp(sample_fmt, "s16le") == 0) {
3741
state->codec_ctx->sample_fmt = AV_SAMPLE_FMT_S16;
@@ -101,7 +105,11 @@ UNIFEX_TERM encode(UnifexEnv *env, UnifexPayload *payload, State *state) {
101105

102106
frame->nb_samples = payload->size / av_get_bytes_per_sample(state->codec_ctx->sample_fmt);
103107
frame->format = state->codec_ctx->sample_fmt;
108+
#if (LIBAVCODEC_VERSION_MAJOR < 59 || (LIBAVCODEC_VERSION_MAJOR == 59 && LIBAVCODEC_VERSION_MINOR < 24))
109+
frame->channels = state->codec_ctx->channels;
110+
#else
104111
av_channel_layout_copy(&frame->ch_layout, &state->codec_ctx->ch_layout);
112+
#endif
105113

106114
frame->data[0] = payload->data;
107115

mix.exs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule Membrane.G711.FFmpeg.Mixfile do
22
use Mix.Project
33

4-
@version "0.1.0"
4+
@version "0.1.1"
55
@github_url "https://github.com/jellyfish-dev/membrane_g711_ffmpeg_plugin"
66

77
def project do
@@ -37,8 +37,9 @@ defmodule Membrane.G711.FFmpeg.Mixfile do
3737

3838
defp deps do
3939
[
40-
{:bundlex, "~> 1.3.0"},
41-
{:unifex, "~> 1.1.0"},
40+
{:bundlex, "~> 1.4"},
41+
{:unifex, "~> 1.1"},
42+
{:membrane_precompiled_dependency_provider, "~> 0.1.0"},
4243
{:membrane_core, "~> 1.0"},
4344
{:membrane_g711_format, "~> 0.1.0"},
4445
{:membrane_raw_audio_format, "~> 0.12.0"},

mix.lock

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"bimap": {:hex, :bimap, "1.3.0", "3ea4832e58dc83a9b5b407c6731e7bae87458aa618e6d11d8e12114a17afa4b3", [:mix], [], "hexpm", "bf5a2b078528465aa705f405a5c638becd63e41d280ada41e0f77e6d255a10b4"},
33
"bunch": {:hex, :bunch, "1.6.1", "5393d827a64d5f846092703441ea50e65bc09f37fd8e320878f13e63d410aec7", [:mix], [], "hexpm", "286cc3add551628b30605efbe2fca4e38cc1bea89bcd0a1a7226920b3364fe4a"},
44
"bunch_native": {:hex, :bunch_native, "0.5.0", "8ac1536789a597599c10b652e0b526d8833348c19e4739a0759a2bedfd924e63", [:mix], [{:bundlex, "~> 1.0", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm", "24190c760e32b23b36edeb2dc4852515c7c5b3b8675b1a864e0715bdd1c8f80d"},
5-
"bundlex": {:hex, :bundlex, "1.3.2", "3fe5de1a96a353b0bc2ea676703f435d955afc466d61a128a887330814434920", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:elixir_uuid, "~> 1.2", [hex: :elixir_uuid, repo: "hexpm", optional: false]}, {:qex, "~> 0.5", [hex: :qex, repo: "hexpm", optional: false]}, {:req, "~> 0.4.0", [hex: :req, repo: "hexpm", optional: false]}, {:zarex, "~> 1.0", [hex: :zarex, repo: "hexpm", optional: false]}], "hexpm", "3806324386d75a0a8451ef3573707af6f30749a361bcf6ea093223c3f9e309fe"},
6-
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
5+
"bundlex": {:hex, :bundlex, "1.4.2", "d493afaf473fef0bf241e55f264b53a79e7172263a5d114d573558ec0c4b8e4a", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:elixir_uuid, "~> 1.2", [hex: :elixir_uuid, repo: "hexpm", optional: false]}, {:qex, "~> 0.5", [hex: :qex, repo: "hexpm", optional: false]}, {:req, "~> 0.4.0", [hex: :req, repo: "hexpm", optional: false]}, {:zarex, "~> 1.0", [hex: :zarex, repo: "hexpm", optional: false]}], "hexpm", "6a484512428c37c221e3bcd17d77c8cdc6aedda547d703dc434d7f1004553abd"},
6+
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
77
"castore": {:hex, :castore, "1.0.5", "9eeebb394cc9a0f3ae56b813459f990abb0a3dedee1be6b27fdb50301930502f", [:mix], [], "hexpm", "8d7c597c3e4a64c395980882d4bca3cebb8d74197c590dc272cfd3b6a6310578"},
88
"coerce": {:hex, :coerce, "1.0.1", "211c27386315dc2894ac11bc1f413a0e38505d808153367bd5c6e75a4003d096", [:mix], [], "hexpm", "b44a691700f7a1a15b4b7e2ff1fa30bebd669929ac8aa43cffe9e2f8bf051cf1"},
9-
"credo": {:hex, :credo, "1.7.1", "6e26bbcc9e22eefbff7e43188e69924e78818e2fe6282487d0703652bc20fd62", [:mix], [{:bunt, "~> 0.2.1", [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", "e9871c6095a4c0381c89b6aa98bc6260a8ba6addccf7f6a53da8849c748a58a2"},
9+
"credo": {:hex, :credo, "1.7.2", "fdee3a7cb553d8f2e773569181f0a4a2bb7d192e27e325404cc31b354f59d68c", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "dd15d6fbc280f6cf9b269f41df4e4992dee6615939653b164ef951f60afcb68e"},
1010
"dialyxir": {:hex, :dialyxir, "1.4.2", "764a6e8e7a354f0ba95d58418178d486065ead1f69ad89782817c296d0d746a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "516603d8067b2fd585319e4b13d3674ad4f314a5902ba8130cd97dc902ce6bbd"},
1111
"earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"},
1212
"elixir_uuid": {:hex, :elixir_uuid, "1.2.1", "dce506597acb7e6b0daeaff52ff6a9043f5919a4c3315abb4143f0b00378c097", [:mix], [], "hexpm", "f7eba2ea6c3555cea09706492716b0d87397b88946e6380898c2889d68585752"},
1313
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
1414
"ex_doc": {:hex, :ex_doc, "0.31.0", "06eb1dfd787445d9cab9a45088405593dd3bb7fe99e097eaa71f37ba80c7a676", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "5350cafa6b7f77bdd107aa2199fe277acf29d739aba5aee7e865fc680c62a110"},
15-
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
15+
"file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"},
1616
"finch": {:hex, :finch, "0.16.0", "40733f02c89f94a112518071c0a91fe86069560f5dbdb39f9150042f44dcfb1a", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f660174c4d519e5fec629016054d60edd822cdfe2b7270836739ac2f97735ec5"},
1717
"hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"},
1818
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
@@ -22,6 +22,7 @@
2222
"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"},
2323
"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"},
2424
"membrane_g711_format": {:hex, :membrane_g711_format, "0.1.0", "a570a9832a6bf23074210816560e5116935f0face32605968135bf3451ad8a12", [:mix], [], "hexpm", "cbf2c0482b4ca2145c440cd1dcfa865967bcaeaa3813f4f4d2c28a66b59659ef"},
25+
"membrane_precompiled_dependency_provider": {:hex, :membrane_precompiled_dependency_provider, "0.1.0", "2ba721d1b5be9b00fb5a9ea7c9a304cbf3f012cbc1e209979aa0641531103112", [:mix], [{:bundlex, "~> 1.4", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm", "73feab552a902af8f64797ddcfd6a1089268eafd07cd5121ead481a26b41354c"},
2526
"membrane_raw_audio_format": {:hex, :membrane_raw_audio_format, "0.12.0", "b574cd90f69ce2a8b6201b0ccf0826ca28b0fbc8245b8078d9f11cef65f7d5d5", [:mix], [{:bimap, "~> 1.1", [hex: :bimap, repo: "hexpm", optional: false]}, {:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:membrane_core, "~> 1.0", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "6e6c98e3622a2b9df19eab50ba65d7eb45949b1ba306fa8423df6cdb12fd0b44"},
2627
"membrane_raw_audio_parser_plugin": {:hex, :membrane_raw_audio_parser_plugin, "0.4.0", "7a1e53b68a221d00e47fb5d3c7e29200dfe8f7bc0862e69000b61c6562093acc", [:mix], [{:membrane_core, "~> 1.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:membrane_raw_audio_format, "~> 0.12.0", [hex: :membrane_raw_audio_format, repo: "hexpm", optional: false]}], "hexpm", "ff8d3fba45b1c2814b68d49878f19d2c1ad1147b53f606b48b6b67068435dcd0"},
2728
"mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"},

0 commit comments

Comments
 (0)