Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Elixir CI

on:
push:
branches:
- master
pull_request:

env:
MIX_ENV: test

jobs:
test:
strategy:
matrix:
include:
- otp_version: 25.3
elixir_version: 1.15

- otp_version: 27.2
elixir_version: 1.18
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir_version }}
otp-version: ${{ matrix.otp_version }}

- name: Install dependencies
run: mix deps.get
- name: Compile dependencies
run: mix deps.compile
- name: Run tests
run: mix test --warnings-as-errors
- name: Run Credo
run: mix credo --strict

format:
runs-on: ubuntu-latest
name: mix format
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: 27.2
elixir-version: 1.18
- run: mix format --check-formatted
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The package can be installed by adding `ex_flv` to your list of dependencies in
```elixir
def deps do
[
{:ex_flv, "~> 0.2.1"}
{:ex_flv, "~> 0.3.0"}
]
end
```
9 changes: 5 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
defmodule ExFLV.MixProject do
use Mix.Project

@version "0.2.1"
@github_url "https://github.com/gBillal/ex_flv"
@version "0.3.0"
@github_url "https://github.com/elixir-streaming/ex_flv"

def project do
[
app: :ex_flv,
version: @version,
elixir: "~> 1.18",
elixir: "~> 1.15",
start_permanent: Mix.env() == :prod,
deps: deps(),
description: "FLV muxer and demuxer implementation in Elixir",
Expand All @@ -29,7 +29,8 @@ defmodule ExFLV.MixProject do

defp deps do
[
{:ex_doc, "~> 0.38", only: :dev, runtime: false}
{:ex_doc, "~> 0.38", only: :dev, runtime: false},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false}
]
end

Expand Down
4 changes: 4 additions & 0 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
%{
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"credo": {:hex, :credo, "1.7.15", "283da72eeb2fd3ccf7248f4941a0527efb97afa224bcdef30b4b580bc8258e1c", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "291e8645ea3fea7481829f1e1eb0881b8395db212821338e577a90bf225c5607"},
"earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"},
"ex_doc": {:hex, :ex_doc, "0.38.4", "ab48dff7a8af84226bf23baddcdda329f467255d924380a0cf0cee97bb9a9ede", [:mix], [{:earmark_parser, "~> 1.4.44", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "f7b62346408a83911c2580154e35613eb314e0278aeea72ed7fedef9c1f165b2"},
"file_system": {:hex, :file_system, "1.1.1", "31864f4685b0148f25bd3fbef2b1228457c0c89024ad67f7a81a3ffbc0bbad3a", [:mix], [], "hexpm", "7a15ff97dfe526aeefb090a7a9d3d03aa907e100e262a0f8f7746b78f8f87a5d"},
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},
"makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"},
"makeup_erlang": {:hex, :makeup_erlang, "1.0.2", "03e1804074b3aa64d5fad7aa64601ed0fb395337b982d9bcf04029d68d51b6a7", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "af33ff7ef368d5893e4a267933e7744e46ce3cf1f61e2dccf53a111ed3aa3727"},
Expand Down
20 changes: 11 additions & 9 deletions test/ex_flv/tag/ex_audio_data_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ defmodule ExFLV.Tag.ExAudioDataTest do

doctest ExFLV.Tag.ExAudioData

alias ExFLV.Tag.{ExAudioData, Serializer}

describe "serialize/1" do
setup do
audio_data = %ExFLV.Tag.ExAudioData{
Expand All @@ -18,30 +20,30 @@ defmodule ExFLV.Tag.ExAudioDataTest do
end

test "serialize", %{audio_data: audio_data} do
serialized = ExFLV.Tag.Serializer.serialize(audio_data)
serialized = Serializer.serialize(audio_data)

assert IO.iodata_to_binary(serialized) ==
<<148, 102, 76, 97, 67, 1, 2, 0, 0, 0, 3>>
end

test "serialize and parse", %{audio_data: audio_data} do
serialized = ExFLV.Tag.Serializer.serialize(audio_data)
serialized = Serializer.serialize(audio_data)
binary = IO.iodata_to_binary(serialized)

{:ok, parsed} = ExFLV.Tag.ExAudioData.parse(binary)
{:ok, parsed} = ExAudioData.parse(binary)
assert parsed == audio_data

audio_data = %ExFLV.Tag.ExAudioData{
audio_data = %ExAudioData{
packet_type: :coded_frames,
fourcc: :mp3,
data: <<1, 2, 3, 4, 5>>
}

serialized = ExFLV.Tag.Serializer.serialize(audio_data)
{:ok, parsed} = ExFLV.Tag.ExAudioData.parse(IO.iodata_to_binary(serialized))
serialized = Serializer.serialize(audio_data)
{:ok, parsed} = ExAudioData.parse(IO.iodata_to_binary(serialized))
assert parsed == audio_data

audio_data = %ExFLV.Tag.ExAudioData{
audio_data = %ExAudioData{
packet_type: :multi_channel_config,
fourcc: :flac,
channel_order: :custom,
Expand All @@ -50,8 +52,8 @@ defmodule ExFLV.Tag.ExAudioDataTest do
data: <<>>
}

serialized = ExFLV.Tag.Serializer.serialize(audio_data)
{:ok, parsed} = ExFLV.Tag.ExAudioData.parse(IO.iodata_to_binary(serialized))
serialized = Serializer.serialize(audio_data)
{:ok, parsed} = ExAudioData.parse(IO.iodata_to_binary(serialized))
assert parsed == audio_data
end
end
Expand Down
6 changes: 3 additions & 3 deletions test/ex_flv/tag/ex_video_data_test.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule ExFLV.Tag.ExVideoDataTest do
use ExUnit.Case, async: true

alias ExFLV.Tag.ExVideoData
alias ExFLV.Tag.{ExVideoData, Serializer}

doctest ExFLV.Tag.ExVideoData

Expand All @@ -27,14 +27,14 @@ defmodule ExFLV.Tag.ExVideoDataTest do
end

test "Serialize", %{video_data: video_data} do
serialized = ExFLV.Tag.Serializer.serialize(video_data)
serialized = Serializer.serialize(video_data)

assert IO.iodata_to_binary(serialized) ==
<<161, 97, 118, 99, 49, 255, 255, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255>>
end

test "Serialize and Parse", %{video_data: video_data} do
serialized = ExFLV.Tag.Serializer.serialize(video_data)
serialized = Serializer.serialize(video_data)
binary = IO.iodata_to_binary(serialized)

{:ok, parsed} = ExVideoData.parse(binary)
Expand Down
2 changes: 1 addition & 1 deletion test/ex_flv/tag_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ defmodule ExFLV.TagTest do
doctest ExFLV.Tag.AudioData.AAC
doctest ExFLV.Tag.VideoData.AVC

alias ExFLV.Tag.AudioData.AAC
alias ExFLV.Tag.{AudioData, VideoData}
alias ExFLV.Tag.AudioData.AAC
alias ExFLV.Tag.VideoData.AVC

@audio_data <<0x01, 0x02, 0x03, 0x04, 0x05>>
Expand Down