diff --git a/.circleci/config.yml b/.circleci/config.yml index 09fadb3..c077fb4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,25 @@ workflows: version: 2 build: jobs: - - elixir/build_test - - elixir/test - - elixir/lint + - elixir/build_test: + filters: &filters + tags: + only: /v.*/ + - elixir/test: + filters: + <<: *filters + - elixir/lint: + filters: + <<: *filters + - elixir/hex_publish: + requires: + - elixir/build_test + - elixir/test + - elixir/lint + context: + - Deployment + filters: + branches: + ignore: /.*/ + tags: + only: /v.*/ diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e310ff5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +max_line_length = 100 +tab_width = 2 +trim_trailing_whitespace = true diff --git a/.formatter.exs b/.formatter.exs index ea095aa..4c3febe 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -2,8 +2,7 @@ inputs: [ "{lib,test,config}/**/*.{ex,exs}", ".formatter.exs", - "*.exs", - "c_src/**/*.spec.exs" + "*.exs" ], - import_deps: [:membrane_core, :bundlex, :unifex] + import_deps: [:membrane_core] ] diff --git a/.gitignore b/.gitignore index 2a7a84a..324f6fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,14 @@ +compile_commands.json +.gdb_history +bundlex.sh +bundlex.bat + +# Dir generated by tmp_dir ExUnit tag +/tmp/ + +# Created by https://www.gitignore.io/api/c,vim,linux,macos,elixir,windows,visualstudiocode +# Edit at https://www.gitignore.io/?templates=c,vim,linux,macos,elixir,windows,visualstudiocode + ### C ### # Prerequisites *.d @@ -61,8 +72,11 @@ dkms.conf erl_crash.dump *.ez *.beam +/config/*.secret.exs +.elixir_ls/ ### Elixir Patch ### + ### Linux ### *~ @@ -79,7 +93,8 @@ erl_crash.dump .nfs* ### macOS ### -*.DS_Store +# General +.DS_Store .AppleDouble .LSOverride @@ -106,15 +121,23 @@ Temporary Items .apdisk ### Vim ### -# swap -.sw[a-p] -.*.sw[a-p] -# session +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session Session.vim -# temporary +Sessionx.vim + +# Temporary .netrwhist -# auto-generated tag files +# Auto-generated tag files tags +# Persistent undo +[._]*.un~ ### VisualStudioCode ### .vscode/* @@ -122,16 +145,23 @@ tags !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json + +### VisualStudioCode Patch ### +# Ignore all local history of files .history ### Windows ### # Windows thumbnail cache files Thumbs.db +Thumbs.db:encryptable ehthumbs.db ehthumbs_vista.db +# Dump file +*.stackdump + # Folder config file -Desktop.ini +[Dd]esktop.ini # Recycle Bin used on file shares $RECYCLE.BIN/ @@ -139,17 +169,11 @@ $RECYCLE.BIN/ # Windows Installer files *.cab *.msi +*.msix *.msm *.msp # Windows shortcuts *.lnk - -compile_commands.json -.elixir_ls -.gdb_history -bundlex.sh -bundlex.bat - # End of https://www.gitignore.io/api/c,vim,linux,macos,elixir,windows,visualstudiocode diff --git a/README.md b/README.md index ace04ea..76476cc 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The package can be installed by adding `membrane_sdl_plugin` to your list of dep ```elixir def deps do [ - {:membrane_sdl_plugin, "~> 0.14.0"} + {:membrane_sdl_plugin, "~> 0.15.0"} ] end ``` diff --git a/examples/player.exs b/examples/player.exs index 7b7947b..61beba4 100644 --- a/examples/player.exs +++ b/examples/player.exs @@ -8,40 +8,36 @@ Mix.install([ defmodule Example do use Membrane.Pipeline + import Membrane.ChildrenSpec + @media_url "http://raw.githubusercontent.com/membraneframework/static/gh-pages/samples/big-buck-bunny/bun33s_720x480.h264" @impl true def handle_init(_opts) do - spec = %ParentSpec{ - children: %{ - source: %Membrane.Hackney.Source{location: @media_url, hackney_opts: [follow_redirect: true]}, - parser: %Membrane.H264.FFmpeg.Parser{framerate: {25, 1}}, - decoder: Membrane.H264.FFmpeg.Decoder, - player: Membrane.SDL.Player - }, - links: [ - link(:source) |> to(:parser) |> to(:decoder) |> to(:player) - ] - } + structure = + child(:source , %Membrane.Hackney.Source{ + location: @media_url, + hackney_opts: [follow_redirect: true] + }) + |> child(:parser, %Membrane.H264.FFmpeg.Parser{framerate: {25, 1}}) + |> child(:decoder, Membrane.H264.FFmpeg.Decoder) + |> child(:player, Membrane.SDL.Player) # Initialize the spec and start the playback - {{:ok, spec: spec, playback: :playing}, %{}} + {[spec: structure, playback: :playing], %{}} end # `handle_element_end_of_stream/3` clauses handle automatic termination of the pipeline after playback is finished @impl true def handle_element_end_of_stream({:player, :input}, _ctx, state) do __MODULE__.terminate(self()) - {:ok, state} + {[], state} end - - @impl true - def handle_element_end_of_stream(_element, _ctx, state), do: {:ok, state} end # Start the pipeline -{:ok, pipeline} = Example.start_link() -monitor_ref = Process.monitor(pipeline) +{:ok, pipeline_supervisor, _pipeline} = Example.start_link() +monitor_ref = Process.monitor(pipeline_supervisor) # Make sure the script doesn't terminate before the pipeline finishes the playback receive do diff --git a/lib/membrane_sdl/player.ex b/lib/membrane_sdl/player.ex index a234ff5..463529b 100644 --- a/lib/membrane_sdl/player.ex +++ b/lib/membrane_sdl/player.ex @@ -6,6 +6,7 @@ defmodule Membrane.SDL.Player do use Bunch use Membrane.Sink + require Membrane.Logger require Unifex.CNode alias Membrane.{Buffer, Time} @@ -15,72 +16,52 @@ defmodule Membrane.SDL.Player do # The measured latency needed to show a frame on a screen. @latency 20 |> Time.milliseconds() - def_input_pad :input, caps: RawVideo, demand_unit: :buffers + def_input_pad :input, accepted_format: RawVideo, demand_unit: :buffers @impl true - def handle_init(_options) do + def handle_init(_options, _ctx) do state = %{cnode: nil, timer_started?: false} - {{:ok, latency: @latency}, state} + {[latency: @latency], state} end @impl true - def handle_stopped_to_prepared(_ctx, state) do + def handle_setup(_ctx, state) do {:ok, cnode} = CNode.start_link(:player) - {:ok, %{state | cnode: cnode}} + + {[], %{state | cnode: cnode}} end @impl true - def handle_caps(:input, caps, ctx, state) do + def handle_stream_format(:input, stream_format, ctx, state) do %{input: input} = ctx.pads %{cnode: cnode} = state - if !input.caps || caps == input.caps do - :ok = CNode.call(cnode, :create, [caps.width, caps.height]) - {:ok, state} + if !input.stream_format || stream_format == input.stream_format do + :ok = CNode.call(cnode, :create, [stream_format.width, stream_format.height]) + {[], state} else - raise "Caps have changed while playing. This is not supported." + raise "Stream format have changed while playing. This is not supported." end end - @impl true - def handle_start_of_stream(:input, %{pads: %{input: %{caps: nil}}}, _state) do - raise "No caps before start of stream" - end - @impl true def handle_start_of_stream(:input, ctx, state) do use Ratio - {nom, denom} = ctx.pads.input.caps.framerate + {nom, denom} = ctx.pads.input.stream_format.framerate timer = {:demand_timer, Time.seconds(denom) <|> nom} - {{:ok, demand: :input, start_timer: timer}, %{state | timer_started?: true}} + {[demand: :input, start_timer: timer], %{state | timer_started?: true}} end @impl true def handle_write(:input, %Buffer{payload: payload}, _ctx, state) do payload = Membrane.Payload.to_binary(payload) :ok = CNode.call(state.cnode, :display_frame, [payload]) - {:ok, state} + {[], state} end @impl true def handle_tick(:demand_timer, _ctx, state) do - {{:ok, demand: :input}, state} - end - - @impl true - def handle_playing_to_prepared(_ctx, %{timer_started?: true} = state) do - {{:ok, stop_timer: :demand_timer}, %{state | timer_started?: false}} - end - - @impl true - def handle_playing_to_prepared(_ctx, state) do - {:ok, state} - end - - @impl true - def handle_prepared_to_stopped(_ctx, state) do - :ok = state.cnode |> CNode.stop() - {:ok, %{state | cnode: nil}} + {[demand: :input], state} end end diff --git a/mix.exs b/mix.exs index 903ef6a..6dc8d8c 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Membrane.SDL.Plugin.MixProject do use Mix.Project - @version "0.14.0" + @version "0.15.0" @github_url "https://github.com/membraneframework/membrane_sdl_plugin" def project do @@ -55,13 +55,13 @@ defmodule Membrane.SDL.Plugin.MixProject do defp deps do [ - {:membrane_core, "~> 0.10.0"}, - {:membrane_common_c, "~> 0.13.0"}, + {:membrane_core, "~> 0.11.0"}, + {:membrane_common_c, "~> 0.14.0"}, {:membrane_raw_video_format, "~> 0.2.0"}, {:unifex, "~> 1.0"}, # Testing - {:membrane_h264_ffmpeg_plugin, "~> 0.17", only: :test}, - {:membrane_hackney_plugin, "~> 0.7", only: :test}, + {:membrane_h264_ffmpeg_plugin, "~> 0.25.0", only: :test}, + {:membrane_hackney_plugin, "~> 0.9.0", only: :test}, # Development {:ex_doc, "~> 0.28", only: :dev, runtime: false}, {:dialyxir, "~> 1.1", only: :dev, runtime: false}, diff --git a/mix.lock b/mix.lock index 6d6ad24..ad22f7d 100644 --- a/mix.lock +++ b/mix.lock @@ -1,27 +1,27 @@ %{ - "bunch": {:hex, :bunch, "1.3.1", "f8fe80042f9eb474ef2801ae2c9372f9b13d11e7053265dcfc24b9d912e3750b", [:mix], [], "hexpm", "00e21b16ff9bb698b728a01a2fc4b3bf7fc0e87c4bb9c6e4a442324aa8c5e567"}, + "bunch": {:hex, :bunch, "1.6.0", "4775f8cdf5e801c06beed3913b0bd53fceec9d63380cdcccbda6be125a6cfd54", [:mix], [], "hexpm", "ef4e9abf83f0299d599daed3764d19e8eac5d27a5237e5e4d5e2c129cfeb9a22"}, "bunch_native": {:hex, :bunch_native, "0.5.0", "8ac1536789a597599c10b652e0b526d8833348c19e4739a0759a2bedfd924e63", [:mix], [{:bundlex, "~> 1.0", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm", "24190c760e32b23b36edeb2dc4852515c7c5b3b8675b1a864e0715bdd1c8f80d"}, - "bundlex": {:hex, :bundlex, "1.0.0", "358c26a6c027359c6935dcd0716b68736b7604599d376c4e1ac17c6618ef6771", [: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", "09b4a0c597a31e6e7ce8e103b94f19539bb2279f5966a3d6d46dcd32a5b6fd44"}, - "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, + "bundlex": {:hex, :bundlex, "1.1.0", "16fff7cfd8a61394c4dc2b22fe6c478ba125f6e5798e3e81ef0bc07ff237bde4", [: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", "9da48a102a924baf8b6161c7c1767b5d68eeba18dd9d37a241b8b2ddf87d8a8f"}, + "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, "coerce": {:hex, :coerce, "1.0.1", "211c27386315dc2894ac11bc1f413a0e38505d808153367bd5c6e75a4003d096", [:mix], [], "hexpm", "b44a691700f7a1a15b4b7e2ff1fa30bebd669929ac8aa43cffe9e2f8bf051cf1"}, - "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.25", "2024618731c55ebfcc5439d756852ec4e85978a39d0d58593763924d9a15916f", [:mix], [], "hexpm", "56749c5e1c59447f7b7a23ddb235e4b3defe276afc220a6227237f3efe83f51e"}, + "credo": {:hex, :credo, "1.6.7", "323f5734350fd23a456f2688b9430e7d517afb313fbd38671b8a4449798a7854", [: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", "41e110bfb007f7eda7f897c10bf019ceab9a0b269ce79f015d54b0dcf4fc7dd3"}, + "dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.29", "149d50dcb3a93d9f3d6f3ecf18c918fb5a2d3c001b5d3305c926cddfbd33355b", [:mix], [], "hexpm", "4902af1b3eb139016aed210888748db8070b8125c2342ce3dcae4f38dcc63503"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, - "ex_doc": {:hex, :ex_doc, "0.28.4", "001a0ea6beac2f810f1abc3dbf4b123e9593eaa5f00dd13ded024eae7c523298", [: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", "bf85d003dd34911d89c8ddb8bda1a958af3471a274a4c2150a9c01c78ac3f8ed"}, + "ex_doc": {:hex, :ex_doc, "0.29.1", "b1c652fa5f92ee9cf15c75271168027f92039b3877094290a75abcaac82a9f77", [: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", "b7745fa6374a36daf484e2a2012274950e084815b936b1319aeebcf7809574f6"}, "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, - "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~>2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, - "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, - "jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"}, + "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~> 2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, + "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, + "jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"}, "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_common_c": {:hex, :membrane_common_c, "0.13.0", "c314623f93209eb2fa092379954c686f6e50ac89baa48360f836d24f4d53f5ee", [:mix], [{:membrane_core, "~> 0.10.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:shmex, "~> 0.5.0", [hex: :shmex, repo: "hexpm", optional: false]}, {:unifex, "~> 1.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "90181fbbe481ccd0a4a76daf0300f8ad1b5b0bf0ebd8b42c133904f8839663ca"}, - "membrane_core": {:hex, :membrane_core, "0.10.1", "b4fb68d9e541888b60ebbf4e22c4913a84f35c955846b7df26154cb7c5ce0f78", [: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", "d039f67d00cb1c1608b1e4f03cea8a9b5a88ff0fef3f61f54dc65e515b9dc286"}, - "membrane_h264_ffmpeg_plugin": {:hex, :membrane_h264_ffmpeg_plugin, "0.21.0", "7c151e7bedcb7087e8441f7574c4277ba2833e115da91b58cfe848d2e0266df2", [:mix], [{:bunch, "~> 1.3.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:membrane_common_c, "~> 0.13.0", [hex: :membrane_common_c, repo: "hexpm", optional: false]}, {:membrane_core, "~> 0.10.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:membrane_h264_format, "~> 0.3.0", [hex: :membrane_h264_format, repo: "hexpm", optional: false]}, {:membrane_raw_video_format, "~> 0.2.0", [hex: :membrane_raw_video_format, repo: "hexpm", optional: false]}, {:ratio, "~> 2.4.0", [hex: :ratio, repo: "hexpm", optional: false]}, {:unifex, "~> 1.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "18d4da4e185b15e8cacb59ebcb468311faa0c4031f0b7530689b2d5cc42cb984"}, - "membrane_h264_format": {:hex, :membrane_h264_format, "0.3.0", "84426aac86c3f4d3e8110438c3514ad94aa528e7002650d40e3b3862e2af5e3e", [:mix], [], "hexpm", "8254e52cea3c5d7c078c960a32f1ba338eeae9e301515302fd293f1683fa8dd9"}, - "membrane_hackney_plugin": {:hex, :membrane_hackney_plugin, "0.8.2", "6b83628cc2019aa0b143c09e77f2dd9199a05528599d93c289dcab2e947369fa", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:membrane_core, "~> 0.10.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:mockery, "~> 2.3", [hex: :mockery, repo: "hexpm", optional: false]}], "hexpm", "42906166b3692ba2270deb61721225ca7edadd1dbde6a44435664234a93597e2"}, + "membrane_common_c": {:hex, :membrane_common_c, "0.14.0", "35621d9736829bf675062dc0af66e931b0d82ff8361c2088576d63d4d002692e", [:mix], [{:membrane_core, "~> 0.11.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:shmex, "~> 0.5.0", [hex: :shmex, repo: "hexpm", optional: false]}, {:unifex, "~> 1.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "262b06e93fe3f1be57a111fa19f5cba4f26000a442ac32a59f3678e83cbb001f"}, + "membrane_core": {:hex, :membrane_core, "0.11.2", "c8a257bea90c53e0fe99453630a07e4711e4d8ba25e647b3ba346b994aa4f7ab", [:mix], [{:bunch, "~> 1.5", [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", "7e2566c9b6d1c22fbb832c22e5f9dbbf7c6cba1c72eeea53bd2f2b73efed58b3"}, + "membrane_h264_ffmpeg_plugin": {:hex, :membrane_h264_ffmpeg_plugin, "0.25.1", "262ed6aef931826bef5c98cd1593893fbd9d488b9fdeb5898cad46026bcf7f12", [:mix], [{:bunch, "~> 1.3", [hex: :bunch, repo: "hexpm", optional: false]}, {:membrane_common_c, "~> 0.14.0", [hex: :membrane_common_c, repo: "hexpm", optional: false]}, {:membrane_core, "~> 0.11.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:membrane_h264_format, "~> 0.4.0", [hex: :membrane_h264_format, repo: "hexpm", optional: false]}, {:membrane_raw_video_format, "~> 0.2.0", [hex: :membrane_raw_video_format, repo: "hexpm", optional: false]}, {:ratio, "~> 2.4.0", [hex: :ratio, repo: "hexpm", optional: false]}, {:unifex, "~> 1.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "f2ade09f84b97d5c9780dcbda74354f82f4d183582c52259619f274f23df388b"}, + "membrane_h264_format": {:hex, :membrane_h264_format, "0.4.0", "7103376864f0c0ef525ab31fc16684fd1aa8453f47fb060f1940125d8956dd5d", [:mix], [], "hexpm", "0a46ffa7a3f0da4da65134c7ef0feb64eb9eea3e55c2f0cf261969ab40f7bdd5"}, + "membrane_hackney_plugin": {:hex, :membrane_hackney_plugin, "0.9.0", "9736e48c3213295f5060e755133465535578a51fe5f01e073696dbe53903478e", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:membrane_core, "~> 0.11.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:mockery, "~> 2.3", [hex: :mockery, repo: "hexpm", optional: false]}], "hexpm", "719971528cf23167b07a344eadc2b97ecdc648c2ea5937f87d98aa3c7e9fa3cf"}, "membrane_raw_video_format": {:hex, :membrane_raw_video_format, "0.2.0", "cda8eb207cf65c93690a19001aba3edbb2ba5d22abc8068a1f6a785ba871e8cf", [:mix], [], "hexpm", "6b716fc24f60834323637c95aaaa0f99be23fcc6a84a21af70195ef50185b634"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, @@ -34,7 +34,7 @@ "secure_random": {:hex, :secure_random, "0.5.1", "c5532b37c89d175c328f5196a0c2a5680b15ebce3e654da37129a9fe40ebf51b", [:mix], [], "hexpm", "1b9754f15e3940a143baafd19da12293f100044df69ea12db5d72878312ae6ab"}, "shmex": {:hex, :shmex, "0.5.0", "7dc4fb1a8bd851085a652605d690bdd070628717864b442f53d3447326bcd3e8", [:mix], [{:bunch_native, "~> 0.5.0", [hex: :bunch_native, repo: "hexpm", optional: false]}, {:bundlex, "~> 1.0", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm", "b67bb1e22734758397c84458dbb746519e28eac210423c267c7248e59fc97bdc"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, - "telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"}, + "telemetry": {:hex, :telemetry, "1.2.0", "a8ce551485a9a3dac8d523542de130eafd12e40bbf76cf0ecd2528f24e812a44", [:rebar3], [], "hexpm", "1427e73667b9a2002cf1f26694c422d5c905df889023903c4518921d53e3e883"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, - "unifex": {:hex, :unifex, "1.0.0", "a8a2ac6f6f437dd689db8c680df53e28e43c0548cd58ba2af36a1241f66fbc62", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:bundlex, "~> 1.0", [hex: :bundlex, repo: "hexpm", optional: false]}, {:shmex, "~> 0.5.0", [hex: :shmex, repo: "hexpm", optional: false]}], "hexpm", "23b30d5d9d65bb77c25397e476d86818df7b6519bcb0ea816429a70d0729c14d"}, + "unifex": {:hex, :unifex, "1.1.0", "26b1bcb6c3b3454e1ea15f85b2e570aaa5b5c609566aa9f5c2e0a8b213379d6b", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:bundlex, "~> 1.0", [hex: :bundlex, repo: "hexpm", optional: false]}, {:shmex, "~> 0.5.0", [hex: :shmex, repo: "hexpm", optional: false]}], "hexpm", "d8f47e9e3240301f5b20eec5792d1d4341e1a3a268d94f7204703b48da4aaa06"}, } diff --git a/test/membrane_sdl/player_test.exs b/test/membrane_sdl/player_test.exs index a6c84ac..6696f22 100644 --- a/test/membrane_sdl/player_test.exs +++ b/test/membrane_sdl/player_test.exs @@ -1,25 +1,26 @@ defmodule Membrane.SDL.PlayerTest do use ExUnit.Case + import Membrane.ChildrenSpec import Membrane.Testing.Assertions alias Membrane.{H264, Hackney, SDL, Testing} @tag :manual test "integration test" do - options = %Testing.Pipeline.Options{ - elements: [ - hackney: %Hackney.Source{ - location: "https://membraneframework.github.io/static/video-samples/test-video.h264" - }, - parser: %H264.FFmpeg.Parser{framerate: {30, 1}}, - decoder: H264.FFmpeg.Decoder, - sdl: SDL.Player - ] - } + options = [ + structure: + child(:hackney, %Hackney.Source{ + location: + "https://raw.githubusercontent.com/membraneframework/static/gh-pages/samples/ffmpeg-testsrc.h264", + hackney_opts: [follow_redirect: true] + }) + |> child(:parser, %H264.FFmpeg.Parser{framerate: {30, 1}}) + |> child(:decoder, H264.FFmpeg.Decoder) + |> child(:sdl, SDL.Player) + ] - {:ok, pid} = Testing.Pipeline.start_link(options) - assert_end_of_stream(pid, :sdl, :input, 15_000) - Testing.Pipeline.terminate(pid, blocking?: true) + pipeline = Testing.Pipeline.start_link_supervised!(options) + assert_end_of_stream(pipeline, :sdl, :input, 15_000) end end