Skip to content

Commit

Permalink
dims -> dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
bblaszkow06 committed Feb 21, 2022
1 parent dae2071 commit b9a4f60
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions lib/membrane_raw_video.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ defmodule Membrane.RawVideo do
in bytes for the given caps.
"""
@spec frame_size(t()) :: {:ok, pos_integer()} | {:error, reason}
when reason: :invalid_dims | :invalid_pixel_format
when reason: :invalid_dimensions | :invalid_pixel_format
def frame_size(%__MODULE__{pixel_format: format, width: width, height: height}) do
frame_size(format, width, height)
end
Expand All @@ -64,7 +64,7 @@ defmodule Membrane.RawVideo do
"""
@spec frame_size(pixel_format_t(), width_t(), height_t()) ::
{:ok, pos_integer()} | {:error, reason}
when reason: :invalid_dims | :invalid_pixel_format
when reason: :invalid_dimensions | :invalid_pixel_format
def frame_size(format, width, height)
when format in [:I420, :YV12, :NV12, :NV21] and Integer.is_even(width) and
Integer.is_even(height) do
Expand Down Expand Up @@ -92,7 +92,7 @@ defmodule Membrane.RawVideo do
end

def frame_size(format, _width, _height) when format in @supported_pixel_formats do
{:error, :invalid_dims}
{:error, :invalid_dimensions}
end

def frame_size(_format, _width, _height) do
Expand Down
36 changes: 18 additions & 18 deletions test/membrane_raw_video_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ defmodule Membrane.RawVideo.Test do
test "frame_size for :I420 format" do
format = :I420
assert @module.frame_size(format, 10, 20) == {:ok, 300}
assert @module.frame_size(format, 9, 20) == {:error, :invalid_dims}
assert @module.frame_size(format, 10, 19) == {:error, :invalid_dims}
assert @module.frame_size(format, 9, 20) == {:error, :invalid_dimensions}
assert @module.frame_size(format, 10, 19) == {:error, :invalid_dimensions}

assert @module.frame_size(format_struct(format, 10, 20)) == {:ok, 300}
assert @module.frame_size(format_struct(format, 9, 20)) == {:error, :invalid_dims}
assert @module.frame_size(format_struct(format, 10, 19)) == {:error, :invalid_dims}
assert @module.frame_size(format_struct(format, 9, 20)) == {:error, :invalid_dimensions}
assert @module.frame_size(format_struct(format, 10, 19)) == {:error, :invalid_dimensions}
end

test "frame_size for :I422 format" do
format = :I422
assert @module.frame_size(format, 10, 20) == {:ok, 400}
assert @module.frame_size(format, 9, 20) == {:error, :invalid_dims}
assert @module.frame_size(format, 9, 20) == {:error, :invalid_dimensions}
assert @module.frame_size(format, 10, 19) == {:ok, 380}

assert @module.frame_size(format_struct(format, 10, 20)) == {:ok, 400}
assert @module.frame_size(format_struct(format, 9, 20)) == {:error, :invalid_dims}
assert @module.frame_size(format_struct(format, 9, 20)) == {:error, :invalid_dimensions}
assert @module.frame_size(format_struct(format, 10, 19)) == {:ok, 380}
end

Expand Down Expand Up @@ -81,34 +81,34 @@ defmodule Membrane.RawVideo.Test do
test "frame_size for :NV12 format" do
format = :NV12
assert @module.frame_size(format, 10, 20) == {:ok, 300}
assert @module.frame_size(format, 9, 20) == {:error, :invalid_dims}
assert @module.frame_size(format, 10, 19) == {:error, :invalid_dims}
assert @module.frame_size(format, 9, 20) == {:error, :invalid_dimensions}
assert @module.frame_size(format, 10, 19) == {:error, :invalid_dimensions}

assert @module.frame_size(format_struct(format, 10, 20)) == {:ok, 300}
assert @module.frame_size(format_struct(format, 9, 20)) == {:error, :invalid_dims}
assert @module.frame_size(format_struct(format, 10, 19)) == {:error, :invalid_dims}
assert @module.frame_size(format_struct(format, 9, 20)) == {:error, :invalid_dimensions}
assert @module.frame_size(format_struct(format, 10, 19)) == {:error, :invalid_dimensions}
end

test "frame_size for :NV21 format" do
format = :NV21
assert @module.frame_size(format, 10, 20) == {:ok, 300}
assert @module.frame_size(format, 9, 20) == {:error, :invalid_dims}
assert @module.frame_size(format, 10, 19) == {:error, :invalid_dims}
assert @module.frame_size(format, 9, 20) == {:error, :invalid_dimensions}
assert @module.frame_size(format, 10, 19) == {:error, :invalid_dimensions}

assert @module.frame_size(format_struct(format, 10, 20)) == {:ok, 300}
assert @module.frame_size(format_struct(format, 9, 20)) == {:error, :invalid_dims}
assert @module.frame_size(format_struct(format, 10, 19)) == {:error, :invalid_dims}
assert @module.frame_size(format_struct(format, 9, 20)) == {:error, :invalid_dimensions}
assert @module.frame_size(format_struct(format, 10, 19)) == {:error, :invalid_dimensions}
end

test "frame_size for :YV12 format" do
format = :YV12
assert @module.frame_size(format, 10, 20) == {:ok, 300}
assert @module.frame_size(format, 9, 20) == {:error, :invalid_dims}
assert @module.frame_size(format, 10, 19) == {:error, :invalid_dims}
assert @module.frame_size(format, 9, 20) == {:error, :invalid_dimensions}
assert @module.frame_size(format, 10, 19) == {:error, :invalid_dimensions}

assert @module.frame_size(format_struct(format, 10, 20)) == {:ok, 300}
assert @module.frame_size(format_struct(format, 9, 20)) == {:error, :invalid_dims}
assert @module.frame_size(format_struct(format, 10, 19)) == {:error, :invalid_dims}
assert @module.frame_size(format_struct(format, 9, 20)) == {:error, :invalid_dimensions}
assert @module.frame_size(format_struct(format, 10, 19)) == {:error, :invalid_dimensions}
end

test "frame_size for :AYUV format" do
Expand Down

0 comments on commit b9a4f60

Please sign in to comment.