Skip to content

Commit

Permalink
small player refactor, core update
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-hek committed Oct 9, 2019
1 parent 4595620 commit 1caf989
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
17 changes: 5 additions & 12 deletions lib/membrane_element_sdl/player.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,15 @@ defmodule Membrane.Element.SDL.Player do
use Membrane.Sink
use Bunch

@experimental_latency 20 |> Time.milliseconds()

def_options latency: [
type: :time,
default: @experimental_latency,
description: """
Time needed to show a frame on a screen.
May have to be adjusted for your system.
"""
]
# Experimentally designated time needed to show a frame on a screeen
@latency 20 |> Time.milliseconds()

def_input_pad :input, caps: Raw, demand_unit: :buffers

@impl true
def handle_init(options) do
def handle_init(_options) do
state = %{cnode: nil, timer_started?: false}
{{:ok, latency: options.latency}, state}
{{:ok, latency: @latency}, state}
end

@impl true
Expand All @@ -54,6 +46,7 @@ defmodule Membrane.Element.SDL.Player 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
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ defmodule Membrane.Element.SDL.MixProject do

defp deps do
[
{:membrane_core, "~> 0.4.0", github: "membraneframework/membrane-core", override: true},
{:membrane_core, "~> 0.4.1"},
{:membrane_common_c, "~> 0.2.0"},
{:membrane_caps_video_raw, "~> 0.1.0"},
{:bundlex, "~> 0.2.6"},
Expand Down
6 changes: 3 additions & 3 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"bunch_native": {:hex, :bunch_native, "0.2.1", "0227d2a751a32f8c0b77dfec57c8dc7216351720c9c755c467e6d9387467fd1f", [:mix], [{:bundlex, "~> 0.2.7", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm"},
"bundlex": {:hex, :bundlex, "0.2.7", "8f46199bf4cf84a60cdfc142edeafbab37040167acc35dda8aa70433f2ff8162", [: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"},
"coerce": {:hex, :coerce, "1.0.1", "211c27386315dc2894ac11bc1f413a0e38505d808153367bd5c6e75a4003d096", [:mix], [], "hexpm"},
"dialyxir": {:hex, :dialyxir, "1.0.0-rc.6", "78e97d9c0ff1b5521dd68041193891aebebce52fc3b93463c0a6806874557d7d", [:mix], [{:erlex, "~> 0.2.1", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm"},
"earmark": {:hex, :earmark, "1.4.0", "397e750b879df18198afc66505ca87ecf6a96645545585899f6185178433cc09", [:mix], [], "hexpm"},
"dialyxir": {:hex, :dialyxir, "1.0.0-rc.7", "6287f8f2cb45df8584317a4be1075b8c9b8a69de8eeb82b4d9e6c761cf2664cd", [:mix], [{:erlex, ">= 0.2.5", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm"},
"earmark": {:hex, :earmark, "1.4.1", "07bb382826ee8d08d575a1981f971ed41bd5d7e86b917fd012a93c51b5d28727", [:mix], [], "hexpm"},
"erlex": {:hex, :erlex, "0.2.5", "e51132f2f472e13d606d808f0574508eeea2030d487fc002b46ad97e738b0510", [:mix], [], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.21.2", "caca5bc28ed7b3bdc0b662f8afe2bee1eedb5c3cf7b322feeeb7c6ebbde089d6", [:mix], [{:earmark, "~> 1.3.3 or ~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"},
"makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"},
"makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"},
"membrane_caps_video_raw": {:hex, :membrane_caps_video_raw, "0.1.0", "6aa751b0c338ea6672540b7ec7ad2be0d23bad931b8a8776757da9b279070a3b", [:mix], [], "hexpm"},
"membrane_common_c": {:hex, :membrane_common_c, "0.2.4", "38ef741e702d7826cc8498673c8964a1974bbb4ce1e423d39a34359459e213a1", [:mix], [{:bundlex, "~> 0.2.0", [hex: :bundlex, repo: "hexpm", optional: false]}, {:membrane_core, "~> 0.4.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:shmex, "~> 0.2.0", [hex: :shmex, repo: "hexpm", optional: false]}, {:unifex, "~> 0.2.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm"},
"membrane_core": {:git, "https://github.com/membraneframework/membrane-core.git", "5f5468cd39a7da5f8a2fae37bb2982d9eac888fb", []},
"membrane_core": {:hex, :membrane_core, "0.4.1", "603054b637c7514cef7454a5aadd224b088f9dabb037e11d968d315d4dea1260", [:mix], [{:bunch, "~> 1.2", [hex: :bunch, repo: "hexpm", optional: false]}, {:qex, "~> 0.3", [hex: :qex, repo: "hexpm", optional: false]}, {:ratio, "~> 2.0", [hex: :ratio, repo: "hexpm", optional: false]}], "hexpm"},
"nimble_parsec": {:hex, :nimble_parsec, "0.5.1", "c90796ecee0289dbb5ad16d3ad06f957b0cd1199769641c961cfe0b97db190e0", [:mix], [], "hexpm"},
"numbers": {:hex, :numbers, "5.1.1", "1277dbee5dc73b0e1608bd6d318bd8338cbcba5b68cade65f24e4bb402676b5c", [:mix], [{:coerce, "~> 1.0", [hex: :coerce, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
"qex": {:hex, :qex, "0.5.0", "5a3a9becf67d4006377c4c247ffdaaa8ae5b3634a0caadb788dc24d6125068f4", [:mix], [], "hexpm"},
Expand Down

0 comments on commit 1caf989

Please sign in to comment.