Imported Upstream version 0.13.2+dsfg1

This commit is contained in:
Sebastian Ramacher 2016-02-24 00:16:51 +01:00
commit fb3990e9e5
2036 changed files with 287360 additions and 0 deletions

View file

@ -0,0 +1,37 @@
project(rtmp-services)
include_directories(${OBS_JANSSON_INCLUDE_DIRS})
set(rtmp-services_SOURCES
rtmp-common.c
rtmp-custom.c
rtmp-services-main.c)
set(rtmp-services_HEADERS
rtmp-format-ver.h)
set(RTMP_SERVICES_URL
"https://obsproject.com/obs2_update/rtmp-services"
CACHE STRING "Default services package URL")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/lookup-config.h.in"
"${CMAKE_BINARY_DIR}/plugins/rtmp-services/lookup-config.h")
set(rtmp-services_config_HEADERS
"${CMAKE_BINARY_DIR}/plugins/rtmp-services/lookup-config.h")
add_library(rtmp-services MODULE
${rtmp-services_SOURCES}
${rtmp-services_HEADERS}
${rtmp-services_config_HEADERS})
target_link_libraries(rtmp-services
libobs
file-updater
${OBS_JANSSON_IMPORT})
target_include_directories(rtmp-services
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/plugins/rtmp-services>")
install_obs_plugin_with_data(rtmp-services data)

View file

@ -0,0 +1,8 @@
StreamingServices="خدمات البث"
CustomStreamingServer="سيرفر بث مخصص"
Service="خدمة"
Server="سيرفر"
StreamKey="مفتاح البث"
Username="اسم المستخدم"
Password="كلمة السر"

View file

@ -0,0 +1,10 @@
StreamingServices="Serveis de transmissió"
CustomStreamingServer="Servidor de transmissió personalitzat"
Service="Servei"
Server="Servidor"
StreamKey="Clau de la transmissió"
UseAuth="Usa autenticació"
Username="Nom dusuari"
Password="Contrasenya"
ShowAll="Mostra tots els serveis"

View file

@ -0,0 +1,10 @@
StreamingServices="Streamovací služby"
CustomStreamingServer="Vlastní streamovací server"
Service="Služba"
Server="Server"
StreamKey="Vysílací klíč"
UseAuth="Použít ověření"
Username="Uživatelské jméno"
Password="Heslo"
ShowAll="Zobrazit všechny služby"

View file

@ -0,0 +1,6 @@
StreamingServices="Streaming Tjenester"
CustomStreamingServer="Brugerdefineret Streaming Server"
Service="Service"
Server="Server"
StreamKey="Stream nøgle"

View file

@ -0,0 +1,10 @@
StreamingServices="Streaming-Plattformen"
CustomStreamingServer="Benutzerdefinierter Streaming-Server"
Service="Plattform"
Server="Server"
StreamKey="Stream-Schlüssel"
UseAuth="Authentifizierung verwenden"
Username="Benutzername"
Password="Passwort"
ShowAll="Alle Plattformen anzeigen"

View file

@ -0,0 +1,7 @@
StreamingServices="Υπηρεσίες Μετάδοσης"
CustomStreamingServer="Προσαρμοσμένος Διακομιστής Μετάδοσης"
Service="Υπηρεσία"
Server="Διακομιστής"
StreamKey="Κλειδί μετάδοσης"
Username="Όνομα χρήστη"

View file

@ -0,0 +1,9 @@
StreamingServices="Streaming Services"
CustomStreamingServer="Custom Streaming Server"
Service="Service"
Server="Server"
StreamKey="Stream key"
UseAuth="Use authentication"
Username="Username"
Password="Password"
ShowAll="Show all services"

View file

@ -0,0 +1,10 @@
StreamingServices="Servicio de retransmisión"
CustomStreamingServer="Presonalizar el servidor de retranmisión"
Service="Servicio"
Server="Servidor"
StreamKey="Clave de retransmisión"
UseAuth="Usar la autentificación"
Username="Nombre de usuario"
Password="Contraseña"
ShowAll="Mostrar todos los servicios"

View file

@ -0,0 +1,10 @@
StreamingServices="Jario Zerbitzuak"
CustomStreamingServer="Norbere Jario Zerbitzaria"
Service="Zerbitzua"
Server="Zerbitzaria"
StreamKey="Jario giltza"
UseAuth="Erabili egiaztapena"
Username="Erabiltzaile-izena"
Password="Sarhitza"
ShowAll="Erakutsi zerbitzu guztiak"

View file

@ -0,0 +1,10 @@
StreamingServices="Palvelut"
CustomStreamingServer="Valinnainen palvelin"
Service="Palvelu"
Server="Palvelin"
StreamKey="Striimiavain"
UseAuth="Käytä todennusta"
Username="Käyttäjätunnus"
Password="Salasana"
ShowAll="Näytä kaikki palvelut"

View file

@ -0,0 +1,10 @@
StreamingServices="Services de Streaming"
CustomStreamingServer="Serveur de Streaming Personnalisé"
Service="Service"
Server="Serveur"
StreamKey="Clé de Stream"
UseAuth="Utiliser l'authentification"
Username="Nom d'utilisateur"
Password="Mot de passe"
ShowAll="Afficher tous les services"

View file

@ -0,0 +1,10 @@
StreamingServices="Servizos de retransmisión"
CustomStreamingServer="Presonalizar o servidor de retranmisión"
Service="Servizo"
Server="Servidor"
StreamKey="Chave de retransmisión"
UseAuth="Usar a autenticación"
Username="Nome de usuario"
Password="Contrasinal"
ShowAll="Mostrar todos os servizos"

View file

@ -0,0 +1,10 @@
StreamingServices="Servisi za strimovanje"
CustomStreamingServer="Posebni server za strim"
Service="Servis"
Server="Server"
StreamKey="Strim ključ"
UseAuth="Koristi autentifikaciju"
Username="Korisničko ime"
Password="Lozinka"
ShowAll="Prikaži sve servise"

View file

@ -0,0 +1,10 @@
StreamingServices="Stream Kiszolgáló"
CustomStreamingServer="Egyéni Streamkiszolgáló"
Service="Szolgáltatás"
Server="Szerver"
StreamKey="Stream Kulcs"
UseAuth="Hitelesítés használata"
Username="Felhasználó"
Password="Jelszó"
ShowAll="Összes szolgáltató mutatása"

View file

@ -0,0 +1,10 @@
StreamingServices="Servizi di streaming"
CustomStreamingServer="Personalizza il server di streaming"
Service="Servizio"
Server="Server"
StreamKey="Chiave Stream"
UseAuth="Usa autenticazione"
Username="Username"
Password="Password"
ShowAll="Mostra tutti i servizi"

View file

@ -0,0 +1,10 @@
StreamingServices="ストリーミングサービス"
CustomStreamingServer="カスタムストリーミングサーバ"
Service="サービス"
Server="サーバー"
StreamKey="ストリームキー"
UseAuth="認証を使用する"
Username="ユーザー名"
Password="パスワード"
ShowAll="すべてのサービスを表示"

View file

@ -0,0 +1,10 @@
StreamingServices="방송 서비스"
CustomStreamingServer="사용자 임의 방송 서버"
Service="서비스"
Server="서버"
StreamKey="스트림 키"
UseAuth="접속 시 인증 필요"
Username="사용자 이름"
Password="암호"
ShowAll="모든 방송 서비스 표시"

View file

@ -0,0 +1,10 @@
StreamingServices="Strømmingstjenester"
CustomStreamingServer="Egendefinert strømmingserver"
Service="Tjeneste"
Server="Tjener"
StreamKey="Strømingsnøkkel"
UseAuth="Bruk godkjenning"
Username="Brukernavn"
Password="Passord"
ShowAll="Vis alle tjenester"

View file

@ -0,0 +1,10 @@
StreamingServices="Streaming Diensten"
CustomStreamingServer="Aangepaste Streaming Server"
Service="Dienst"
Server="Server"
StreamKey="Stream key"
UseAuth="Gebruik authenticatie"
Username="Gebruikersnaam"
Password="Wachtwoord"
ShowAll="Laat alle services zien"

View file

@ -0,0 +1,10 @@
StreamingServices="Serwisy strumieniowania"
CustomStreamingServer="Własny serwer strumieniowania"
Service="Serwis"
Server="Serwer"
StreamKey="Klucz strumienia"
UseAuth="Użyj uwierzytelniania"
Username="Użytkownik"
Password="Hasło"
ShowAll="Pokaż wszystkie serwisy"

View file

@ -0,0 +1,10 @@
StreamingServices="Serviços de Streaming"
CustomStreamingServer="Servidor de Streaming Personalizado"
Service="Serviço"
Server="Servidor"
StreamKey="Chave da Stream"
UseAuth="Utilizar autenticação"
Username="Nome de utilizador"
Password="Palavra-passe"
ShowAll="Mostrar todos os serviços"

View file

@ -0,0 +1,10 @@
StreamingServices="Serviço de Stream"
CustomStreamingServer="Servidor de Stream Personalizado"
Service="Serviço"
Server="Servidor"
StreamKey="Chave de Steam"
UseAuth="Utilizar autenticação"
Username="Nome de utilizador"
Password="Palavra-passe"
ShowAll="Mostrar todos os serviços"

View file

@ -0,0 +1,10 @@
StreamingServices="Servicii de streaming"
CustomStreamingServer="Server de Streaming Personalizat"
Service="Serviciu"
Server="Server"
StreamKey="Cheie Stream"
UseAuth="Utilizează autentificare"
Username="Nume utilizator"
Password="Parolă"
ShowAll="Arată toate serviciile"

View file

@ -0,0 +1,10 @@
StreamingServices="Сервисы вещания"
CustomStreamingServer="Пользовательский сервер вещания"
Service="Сервис"
Server="Сервер"
StreamKey="Ключ потока"
UseAuth="Использовать авторизацию"
Username="Имя пользователя"
Password="Пароль"
ShowAll="Показать все сервисы"

View file

@ -0,0 +1,10 @@
StreamingServices="Streamovacie služby"
CustomStreamingServer="Vlastný stream server"
Service="Služba"
Server="Server"
StreamKey="Stream kľúč"
UseAuth="Použiť overenie"
Username="Užívateľské meno"
Password="Heslo"
ShowAll="Zobraziť všetky služby"

View file

@ -0,0 +1,6 @@
StreamingServices="Storitev oddajanja"
CustomStreamingServer="Streming Server po želji"
Service="Storitev"
Server="Strežnik"
StreamKey="Ključ pretoka"

View file

@ -0,0 +1,10 @@
StreamingServices="Servisi za strimovanje"
CustomStreamingServer="Posebni server za strim"
Service="Servis"
Server="Server"
StreamKey="Strim ključ"
UseAuth="Koristi autentifikaciju"
Username="Korisničko ime"
Password="Lozinka"
ShowAll="Prikaži sve servise"

View file

@ -0,0 +1,10 @@
StreamingServices="Сервиси за стримовање"
CustomStreamingServer="Посебни сервер за стрим"
Service="Сервис"
Server="Сервер"
StreamKey="Стрим кључ"
UseAuth="Користи аутентификацију"
Username="Корисничко име"
Password="Лозинка"
ShowAll="Прикажи све сервисе"

View file

@ -0,0 +1,9 @@
StreamingServices="Streamtjänster"
CustomStreamingServer="Anpassad streamningsserver"
Service="Tjänst"
Server="Server"
StreamKey="Streamnyckel"
UseAuth="Använd autentisering"
Username="Användarnanm"
Password="Lösenord"

View file

@ -0,0 +1,3 @@
Service="บริการ"
Server="เซิร์ฟเวอร์"

View file

@ -0,0 +1,10 @@
StreamingServices="Yayın Servisleri"
CustomStreamingServer="Özel Yayın Sunucusu"
Service="Servis"
Server="Sunucu"
StreamKey="Yayın Anahtarı"
UseAuth="Kimlik doğrulaması kullan"
Username="Kullanıcı adı"
Password="Şifre"
ShowAll="Tüm hizmetleri göster"

View file

@ -0,0 +1,2 @@
Server="Сервер"

View file

@ -0,0 +1,10 @@
StreamingServices="流媒体服务"
CustomStreamingServer="自定义流媒体服务器"
Service="服务"
Server="服务器"
StreamKey="流密钥"
UseAuth="使用身份验证"
Username="用户名"
Password="密码"
ShowAll="显示所有服务"

View file

@ -0,0 +1,9 @@
StreamingServices="串流服務"
CustomStreamingServer="自訂串流伺服器"
Service="服務商"
Server="伺服器"
StreamKey="串流金鑰"
UseAuth="使用身份驗證"
Username="使用者名稱"
Password="密碼"

View file

@ -0,0 +1,10 @@
{
"url": "https://obsproject.com/obs2_update/rtmp-services",
"version": 13,
"files": [
{
"name": "services.json",
"version": 13
}
]
}

View file

@ -0,0 +1,458 @@
{
"format_version": 1,
"services": [
{
"name": "Twitch",
"common": true,
"servers": [
{
"name": "US West: San Francisco, CA",
"url": "rtmp://live.twitch.tv/app"
},
{
"name": "Asia: Hong Kong",
"url": "rtmp://live-hkg.twitch.tv/app"
},
{
"name": "Asia: Seoul, South Korea",
"url": "rtmp://live-sel.twitch.tv/app"
},
{
"name": "Asia: Singapore",
"url": "rtmp://live-sin.twitch.tv/app"
},
{
"name": "Asia: Taipei, Taiwan",
"url": "rtmp://live-tpe.twitch.tv/app"
},
{
"name": "Asia: Tokyo, Japan",
"url": "rtmp://live-tyo.twitch.tv/app"
},
{
"name": "Australia: Sydney",
"url": "rtmp://live-syd.twitch.tv/app"
},
{
"name": "EU: Amsterdam, NL",
"url": "rtmp://live-ams.twitch.tv/app"
},
{
"name": "EU: Frankfurt, DE",
"url": "rtmp://live-fra.twitch.tv/app"
},
{
"name": "EU: London, UK",
"url": "rtmp://live-lhr.twitch.tv/app"
},
{
"name": "EU: Paris, FR",
"url": "rtmp://live-cdg.twitch.tv/app"
},
{
"name": "EU: Prague, CZ",
"url": "rtmp://live-prg.twitch.tv/app"
},
{
"name": "EU: Stockholm, SE",
"url": "rtmp://live-arn.twitch.tv/app"
},
{
"name": "South America: Argentina",
"url": "rtmp://live-eze.twitch.tv/app"
},
{
"name": "South America: Chile",
"url": "rtmp://live-scl.twitch.tv/app"
},
{
"name": "South America: Rio de Janeiro, Brazil",
"url": "rtmp://live-gig.twitch.tv/app"
},
{
"name": "South America: Sao Paulo, Brazil",
"url": "rtmp://live-gru.twitch.tv/app"
},
{
"name": "US Central: Dallas, TX",
"url": "rtmp://live-dfw.twitch.tv/app"
},
{
"name": "US East: Ashburn, VA",
"url": "rtmp://live-iad.twitch.tv/app"
},
{
"name": "US East: Chicago",
"url": "rtmp://live-ord.twitch.tv/app"
},
{
"name": "US East: Miami, FL",
"url": "rtmp://live-mia.twitch.tv/app"
},
{
"name": "US East: New York, NY",
"url": "rtmp://live-jfk.twitch.tv/app"
},
{
"name": "US West: Los Angeles, CA",
"url": "rtmp://live-lax.twitch.tv/app"
},
{
"name": "US West: San Jose, CA",
"url": "rtmp://live-sjc.twitch.tv/app"
},
{
"name": "US West: Seattle, WA",
"url": "rtmp://live-sea.twitch.tv/app"
}
],
"recommended": {
"keyint": 2,
"profile": "main",
"max video bitrate": 3500,
"max audio bitrate": 160
}
},
{
"name": "YouTube / YouTube Gaming",
"common": true,
"servers": [
{
"name": "Primary YouTube ingest server",
"url": "rtmp://a.rtmp.youtube.com/live2"
},
{
"name": "Backup YouTube ingest server",
"url": "rtmp://b.rtmp.youtube.com/live2?backup=1"
}
],
"recommended": {
"keyint": 4,
"profile": "main",
"max video bitrate": 9000,
"max audio bitrate": 160
}
},
{
"name": "hitbox.tv",
"common": true,
"servers": [
{
"name": "Default",
"url": "rtmp://live.hitbox.tv/push"
},
{
"name": "EU-North: Amsterdam, Netherlands",
"url": "rtmp://live.ams.hitbox.tv/push"
},
{
"name": "EU-West: Frankfurt, Germany",
"url": "rtmp://live.fra.hitbox.tv/push"
},
{
"name": "EU-West: Paris, France",
"url": "rtmp://live.cdg.hitbox.tv/push"
},
{
"name": "EU-West: London, United Kingdom",
"url": "rtmp://live.lhr.hitbox.tv/push"
},
{
"name": "EU-Central: Nurnberg, Germany",
"url": "rtmp://live.nbg.hitbox.tv/push"
},
{
"name": "EU-East: Vienna, Austria",
"url": "rtmp://live.vie.hitbox.tv/push"
},
{
"name": "EU-South: Milan, Italia",
"url": "rtmp://live.mxp.hitbox.tv/push"
},
{
"name": "Russia: Moscow",
"url": "rtmp://live.dme.hitbox.tv/push"
},
{
"name": "US-East: Washington",
"url": "rtmp://live.vgn.hitbox.tv/push"
},
{
"name": "US-East: New York",
"url": "rtmp://live.jfk.hitbox.tv/push"
},
{
"name": "US-Central: Denver",
"url": "rtmp://live.den.hitbox.tv/push"
},
{
"name": "US-West: San Francisco",
"url": "rtmp://live.sfo.hitbox.tv/push"
},
{
"name": "US-West: Los Angeles",
"url": "rtmp://live.lax.hitbox.tv/push"
},
{
"name": "South America: Sao Paulo, Brazil",
"url": "rtmp://live.gru.hitbox.tv/push"
},
{
"name": "South Korea: Seoul",
"url": "rtmp://live.icn.hitbox.tv/push"
},
{
"name": "Asia: Singapore",
"url": "rtmp://live.sin.hitbox.tv/push"
},
{
"name": "China: Hong Kong",
"url": "rtmp://live.hkg.hitbox.tv/push"
},
{
"name": "Oceania: Sydney, Australia",
"url": "rtmp://live.syd.hitbox.tv/push"
}
],
"recommended": {
"keyint": 2,
"profile": "high",
"max video bitrate": 3500,
"max audio bitrate": 320
}
},
{
"name": "beam.pro",
"common": true,
"servers": [
{
"name": "US: Dallas, TX",
"url": "rtmp://ingest-dal.beam.pro:1935/beam"
},
{
"name": "US: San Jose, CA",
"url": "rtmp://ingest-sjc.beam.pro:1935/beam"
},
{
"name": "US: Seattle, WA",
"url": "rtmp://ingest-sea.beam.pro:1935/beam"
},
{
"name": "US: Washington DC",
"url": "rtmp://ingest-wdc.beam.pro:1935/beam"
},
{
"name": "Canada: Toronto",
"url": "rtmp://ingest-tor.beam.pro:1935/beam"
},
{
"name": "EU: London",
"url": "rtmp://ingest-lon.beam.pro:1935/beam"
},
{
"name": "EU: Amsterdam",
"url": "rtmp://ingest-ams.beam.pro:1935/beam"
},
{
"name": "EU: Frankfurt",
"url": "rtmp://ingest-fra.beam.pro:1935/beam"
},
{
"name": "Australia: Melbourne",
"url": "rtmp://ingest-mel.beam.pro:1935/beam"
},
{
"name": "Brazil: Sao Paulo",
"url": "rtmp://ingest-sao.beam.pro:1935/beam"
}
],
"recommended": {
"keyint": 1,
"max audio bitrate": 160,
"max video bitrate": 3500,
"profile": "main"
}
},
{
"name": "DailyMotion",
"common": true,
"servers": [
{
"name": "Primary",
"url": "rtmp://publish.dailymotion.com/publish-dm"
}
]
},
{
"name": "Livecoding.tv",
"common": true,
"servers": [
{
"name": "United States",
"url": "rtmp://usmedia3.livecoding.tv/livecodingtv"
},
{
"name": "EU",
"url": "rtmp://eumedia1.livecoding.tv/livecodingtv"
}
],
"recommended": {
"max video bitrate": 1300
}
},
{
"name": "WatchPeopleCode.com",
"servers": [
{
"name": "Primary",
"url": "rtmp://streaming.watchpeoplecode.com/live"
}
]
},
{
"name": "Restream.io",
"servers": [
{
"name": "EU Primary",
"url": "rtmp://eu.restream.io/live"
},
{
"name": "EU Secondary",
"url": "rtmp://eu-secondary.restream.io/live"
},
{
"name": "US West",
"url": "rtmp://us-west.restream.io/live"
},
{
"name": "US East",
"url": "rtmp://us-east.restream.io/live"
}
]
},
{
"name": "JOICASTER",
"servers": [
{
"name": "U.S. - Washington, DC",
"url": "rtmp://ingest-1.wdc01.joicaster.co/live"
},
{
"name": "U.S. - Dallas, TX",
"url": "rtmp://ingest-1.dal09.joicaster.co/live"
},
{
"name": "U.S. - Seattle, WA",
"url": "rtmp://ingest-1.sea01.joicaster.co/live"
},
{
"name": "C.A. - Toronto, Canada",
"url": "rtmp://ingest-1.tor01.joicaster.co/live"
},
{
"name": "E.U. - London, England",
"url": "rtmp://ingest-1.lon02.joicaster.co/live"
},
{
"name": "E.U. - Amsterdam, Netherlands",
"url": "rtmp://ingest-1.ams03.joicaster.co/live"
},
{
"name": "A.S. - Tokyo, Japan",
"url": "rtmp://ingest-1.tok02.joicaster.co/live"
},
{
"name": "A.U. - Melbourne, Australia",
"url": "rtmp://ingest-1.mel01.joicaster.co/live"
},
{
"name": "S.A - São Paulo, Brazil",
"url": "rtmp://ingest-1.sao01.joicaster.co/live"
}
]
},
{
"name": "GoodGame.ru",
"servers": [
{
"name": "Моscow",
"url": "rtmp://msk.goodgame.ru:1940/live"
}
]
},
{
"name": "GamePlank",
"servers": [
{
"name": "Primary",
"url": "rtmp://www.gameplank.tv/live"
}
]
},
{
"name": "Vaughn Live / iNSTAGIB.tv",
"servers": [
{
"name": "US: Primary",
"url": "rtmp://live.vaughnsoft.net:443/live"
},
{
"name": "US: San Jose, CA",
"url": "rtmp://live-sjc.vaughnsoft.net:443/live"
},
{
"name": "US: New York, NY",
"url": "rtmp://live-nyc.vaughnsoft.net:443/live"
},
{
"name": "US: New York 2, NY",
"url": "rtmp://live-nyc2.vaughnsoft.net:443/live"
}
]
},
{
"name": "Streamup",
"servers": [
{
"name": "Worldwide",
"url": "rtmp://origin.streamuplive.com/app"
}
]
},
{
"name": "connectcast.tv",
"servers": [
{
"name": "Default",
"url": "rtmp://stream.connectcast.tv/live"
}
]
},
{
"name": "CyberGame.TV",
"servers": [
{
"name": "RU Origin",
"url": "rtmp://st.cybergame.tv:1953/live"
},
{
"name": "RU Premium",
"url": "rtmp://premium.cybergame.tv:1953/premium"
}
]
},
{
"name": "CashPlay.tv",
"servers": [
{
"name": "Primary, UK",
"url": "rtmp://live.cashplay.tv/live"
},
{
"name": "Low Priority, DE",
"url": "rtmp://de.live.cashplay.tv/live"
}
]
}
]
}

View file

@ -0,0 +1,3 @@
#pragma once
#define RTMP_SERVICES_URL "@RTMP_SERVICES_URL@"

View file

@ -0,0 +1,418 @@
#include <util/platform.h>
#include <obs-module.h>
#include <jansson.h>
#include "rtmp-format-ver.h"
struct rtmp_common {
char *service;
char *server;
char *key;
};
static const char *rtmp_common_getname(void *unused)
{
UNUSED_PARAMETER(unused);
return obs_module_text("StreamingServices");
}
static void rtmp_common_update(void *data, obs_data_t *settings)
{
struct rtmp_common *service = data;
bfree(service->service);
bfree(service->server);
bfree(service->key);
service->service = bstrdup(obs_data_get_string(settings, "service"));
service->server = bstrdup(obs_data_get_string(settings, "server"));
service->key = bstrdup(obs_data_get_string(settings, "key"));
}
static void rtmp_common_destroy(void *data)
{
struct rtmp_common *service = data;
bfree(service->service);
bfree(service->server);
bfree(service->key);
bfree(service);
}
static void *rtmp_common_create(obs_data_t *settings, obs_service_t *service)
{
struct rtmp_common *data = bzalloc(sizeof(struct rtmp_common));
rtmp_common_update(data, settings);
UNUSED_PARAMETER(service);
return data;
}
static inline const char *get_string_val(json_t *service, const char *key)
{
json_t *str_val = json_object_get(service, key);
if (!str_val || !json_is_string(str_val))
return NULL;
return json_string_value(str_val);
}
static inline int get_int_val(json_t *service, const char *key)
{
json_t *integer_val = json_object_get(service, key);
if (!integer_val || !json_is_integer(integer_val))
return 0;
return (int)json_integer_value(integer_val);
}
static inline bool get_bool_val(json_t *service, const char *key)
{
json_t *bool_val = json_object_get(service, key);
if (!bool_val || !json_is_boolean(bool_val))
return false;
return json_is_true(bool_val);
}
static void add_service(obs_property_t *list, json_t *service, bool show_all,
const char *cur_service)
{
json_t *servers;
const char *name;
bool common;
if (!json_is_object(service)) {
blog(LOG_WARNING, "rtmp-common.c: [add_service] service "
"is not an object");
return;
}
name = get_string_val(service, "name");
if (!name) {
blog(LOG_WARNING, "rtmp-common.c: [add_service] service "
"has no name");
return;
}
common = get_bool_val(service, "common");
if (!show_all && !common && strcmp(cur_service, name) != 0) {
return;
}
servers = json_object_get(service, "servers");
if (!servers || !json_is_array(servers)) {
blog(LOG_WARNING, "rtmp-common.c: [add_service] service "
"'%s' has no servers", name);
return;
}
obs_property_list_add_string(list, name, name);
}
static void add_services(obs_property_t *list, json_t *root, bool show_all,
const char *cur_service)
{
json_t *service;
size_t index;
if (!json_is_array(root)) {
blog(LOG_WARNING, "rtmp-common.c: [add_services] JSON file "
"root is not an array");
return;
}
json_array_foreach (root, index, service) {
add_service(list, service, show_all, cur_service);
}
}
static json_t *open_json_file(const char *file)
{
char *file_data = os_quick_read_utf8_file(file);
json_error_t error;
json_t *root;
json_t *list;
int format_ver;
if (!file_data)
return NULL;
root = json_loads(file_data, JSON_REJECT_DUPLICATES, &error);
bfree(file_data);
if (!root) {
blog(LOG_WARNING, "rtmp-common.c: [open_json_file] "
"Error reading JSON file (%d): %s",
error.line, error.text);
return NULL;
}
format_ver = get_int_val(root, "format_version");
if (format_ver != RTMP_SERVICES_FORMAT_VERSION) {
blog(LOG_WARNING, "rtmp-common.c: [open_json_file] "
"Wrong format version (%d), expected %d",
format_ver, RTMP_SERVICES_FORMAT_VERSION);
json_decref(root);
return NULL;
}
list = json_object_get(root, "services");
if (list)
json_incref(list);
json_decref(root);
if (!list) {
blog(LOG_WARNING, "rtmp-common.c: [open_json_file] "
"No services list");
return NULL;
}
return list;
}
static json_t *open_services_file(void)
{
char *file;
json_t *root = NULL;
file = obs_module_config_path("services.json");
if (file) {
root = open_json_file(file);
bfree(file);
}
if (!root) {
file = obs_module_file("services.json");
if (file) {
root = open_json_file(file);
bfree(file);
}
}
return root;
}
static void build_service_list(obs_property_t *list, json_t *root,
bool show_all, const char *cur_service)
{
obs_property_list_clear(list);
add_services(list, root, show_all, cur_service);
}
static void properties_data_destroy(void *data)
{
json_t *root = data;
if (root)
json_decref(root);
}
static void fill_servers(obs_property_t *servers_prop, json_t *service,
const char *name)
{
json_t *servers, *server;
size_t index;
obs_property_list_clear(servers_prop);
servers = json_object_get(service, "servers");
if (!json_is_array(servers)) {
blog(LOG_WARNING, "rtmp-common.c: [fill_servers] "
"Servers for service '%s' not a valid object",
name);
return;
}
json_array_foreach (servers, index, server) {
const char *server_name = get_string_val(server, "name");
const char *url = get_string_val(server, "url");
if (!server_name || !url)
continue;
obs_property_list_add_string(servers_prop, server_name, url);
}
}
static inline json_t *find_service(json_t *root, const char *name)
{
size_t index;
json_t *service;
json_array_foreach (root, index, service) {
const char *cur_name = get_string_val(service, "name");
if (strcmp(name, cur_name) == 0)
return service;
}
return NULL;
}
static bool service_selected(obs_properties_t *props, obs_property_t *p,
obs_data_t *settings)
{
const char *name = obs_data_get_string(settings, "service");
json_t *root = obs_properties_get_param(props);
json_t *service;
if (!name || !*name)
return false;
service = find_service(root, name);
if (!service)
return false;
fill_servers(obs_properties_get(props, "server"), service, name);
UNUSED_PARAMETER(p);
return true;
}
static bool show_all_services_toggled(obs_properties_t *ppts,
obs_property_t *p, obs_data_t *settings)
{
const char *cur_service = obs_data_get_string(settings, "service");
bool show_all = obs_data_get_bool(settings, "show_all");
json_t *root = obs_properties_get_param(ppts);
if (!root)
return false;
build_service_list(obs_properties_get(ppts, "service"), root, show_all,
cur_service);
UNUSED_PARAMETER(p);
return true;
}
static obs_properties_t *rtmp_common_properties(void *unused)
{
UNUSED_PARAMETER(unused);
obs_properties_t *ppts = obs_properties_create();
obs_property_t *p;
json_t *root;
root = open_services_file();
if (root)
obs_properties_set_param(ppts, root, properties_data_destroy);
p = obs_properties_add_list(ppts, "service",
obs_module_text("Service"),
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
obs_property_set_modified_callback(p, service_selected);
p = obs_properties_add_bool(ppts, "show_all",
obs_module_text("ShowAll"));
obs_property_set_modified_callback(p, show_all_services_toggled);
obs_properties_add_list(ppts, "server", obs_module_text("Server"),
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
obs_properties_add_text(ppts, "key", obs_module_text("StreamKey"),
OBS_TEXT_PASSWORD);
return ppts;
}
static void apply_video_encoder_settings(obs_data_t *settings,
json_t *recommended)
{
json_t *item = json_object_get(recommended, "keyint");
if (item && json_is_integer(item)) {
int keyint = (int)json_integer_value(item);
obs_data_set_int(settings, "keyint_sec", keyint);
}
obs_data_set_bool(settings, "cbr", true);
item = json_object_get(recommended, "profile");
if (item && json_is_string(item)) {
const char *profile = json_string_value(item);
obs_data_set_string(settings, "profile", profile);
}
item = json_object_get(recommended, "max video bitrate");
if (item && json_is_integer(item)) {
int max_bitrate = (int)json_integer_value(item);
if (obs_data_get_int(settings, "bitrate") > max_bitrate) {
obs_data_set_int(settings, "bitrate", max_bitrate);
obs_data_set_int(settings, "buffer_size", max_bitrate);
}
}
}
static void apply_audio_encoder_settings(obs_data_t *settings,
json_t *recommended)
{
json_t *item = json_object_get(recommended, "max audio bitrate");
if (item && json_is_integer(item)) {
int max_bitrate = (int)json_integer_value(item);
if (obs_data_get_int(settings, "bitrate") > max_bitrate)
obs_data_set_int(settings, "bitrate", max_bitrate);
}
}
static void initialize_output(struct rtmp_common *service, json_t *root,
obs_data_t *video_settings, obs_data_t *audio_settings)
{
json_t *json_service = find_service(root, service->service);
json_t *recommended;
if (!json_service) {
blog(LOG_WARNING, "rtmp-common.c: [initialize_output] "
"Could not find service '%s'",
service->service);
return;
}
recommended = json_object_get(json_service, "recommended");
if (!recommended)
return;
if (video_settings)
apply_video_encoder_settings(video_settings, recommended);
if (audio_settings)
apply_audio_encoder_settings(audio_settings, recommended);
}
static void rtmp_common_apply_settings(void *data,
obs_data_t *video_settings, obs_data_t *audio_settings)
{
struct rtmp_common *service = data;
json_t *root = open_services_file();
if (root) {
initialize_output(service, root, video_settings,
audio_settings);
json_decref(root);
}
}
static const char *rtmp_common_url(void *data)
{
struct rtmp_common *service = data;
return service->server;
}
static const char *rtmp_common_key(void *data)
{
struct rtmp_common *service = data;
return service->key;
}
struct obs_service_info rtmp_common_service = {
.id = "rtmp_common",
.get_name = rtmp_common_getname,
.create = rtmp_common_create,
.destroy = rtmp_common_destroy,
.update = rtmp_common_update,
.get_properties = rtmp_common_properties,
.get_url = rtmp_common_url,
.get_key = rtmp_common_key,
.apply_encoder_settings = rtmp_common_apply_settings,
};

View file

@ -0,0 +1,120 @@
#include <obs-module.h>
struct rtmp_custom {
char *server, *key;
bool use_auth;
char *username, *password;
};
static const char *rtmp_custom_name(void *unused)
{
UNUSED_PARAMETER(unused);
return obs_module_text("CustomStreamingServer");
}
static void rtmp_custom_update(void *data, obs_data_t *settings)
{
struct rtmp_custom *service = data;
bfree(service->server);
bfree(service->key);
service->server = bstrdup(obs_data_get_string(settings, "server"));
service->key = bstrdup(obs_data_get_string(settings, "key"));
service->use_auth = obs_data_get_bool(settings, "use_auth");
service->username = bstrdup(obs_data_get_string(settings, "username"));
service->password = bstrdup(obs_data_get_string(settings, "password"));
}
static void rtmp_custom_destroy(void *data)
{
struct rtmp_custom *service = data;
bfree(service->server);
bfree(service->key);
bfree(service->username);
bfree(service->password);
bfree(service);
}
static void *rtmp_custom_create(obs_data_t *settings, obs_service_t *service)
{
struct rtmp_custom *data = bzalloc(sizeof(struct rtmp_custom));
rtmp_custom_update(data, settings);
UNUSED_PARAMETER(service);
return data;
}
static bool use_auth_modified(obs_properties_t *ppts, obs_property_t *p,
obs_data_t *settings)
{
bool use_auth = obs_data_get_bool(settings, "use_auth");
p = obs_properties_get(ppts, "username");
obs_property_set_visible(p, use_auth);
p = obs_properties_get(ppts, "password");
obs_property_set_visible(p, use_auth);
return true;
}
static obs_properties_t *rtmp_custom_properties(void *unused)
{
UNUSED_PARAMETER(unused);
obs_properties_t *ppts = obs_properties_create();
obs_property_t *p;
obs_properties_add_text(ppts, "server", "URL", OBS_TEXT_DEFAULT);
obs_properties_add_text(ppts, "key", obs_module_text("StreamKey"),
OBS_TEXT_PASSWORD);
p = obs_properties_add_bool(ppts, "use_auth", obs_module_text("UseAuth"));
obs_properties_add_text(ppts, "username", obs_module_text("Username"),
OBS_TEXT_DEFAULT);
obs_properties_add_text(ppts, "password", obs_module_text("Password"),
OBS_TEXT_PASSWORD);
obs_property_set_modified_callback(p, use_auth_modified);
return ppts;
}
static const char *rtmp_custom_url(void *data)
{
struct rtmp_custom *service = data;
return service->server;
}
static const char *rtmp_custom_key(void *data)
{
struct rtmp_custom *service = data;
return service->key;
}
static const char *rtmp_custom_username(void *data)
{
struct rtmp_custom *service = data;
if (!service->use_auth)
return NULL;
return service->username;
}
static const char *rtmp_custom_password(void *data)
{
struct rtmp_custom *service = data;
if (!service->use_auth)
return NULL;
return service->password;
}
struct obs_service_info rtmp_custom_service = {
.id = "rtmp_custom",
.get_name = rtmp_custom_name,
.create = rtmp_custom_create,
.destroy = rtmp_custom_destroy,
.update = rtmp_custom_update,
.get_properties = rtmp_custom_properties,
.get_url = rtmp_custom_url,
.get_key = rtmp_custom_key,
.get_username = rtmp_custom_username,
.get_password = rtmp_custom_password
};

View file

@ -0,0 +1,3 @@
#pragma once
#define RTMP_SERVICES_FORMAT_VERSION 1

View file

@ -0,0 +1,69 @@
#include <util/text-lookup.h>
#include <util/threading.h>
#include <util/platform.h>
#include <util/dstr.h>
#include <obs-module.h>
#include <file-updater/file-updater.h>
#include "rtmp-format-ver.h"
#include "lookup-config.h"
OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE("rtmp-services", "en-US")
#define RTMP_SERVICES_LOG_STR "[rtmp-services plugin] "
#define RTMP_SERVICES_VER_STR "rtmp-services plugin (libobs " OBS_VERSION ")"
extern struct obs_service_info rtmp_common_service;
extern struct obs_service_info rtmp_custom_service;
static update_info_t *update_info = NULL;
static bool confirm_service_file(void *param, struct file_download_data *file)
{
if (astrcmpi(file->name, "services.json") == 0) {
obs_data_t *data;
int format_version;
data = obs_data_create_from_json((char*)file->buffer.array);
if (!data)
return false;
format_version = (int)obs_data_get_int(data, "format_version");
obs_data_release(data);
if (format_version != RTMP_SERVICES_FORMAT_VERSION)
return false;
}
UNUSED_PARAMETER(param);
return true;
}
bool obs_module_load(void)
{
char *local_dir = obs_module_file("");
char *cache_dir = obs_module_config_path("");
if (cache_dir) {
update_info = update_info_create(
RTMP_SERVICES_LOG_STR,
RTMP_SERVICES_VER_STR,
RTMP_SERVICES_URL,
local_dir,
cache_dir,
confirm_service_file, NULL);
}
bfree(local_dir);
bfree(cache_dir);
obs_register_service(&rtmp_common_service);
obs_register_service(&rtmp_custom_service);
return true;
}
void obs_module_unload(void)
{
update_info_destroy(update_info);
}