mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-24 10:14:13 -05:00
@@ -14,7 +14,7 @@ from collections import defaultdict
|
||||
|
||||
MINIMUM_PURGE_AGE = 9.75 * 24 * 60 * 60 # slightly less than 10 days
|
||||
TIMEOUT = 10
|
||||
SKIPPED_SERVICES = {"YouNow", "SHOWROOM", "Dacast"}
|
||||
SKIPPED_SERVICES = {"SHOWROOM", "Dacast"}
|
||||
SERVICES_FILE = "plugins/rtmp-services/data/services.json"
|
||||
PACKAGE_FILE = "plugins/rtmp-services/data/package.json"
|
||||
CACHE_FILE = "other/timestamps.json"
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
[submodule "plugins/obs-browser"]
|
||||
path = plugins/obs-browser
|
||||
url = https://github.com/obsproject/obs-browser.git
|
||||
[submodule "plugins/obs-outputs/ftl-sdk"]
|
||||
path = plugins/obs-outputs/ftl-sdk
|
||||
url = https://github.com/Mixer/ftl-sdk.git
|
||||
[submodule "plugins/obs-websocket"]
|
||||
path = plugins/obs-websocket
|
||||
url = https://github.com/obsproject/obs-websocket.git
|
||||
|
||||
@@ -228,9 +228,6 @@ void AutoConfigTestPage::TestBandwidthThread()
|
||||
wiz->serviceName == "Restream.io - RTMP") {
|
||||
string_depad_key(key);
|
||||
key += "?test=true";
|
||||
} else if (wiz->serviceName == "Restream.io - FTL") {
|
||||
string_depad_key(key);
|
||||
key += "?test";
|
||||
}
|
||||
|
||||
obs_data_set_string(service_settings, "service",
|
||||
|
||||
@@ -20,7 +20,6 @@ volatile bool recording_paused = false;
|
||||
volatile bool replaybuf_active = false;
|
||||
volatile bool virtualcam_active = false;
|
||||
|
||||
#define FTL_PROTOCOL "ftl"
|
||||
#define RTMP_PROTOCOL "rtmp"
|
||||
#define SRT_PROTOCOL "srt"
|
||||
#define RIST_PROTOCOL "rist"
|
||||
|
||||
@@ -1499,9 +1499,8 @@ bool OBSBasic::LoadService()
|
||||
if (!service)
|
||||
return false;
|
||||
|
||||
/* Enforce Opus on FTL if needed */
|
||||
if (strcmp(obs_service_get_protocol(service), "FTL") == 0 ||
|
||||
strcmp(obs_service_get_protocol(service), "WHIP") == 0) {
|
||||
/* Enforce Opus on WHIP if needed */
|
||||
if (strcmp(obs_service_get_protocol(service), "WHIP") == 0) {
|
||||
const char *option = config_get_string(
|
||||
basicConfig, "SimpleOutput", "StreamAudioEncoder");
|
||||
if (strcmp(option, "opus") != 0)
|
||||
|
||||
@@ -746,9 +746,6 @@ QString OBSBasicSettings::FindProtocol()
|
||||
server.startsWith("rtmps://"))
|
||||
return QString("RTMPS");
|
||||
|
||||
if (server.startsWith("ftl://"))
|
||||
return QString("FTL");
|
||||
|
||||
if (server.startsWith("srt://"))
|
||||
return QString("SRT");
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ invoke_formatter() {
|
||||
|
||||
if (( ! #source_files )) source_files=((libobs|libobs-*|UI|plugins|deps|shared)/**/*.(c|cpp|h|hpp|m|mm)(.N))
|
||||
|
||||
source_files=(${source_files:#*/(obs-websocket/deps|decklink/*/decklink-sdk|mac-syphon/syphon-framework|obs-outputs/ftl-sdk|win-dshow/libdshowcapture)/*})
|
||||
source_files=(${source_files:#*/(obs-websocket/deps|decklink/*/decklink-sdk|mac-syphon/syphon-framework|win-dshow/libdshowcapture)/*})
|
||||
|
||||
local -a format_args=(-style=file -fallback-style=none)
|
||||
if (( _loglevel > 2 )) format_args+=(--verbose)
|
||||
@@ -77,7 +77,7 @@ invoke_formatter() {
|
||||
|
||||
if (( ! #source_files )) source_files=((libobs|libobs-*|UI|plugins|deps|shared|cmake)/**/(CMakeLists.txt|*.cmake)(.N))
|
||||
|
||||
source_files=(${source_files:#*/(obs-outputs/ftl-sdk|jansson|decklink/*/decklink-sdk|obs-websocket|obs-browser|win-dshow/libdshowcapture)/*})
|
||||
source_files=(${source_files:#*/(jansson|decklink/*/decklink-sdk|obs-websocket|obs-browser|win-dshow/libdshowcapture)/*})
|
||||
|
||||
local -a format_args=()
|
||||
if (( _loglevel > 2 )) format_args+=(--log-level debug)
|
||||
|
||||
@@ -87,8 +87,6 @@ if(OS_WINDOWS)
|
||||
target_sources(obs-outputs PRIVATE obs-outputs.rc)
|
||||
endif()
|
||||
|
||||
include(cmake/ftl.cmake)
|
||||
|
||||
# cmake-format: off
|
||||
set_target_properties_obs(obs-outputs PROPERTIES FOLDER plugins/obs-outputs PREFIX "")
|
||||
# cmake-format: on
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(jansson REQUIRED)
|
||||
|
||||
add_library(ftl-sdk OBJECT)
|
||||
add_library(OBS::ftl-sdk ALIAS ftl-sdk)
|
||||
|
||||
target_compile_definitions(ftl-sdk PUBLIC FTL_FOUND FTL_STATIC_COMPILE)
|
||||
|
||||
target_link_libraries(ftl-sdk PRIVATE jansson::jansson CURL::libcurl)
|
||||
|
||||
target_sources(
|
||||
ftl-sdk
|
||||
PRIVATE # cmake-format: sortable
|
||||
$<$<NOT:$<PLATFORM_ID:Windows>>:ftl-sdk/libftl/posix/socket.c>
|
||||
$<$<NOT:$<PLATFORM_ID:Windows>>:ftl-sdk/libftl/posix/threads.c>
|
||||
$<$<NOT:$<PLATFORM_ID:Windows>>:ftl-sdk/libftl/posix/threads.h>
|
||||
$<$<PLATFORM_ID:Windows>:ftl-sdk/libftl/win32/socket.c>
|
||||
$<$<PLATFORM_ID:Windows>:ftl-sdk/libftl/win32/threads.c>
|
||||
$<$<PLATFORM_ID:Windows>:ftl-sdk/libftl/win32/threads.h>
|
||||
ftl-sdk/libftl/ftl-sdk.c
|
||||
ftl-sdk/libftl/ftl_helpers.c
|
||||
ftl-sdk/libftl/ftl_private.h
|
||||
ftl-sdk/libftl/gettimeofday/gettimeofday.c
|
||||
ftl-sdk/libftl/gettimeofday/gettimeofday.h
|
||||
ftl-sdk/libftl/handshake.c
|
||||
ftl-sdk/libftl/hmac/hmac.c
|
||||
ftl-sdk/libftl/hmac/hmac.h
|
||||
ftl-sdk/libftl/hmac/sha2.c
|
||||
ftl-sdk/libftl/hmac/sha2.h
|
||||
ftl-sdk/libftl/ingest.c
|
||||
ftl-sdk/libftl/logging.c
|
||||
ftl-sdk/libftl/media.c
|
||||
PUBLIC ftl-sdk/libftl/ftl.h)
|
||||
|
||||
target_compile_options(
|
||||
ftl-sdk
|
||||
PRIVATE $<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang,GNU>:-Wno-unused-parameter>
|
||||
$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang,GNU>:-Wno-unused-variable>
|
||||
$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang,GNU>:-Wno-sign-compare>
|
||||
$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang,GNU>:-Wno-pointer-sign>
|
||||
$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang,GNU>:-Wno-int-conversion>
|
||||
$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang>:-Wno-incompatible-function-pointer-types>
|
||||
$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang>:-Wno-implicit-int-conversion>
|
||||
$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang>:-Wno-shorten-64-to-32>
|
||||
$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang>:-Wno-macro-redefined>
|
||||
$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang>:-Wno-enum-conversion>
|
||||
$<$<COMPILE_LANG_AND_ID:C,GNU>:-Wno-extra>
|
||||
$<$<COMPILE_LANG_AND_ID:C,GNU>:-Wno-incompatible-pointer-types>
|
||||
$<$<COMPILE_LANG_AND_ID:C,GNU>:-Wno-builtin-macro-redefined>)
|
||||
|
||||
target_include_directories(
|
||||
ftl-sdk
|
||||
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl"
|
||||
"$<$<PLATFORM_ID:Windows>:${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl/win32>"
|
||||
"$<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl/posix>")
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
|
||||
target_compile_options(ftl-sdk PRIVATE -Wno-error=enum-conversion -Wno-error=maybe-uninitialized)
|
||||
endif()
|
||||
|
||||
target_sources(obs-outputs PRIVATE ftl-stream.c)
|
||||
target_link_libraries(obs-outputs PRIVATE ftl-sdk)
|
||||
target_enable_feature(obs-outputs "FTL protocol support")
|
||||
|
||||
set_target_properties(ftl-sdk PROPERTIES FOLDER plugins/obs-outputs POSITION_INDEPENDENT_CODE TRUE)
|
||||
@@ -118,85 +118,4 @@ else()
|
||||
target_compile_definitions(obs-outputs PRIVATE NO_CRYPTO)
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(FTL QUIET libftl)
|
||||
endif()
|
||||
|
||||
if(FTL_FOUND)
|
||||
find_package(CURL REQUIRED)
|
||||
obs_status(ENABLED "ftl outputs (system ftl-sdk)")
|
||||
|
||||
target_sources(obs-outputs PRIVATE ftl-stream.c)
|
||||
|
||||
target_include_directories(obs-outputs PRIVATE ${FTL_INCLUDE_DIRS})
|
||||
|
||||
target_link_libraries(obs-outputs PRIVATE ${FTL_LIBRARIES} CURL::libcurl)
|
||||
|
||||
target_compile_features(obs-outputs PRIVATE c_std_11)
|
||||
|
||||
target_compile_definitions(obs-outputs PRIVATE FTL_FOUND)
|
||||
|
||||
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/CMakeLists.txt")
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(Jansson 2.5 REQUIRED)
|
||||
obs_status(ENABLED "ftl ouputs (bundled ftl-sdk)")
|
||||
|
||||
target_compile_definitions(obs-outputs PRIVATE FTL_STATIC_COMPILE)
|
||||
|
||||
target_compile_features(obs-outputs PRIVATE c_std_11)
|
||||
|
||||
target_link_libraries(obs-outputs PRIVATE Jansson::Jansson CURL::libcurl)
|
||||
|
||||
target_sources(
|
||||
obs-outputs
|
||||
PRIVATE ftl-stream.c
|
||||
ftl-sdk/libftl/ftl.h
|
||||
ftl-sdk/libftl/ftl_private.h
|
||||
ftl-sdk/libftl/hmac/hmac.c
|
||||
ftl-sdk/libftl/hmac/hmac.h
|
||||
ftl-sdk/libftl/hmac/sha2.c
|
||||
ftl-sdk/libftl/hmac/sha2.h
|
||||
ftl-sdk/libftl/ftl-sdk.c
|
||||
ftl-sdk/libftl/handshake.c
|
||||
ftl-sdk/libftl/ingest.c
|
||||
ftl-sdk/libftl/ftl_helpers.c
|
||||
ftl-sdk/libftl/media.c
|
||||
ftl-sdk/libftl/gettimeofday/gettimeofday.c
|
||||
ftl-sdk/libftl/logging.c)
|
||||
|
||||
target_include_directories(obs-outputs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl)
|
||||
|
||||
if(OS_WINDOWS)
|
||||
target_sources(
|
||||
obs-outputs PRIVATE ftl-sdk/libftl/gettimeofday/gettimeofday.c ftl-sdk/libftl/gettimeofday/gettimeofday.h
|
||||
ftl-sdk/libftl/win32/socket.c ftl-sdk/libftl/win32/threads.c ftl-sdk/libftl/win32/threads.h)
|
||||
|
||||
target_include_directories(obs-outputs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl/win32)
|
||||
elseif(OS_POSIX)
|
||||
target_sources(obs-outputs PRIVATE ftl-sdk/libftl/posix/socket.c ftl-sdk/libftl/posix/threads.c
|
||||
ftl-sdk/libftl/posix/threads.h)
|
||||
|
||||
target_include_directories(obs-outputs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl/posix)
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(
|
||||
obs-outputs
|
||||
PRIVATE -Wno-error=extra
|
||||
-Wno-error=sign-compare
|
||||
-Wno-error=incompatible-pointer-types
|
||||
-Wno-error=int-conversion
|
||||
-Wno-error=unused-parameter
|
||||
-Wno-error=deprecated-declarations
|
||||
"$<$<COMPILE_LANG_AND_ID:C,GNU>:-Wno-error=maybe-uninitialized>"
|
||||
"$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang>:-Wno-error=pointer-sign>")
|
||||
if((NOT CMAKE_C_COMPILER_ID STREQUAL "GNU") OR CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "10")
|
||||
target_compile_options(obs-outputs PRIVATE -Wno-error=enum-conversion)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_compile_definitions(obs-outputs PRIVATE FTL_FOUND)
|
||||
endif()
|
||||
|
||||
setup_plugin_target(obs-outputs)
|
||||
|
||||
@@ -27,6 +27,3 @@ AddressNotAvailable="Address not available. You may have tried to bind to an inv
|
||||
SSLCertVerifyFailed="The RTMP server sent an invalid SSL certificate."
|
||||
InvalidParameter="Invalid connection parameters. Check that the streaming service address is correct."
|
||||
NoRoute="Error reaching host. Make sure that the interface you have bound can access the internet and that the streaming service supports the address family you selected (see Settings → Advanced)."
|
||||
|
||||
FTLStream="FTL Stream"
|
||||
FTLStream.PeakBitrate="Peak Bitrate"
|
||||
|
||||
Submodule plugins/obs-outputs/ftl-sdk deleted from d0c8469f66
File diff suppressed because it is too large
Load Diff
@@ -9,16 +9,13 @@ OBS_DECLARE_MODULE()
|
||||
OBS_MODULE_USE_DEFAULT_LOCALE("obs-outputs", "en-US")
|
||||
MODULE_EXPORT const char *obs_module_description(void)
|
||||
{
|
||||
return "OBS core RTMP/FLV/null/FTL outputs";
|
||||
return "OBS core RTMP/FLV/null outputs";
|
||||
}
|
||||
|
||||
extern struct obs_output_info rtmp_output_info;
|
||||
extern struct obs_output_info null_output_info;
|
||||
extern struct obs_output_info flv_output_info;
|
||||
extern struct obs_output_info mp4_output_info;
|
||||
#if defined(FTL_FOUND)
|
||||
extern struct obs_output_info ftl_output_info;
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(MBEDTLS_THREADING_ALT)
|
||||
void mbed_mutex_init(mbedtls_threading_mutex_t *m)
|
||||
@@ -67,9 +64,6 @@ bool obs_module_load(void)
|
||||
obs_register_output(&null_output_info);
|
||||
obs_register_output(&flv_output_info);
|
||||
obs_register_output(&mp4_output_info);
|
||||
#if defined(FTL_FOUND)
|
||||
obs_register_output(&ftl_output_info);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,9 +32,7 @@ target_sources(
|
||||
service-specific/showroom.c
|
||||
service-specific/showroom.h
|
||||
service-specific/twitch.c
|
||||
service-specific/twitch.h
|
||||
service-specific/younow.c
|
||||
service-specific/younow.h)
|
||||
service-specific/twitch.h)
|
||||
|
||||
target_compile_definitions(rtmp-services PRIVATE SERVICES_URL="${RTMP_SERVICES_URL}"
|
||||
$<$<BOOL:${ENABLE_SERVICE_UPDATES}>:ENABLE_SERVICE_UPDATES>)
|
||||
|
||||
@@ -21,8 +21,6 @@ target_sources(
|
||||
rtmp-services
|
||||
PRIVATE service-specific/twitch.c
|
||||
service-specific/twitch.h
|
||||
service-specific/younow.c
|
||||
service-specific/younow.h
|
||||
service-specific/nimotv.c
|
||||
service-specific/nimotv.h
|
||||
service-specific/showroom.c
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"$schema": "schema/package-schema.json",
|
||||
"url": "https://obsproject.com/obs2_update/rtmp-services/v5",
|
||||
"version": 256,
|
||||
"version": 257,
|
||||
"files": [
|
||||
{
|
||||
"name": "services.json",
|
||||
"version": 256
|
||||
"version": 257
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
"RTMP",
|
||||
"RTMPS",
|
||||
"HLS",
|
||||
"FTL",
|
||||
"SRT",
|
||||
"RIST",
|
||||
"WHIP"
|
||||
@@ -124,7 +123,6 @@
|
||||
"enum": [
|
||||
"rtmp_output",
|
||||
"ffmpeg_hls_muxer",
|
||||
"ftl_output",
|
||||
"ffmpeg_mpegts_muxer"
|
||||
]
|
||||
},
|
||||
@@ -235,7 +233,7 @@
|
||||
},
|
||||
{
|
||||
"$comment": "Require recommended output field if protocol field is not RTMP(S)",
|
||||
"if": { "required": ["protocol"], "properties": { "protocol": { "pattern": "^(HLS|SRT|RIST|FTL|WHIP)$" } } },
|
||||
"if": { "required": ["protocol"], "properties": { "protocol": { "pattern": "^(HLS|SRT|RIST|WHIP)$" } } },
|
||||
"then": { "properties": { "recommended": { "required": ["output"] } } }
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1600,25 +1600,6 @@
|
||||
"h264"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "YouNow",
|
||||
"common": false,
|
||||
"protocol": "FTL",
|
||||
"servers": [
|
||||
{
|
||||
"name": "younow.com",
|
||||
"url": "https://api.younow.com/php/api/broadcast/ingest?id="
|
||||
}
|
||||
],
|
||||
"recommended": {
|
||||
"keyint": 2,
|
||||
"output": "ftl_output",
|
||||
"max audio bitrate": 160,
|
||||
"max video bitrate": 7000,
|
||||
"profile": "main",
|
||||
"bframes": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Steam",
|
||||
"common": false,
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "rtmp-format-ver.h"
|
||||
#include "service-specific/twitch.h"
|
||||
#include "service-specific/younow.h"
|
||||
#include "service-specific/nimotv.h"
|
||||
#include "service-specific/showroom.h"
|
||||
#include "service-specific/dacast.h"
|
||||
@@ -826,12 +825,6 @@ static const char *rtmp_common_url(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
if (service->service && strcmp(service->service, "YouNow") == 0) {
|
||||
if (service->server && service->key) {
|
||||
return younow_get_ingest(service->server, service->key);
|
||||
}
|
||||
}
|
||||
|
||||
if (service->service && strcmp(service->service, "Nimo TV") == 0) {
|
||||
if (service->server && strcmp(service->server, "auto") == 0) {
|
||||
return nimotv_get_ingest(service->key);
|
||||
|
||||
@@ -111,7 +111,6 @@ static const char *rtmp_custom_password(void *data)
|
||||
}
|
||||
|
||||
#define RTMPS_PREFIX "rtmps://"
|
||||
#define FTL_PREFIX "ftl://"
|
||||
#define SRT_PREFIX "srt://"
|
||||
#define RIST_PREFIX "rist://"
|
||||
|
||||
@@ -122,9 +121,6 @@ static const char *rtmp_custom_get_protocol(void *data)
|
||||
if (strncmp(service->server, RTMPS_PREFIX, strlen(RTMPS_PREFIX)) == 0)
|
||||
return "RTMPS";
|
||||
|
||||
if (strncmp(service->server, FTL_PREFIX, strlen(FTL_PREFIX)) == 0)
|
||||
return "FTL";
|
||||
|
||||
if (strncmp(service->server, SRT_PREFIX, strlen(SRT_PREFIX)) == 0)
|
||||
return "SRT";
|
||||
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
#include <util/curl/curl-helper.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <util/dstr.h>
|
||||
#include "util/base.h"
|
||||
#include "younow.h"
|
||||
|
||||
struct younow_mem_struct {
|
||||
char *memory;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
static char *current_ingest = NULL;
|
||||
|
||||
static size_t younow_write_cb(void *contents, size_t size, size_t nmemb,
|
||||
void *userp)
|
||||
{
|
||||
size_t realsize = size * nmemb;
|
||||
struct younow_mem_struct *mem = (struct younow_mem_struct *)userp;
|
||||
|
||||
mem->memory = realloc(mem->memory, mem->size + realsize + 1);
|
||||
if (mem->memory == NULL) {
|
||||
blog(LOG_WARNING, "yyounow_write_cb: realloc returned NULL");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(&(mem->memory[mem->size]), contents, realsize);
|
||||
mem->size += realsize;
|
||||
mem->memory[mem->size] = 0;
|
||||
|
||||
return realsize;
|
||||
}
|
||||
|
||||
const char *younow_get_ingest(const char *server, const char *key)
|
||||
{
|
||||
CURL *curl_handle;
|
||||
CURLcode res;
|
||||
struct younow_mem_struct chunk;
|
||||
struct dstr uri;
|
||||
long response_code;
|
||||
|
||||
// find the delimiter in stream key
|
||||
const char *delim = strchr(key, '_');
|
||||
if (delim == NULL) {
|
||||
blog(LOG_WARNING,
|
||||
"younow_get_ingest: delimiter not found in stream key");
|
||||
return server;
|
||||
}
|
||||
|
||||
curl_handle = curl_easy_init();
|
||||
|
||||
chunk.memory = malloc(1); /* will be grown as needed by realloc */
|
||||
chunk.size = 0; /* no data at this point */
|
||||
|
||||
dstr_init(&uri);
|
||||
dstr_copy(&uri, server);
|
||||
dstr_ncat(&uri, key, delim - key);
|
||||
|
||||
curl_easy_setopt(curl_handle, CURLOPT_URL, uri.array);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, true);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 2L);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 3L);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, younow_write_cb);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
|
||||
curl_obs_set_revoke_setting(curl_handle);
|
||||
|
||||
res = curl_easy_perform(curl_handle);
|
||||
dstr_free(&uri);
|
||||
|
||||
if (res != CURLE_OK) {
|
||||
blog(LOG_WARNING,
|
||||
"younow_get_ingest: curl_easy_perform() failed: %s",
|
||||
curl_easy_strerror(res));
|
||||
curl_easy_cleanup(curl_handle);
|
||||
free(chunk.memory);
|
||||
return server;
|
||||
}
|
||||
|
||||
curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &response_code);
|
||||
if (response_code != 200) {
|
||||
blog(LOG_WARNING,
|
||||
"younow_get_ingest: curl_easy_perform() returned code: %ld",
|
||||
response_code);
|
||||
curl_easy_cleanup(curl_handle);
|
||||
free(chunk.memory);
|
||||
return server;
|
||||
}
|
||||
|
||||
curl_easy_cleanup(curl_handle);
|
||||
|
||||
if (chunk.size == 0) {
|
||||
blog(LOG_WARNING,
|
||||
"younow_get_ingest: curl_easy_perform() returned empty response");
|
||||
free(chunk.memory);
|
||||
return server;
|
||||
}
|
||||
|
||||
if (current_ingest) {
|
||||
free(current_ingest);
|
||||
current_ingest = NULL;
|
||||
}
|
||||
|
||||
current_ingest = strdup(chunk.memory);
|
||||
free(chunk.memory);
|
||||
blog(LOG_INFO, "younow_get_ingest: returning ingest: %s",
|
||||
current_ingest);
|
||||
return current_ingest;
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
extern const char *younow_get_ingest(const char *server, const char *key);
|
||||
Reference in New Issue
Block a user