New upstream version 26.0.0+dfsg1

This commit is contained in:
Sebastian Ramacher 2020-10-01 22:15:25 +02:00
parent 8e020cdacb
commit 240080891f
837 changed files with 41275 additions and 9196 deletions

View file

@ -22,11 +22,10 @@ add_library(file-updater STATIC
target_include_directories(file-updater
PUBLIC .)
if(NOT MSVC AND NOT MINGW)
target_compile_options(file-updater PRIVATE -fPIC)
endif()
target_link_libraries(file-updater
${LIBCURL_LIBRARIES}
${file-updater_PLATFORM_DEPS}
libobs)
set_target_properties(file-updater PROPERTIES
FOLDER "deps"
POSITION_INDEPENDENT_CODE ON)

View file

@ -35,9 +35,11 @@ add_library(glad SHARED
${glad_SOURCES}
${glad_PLATFORM_SOURCES})
set_target_properties(glad PROPERTIES
FOLDER "deps"
OUTPUT_NAME obsglad
VERSION "0"
SOVERSION "0")
SOVERSION "0"
POSITION_INDEPENDENT_CODE ON)
target_include_directories(glad
PUBLIC include
${glad_include_dirs})
@ -47,9 +49,6 @@ target_compile_definitions(glad
if(NOT MSVC)
target_compile_options(glad
PRIVATE -DPIC -fvisibility=hidden)
if(NOT MINGW)
target_compile_options(glad PRIVATE -fPIC)
endif()
endif()
if(NOT WIN32 AND NOT APPLE)

View file

@ -35,7 +35,7 @@ static void* libGL;
#ifndef __APPLE__
typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*);
PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
extern PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
#endif
static

View file

@ -29,6 +29,9 @@ endif()
add_library(ipc-util STATIC
${ipc-util_SOURCES}
${ipc-util_HEADERS})
set_target_properties(ipc-util PROPERTIES
FOLDER "deps"
POSITION_INDEPENDENT_CODE ON)
target_include_directories(ipc-util
PUBLIC .)
target_link_libraries(ipc-util)

View file

@ -50,15 +50,12 @@ endif(WIN32)
add_library (libff STATIC
${libff_HEADERS}
${libff_SOURCES})
set_target_properties(libff PROPERTIES
FOLDER "deps"
POSITION_INDEPENDENT_CODE ON)
target_include_directories(libff
PUBLIC .)
if(NOT MSVC)
if(NOT MINGW)
target_compile_options(libff PRIVATE -fPIC)
endif()
endif()
target_link_libraries (libff
${FFMPEG_LIBRARIES})

View file

@ -291,7 +291,6 @@ static inline bool is_output_device(const AVClass *avclass)
if (!avclass)
return 0;
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(52, 66, 101)
switch (avclass->category) {
case AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT:
case AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT:
@ -300,9 +299,6 @@ static inline bool is_output_device(const AVClass *avclass)
default:
return false;
}
#else
return (avclass->category == AV_CLASS_CATEGORY_OUTPUT);
#endif
}
const struct ff_format_desc *ff_format_supported()

View file

@ -31,13 +31,9 @@ target_include_directories(media-playback
PUBLIC .
)
if(NOT MSVC)
if(NOT MINGW)
target_compile_options(media-playback PRIVATE -fPIC)
endif()
endif()
target_link_libraries(media-playback
${FFMPEG_LIBRARIES}
)
set_target_properties(media-playback PROPERTIES
FOLDER "deps"
POSITION_INDEPENDENT_CODE ON)

View file

@ -21,7 +21,18 @@ static enum AVPixelFormat closest_format(enum AVPixelFormat fmt)
switch (fmt) {
case AV_PIX_FMT_YUYV422:
return AV_PIX_FMT_YUYV422;
case AV_PIX_FMT_YUV444P:
case AV_PIX_FMT_YUV444P16LE:
case AV_PIX_FMT_YUV444P16BE:
case AV_PIX_FMT_YUV444P9BE:
case AV_PIX_FMT_YUV444P9LE:
case AV_PIX_FMT_YUV444P10BE:
case AV_PIX_FMT_YUV444P10LE:
case AV_PIX_FMT_YUV444P12BE:
case AV_PIX_FMT_YUV444P12LE:
case AV_PIX_FMT_YUV444P14BE:
case AV_PIX_FMT_YUV444P14LE:
return AV_PIX_FMT_YUV444P;
case AV_PIX_FMT_YUV422P:
@ -68,6 +79,16 @@ static enum AVPixelFormat closest_format(enum AVPixelFormat fmt)
return AV_PIX_FMT_YUVA422P;
case AV_PIX_FMT_YUVA444P:
case AV_PIX_FMT_YUVA444P9BE:
case AV_PIX_FMT_YUVA444P9LE:
case AV_PIX_FMT_YUVA444P10BE:
case AV_PIX_FMT_YUVA444P10LE:
case AV_PIX_FMT_YUVA444P16BE:
case AV_PIX_FMT_YUVA444P16LE:
#if LIBAVUTIL_BUILD >= AV_VERSION_INT(56, 31, 100)
case AV_PIX_FMT_YUVA444P12BE:
case AV_PIX_FMT_YUVA444P12LE:
#endif
return AV_PIX_FMT_YUVA444P;
case AV_PIX_FMT_RGBA:

View file

@ -44,12 +44,6 @@ extern "C" {
#define CODEC_FLAG_TRUNC CODEC_FLAG_TRUNCATED
#endif
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(54, 31, 100)
#define AV_PIX_FMT_VDTOOL AV_PIX_FMT_VIDEOTOOLBOX
#else
#define AV_PIX_FMT_VDTOOL AV_PIX_FMT_VDA_VLD
#endif
struct mp_media;
struct mp_decode {

View file

@ -109,9 +109,21 @@ static inline enum speaker_layout convert_speaker_layout(uint8_t channels)
}
}
static inline enum video_colorspace convert_color_space(enum AVColorSpace s)
static inline enum video_colorspace
convert_color_space(enum AVColorSpace s, enum AVColorTransferCharacteristic trc)
{
return s == AVCOL_SPC_BT709 ? VIDEO_CS_709 : VIDEO_CS_DEFAULT;
switch (s) {
case AVCOL_SPC_BT709:
return (trc == AVCOL_TRC_IEC61966_2_1) ? VIDEO_CS_SRGB
: VIDEO_CS_709;
case AVCOL_SPC_FCC:
case AVCOL_SPC_BT470BG:
case AVCOL_SPC_SMPTE170M:
case AVCOL_SPC_SMPTE240M:
return VIDEO_CS_601;
default:
return VIDEO_CS_DEFAULT;
}
}
static inline enum video_range_type convert_color_range(enum AVColorRange r)
@ -205,7 +217,7 @@ static bool mp_media_init_scaling(mp_media_t *m)
m->v.decoder->pix_fmt,
m->v.decoder->width,
m->v.decoder->height, m->scale_format,
SWS_FAST_BILINEAR, NULL, NULL, NULL);
SWS_POINT, NULL, NULL, NULL);
if (!m->swscale) {
blog(LOG_WARNING, "MP: Failed to initialize scaler");
return false;
@ -216,7 +228,7 @@ static bool mp_media_init_scaling(mp_media_t *m)
int ret = av_image_alloc(m->scale_pic, m->scale_linesizes,
m->v.decoder->width, m->v.decoder->height,
m->scale_format, 1);
m->scale_format, 32);
if (ret < 0) {
blog(LOG_WARNING, "MP: Failed to create scale pic data");
return false;
@ -227,13 +239,20 @@ static bool mp_media_init_scaling(mp_media_t *m)
static bool mp_media_prepare_frames(mp_media_t *m)
{
bool actively_seeking = m->seek_next_ts && m->pause;
while (!mp_media_ready_to_start(m)) {
if (!m->eof) {
int ret = mp_media_next_packet(m);
if (ret == AVERROR_EOF || ret == AVERROR_EXIT)
m->eof = true;
else if (ret < 0)
if (ret == AVERROR_EOF || ret == AVERROR_EXIT) {
if (!actively_seeking) {
m->eof = true;
} else {
break;
}
} else if (ret < 0) {
return false;
}
}
if (m->has_video && !mp_decode_frame(&m->v))
@ -365,7 +384,7 @@ static void mp_media_next_video(mp_media_t *m, bool preload)
frame->data[0] -= frame->linesize[0] * (f->height - 1);
new_format = convert_pixel_format(m->scale_format);
new_space = convert_color_space(f->colorspace);
new_space = convert_color_space(f->colorspace, f->color_trc);
new_range = m->force_range == VIDEO_RANGE_DEFAULT
? convert_color_range(f->color_range)
: m->force_range;
@ -409,23 +428,34 @@ static void mp_media_next_video(mp_media_t *m, bool preload)
d->got_first_keyframe = true;
}
if (preload)
m->v_preload_cb(m->opaque, frame);
else
if (preload) {
if (m->seek_next_ts && m->v_seek_cb) {
m->v_seek_cb(m->opaque, frame);
} else {
m->v_preload_cb(m->opaque, frame);
}
} else {
m->v_cb(m->opaque, frame);
}
}
static void mp_media_calc_next_ns(mp_media_t *m)
{
int64_t min_next_ns = mp_media_get_next_min_pts(m);
int64_t delta = min_next_ns - m->next_pts_ns;
if (m->seek_next_ts) {
delta = 0;
m->seek_next_ts = false;
} else {
#ifdef _DEBUG
assert(delta >= 0);
assert(delta >= 0);
#endif
if (delta < 0)
delta = 0;
if (delta > 3000000000)
delta = 0;
if (delta < 0)
delta = 0;
if (delta > 3000000000)
delta = 0;
}
m->next_ns += delta;
m->next_pts_ns = min_next_ns;
@ -455,8 +485,12 @@ static void seek_to(mp_media_t *m, int64_t pos)
}
}
if (m->has_video && m->is_local_file)
if (m->has_video && m->is_local_file) {
mp_decode_flush(&m->v);
if (m->seek_next_ts && m->pause && m->v_preload_cb &&
mp_media_prepare_frames(m))
mp_media_next_video(m, true);
}
if (m->has_audio && m->is_local_file)
mp_decode_flush(&m->a);
}
@ -473,6 +507,7 @@ static bool mp_media_reset(mp_media_t *m)
m->eof = false;
m->base_ts += next_ts;
m->seek_next_ts = false;
pthread_mutex_lock(&m->mutex);
stopping = m->stopping;
@ -583,7 +618,11 @@ static bool init_avformat(mp_media_t *m)
av_dict_set_int(&opts, "buffer_size", m->buffering, 0);
m->fmt = avformat_alloc_context();
if (m->buffering == 0) {
m->fmt->flags |= AVFMT_FLAG_NOBUFFER;
}
if (!m->is_local_file) {
av_dict_set(&opts, "stimeout", "30000000", 0);
m->fmt->interrupt_callback.callback = interrupt_callback;
m->fmt->interrupt_callback.opaque = m;
}
@ -593,7 +632,9 @@ static bool init_avformat(mp_media_t *m)
av_dict_free(&opts);
if (ret < 0) {
blog(LOG_WARNING, "MP: Failed to open media: '%s'", m->path);
if (!m->reconnecting)
blog(LOG_WARNING, "MP: Failed to open media: '%s'",
m->path);
return false;
}
@ -603,6 +644,7 @@ static bool init_avformat(mp_media_t *m)
return false;
}
m->reconnecting = false;
m->has_video = mp_decode_init(m, AVMEDIA_TYPE_VIDEO, m->hw);
m->has_audio = mp_decode_init(m, AVMEDIA_TYPE_AUDIO, m->hw);
@ -643,11 +685,14 @@ static inline bool mp_media_thread(mp_media_t *m)
pthread_mutex_lock(&m->mutex);
is_active = m->active;
pause = m->pause;
pthread_mutex_unlock(&m->mutex);
if (!is_active) {
if (!is_active || pause) {
if (os_sem_wait(m->sem) < 0)
return false;
if (pause)
reset_ts(m);
} else {
timeout = mp_media_sleepto(m);
}
@ -677,6 +722,7 @@ static inline bool mp_media_thread(mp_media_t *m)
}
if (seek) {
m->seek_next_ts = true;
seek_to(m, seek_pos);
continue;
}
@ -754,6 +800,7 @@ bool mp_media_init(mp_media_t *media, const struct mp_media_info *info)
media->v_cb = info->v_cb;
media->a_cb = info->a_cb;
media->stop_cb = info->stop_cb;
media->v_seek_cb = info->v_seek_cb;
media->v_preload_cb = info->v_preload_cb;
media->force_range = info->force_range;
media->buffering = info->buffering;
@ -817,7 +864,7 @@ void mp_media_free(mp_media_t *media)
pthread_mutex_init_value(&media->mutex);
}
void mp_media_play(mp_media_t *m, bool loop)
void mp_media_play(mp_media_t *m, bool loop, bool reconnecting)
{
pthread_mutex_lock(&m->mutex);
@ -826,6 +873,7 @@ void mp_media_play(mp_media_t *m, bool loop)
m->looping = loop;
m->active = true;
m->reconnecting = reconnecting;
pthread_mutex_unlock(&m->mutex);
@ -859,8 +907,7 @@ void mp_media_stop(mp_media_t *m)
int64_t mp_get_current_time(mp_media_t *m)
{
int speed = (int)((float)m->speed / 100.0f);
return (mp_media_get_base_pts(m) / 1000000) * speed;
return mp_media_get_base_pts(m) * (int64_t)m->speed / 100000000LL;
}
void mp_media_seek_to(mp_media_t *m, int64_t pos)

View file

@ -46,6 +46,7 @@ struct mp_media {
AVFormatContext *fmt;
mp_video_cb v_preload_cb;
mp_video_cb v_seek_cb;
mp_stop_cb stop_cb;
mp_video_cb v_cb;
mp_audio_cb a_cb;
@ -64,6 +65,7 @@ struct mp_media {
struct mp_decode v;
struct mp_decode a;
bool is_local_file;
bool reconnecting;
bool has_video;
bool has_audio;
bool is_file;
@ -97,6 +99,7 @@ struct mp_media {
bool pause;
bool reset_ts;
bool seek;
bool seek_next_ts;
int64_t seek_pos;
};
@ -107,6 +110,7 @@ struct mp_media_info {
mp_video_cb v_cb;
mp_video_cb v_preload_cb;
mp_video_cb v_seek_cb;
mp_audio_cb a_cb;
mp_stop_cb stop_cb;
@ -117,12 +121,13 @@ struct mp_media_info {
enum video_range_type force_range;
bool hardware_decoding;
bool is_local_file;
bool reconnecting;
};
extern bool mp_media_init(mp_media_t *media, const struct mp_media_info *info);
extern void mp_media_free(mp_media_t *media);
extern void mp_media_play(mp_media_t *media, bool loop);
extern void mp_media_play(mp_media_t *media, bool loop, bool reconnecting);
extern void mp_media_stop(mp_media_t *media);
extern void mp_media_play_pause(mp_media_t *media, bool pause);
extern int64_t mp_get_current_time(mp_media_t *m);

View file

@ -207,6 +207,8 @@ target_link_libraries(obs-scripting
${obs-scripting_PLATFORM_DEPS}
)
set_target_properties(obs-scripting PROPERTIES FOLDER "scripting")
if(PYTHONLIBS_FOUND)
add_subdirectory(obspython)
endif()

View file

@ -147,8 +147,13 @@ void add_functions_to_py_module(PyObject *module, PyMethodDef *method_list)
static PyObject *py_get_current_script_path(PyObject *self, PyObject *args)
{
PyObject *dir;
UNUSED_PARAMETER(args);
return PyDict_GetItemString(PyModule_GetDict(self), "__script_dir__");
dir = PyDict_GetItemString(PyModule_GetDict(self), "__script_dir__");
Py_XINCREF(dir);
return dir;
}
static void get_defaults(struct obs_python_script *data, PyObject *get_defs)
@ -595,7 +600,7 @@ static PyObject *obs_python_signal_handler_disconnect(PyObject *self,
const char *cb_signal =
calldata_string(&cb->base.extra, "signal");
if (cb_signal && strcmp(signal, cb_signal) != 0 &&
if (cb_signal && strcmp(signal, cb_signal) == 0 &&
handler == cb_handler)
break;

View file

@ -35,6 +35,8 @@ else()
endif()
SWIG_LINK_LIBRARIES(obslua obs-scripting libobs ${LUA_LIBRARIES} ${EXTRA_LIBS})
set_target_properties(obslua PROPERTIES FOLDER "scripting")
function(install_plugin_bin_swig target additional_target)
if(APPLE)
set(_bit_suffix "")

View file

@ -24,6 +24,7 @@
#include <util/base.h>
#include "cstrcache.h"
#include "obs-scripting-config.h"
#include <util/platform.h>
#if UI_ENABLED
#include "obs-frontend-api.h"
@ -100,6 +101,7 @@ static inline void wrap_blog(int log_level, const char *message)
%include "callback/signal.h"
%include "util/bmem.h"
%include "util/base.h"
%include "util/platform.h"
#if UI_ENABLED
%include "obs-frontend-api.h"

View file

@ -54,6 +54,8 @@ ELSE()
SWIG_LINK_LIBRARIES(obspython obs-scripting libobs ${PYTHON_LIBRARIES})
ENDIF()
set_target_properties(_obspython PROPERTIES FOLDER "scripting")
function(install_plugin_bin_swig target additional_target)
if(APPLE)
set(_bit_suffix "")

View file

@ -24,6 +24,7 @@
#include <util/bmem.h>
#include <util/base.h>
#include "obs-scripting-config.h"
#include <util/platform.h>
#if UI_ENABLED
#include "obs-frontend-api.h"
@ -98,6 +99,7 @@ static inline void wrap_blog(int log_level, const char *message)
%include "callback/signal.h"
%include "util/bmem.h"
%include "util/base.h"
%include "util/platform.h"
#if UI_ENABLED
%include "obs-frontend-api.h"

View file

@ -25,5 +25,6 @@ target_include_directories(w32-pthreads
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
target_link_libraries(w32-pthreads)
set_target_properties(w32-pthreads PROPERTIES FOLDER "deps")
install_obs_core(w32-pthreads EXPORT w32-pthreads)