diff --git a/README.md b/README.md index 28a9d37..ed2f521 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ The package can be installed by adding `membrane_transcoder_plugin` to your list ```elixir def deps do [ - {:membrane_transcoder_plugin, "~> 0.1.0"} + {:membrane_transcoder_plugin, "~> 0.1.1"} ] end ``` diff --git a/lib/transcoder/audio.ex b/lib/transcoder/audio.ex index 301d075..2c71c5e 100644 --- a/lib/transcoder/audio.ex +++ b/lib/transcoder/audio.ex @@ -53,11 +53,20 @@ defmodule Membrane.Transcoder.Audio do defp do_plug_audio_transcoding(builder, input_format, output_format) do builder + |> maybe_plug_parser(input_format) |> maybe_plug_decoder(input_format) |> maybe_plug_resampler(input_format, output_format) |> maybe_plug_encoder(output_format) end + defp maybe_plug_parser(builder, %AAC{}) do + builder |> child(:aac_parser, AAC.Parser) + end + + defp maybe_plug_parser(builder, _input_format) do + builder + end + defp maybe_plug_decoder(builder, %Opus{}) do builder |> child(:opus_decoder, Opus.Decoder) end diff --git a/lib/transcoder/video.ex b/lib/transcoder/video.ex index c4cd7be..b025ebd 100644 --- a/lib/transcoder/video.ex +++ b/lib/transcoder/video.ex @@ -3,12 +3,15 @@ defmodule Membrane.Transcoder.Video do import Membrane.ChildrenSpec require Membrane.Logger - alias Membrane.{ChildrenSpec, H264, H265, RawVideo, VP8} + alias Membrane.{ChildrenSpec, H264, H265, RawVideo, RemoteStream, VP8} @type video_stream_format :: VP8.t() | H264.t() | H265.t() | RawVideo.t() defguard is_video_format(format) - when is_struct(format) and format.__struct__ in [VP8, H264, H265, RawVideo] + when is_struct(format) and + (format.__struct__ in [VP8, H264, H265, RawVideo] or + (format.__struct__ == RemoteStream and format.content_format == VP8 and + format.type == :packetized)) @spec plug_video_transcoding( ChildrenSpec.builder(), @@ -69,6 +72,13 @@ defmodule Membrane.Transcoder.Video do builder |> child(:vp8_decoder, %VP8.Decoder{}) end + defp maybe_plug_parser_and_decoder(builder, %RemoteStream{ + content_format: VP8, + type: :packetized + }) do + builder |> child(:vp8_decoder, %VP8.Decoder{}) + end + defp maybe_plug_parser_and_decoder(builder, %RawVideo{}) do builder end diff --git a/mix.exs b/mix.exs index a04dba7..532f2c6 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Membrane.Transcoder.Plugin.Mixfile do use Mix.Project - @version "0.1.0" + @version "0.1.1" @github_url "https://github.com/membraneframework/membrane_transcoder_plugin" def project do @@ -39,6 +39,7 @@ defmodule Membrane.Transcoder.Plugin.Mixfile do [ {:membrane_core, "~> 1.1"}, {:membrane_opus_plugin, "~> 0.20.3"}, + {:membrane_aac_plugin, "~> 0.19.0"}, {:membrane_aac_fdk_plugin, "~> 0.18.0"}, {:membrane_vpx_plugin, "~> 0.2.0"}, {:membrane_h26x_plugin, "~> 0.10.0"}, @@ -57,7 +58,6 @@ defmodule Membrane.Transcoder.Plugin.Mixfile do {:credo, ">= 0.0.0", only: :dev, runtime: false}, {:membrane_file_plugin, "~> 0.17.2", only: :test}, {:membrane_raw_audio_parser_plugin, "~> 0.4.0", only: :test}, - {:membrane_aac_plugin, "~> 0.19.0", only: :test}, {:membrane_ivf_plugin, "~> 0.8.0", only: :test} ] end