diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fda0a01..8b15f61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,3 +18,30 @@ jobs: run: buf lint - name: format run: buf format --exit-code + + fishjam_protos_lint: + runs-on: ubuntu-latest + name: CI elixir lint + strategy: + matrix: + otp: ['27'] + elixir: ['1.17'] + steps: + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + otp-version: ${{matrix.otp}} + elixir-version: ${{matrix.elixir}} + - name: Checkout the code + uses: actions/checkout@v3 + - name: Install dependencies + working-directory: fishjam_protos + run: mix deps.get + - name: Compile without warnings + working-directory: fishjam_protos + id: compile + run: mix compile --warnings-as-errors + - name: Check formatting + working-directory: fishjam_protos + if: ${{ !cancelled() && steps.compile.outcome == 'success' }} + run: mix format --check-formatted diff --git a/fishjam_protos/.formatter.exs b/fishjam_protos/.formatter.exs new file mode 100644 index 0000000..d2cda26 --- /dev/null +++ b/fishjam_protos/.formatter.exs @@ -0,0 +1,4 @@ +# Used by "mix format" +[ + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/fishjam_protos/.gitignore b/fishjam_protos/.gitignore new file mode 100644 index 0000000..0be3726 --- /dev/null +++ b/fishjam_protos/.gitignore @@ -0,0 +1,26 @@ +# The directory Mix will write compiled artifacts to. +/_build/ + +# If you run "mix test --cover", coverage assets end up here. +/cover/ + +# The directory Mix downloads your dependencies sources to. +/deps/ + +# Where third-party dependencies like ExDoc output generated docs. +/doc/ + +# Ignore .fetch files in case you like to edit your project deps locally. +/.fetch + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Also ignore archive artifacts (built via "mix archive.build"). +*.ez + +# Ignore package tarball (built via "mix hex.build"). +fishjam_protos-*.tar + +# Temporary files, for example, from tests. +/tmp/ diff --git a/fishjam_protos/README.md b/fishjam_protos/README.md new file mode 100644 index 0000000..e52caf8 --- /dev/null +++ b/fishjam_protos/README.md @@ -0,0 +1,16 @@ +# FishjamProtos + +Elixir protobuf modules for Fishjam and [MembraneRTCEngine](https://github.com/fishjam-cloud/membrane_rtc_engine) + +## Installation + +The package can be installed by adding `fishjam_protos` to your list of dependencies in `mix.exs`: + +```elixir +def deps do + [ + {:fishjam_protos, "~> 0.1.0"} + ] +end +``` + diff --git a/fishjam_protos/compile_proto.sh b/fishjam_protos/compile_proto.sh new file mode 100755 index 0000000..b4b5e1c --- /dev/null +++ b/fishjam_protos/compile_proto.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Terminate on errors +set -e + +cd .. + +files=$(find fishjam -name "*.proto") + +printf "Compiling:\n" +count=1 +total=${#files[@]} + +for file in $files; do + printf "Compile file %s %s ... " $count $file + protoc --elixir_out=./fishjam_protos/lib $file + printf "DONE\n" + count=$(($count + 1)) +done diff --git a/fishjam_protos/lib/fishjam/media_events/peer/peer.pb.ex b/fishjam_protos/lib/fishjam/media_events/peer/peer.pb.ex new file mode 100644 index 0000000..357d717 --- /dev/null +++ b/fishjam_protos/lib/fishjam/media_events/peer/peer.pb.ex @@ -0,0 +1,146 @@ +defmodule Fishjam.MediaEvents.Peer.MediaEvent.VariantBitrate do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:variant, 1, type: Fishjam.MediaEvents.Variant, enum: true) + field(:bitrate, 2, type: :int32) +end + +defmodule Fishjam.MediaEvents.Peer.MediaEvent.TrackIdToMetadata do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:track_id, 1, type: :string, json_name: "trackId") + field(:metadata, 2, type: Fishjam.MediaEvents.Metadata) +end + +defmodule Fishjam.MediaEvents.Peer.MediaEvent.TrackIdToBitrates do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + oneof(:tracks, 0) + + field(:track_bitrate, 1, + type: Fishjam.MediaEvents.Peer.MediaEvent.TrackBitrate, + json_name: "trackBitrate", + oneof: 0 + ) +end + +defmodule Fishjam.MediaEvents.Peer.MediaEvent.Connect do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:metadata, 1, type: Fishjam.MediaEvents.Metadata) +end + +defmodule Fishjam.MediaEvents.Peer.MediaEvent.Disconnect do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" +end + +defmodule Fishjam.MediaEvents.Peer.MediaEvent.UpdateEndpointMetadata do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:metadata, 1, type: Fishjam.MediaEvents.Metadata) +end + +defmodule Fishjam.MediaEvents.Peer.MediaEvent.UpdateTrackMetadata do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:track_id, 1, type: :string, json_name: "trackId") + field(:metadata, 2, type: Fishjam.MediaEvents.Metadata) +end + +defmodule Fishjam.MediaEvents.Peer.MediaEvent.RenegotiateTracks do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" +end + +defmodule Fishjam.MediaEvents.Peer.MediaEvent.SdpOffer do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:sdp_offer, 1, type: :string, json_name: "sdpOffer") + + field(:track_id_to_metadata, 2, + repeated: true, + type: Fishjam.MediaEvents.Peer.MediaEvent.TrackIdToMetadata, + json_name: "trackIdToMetadata" + ) + + field(:track_id_to_bitrates, 3, + repeated: true, + type: Fishjam.MediaEvents.Peer.MediaEvent.TrackIdToBitrates, + json_name: "trackIdToBitrates" + ) + + field(:mid_to_track_id, 4, + repeated: true, + type: Fishjam.MediaEvents.MidToTrackId, + json_name: "midToTrackId" + ) +end + +defmodule Fishjam.MediaEvents.Peer.MediaEvent.TrackBitrate do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:track_id, 1, type: :string, json_name: "trackId") + field(:bitrate, 2, type: :int32) +end + +defmodule Fishjam.MediaEvents.Peer.MediaEvent do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + oneof(:content, 0) + + field(:connect, 1, type: Fishjam.MediaEvents.Peer.MediaEvent.Connect, oneof: 0) + field(:disconnect, 2, type: Fishjam.MediaEvents.Peer.MediaEvent.Disconnect, oneof: 0) + + field(:update_endpoint_metadata, 3, + type: Fishjam.MediaEvents.Peer.MediaEvent.UpdateEndpointMetadata, + json_name: "updateEndpointMetadata", + oneof: 0 + ) + + field(:update_track_metadata, 4, + type: Fishjam.MediaEvents.Peer.MediaEvent.UpdateTrackMetadata, + json_name: "updateTrackMetadata", + oneof: 0 + ) + + field(:renegotiate_tracks, 5, + type: Fishjam.MediaEvents.Peer.MediaEvent.RenegotiateTracks, + json_name: "renegotiateTracks", + oneof: 0 + ) + + field(:candidate, 6, type: Fishjam.MediaEvents.Candidate, oneof: 0) + + field(:sdp_offer, 7, + type: Fishjam.MediaEvents.Peer.MediaEvent.SdpOffer, + json_name: "sdpOffer", + oneof: 0 + ) + + field(:track_bitrate, 8, + type: Fishjam.MediaEvents.Peer.MediaEvent.TrackBitrate, + json_name: "trackBitrate", + oneof: 0 + ) +end diff --git a/fishjam_protos/lib/fishjam/media_events/server/server.pb.ex b/fishjam_protos/lib/fishjam/media_events/server/server.pb.ex new file mode 100644 index 0000000..b523583 --- /dev/null +++ b/fishjam_protos/lib/fishjam/media_events/server/server.pb.ex @@ -0,0 +1,214 @@ +defmodule Fishjam.MediaEvents.Server.MediaEvent.VadNotification.Status do + @moduledoc false + + use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:STATUS_UNSPECIFIED, 0) + field(:STATUS_SILENCE, 1) + field(:STATUS_SPEECH, 2) +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.Track do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:track_id, 1, type: :string, json_name: "trackId") + field(:metadata, 2, type: Fishjam.MediaEvents.Metadata) +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.Endpoint do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:endpoint_id, 1, type: :string, json_name: "endpointId") + field(:endpoint_type, 2, type: :string, json_name: "endpointType") + field(:metadata, 3, type: Fishjam.MediaEvents.Metadata) + field(:tracks, 4, repeated: true, type: Fishjam.MediaEvents.Server.MediaEvent.Track) +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.EndpointUpdated do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:endpoint_id, 1, type: :string, json_name: "endpointId") + field(:metadata, 2, type: Fishjam.MediaEvents.Metadata) +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.TrackUpdated do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:endpoint_id, 1, type: :string, json_name: "endpointId") + field(:track_id, 2, type: :string, json_name: "trackId") + field(:metadata, 3, type: Fishjam.MediaEvents.Metadata) +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.TracksAdded do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:endpoint_id, 1, type: :string, json_name: "endpointId") + field(:tracks, 2, repeated: true, type: Fishjam.MediaEvents.Server.MediaEvent.Track) +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.TracksRemoved do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:endpoint_id, 1, type: :string, json_name: "endpointId") + field(:track_ids, 2, repeated: true, type: :string, json_name: "trackIds") +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.EndpointAdded do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:endpoint_id, 1, type: :string, json_name: "endpointId") + field(:metadata, 2, type: Fishjam.MediaEvents.Metadata) +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.Connected do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:endpoint_id, 1, type: :string, json_name: "endpointId") + field(:endpoints, 2, repeated: true, type: Fishjam.MediaEvents.Server.MediaEvent.Endpoint) +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.EndpointRemoved do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:endpoint_id, 1, type: :string, json_name: "endpointId") +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.Error do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:message, 1, type: :string) +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.OfferData.TrackTypes do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:audio, 1, type: :int32) + field(:video, 2, type: :int32) +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.OfferData do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:tracks_types, 1, + type: Fishjam.MediaEvents.Server.MediaEvent.OfferData.TrackTypes, + json_name: "tracksTypes" + ) +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.SdpAnswer do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:sdp_answer, 1, type: :string, json_name: "sdpAnswer") + + field(:mid_to_track_id, 2, + repeated: true, + type: Fishjam.MediaEvents.MidToTrackId, + json_name: "midToTrackId" + ) +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent.VadNotification do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:track_id, 1, type: :string, json_name: "trackId") + + field(:status, 2, + type: Fishjam.MediaEvents.Server.MediaEvent.VadNotification.Status, + enum: true + ) +end + +defmodule Fishjam.MediaEvents.Server.MediaEvent do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + oneof(:content, 0) + + field(:endpoint_updated, 1, + type: Fishjam.MediaEvents.Server.MediaEvent.EndpointUpdated, + json_name: "endpointUpdated", + oneof: 0 + ) + + field(:track_updated, 2, + type: Fishjam.MediaEvents.Server.MediaEvent.TrackUpdated, + json_name: "trackUpdated", + oneof: 0 + ) + + field(:tracks_added, 3, + type: Fishjam.MediaEvents.Server.MediaEvent.TracksAdded, + json_name: "tracksAdded", + oneof: 0 + ) + + field(:tracks_removed, 4, + type: Fishjam.MediaEvents.Server.MediaEvent.TracksRemoved, + json_name: "tracksRemoved", + oneof: 0 + ) + + field(:endpoint_added, 5, + type: Fishjam.MediaEvents.Server.MediaEvent.EndpointAdded, + json_name: "endpointAdded", + oneof: 0 + ) + + field(:endpoint_removed, 6, + type: Fishjam.MediaEvents.Server.MediaEvent.EndpointRemoved, + json_name: "endpointRemoved", + oneof: 0 + ) + + field(:connected, 7, type: Fishjam.MediaEvents.Server.MediaEvent.Connected, oneof: 0) + field(:error, 8, type: Fishjam.MediaEvents.Server.MediaEvent.Error, oneof: 0) + + field(:offer_data, 9, + type: Fishjam.MediaEvents.Server.MediaEvent.OfferData, + json_name: "offerData", + oneof: 0 + ) + + field(:candidate, 10, type: Fishjam.MediaEvents.Candidate, oneof: 0) + + field(:sdp_answer, 11, + type: Fishjam.MediaEvents.Server.MediaEvent.SdpAnswer, + json_name: "sdpAnswer", + oneof: 0 + ) + + field(:vad_notification, 12, + type: Fishjam.MediaEvents.Server.MediaEvent.VadNotification, + json_name: "vadNotification", + oneof: 0 + ) +end diff --git a/fishjam_protos/lib/fishjam/media_events/shared.pb.ex b/fishjam_protos/lib/fishjam/media_events/shared.pb.ex new file mode 100644 index 0000000..e15d4c5 --- /dev/null +++ b/fishjam_protos/lib/fishjam/media_events/shared.pb.ex @@ -0,0 +1,38 @@ +defmodule Fishjam.MediaEvents.Variant do + @moduledoc false + + use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:VARIANT_UNSPECIFIED, 0) + field(:VARIANT_LOW, 1) + field(:VARIANT_MEDIUM, 2) + field(:VARIANT_HIGH, 3) +end + +defmodule Fishjam.MediaEvents.Metadata do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:json, 1, type: :string) +end + +defmodule Fishjam.MediaEvents.MidToTrackId do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:mid, 1, type: :string) + field(:track_id, 2, type: :string, json_name: "trackId") +end + +defmodule Fishjam.MediaEvents.Candidate do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:candidate, 1, type: :string) + field(:sdp_m_line_index, 2, type: :int32, json_name: "sdpMLineIndex") + field(:sdp_mid, 3, type: :string, json_name: "sdpMid") + field(:username_fragment, 4, type: :string, json_name: "usernameFragment") +end diff --git a/fishjam_protos/lib/fishjam/peer_notifications.pb.ex b/fishjam_protos/lib/fishjam/peer_notifications.pb.ex new file mode 100644 index 0000000..373df3f --- /dev/null +++ b/fishjam_protos/lib/fishjam/peer_notifications.pb.ex @@ -0,0 +1,56 @@ +defmodule Fishjam.PeerMessage.Authenticated do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" +end + +defmodule Fishjam.PeerMessage.AuthRequest do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:token, 1, type: :string) + field(:sdk_version, 2, type: :string, json_name: "sdkVersion") +end + +defmodule Fishjam.PeerMessage.RTCStatsReport do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:data, 1, type: :string) +end + +defmodule Fishjam.PeerMessage do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + oneof(:content, 0) + + field(:authenticated, 1, type: Fishjam.PeerMessage.Authenticated, oneof: 0) + + field(:auth_request, 2, + type: Fishjam.PeerMessage.AuthRequest, + json_name: "authRequest", + oneof: 0 + ) + + field(:peer_media_event, 3, + type: Fishjam.MediaEvents.Peer.MediaEvent, + json_name: "peerMediaEvent", + oneof: 0 + ) + + field(:server_media_event, 4, + type: Fishjam.MediaEvents.Server.MediaEvent, + json_name: "serverMediaEvent", + oneof: 0 + ) + + field(:rtc_stats_report, 5, + type: Fishjam.PeerMessage.RTCStatsReport, + json_name: "rtcStatsReport", + oneof: 0 + ) +end diff --git a/fishjam_protos/lib/fishjam/server_notifications.pb.ex b/fishjam_protos/lib/fishjam/server_notifications.pb.ex new file mode 100644 index 0000000..a599f0c --- /dev/null +++ b/fishjam_protos/lib/fishjam/server_notifications.pb.ex @@ -0,0 +1,346 @@ +defmodule Fishjam.ServerMessage.EventType do + @moduledoc false + + use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:EVENT_TYPE_UNSPECIFIED, 0) + field(:EVENT_TYPE_SERVER_NOTIFICATION, 1) + field(:EVENT_TYPE_METRICS, 2) +end + +defmodule Fishjam.ServerMessage.TrackType do + @moduledoc false + + use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:TRACK_TYPE_UNSPECIFIED, 0) + field(:TRACK_TYPE_VIDEO, 1) + field(:TRACK_TYPE_AUDIO, 2) +end + +defmodule Fishjam.ServerMessage.RoomCrashed do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:room_id, 1, type: :string, json_name: "roomId") +end + +defmodule Fishjam.ServerMessage.PeerAdded do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:room_id, 1, type: :string, json_name: "roomId") + field(:peer_id, 2, type: :string, json_name: "peerId") +end + +defmodule Fishjam.ServerMessage.PeerDeleted do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:room_id, 1, type: :string, json_name: "roomId") + field(:peer_id, 2, type: :string, json_name: "peerId") +end + +defmodule Fishjam.ServerMessage.PeerConnected do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:room_id, 1, type: :string, json_name: "roomId") + field(:peer_id, 2, type: :string, json_name: "peerId") +end + +defmodule Fishjam.ServerMessage.PeerDisconnected do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:room_id, 1, type: :string, json_name: "roomId") + field(:peer_id, 2, type: :string, json_name: "peerId") +end + +defmodule Fishjam.ServerMessage.PeerCrashed do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:room_id, 1, type: :string, json_name: "roomId") + field(:peer_id, 2, type: :string, json_name: "peerId") + field(:reason, 3, type: :string) +end + +defmodule Fishjam.ServerMessage.ComponentCrashed do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:room_id, 1, type: :string, json_name: "roomId") + field(:component_id, 2, type: :string, json_name: "componentId") +end + +defmodule Fishjam.ServerMessage.Authenticated do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" +end + +defmodule Fishjam.ServerMessage.AuthRequest do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:token, 1, type: :string) +end + +defmodule Fishjam.ServerMessage.SubscribeRequest do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:event_type, 1, type: Fishjam.ServerMessage.EventType, json_name: "eventType", enum: true) +end + +defmodule Fishjam.ServerMessage.SubscribeResponse do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:event_type, 1, type: Fishjam.ServerMessage.EventType, json_name: "eventType", enum: true) +end + +defmodule Fishjam.ServerMessage.RoomCreated do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:room_id, 1, type: :string, json_name: "roomId") +end + +defmodule Fishjam.ServerMessage.RoomDeleted do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:room_id, 1, type: :string, json_name: "roomId") +end + +defmodule Fishjam.ServerMessage.MetricsReport do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:metrics, 1, type: :string) +end + +defmodule Fishjam.ServerMessage.HlsPlayable do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:room_id, 1, type: :string, json_name: "roomId") + field(:component_id, 2, type: :string, json_name: "componentId") +end + +defmodule Fishjam.ServerMessage.HlsUploaded do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:room_id, 1, type: :string, json_name: "roomId") +end + +defmodule Fishjam.ServerMessage.HlsUploadCrashed do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:room_id, 1, type: :string, json_name: "roomId") +end + +defmodule Fishjam.ServerMessage.PeerMetadataUpdated do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:room_id, 1, type: :string, json_name: "roomId") + field(:peer_id, 2, type: :string, json_name: "peerId") + field(:metadata, 3, type: :string) +end + +defmodule Fishjam.ServerMessage.Track do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:id, 1, type: :string) + field(:type, 2, type: Fishjam.ServerMessage.TrackType, enum: true) + field(:metadata, 3, type: :string) +end + +defmodule Fishjam.ServerMessage.TrackAdded do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + oneof(:endpoint_info, 0) + + field(:room_id, 1, type: :string, json_name: "roomId") + field(:peer_id, 2, type: :string, json_name: "peerId", oneof: 0) + field(:component_id, 3, type: :string, json_name: "componentId", oneof: 0) + field(:track, 4, type: Fishjam.ServerMessage.Track) +end + +defmodule Fishjam.ServerMessage.TrackRemoved do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + oneof(:endpoint_info, 0) + + field(:room_id, 1, type: :string, json_name: "roomId") + field(:peer_id, 2, type: :string, json_name: "peerId", oneof: 0) + field(:component_id, 3, type: :string, json_name: "componentId", oneof: 0) + field(:track, 4, type: Fishjam.ServerMessage.Track) +end + +defmodule Fishjam.ServerMessage.TrackMetadataUpdated do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + oneof(:endpoint_info, 0) + + field(:room_id, 1, type: :string, json_name: "roomId") + field(:peer_id, 2, type: :string, json_name: "peerId", oneof: 0) + field(:component_id, 3, type: :string, json_name: "componentId", oneof: 0) + field(:track, 4, type: Fishjam.ServerMessage.Track) +end + +defmodule Fishjam.ServerMessage do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + oneof(:content, 0) + + field(:room_crashed, 1, + type: Fishjam.ServerMessage.RoomCrashed, + json_name: "roomCrashed", + oneof: 0 + ) + + field(:peer_connected, 2, + type: Fishjam.ServerMessage.PeerConnected, + json_name: "peerConnected", + oneof: 0 + ) + + field(:peer_disconnected, 3, + type: Fishjam.ServerMessage.PeerDisconnected, + json_name: "peerDisconnected", + oneof: 0 + ) + + field(:peer_crashed, 4, + type: Fishjam.ServerMessage.PeerCrashed, + json_name: "peerCrashed", + oneof: 0 + ) + + field(:component_crashed, 5, + type: Fishjam.ServerMessage.ComponentCrashed, + json_name: "componentCrashed", + oneof: 0 + ) + + field(:authenticated, 6, type: Fishjam.ServerMessage.Authenticated, oneof: 0) + + field(:auth_request, 7, + type: Fishjam.ServerMessage.AuthRequest, + json_name: "authRequest", + oneof: 0 + ) + + field(:subscribe_request, 8, + type: Fishjam.ServerMessage.SubscribeRequest, + json_name: "subscribeRequest", + oneof: 0 + ) + + field(:subscribe_response, 9, + type: Fishjam.ServerMessage.SubscribeResponse, + json_name: "subscribeResponse", + oneof: 0 + ) + + field(:room_created, 10, + type: Fishjam.ServerMessage.RoomCreated, + json_name: "roomCreated", + oneof: 0 + ) + + field(:room_deleted, 11, + type: Fishjam.ServerMessage.RoomDeleted, + json_name: "roomDeleted", + oneof: 0 + ) + + field(:metrics_report, 12, + type: Fishjam.ServerMessage.MetricsReport, + json_name: "metricsReport", + oneof: 0 + ) + + field(:hls_playable, 13, + type: Fishjam.ServerMessage.HlsPlayable, + json_name: "hlsPlayable", + oneof: 0 + ) + + field(:hls_uploaded, 14, + type: Fishjam.ServerMessage.HlsUploaded, + json_name: "hlsUploaded", + oneof: 0 + ) + + field(:hls_upload_crashed, 15, + type: Fishjam.ServerMessage.HlsUploadCrashed, + json_name: "hlsUploadCrashed", + oneof: 0 + ) + + field(:peer_metadata_updated, 16, + type: Fishjam.ServerMessage.PeerMetadataUpdated, + json_name: "peerMetadataUpdated", + oneof: 0 + ) + + field(:track_added, 17, + type: Fishjam.ServerMessage.TrackAdded, + json_name: "trackAdded", + oneof: 0 + ) + + field(:track_removed, 18, + type: Fishjam.ServerMessage.TrackRemoved, + json_name: "trackRemoved", + oneof: 0 + ) + + field(:track_metadata_updated, 19, + type: Fishjam.ServerMessage.TrackMetadataUpdated, + json_name: "trackMetadataUpdated", + oneof: 0 + ) + + field(:peer_added, 20, type: Fishjam.ServerMessage.PeerAdded, json_name: "peerAdded", oneof: 0) + + field(:peer_deleted, 21, + type: Fishjam.ServerMessage.PeerDeleted, + json_name: "peerDeleted", + oneof: 0 + ) +end diff --git a/fishjam_protos/mix.exs b/fishjam_protos/mix.exs new file mode 100644 index 0000000..2017ee6 --- /dev/null +++ b/fishjam_protos/mix.exs @@ -0,0 +1,26 @@ +defmodule FishjamProtos.MixProject do + use Mix.Project + + def project do + [ + app: :fishjam_protos, + version: "0.1.0", + elixir: "~> 1.17", + start_permanent: Mix.env() == :prod, + deps: deps(), + description: "Protobuf modules for Fishjam and Membrane RTC Engine" + ] + end + + def application do + [ + extra_applications: [:logger] + ] + end + + defp deps do + [ + {:protobuf, "~> 0.13.0"} + ] + end +end diff --git a/fishjam_protos/mix.lock b/fishjam_protos/mix.lock new file mode 100644 index 0000000..d13d111 --- /dev/null +++ b/fishjam_protos/mix.lock @@ -0,0 +1,3 @@ +%{ + "protobuf": {:hex, :protobuf, "0.13.0", "7a9d9aeb039f68a81717eb2efd6928fdf44f03d2c0dfdcedc7b560f5f5aae93d", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "21092a223e3c6c144c1a291ab082a7ead32821ba77073b72c68515aa51fef570"}, +}