浏览代码

rtmp-services: Remove YouNow specific code

Rodney 1 年之前
父节点
当前提交
58264833c9

+ 1 - 3
plugins/rtmp-services/CMakeLists.txt

@@ -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>)

+ 0 - 2
plugins/rtmp-services/cmake/legacy.cmake

@@ -17,8 +17,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

+ 0 - 7
plugins/rtmp-services/rtmp-common.c

@@ -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);

+ 0 - 109
plugins/rtmp-services/service-specific/younow.c

@@ -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;
-}

+ 0 - 3
plugins/rtmp-services/service-specific/younow.h

@@ -1,3 +0,0 @@
-#pragma once
-
-extern const char *younow_get_ingest(const char *server, const char *key);