New upstream version 25.0.3+dfsg1
This commit is contained in:
parent
04fe0efc67
commit
8b2e5f2130
569 changed files with 62491 additions and 5875 deletions
|
|
@ -1,9 +1,9 @@
|
|||
#include <util/curl/curl-helper.h>
|
||||
#include <util/threading.h>
|
||||
#include <util/platform.h>
|
||||
#include <util/darray.h>
|
||||
#include <util/dstr.h>
|
||||
#include <obs-data.h>
|
||||
#include <curl/curl.h>
|
||||
#include "file-updater.h"
|
||||
|
||||
#define warn(msg, ...) \
|
||||
|
|
@ -118,6 +118,7 @@ static bool do_http_request(struct update_info *info, const char *url,
|
|||
curl_easy_setopt(info->curl, CURLOPT_FAILONERROR, true);
|
||||
curl_easy_setopt(info->curl, CURLOPT_NOSIGNAL, 1);
|
||||
curl_easy_setopt(info->curl, CURLOPT_ACCEPT_ENCODING, "");
|
||||
curl_obs_set_revoke_setting(info->curl);
|
||||
|
||||
if (!info->remote_url) {
|
||||
// We only care about headers from the main package file
|
||||
|
|
|
|||
16
deps/media-playback/CMakeLists.txt
vendored
16
deps/media-playback/CMakeLists.txt
vendored
|
|
@ -23,23 +23,15 @@ add_library(media-playback STATIC
|
|||
${media-playback_SOURCES}
|
||||
)
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le")
|
||||
target_compile_options(media-playback
|
||||
PUBLIC
|
||||
-mvsx)
|
||||
add_compile_definitions(NO_WARN_X86_INTRINSICS)
|
||||
elseif(NOT MSVC)
|
||||
target_compile_options(media-playback
|
||||
PUBLIC
|
||||
-mmmx
|
||||
-msse
|
||||
-msse2)
|
||||
endif()
|
||||
target_compile_options(media-playback
|
||||
PUBLIC
|
||||
${ARCH_SIMD_FLAGS})
|
||||
|
||||
target_include_directories(media-playback
|
||||
PUBLIC .
|
||||
)
|
||||
|
||||
|
||||
if(NOT MSVC)
|
||||
if(NOT MINGW)
|
||||
target_compile_options(media-playback PRIVATE -fPIC)
|
||||
|
|
|
|||
90
deps/media-playback/media-playback/media.c
vendored
90
deps/media-playback/media-playback/media.c
vendored
|
|
@ -307,6 +307,7 @@ static void mp_media_next_audio(mp_media_t *m)
|
|||
audio.speakers = convert_speaker_layout(f->channels);
|
||||
audio.format = convert_sample_format(f->format);
|
||||
audio.frames = f->nb_samples;
|
||||
|
||||
audio.timestamp = m->base_ts + d->frame_pts - m->start_ts +
|
||||
m->play_sys_ts - base_sys_ts;
|
||||
|
||||
|
|
@ -396,6 +397,7 @@ static void mp_media_next_video(mp_media_t *m, bool preload)
|
|||
|
||||
frame->timestamp = m->base_ts + d->frame_pts - m->start_ts +
|
||||
m->play_sys_ts - base_sys_ts;
|
||||
|
||||
frame->width = f->width;
|
||||
frame->height = f->height;
|
||||
frame->flip = flip;
|
||||
|
|
@ -416,7 +418,6 @@ static void mp_media_next_video(mp_media_t *m, bool preload)
|
|||
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;
|
||||
#ifdef _DEBUG
|
||||
assert(delta >= 0);
|
||||
|
|
@ -430,21 +431,16 @@ static void mp_media_calc_next_ns(mp_media_t *m)
|
|||
m->next_pts_ns = min_next_ns;
|
||||
}
|
||||
|
||||
static bool mp_media_reset(mp_media_t *m)
|
||||
static void seek_to(mp_media_t *m, int64_t pos)
|
||||
{
|
||||
AVStream *stream = m->fmt->streams[0];
|
||||
int64_t seek_pos;
|
||||
int64_t seek_pos = pos;
|
||||
int seek_flags;
|
||||
bool stopping;
|
||||
bool active;
|
||||
|
||||
if (m->fmt->duration == AV_NOPTS_VALUE) {
|
||||
seek_pos = 0;
|
||||
if (m->fmt->duration == AV_NOPTS_VALUE)
|
||||
seek_flags = AVSEEK_FLAG_FRAME;
|
||||
} else {
|
||||
seek_pos = m->fmt->start_time;
|
||||
else
|
||||
seek_flags = AVSEEK_FLAG_BACKWARD;
|
||||
}
|
||||
|
||||
int64_t seek_target = seek_flags == AVSEEK_FLAG_BACKWARD
|
||||
? av_rescale_q(seek_pos, AV_TIME_BASE_Q,
|
||||
|
|
@ -463,6 +459,14 @@ static bool mp_media_reset(mp_media_t *m)
|
|||
mp_decode_flush(&m->v);
|
||||
if (m->has_audio && m->is_local_file)
|
||||
mp_decode_flush(&m->a);
|
||||
}
|
||||
|
||||
static bool mp_media_reset(mp_media_t *m)
|
||||
{
|
||||
bool stopping;
|
||||
bool active;
|
||||
|
||||
seek_to(m, m->fmt->start_time);
|
||||
|
||||
int64_t next_ts = mp_media_get_base_pts(m);
|
||||
int64_t offset = next_ts - m->next_pts_ns;
|
||||
|
|
@ -491,6 +495,8 @@ static bool mp_media_reset(mp_media_t *m)
|
|||
m->next_ns = 0;
|
||||
}
|
||||
|
||||
m->pause = false;
|
||||
|
||||
if (!active && m->is_local_file && m->v_preload_cb)
|
||||
mp_media_next_video(m, true);
|
||||
if (stopping && m->stop_cb)
|
||||
|
|
@ -611,6 +617,14 @@ static bool init_avformat(mp_media_t *m)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void reset_ts(mp_media_t *m)
|
||||
{
|
||||
m->base_ts += mp_media_get_base_pts(m);
|
||||
m->play_sys_ts = (int64_t)os_gettime_ns();
|
||||
m->start_ts = m->next_pts_ns = mp_media_get_next_min_pts(m);
|
||||
m->next_ns = 0;
|
||||
}
|
||||
|
||||
static inline bool mp_media_thread(mp_media_t *m)
|
||||
{
|
||||
os_set_thread_name("mp_media_thread");
|
||||
|
|
@ -623,7 +637,8 @@ static inline bool mp_media_thread(mp_media_t *m)
|
|||
}
|
||||
|
||||
for (;;) {
|
||||
bool reset, kill, is_active;
|
||||
bool reset, kill, is_active, seek, pause, reset_time;
|
||||
int64_t seek_pos;
|
||||
bool timeout = false;
|
||||
|
||||
pthread_mutex_lock(&m->mutex);
|
||||
|
|
@ -644,6 +659,13 @@ static inline bool mp_media_thread(mp_media_t *m)
|
|||
m->reset = false;
|
||||
m->kill = false;
|
||||
|
||||
pause = m->pause;
|
||||
seek_pos = m->seek_pos;
|
||||
seek = m->seek;
|
||||
reset_time = m->reset_ts;
|
||||
m->seek = false;
|
||||
m->reset_ts = false;
|
||||
|
||||
pthread_mutex_unlock(&m->mutex);
|
||||
|
||||
if (kill) {
|
||||
|
|
@ -654,6 +676,19 @@ static inline bool mp_media_thread(mp_media_t *m)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (seek) {
|
||||
seek_to(m, seek_pos);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (reset_time) {
|
||||
reset_ts(m);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pause)
|
||||
continue;
|
||||
|
||||
/* frames are ready */
|
||||
if (is_active && !timeout) {
|
||||
if (m->has_video)
|
||||
|
|
@ -797,6 +832,18 @@ void mp_media_play(mp_media_t *m, bool loop)
|
|||
os_sem_post(m->sem);
|
||||
}
|
||||
|
||||
void mp_media_play_pause(mp_media_t *m, bool pause)
|
||||
{
|
||||
pthread_mutex_lock(&m->mutex);
|
||||
if (m->active) {
|
||||
m->pause = pause;
|
||||
m->reset_ts = !pause;
|
||||
}
|
||||
pthread_mutex_unlock(&m->mutex);
|
||||
|
||||
os_sem_post(m->sem);
|
||||
}
|
||||
|
||||
void mp_media_stop(mp_media_t *m)
|
||||
{
|
||||
pthread_mutex_lock(&m->mutex);
|
||||
|
|
@ -804,7 +851,26 @@ void mp_media_stop(mp_media_t *m)
|
|||
m->reset = true;
|
||||
m->active = false;
|
||||
m->stopping = true;
|
||||
os_sem_post(m->sem);
|
||||
}
|
||||
pthread_mutex_unlock(&m->mutex);
|
||||
|
||||
os_sem_post(m->sem);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void mp_media_seek_to(mp_media_t *m, int64_t pos)
|
||||
{
|
||||
pthread_mutex_lock(&m->mutex);
|
||||
if (m->active) {
|
||||
m->seek = true;
|
||||
m->seek_pos = pos * 1000;
|
||||
}
|
||||
pthread_mutex_unlock(&m->mutex);
|
||||
|
||||
os_sem_post(m->sem);
|
||||
}
|
||||
|
|
|
|||
8
deps/media-playback/media-playback/media.h
vendored
8
deps/media-playback/media-playback/media.h
vendored
|
|
@ -93,6 +93,11 @@ struct mp_media {
|
|||
|
||||
bool thread_valid;
|
||||
pthread_t thread;
|
||||
|
||||
bool pause;
|
||||
bool reset_ts;
|
||||
bool seek;
|
||||
int64_t seek_pos;
|
||||
};
|
||||
|
||||
typedef struct mp_media mp_media_t;
|
||||
|
|
@ -119,6 +124,9 @@ extern void mp_media_free(mp_media_t *media);
|
|||
|
||||
extern void mp_media_play(mp_media_t *media, bool loop);
|
||||
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);
|
||||
extern void mp_media_seek_to(mp_media_t *m, int64_t pos);
|
||||
|
||||
/* #define DETAILED_DEBUG_INFO */
|
||||
|
||||
|
|
|
|||
7
deps/obs-scripting/CMakeLists.txt
vendored
7
deps/obs-scripting/CMakeLists.txt
vendored
|
|
@ -7,6 +7,11 @@ endif()
|
|||
|
||||
project(obs-scripting)
|
||||
|
||||
if(POLICY CMP0068)
|
||||
# RPATH settings on macOS do not affect install_name.
|
||||
cmake_policy(SET CMP0068 NEW)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set(obs-scripting_PLATFORM_DEPS
|
||||
w32-pthreads)
|
||||
|
|
@ -75,7 +80,7 @@ if(NOT PYTHONLIBS_FOUND AND NOT LUAJIT_FOUND)
|
|||
return()
|
||||
endif()
|
||||
|
||||
set(SCRIPTING_ENABLED ON CACHE BOOL "Interal global cmake variable" FORCE)
|
||||
set(SCRIPTING_ENABLED ON CACHE BOOL "Internal global cmake variable" FORCE)
|
||||
|
||||
if(UI_ENABLED)
|
||||
set(EXTRA_LIBS obs-frontend-api)
|
||||
|
|
|
|||
|
|
@ -331,6 +331,76 @@ static PyObject *add_save_callback(PyObject *self, PyObject *args)
|
|||
return python_none();
|
||||
}
|
||||
|
||||
static void frontend_event_callback(enum obs_frontend_event event, void *priv)
|
||||
{
|
||||
struct python_obs_callback *cb = priv;
|
||||
|
||||
if (cb->base.removed) {
|
||||
obs_frontend_remove_event_callback(frontend_event_callback, cb);
|
||||
return;
|
||||
}
|
||||
|
||||
lock_python();
|
||||
|
||||
PyObject *args = Py_BuildValue("(i)", event);
|
||||
|
||||
struct python_obs_callback *last_cb = cur_python_cb;
|
||||
cur_python_cb = cb;
|
||||
cur_python_script = (struct obs_python_script *)cb->base.script;
|
||||
|
||||
PyObject *py_ret = PyObject_CallObject(cb->func, args);
|
||||
Py_XDECREF(py_ret);
|
||||
py_error();
|
||||
|
||||
cur_python_script = NULL;
|
||||
cur_python_cb = last_cb;
|
||||
|
||||
Py_XDECREF(args);
|
||||
|
||||
unlock_python();
|
||||
}
|
||||
|
||||
static PyObject *remove_event_callback(PyObject *self, PyObject *args)
|
||||
{
|
||||
struct obs_python_script *script = cur_python_script;
|
||||
PyObject *py_cb = NULL;
|
||||
|
||||
UNUSED_PARAMETER(self);
|
||||
|
||||
if (!parse_args(args, "O", &py_cb))
|
||||
return python_none();
|
||||
if (!py_cb || !PyFunction_Check(py_cb))
|
||||
return python_none();
|
||||
|
||||
struct python_obs_callback *cb =
|
||||
find_python_obs_callback(script, py_cb);
|
||||
if (cb)
|
||||
remove_python_obs_callback(cb);
|
||||
return python_none();
|
||||
}
|
||||
|
||||
static void add_event_callback_defer(void *cb)
|
||||
{
|
||||
obs_frontend_add_event_callback(frontend_event_callback, cb);
|
||||
}
|
||||
|
||||
static PyObject *add_event_callback(PyObject *self, PyObject *args)
|
||||
{
|
||||
struct obs_python_script *script = cur_python_script;
|
||||
PyObject *py_cb = NULL;
|
||||
|
||||
UNUSED_PARAMETER(self);
|
||||
|
||||
if (!parse_args(args, "O", &py_cb))
|
||||
return python_none();
|
||||
if (!py_cb || !PyFunction_Check(py_cb))
|
||||
return python_none();
|
||||
|
||||
struct python_obs_callback *cb = add_python_obs_callback(script, py_cb);
|
||||
defer_call_post(add_event_callback_defer, cb);
|
||||
return python_none();
|
||||
}
|
||||
|
||||
/* ----------------------------------- */
|
||||
|
||||
void add_python_frontend_funcs(PyObject *module)
|
||||
|
|
@ -353,6 +423,8 @@ void add_python_frontend_funcs(PyObject *module)
|
|||
DEF_FUNC(set_current_profile),
|
||||
DEF_FUNC(remove_save_callback),
|
||||
DEF_FUNC(add_save_callback),
|
||||
DEF_FUNC(remove_event_callback),
|
||||
DEF_FUNC(add_event_callback),
|
||||
|
||||
#undef DEF_FUNC
|
||||
{0}};
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ bool import_python(const char *python_path)
|
|||
IMPORT_FUNC(PyExc_RuntimeError);
|
||||
IMPORT_FUNC(PyObject_GetAttr);
|
||||
IMPORT_FUNC(PyUnicode_FromString);
|
||||
IMPORT_FUNC(PyDict_New);
|
||||
IMPORT_FUNC(PyDict_GetItemString);
|
||||
IMPORT_FUNC(PyDict_SetItemString);
|
||||
IMPORT_FUNC(PyCFunction_NewEx);
|
||||
|
|
@ -140,6 +141,7 @@ bool import_python(const char *python_path)
|
|||
IMPORT_FUNC(PyLong_FromUnsignedLongLong);
|
||||
IMPORT_FUNC(PyArg_VaParse);
|
||||
IMPORT_FUNC(_Py_NoneStruct);
|
||||
IMPORT_FUNC(PyTuple_New);
|
||||
|
||||
#undef IMPORT_FUNC
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ PY_EXTERN PyObject *(*Import_PyExc_TypeError);
|
|||
PY_EXTERN PyObject *(*Import_PyExc_RuntimeError);
|
||||
PY_EXTERN PyObject *(*Import_PyObject_GetAttr)(PyObject *, PyObject *);
|
||||
PY_EXTERN PyObject *(*Import_PyUnicode_FromString)(const char *u);
|
||||
PY_EXTERN PyObject *(*Import_PyDict_New)(void);
|
||||
PY_EXTERN PyObject *(*Import_PyDict_GetItemString)(PyObject *dp,
|
||||
const char *key);
|
||||
PY_EXTERN int (*Import_PyDict_SetItemString)(PyObject *dp, const char *key,
|
||||
|
|
@ -133,6 +134,7 @@ PY_EXTERN PyObject *(*Import_PyUnicode_AsUTF8String)(PyObject *unicode);
|
|||
PY_EXTERN PyObject *(*Import_PyLong_FromUnsignedLongLong)(unsigned long long);
|
||||
PY_EXTERN int (*Import_PyArg_VaParse)(PyObject *, const char *, va_list);
|
||||
PY_EXTERN PyObject(*Import__Py_NoneStruct);
|
||||
PY_EXTERN PyObject *(*Import_PyTuple_New)(Py_ssize_t size);
|
||||
|
||||
extern bool import_python(const char *python_path);
|
||||
|
||||
|
|
@ -174,6 +176,7 @@ extern bool import_python(const char *python_path);
|
|||
#define PyExc_RuntimeError (*Import_PyExc_RuntimeError)
|
||||
#define PyObject_GetAttr Import_PyObject_GetAttr
|
||||
#define PyUnicode_FromString Import_PyUnicode_FromString
|
||||
#define PyDict_New Import_PyDict_New
|
||||
#define PyDict_GetItemString Import_PyDict_GetItemString
|
||||
#define PyDict_SetItemString Import_PyDict_SetItemString
|
||||
#define PyCFunction_NewEx Import_PyCFunction_NewEx
|
||||
|
|
@ -206,6 +209,7 @@ extern bool import_python(const char *python_path);
|
|||
#define PyLong_FromUnsignedLongLong Import_PyLong_FromUnsignedLongLong
|
||||
#define PyArg_VaParse Import_PyArg_VaParse
|
||||
#define _Py_NoneStruct (*Import__Py_NoneStruct)
|
||||
#define PyTuple_New Import_PyTuple_New
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
5
deps/obs-scripting/obslua/CMakeLists.txt
vendored
5
deps/obs-scripting/obslua/CMakeLists.txt
vendored
|
|
@ -2,8 +2,13 @@ cmake_minimum_required(VERSION 2.8)
|
|||
project(obslua)
|
||||
|
||||
if(POLICY CMP0078)
|
||||
# UseSWIG generates standard target names.
|
||||
cmake_policy(SET CMP0078 OLD)
|
||||
endif()
|
||||
if(POLICY CMP0086)
|
||||
# UseSWIG honors SWIG_MODULE_NAME via -module flag.
|
||||
cmake_policy(SET CMP0086 OLD)
|
||||
endif()
|
||||
|
||||
find_package(SWIG 2 REQUIRED)
|
||||
include(${SWIG_USE_FILE})
|
||||
|
|
|
|||
4
deps/obs-scripting/obslua/obslua.i
vendored
4
deps/obs-scripting/obslua/obslua.i
vendored
|
|
@ -7,6 +7,8 @@
|
|||
#include <graphics/vec4.h>
|
||||
#include <graphics/vec3.h>
|
||||
#include <graphics/vec2.h>
|
||||
#include <graphics/matrix4.h>
|
||||
#include <graphics/matrix3.h>
|
||||
#include <graphics/quat.h>
|
||||
#include <graphics/image-file.h>
|
||||
#include <obs.h>
|
||||
|
|
@ -82,6 +84,8 @@ static inline void wrap_blog(int log_level, const char *message)
|
|||
%include "graphics/vec4.h"
|
||||
%include "graphics/vec3.h"
|
||||
%include "graphics/vec2.h"
|
||||
%include "graphics/matrix4.h"
|
||||
%include "graphics/matrix3.h"
|
||||
%include "graphics/quat.h"
|
||||
%include "graphics/image-file.h"
|
||||
%include "obs-scripting-config.h"
|
||||
|
|
|
|||
5
deps/obs-scripting/obspython/CMakeLists.txt
vendored
5
deps/obs-scripting/obspython/CMakeLists.txt
vendored
|
|
@ -2,8 +2,13 @@ cmake_minimum_required(VERSION 2.8)
|
|||
project(obspython)
|
||||
|
||||
if(POLICY CMP0078)
|
||||
# UseSWIG generates standard target names.
|
||||
cmake_policy(SET CMP0078 OLD)
|
||||
endif()
|
||||
if(POLICY CMP0086)
|
||||
# UseSWIG honors SWIG_MODULE_NAME via -module flag.
|
||||
cmake_policy(SET CMP0086 OLD)
|
||||
endif()
|
||||
|
||||
find_package(SWIG 2 REQUIRED)
|
||||
include(${SWIG_USE_FILE})
|
||||
|
|
|
|||
4
deps/obs-scripting/obspython/obspython.i
vendored
4
deps/obs-scripting/obspython/obspython.i
vendored
|
|
@ -8,6 +8,8 @@
|
|||
#include <graphics/vec4.h>
|
||||
#include <graphics/vec3.h>
|
||||
#include <graphics/vec2.h>
|
||||
#include <graphics/matrix4.h>
|
||||
#include <graphics/matrix3.h>
|
||||
#include <graphics/quat.h>
|
||||
#include <obs.h>
|
||||
#include <obs-hotkey.h>
|
||||
|
|
@ -81,6 +83,8 @@ static inline void wrap_blog(int log_level, const char *message)
|
|||
%include "graphics/vec4.h"
|
||||
%include "graphics/vec3.h"
|
||||
%include "graphics/vec2.h"
|
||||
%include "graphics/matrix4.h"
|
||||
%include "graphics/matrix3.h"
|
||||
%include "graphics/quat.h"
|
||||
%include "obs-scripting-config.h"
|
||||
%include "obs-data.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue