New upstream version 21.1.2+dfsg1
This commit is contained in:
parent
baafb6325b
commit
665f64a933
152 changed files with 3957 additions and 356 deletions
9
deps/media-playback/media-playback/decode.c
vendored
9
deps/media-playback/media-playback/decode.c
vendored
|
|
@ -338,6 +338,15 @@ bool mp_decode_next(struct mp_decode *d)
|
|||
d->stream->time_base,
|
||||
(AVRational){1, 1000000000});
|
||||
|
||||
if (d->m->speed != 100) {
|
||||
d->frame_pts = av_rescale_q(d->frame_pts,
|
||||
(AVRational){1, d->m->speed},
|
||||
(AVRational){1, 100});
|
||||
duration = av_rescale_q(duration,
|
||||
(AVRational){1, d->m->speed},
|
||||
(AVRational){1, 100});
|
||||
}
|
||||
|
||||
d->last_duration = duration;
|
||||
d->next_pts = d->frame_pts + duration;
|
||||
}
|
||||
|
|
|
|||
47
deps/media-playback/media-playback/media.c
vendored
47
deps/media-playback/media-playback/media.c
vendored
|
|
@ -271,7 +271,7 @@ static void mp_media_next_audio(mp_media_t *m)
|
|||
for (size_t i = 0; i < MAX_AV_PLANES; i++)
|
||||
audio.data[i] = f->data[i];
|
||||
|
||||
audio.samples_per_sec = f->sample_rate;
|
||||
audio.samples_per_sec = f->sample_rate * m->speed / 100;
|
||||
audio.speakers = convert_speaker_layout(f->channels);
|
||||
audio.format = convert_sample_format(f->format);
|
||||
audio.frames = f->nb_samples;
|
||||
|
|
@ -652,9 +652,7 @@ static void *mp_media_thread_start(void *opaque)
|
|||
}
|
||||
|
||||
static inline bool mp_media_init_internal(mp_media_t *m,
|
||||
const char *path,
|
||||
const char *format_name,
|
||||
bool hw)
|
||||
const struct mp_media_info *info)
|
||||
{
|
||||
if (pthread_mutex_init(&m->mutex, NULL) != 0) {
|
||||
blog(LOG_WARNING, "MP: Failed to init mutex");
|
||||
|
|
@ -665,9 +663,9 @@ static inline bool mp_media_init_internal(mp_media_t *m,
|
|||
return false;
|
||||
}
|
||||
|
||||
m->path = path ? bstrdup(path) : NULL;
|
||||
m->format_name = format_name ? bstrdup(format_name) : NULL;
|
||||
m->hw = hw;
|
||||
m->path = info->path ? bstrdup(info->path) : NULL;
|
||||
m->format_name = info->format ? bstrdup(info->format) : NULL;
|
||||
m->hw = info->hardware_decoding;
|
||||
|
||||
if (pthread_create(&m->thread, NULL, mp_media_thread_start, m) != 0) {
|
||||
blog(LOG_WARNING, "MP: Could not create media thread");
|
||||
|
|
@ -678,29 +676,22 @@ static inline bool mp_media_init_internal(mp_media_t *m,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool mp_media_init(mp_media_t *media,
|
||||
const char *path,
|
||||
const char *format,
|
||||
int buffering,
|
||||
void *opaque,
|
||||
mp_video_cb v_cb,
|
||||
mp_audio_cb a_cb,
|
||||
mp_stop_cb stop_cb,
|
||||
mp_video_cb v_preload_cb,
|
||||
bool hw_decoding,
|
||||
bool is_local_file,
|
||||
enum video_range_type force_range)
|
||||
bool mp_media_init(mp_media_t *media, const struct mp_media_info *info)
|
||||
{
|
||||
memset(media, 0, sizeof(*media));
|
||||
pthread_mutex_init_value(&media->mutex);
|
||||
media->opaque = opaque;
|
||||
media->v_cb = v_cb;
|
||||
media->a_cb = a_cb;
|
||||
media->stop_cb = stop_cb;
|
||||
media->v_preload_cb = v_preload_cb;
|
||||
media->force_range = force_range;
|
||||
media->buffering = buffering;
|
||||
media->is_local_file = is_local_file;
|
||||
media->opaque = info->opaque;
|
||||
media->v_cb = info->v_cb;
|
||||
media->a_cb = info->a_cb;
|
||||
media->stop_cb = info->stop_cb;
|
||||
media->v_preload_cb = info->v_preload_cb;
|
||||
media->force_range = info->force_range;
|
||||
media->buffering = info->buffering;
|
||||
media->speed = info->speed;
|
||||
media->is_local_file = info->is_local_file;
|
||||
|
||||
if (!info->is_local_file || media->speed < 1 || media->speed > 200)
|
||||
media->speed = 100;
|
||||
|
||||
static bool initialized = false;
|
||||
if (!initialized) {
|
||||
|
|
@ -714,7 +705,7 @@ bool mp_media_init(mp_media_t *media,
|
|||
if (!base_sys_ts)
|
||||
base_sys_ts = (int64_t)os_gettime_ns();
|
||||
|
||||
if (!mp_media_init_internal(media, path, format, hw_decoding)) {
|
||||
if (!mp_media_init_internal(media, info)) {
|
||||
mp_media_free(media);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
31
deps/media-playback/media-playback/media.h
vendored
31
deps/media-playback/media-playback/media.h
vendored
|
|
@ -54,6 +54,7 @@ struct mp_media {
|
|||
char *path;
|
||||
char *format_name;
|
||||
int buffering;
|
||||
int speed;
|
||||
|
||||
enum AVPixelFormat scale_format;
|
||||
struct SwsContext *swscale;
|
||||
|
|
@ -96,18 +97,24 @@ struct mp_media {
|
|||
|
||||
typedef struct mp_media mp_media_t;
|
||||
|
||||
extern bool mp_media_init(mp_media_t *media,
|
||||
const char *path,
|
||||
const char *format,
|
||||
int buffering,
|
||||
void *opaque,
|
||||
mp_video_cb v_cb,
|
||||
mp_audio_cb a_cb,
|
||||
mp_stop_cb stop_cb,
|
||||
mp_video_cb v_preload_cb,
|
||||
bool hardware_decoding,
|
||||
bool is_local_file,
|
||||
enum video_range_type force_range);
|
||||
struct mp_media_info {
|
||||
void *opaque;
|
||||
|
||||
mp_video_cb v_cb;
|
||||
mp_video_cb v_preload_cb;
|
||||
mp_audio_cb a_cb;
|
||||
mp_stop_cb stop_cb;
|
||||
|
||||
const char *path;
|
||||
const char *format;
|
||||
int buffering;
|
||||
int speed;
|
||||
enum video_range_type force_range;
|
||||
bool hardware_decoding;
|
||||
bool is_local_file;
|
||||
};
|
||||
|
||||
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);
|
||||
|
|
|
|||
29
deps/obs-scripting/obs-scripting-lua.c
vendored
29
deps/obs-scripting/obs-scripting-lua.c
vendored
|
|
@ -377,7 +377,7 @@ static void obs_lua_tick_callback(void *priv, float seconds)
|
|||
lock_callback();
|
||||
|
||||
lua_pushnumber(script, (lua_Number)seconds);
|
||||
call_func(obs_lua_tick_callback, 2, 0);
|
||||
call_func(obs_lua_tick_callback, 1, 0);
|
||||
|
||||
unlock_callback();
|
||||
}
|
||||
|
|
@ -579,6 +579,32 @@ static int enum_sources(lua_State *script)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
static bool source_enum_filters_proc(obs_source_t *source, obs_source_t *filter, void *param)
|
||||
{
|
||||
lua_State *script = param;
|
||||
|
||||
obs_source_get_ref(filter);
|
||||
ls_push_libobs_obj(obs_source_t, filter, false);
|
||||
|
||||
size_t idx = lua_rawlen(script, -2);
|
||||
lua_rawseti(script, -2, (int)idx + 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
static int source_enum_filters(lua_State *script)
|
||||
{
|
||||
obs_source_t *source;
|
||||
if (!ls_get_libobs_obj(obs_source_t, 1, &source))
|
||||
return 0;
|
||||
|
||||
lua_newtable(script);
|
||||
obs_source_enum_filters(source, source_enum_filters_proc, script);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
static bool enum_items_proc(obs_scene_t *scene, obs_sceneitem_t *item,
|
||||
|
|
@ -972,6 +998,7 @@ static void add_hook_functions(lua_State *script)
|
|||
add_func("timer_remove", timer_remove);
|
||||
add_func("timer_add", timer_add);
|
||||
add_func("obs_enum_sources", enum_sources);
|
||||
add_func("obs_source_enum_filters", source_enum_filters);
|
||||
add_func("obs_scene_enum_items", scene_enum_items);
|
||||
add_func("source_list_release", source_list_release);
|
||||
add_func("sceneitem_list_release", sceneitem_list_release);
|
||||
|
|
|
|||
9
deps/obs-scripting/obs-scripting-python.c
vendored
9
deps/obs-scripting/obs-scripting-python.c
vendored
|
|
@ -1595,6 +1595,8 @@ void obs_python_load(void)
|
|||
|
||||
extern void add_python_frontend_funcs(PyObject *module);
|
||||
|
||||
static bool python_loaded_at_all = false;
|
||||
|
||||
bool obs_scripting_load_python(const char *python_path)
|
||||
{
|
||||
if (python_loaded)
|
||||
|
|
@ -1696,6 +1698,8 @@ out:
|
|||
obs_python_unload();
|
||||
}
|
||||
|
||||
python_loaded_at_all = success;
|
||||
|
||||
if (python_loaded)
|
||||
obs_add_tick_callback(python_tick, NULL);
|
||||
|
||||
|
|
@ -1704,6 +1708,9 @@ out:
|
|||
|
||||
void obs_python_unload(void)
|
||||
{
|
||||
if (!python_loaded_at_all)
|
||||
return;
|
||||
|
||||
if (python_loaded && Py_IsInitialized()) {
|
||||
PyGILState_Ensure();
|
||||
|
||||
|
|
@ -1722,4 +1729,6 @@ void obs_python_unload(void)
|
|||
pthread_mutex_destroy(&tick_mutex);
|
||||
pthread_mutex_destroy(&timer_mutex);
|
||||
dstr_free(&cur_py_log_chunk);
|
||||
|
||||
python_loaded_at_all = false;
|
||||
}
|
||||
|
|
|
|||
2
deps/obs-scripting/obs-scripting.c
vendored
2
deps/obs-scripting/obs-scripting.c
vendored
|
|
@ -213,6 +213,8 @@ void obs_scripting_unload(void)
|
|||
|
||||
pthread_mutex_destroy(&defer_call_mutex);
|
||||
os_sem_destroy(defer_call_semaphore);
|
||||
|
||||
scripting_loaded = false;
|
||||
}
|
||||
|
||||
const char **obs_scripting_supported_formats(void)
|
||||
|
|
|
|||
1
deps/obs-scripting/obslua/obslua.i
vendored
1
deps/obs-scripting/obslua/obslua.i
vendored
|
|
@ -59,6 +59,7 @@ static inline void wrap_blog(int log_level, const char *message)
|
|||
%ignore obs_add_main_render_callback;
|
||||
%ignore obs_remove_main_render_callback;
|
||||
%ignore obs_enum_sources;
|
||||
%ignore obs_source_enum_filters;
|
||||
%ignore obs_properties_add_button;
|
||||
%ignore obs_property_set_modified_callback;
|
||||
%ignore signal_handler_connect;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue