New upstream version 24.0.5+dfsg1

This commit is contained in:
Sebastian Ramacher 2019-12-10 20:31:54 +01:00
parent 52fa83f147
commit 4c2ea24267
61 changed files with 710 additions and 130 deletions

View file

@ -664,7 +664,8 @@ void XCompcapMain::render(gs_effect_t *effect)
effect = obs_get_base_effect(OBS_EFFECT_DEFAULT);
while (gs_effect_loop(effect, "Draw")) {
xcursor_render(p->cursor);
xcursor_render(p->cursor, -p->cur_cut_left,
-p->cur_cut_top);
}
}
}

View file

@ -103,7 +103,7 @@ void xcursor_tick(xcursor_t *data)
XFree(xc);
}
void xcursor_render(xcursor_t *data)
void xcursor_render(xcursor_t *data, int x_offset, int y_offset)
{
if (!data->tex)
return;
@ -117,7 +117,8 @@ void xcursor_render(xcursor_t *data)
gs_enable_color(true, true, true, false);
gs_matrix_push();
gs_matrix_translate3f(data->render_x, data->render_y, 0.0f);
gs_matrix_translate3f(data->render_x + x_offset,
data->render_y + y_offset, 0.0f);
gs_draw_sprite(data->tex, 0, 0, 0);
gs_matrix_pop();

View file

@ -61,7 +61,7 @@ void xcursor_tick(xcursor_t *data);
*
* This needs to be executed within a valid render context
*/
void xcursor_render(xcursor_t *data);
void xcursor_render(xcursor_t *data, int x_offset, int y_offset);
/**
* Specify offset for the cursor

View file

@ -108,7 +108,6 @@ int randr_screen_count(xcb_connection_t *xcb)
{
if (!xcb)
return 0;
xcb_screen_t *screen;
screen = xcb_setup_roots_iterator(xcb_get_setup(xcb)).data;

View file

@ -324,7 +324,9 @@ static bool xshm_server_changed(obs_properties_t *props, obs_property_t *p,
")",
i, w, h, x, y);
obs_property_list_add_int(screens, screen_info.array, i);
if (h > 0 && w > 0)
obs_property_list_add_int(screens, screen_info.array,
i);
}
/* handle missing screen */

View file

@ -183,7 +183,8 @@ static bool parse_params(AVCodecContext *context, char **opts)
*assign = 0;
value = assign + 1;
if (av_opt_set(context->priv_data, name, value, 0)) {
if (av_opt_set(context, name, value,
AV_OPT_SEARCH_CHILDREN)) {
blog(LOG_WARNING, "Failed to set %s=%s", name,
value);
ret = false;

View file

@ -1342,7 +1342,7 @@ static void check_to_drop_frames(struct rtmp_stream *stream, bool pframes)
return;
}
if (buffer_duration_usec >= DBR_TRIGGER_USEC) {
if ((uint64_t)buffer_duration_usec >= DBR_TRIGGER_USEC) {
pthread_mutex_lock(&stream->dbr_mutex);
bitrate_changed = dbr_bitrate_lowered(stream);
pthread_mutex_unlock(&stream->dbr_mutex);

View file

@ -1,15 +1,21 @@
project(rtmp-services)
find_package(Libcurl REQUIRED)
include_directories(${LIBCURL_INCLUDE_DIRS})
include_directories(${OBS_JANSSON_INCLUDE_DIRS})
set(rtmp-services_SOURCES
twitch.c
younow.c
rtmp-common.c
rtmp-custom.c
rtmp-services-main.c)
set(rtmp-services_HEADERS
twitch.h
younow.h
rtmp-format-ver.h)
set(RTMP_SERVICES_URL
@ -28,10 +34,12 @@ 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})
${OBS_JANSSON_IMPORT}
${LIBCURL_LIBRARIES})
target_include_directories(rtmp-services
PUBLIC

4
plugins/rtmp-services/data/package.json Normal file → Executable file
View file

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

49
plugins/rtmp-services/data/services.json Normal file → Executable file
View file

@ -1465,6 +1465,20 @@
"max audio bitrate": 192
}
},
{
"name": "ChathostessModels",
"servers": [
{
"name": "ChathostessModels - Default",
"url": "rtmp://wowza01.foobarweb.com/cmschatsys_video"
}
],
"recommended": {
"keyint": 2,
"max video bitrate": 3000,
"max audio bitrate": 128
}
},
{
"name": "Camplace",
"servers": [
@ -1500,6 +1514,24 @@
"x264opts": "tune=zerolatency"
}
},
{
"name": "YouNow",
"common": false,
"servers": [
{
"name": "younow.com",
"url": "https://signaling-api.younow-prod.video.propsproject.com/api/v1/ingest/server/"
}
],
"recommended": {
"keyint": 2,
"output": "ftl_output",
"max audio bitrate": 160,
"max video bitrate": 7000,
"profile": "main",
"bframes": 0
}
},
{
"name": "Steam",
"common": false,
@ -1559,6 +1591,23 @@
"max video bitrate": 7000,
"max audio bitrate": 128
}
},
{
"name": "Stars.AVN.com",
"servers": [
{
"name": "Default",
"url": "rtmp://alpha.gateway.stars.avn.com/live"
}
],
"recommended": {
"keyint": 2,
"profile": "main",
"max video bitrate": 2500,
"max audio bitrate": 192,
"bframes": 0,
"x264opts": "tune=zerolatency"
}
}
]
}

View file

@ -5,6 +5,7 @@
#include "rtmp-format-ver.h"
#include "twitch.h"
#include "younow.h"
struct rtmp_common {
char *service;
@ -485,7 +486,9 @@ static void apply_video_encoder_settings(obs_data_t *settings,
obs_data_set_string(settings, "rate_control", "CBR");
item = json_object_get(recommended, "profile");
if (json_is_string(item)) {
obs_data_item_t *enc_item = obs_data_item_byname(settings, "profile");
if (json_is_string(item) &&
obs_data_item_gettype(enc_item) == OBS_DATA_STRING) {
const char *profile = json_string_value(item);
obs_data_set_string(settings, "profile", profile);
}
@ -594,6 +597,12 @@ 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);
}
}
return service->server;
}

View file

@ -0,0 +1,113 @@
#include <curl/curl.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);
#if LIBCURL_VERSION_NUM >= 0x072400
// A lot of servers don't yet support ALPN
curl_easy_setopt(curl_handle, CURLOPT_SSL_ENABLE_ALPN, 0);
#endif
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;
}

View file

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