Skip to content

Commit 124f7f9

Browse files
authored
Merge pull request #13 from membraneframework/allow-h26x-in-remote-stream
Allow H26x in remote stream
2 parents 4b45977 + 3d0d79a commit 124f7f9

File tree

4 files changed

+59
-12
lines changed

4 files changed

+59
-12
lines changed

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_transcoder_plugin` to your list
1717
```elixir
1818
def deps do
1919
[
20-
{:membrane_transcoder_plugin, "~> 0.3.1"}
20+
{:membrane_transcoder_plugin, "~> 0.3.2"}
2121
]
2222
end
2323
```

lib/transcoder/audio.ex

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,30 @@ defmodule Membrane.Transcoder.Audio do
2222

2323
@type audio_stream_format :: AAC.t() | Opus.t() | Membrane.MPEGAudio.t() | RawAudio.t()
2424

25+
defguardp is_raw_audio_format(format)
26+
when is_struct(format) and format.__struct__ == RawAudio
27+
28+
defguardp is_aac_format(format)
29+
when is_struct(format) and format.__struct__ == AAC
30+
31+
defguardp is_opus_format(format)
32+
when is_struct(format) and
33+
(format.__struct__ == Opus or
34+
(format.__struct__ == RemoteStream and
35+
format.content_format == Opus and
36+
format.type == :packetized))
37+
38+
defguardp is_mpeg_audio_format(format)
39+
when is_struct(format) and
40+
(format.__struct__ == MPEGAudio or
41+
(format.__struct__ == RemoteStream and
42+
format.content_format == MPEGAudio))
43+
2544
defguard is_audio_format(format)
26-
when is_struct(format) and
27-
(format.__struct__ in [AAC, Opus, MPEGAudio, RawAudio] or
28-
(format.__struct__ == RemoteStream and
29-
format.content_format == Opus and
30-
format.type == :packetized) or
31-
(format.__struct__ == RemoteStream and format.content_format == MPEGAudio))
45+
when is_raw_audio_format(format) or
46+
is_aac_format(format) or
47+
is_opus_format(format) or
48+
is_mpeg_audio_format(format)
3249

3350
defguard is_opus_compliant(format)
3451
when is_map_key(format, :content_type) and format.content_type == :s16le and

lib/transcoder/video.ex

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,26 @@ defmodule Membrane.Transcoder.Video do
77

88
@type video_stream_format :: VP8.t() | VP9.t() | H264.t() | H265.t() | RawVideo.t()
99

10+
defguardp is_raw_video_format(format)
11+
when is_struct(format) and format.__struct__ == RawVideo
12+
13+
defguardp is_h26x_format(format)
14+
when is_struct(format) and
15+
(format.__struct__ in [H264, H265] or
16+
(format.__struct__ == RemoteStream and
17+
format.content_format in [H264, H265]))
18+
19+
defguardp is_vpx_format(format)
20+
when is_struct(format) and
21+
(format.__struct__ in [VP8, VP9] or
22+
(format.__struct__ == RemoteStream and
23+
format.content_format in [VP8, VP9] and
24+
format.type == :packetized))
25+
1026
defguard is_video_format(format)
11-
when is_struct(format) and
12-
(format.__struct__ in [VP8, VP9, H264, H265, RawVideo] or
13-
(format.__struct__ == RemoteStream and format.content_format in [VP8, VP9] and
14-
format.type == :packetized))
27+
when is_h26x_format(format) or
28+
is_vpx_format(format) or
29+
is_raw_video_format(format)
1530

1631
@spec plug_video_transcoding(
1732
ChildrenSpec.builder(),
@@ -24,6 +39,21 @@ defmodule Membrane.Transcoder.Video do
2439
do_plug_video_transcoding(builder, input_format, output_format, transcoding_policy)
2540
end
2641

42+
defp do_plug_video_transcoding(
43+
builder,
44+
%RemoteStream{content_format: h26x},
45+
output_format,
46+
transcoding_policy
47+
)
48+
when h26x in [H264, H265] do
49+
do_plug_video_transcoding(
50+
builder,
51+
struct!(h26x),
52+
output_format,
53+
transcoding_policy
54+
)
55+
end
56+
2757
defp do_plug_video_transcoding(builder, %H264{}, %H264{} = output_format, transcoding_policy)
2858
when transcoding_policy in [:if_needed, :never] do
2959
builder

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule Membrane.Transcoder.Plugin.Mixfile do
22
use Mix.Project
33

4-
@version "0.3.1"
4+
@version "0.3.2"
55
@github_url "https://github.com/membraneframework/membrane_transcoder_plugin"
66

77
def project do

0 commit comments

Comments
 (0)