[vlc-commits] [Git][videolan/vlc][master] 2 commits: load module with a logger
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Oct 20 14:12:42 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
05925322 by Steve Lhomme at 2023-10-20T13:31:31+00:00
load module with a logger
So we can simplify the accepted types.
- - - - -
b1e349d7 by Steve Lhomme at 2023-10-20T13:31:31+00:00
vlc_modules: remove _Generic for vlc_module_load()
We don't need it anymore, we always pass a logger.
- - - - -
12 changed files:
- include/vlc_modules.h
- modules/audio_output/mmdevice.c
- modules/audio_output/winstore.c
- modules/video_output/libplacebo/instance.c
- modules/video_output/opengl/filter.c
- modules/video_output/vulkan/platform.c
- src/input/decoder_device.c
- src/input/demux.c
- src/misc/messages.c
- src/misc/tracer.c
- src/video_output/opengl.c
- src/video_output/window.c
Changes:
=====================================
include/vlc_modules.h
=====================================
@@ -94,17 +94,6 @@ void *vlc_module_map(struct vlc_logger *log, module_t *mod);
VLC_API module_t *vlc_module_load(struct vlc_logger *log, const char *cap,
const char *name, bool strict,
vlc_activate_t probe, ... ) VLC_USED;
-#ifndef __cplusplus
-#define vlc_module_load(ctx, cap, name, strict, ...) \
- _Generic ((ctx), \
- struct vlc_logger *: \
- vlc_module_load((void *)(ctx), cap, name, strict, __VA_ARGS__), \
- void *: \
- vlc_module_load((void *)(ctx), cap, name, strict, __VA_ARGS__), \
- default: \
- vlc_module_load(vlc_object_logger((vlc_object_t *)(ctx)), cap, \
- name, strict, __VA_ARGS__))
-#endif
VLC_API module_t * module_need( vlc_object_t *, const char *, const char *, bool ) VLC_USED;
#define module_need(a,b,c,d) module_need(VLC_OBJECT(a),b,c,d)
=====================================
modules/audio_output/mmdevice.c
=====================================
@@ -1231,7 +1231,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
HRESULT hr;
owner->device = sys->dev;
- module = vlc_module_load(s, "aout stream", modlist,
+ module = vlc_module_load(vlc_object_logger(s), "aout stream", modlist,
false, aout_stream_Start, s, fmt, &hr);
free(modlist);
=====================================
modules/audio_output/winstore.c
=====================================
@@ -551,8 +551,8 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
for (;;)
{
owner->device = sys->client;
- sys->module = vlc_module_load(s, "aout stream", NULL, false,
- aout_stream_Start, s, fmt, &hr);
+ sys->module = vlc_module_load(vlc_object_logger(s), "aout stream", NULL,
+ false, aout_stream_Start, s, fmt, &hr);
int ret = -1;
if (hr == AUDCLNT_E_DEVICE_INVALIDATED)
=====================================
modules/video_output/libplacebo/instance.c
=====================================
@@ -83,7 +83,8 @@ vlc_placebo_t *vlc_placebo_Create(const vout_display_cfg_t *cfg, const char *nam
if (pl->log == NULL)
goto delete_pl;
- module_t *module = vlc_module_load(parent, "libplacebo gpu", name, false,
+ module_t *module = vlc_module_load(vlc_object_logger(parent), "libplacebo gpu",
+ name, false,
vlc_placebo_start, pl, cfg);
if (module == NULL)
goto delete_log;
=====================================
modules/video_output/opengl/filter.c
=====================================
@@ -87,7 +87,8 @@ vlc_gl_filter_LoadModule(vlc_object_t *parent, const char *name,
const struct vlc_gl_format *glfmt,
struct vlc_gl_tex_size *size_out)
{
- filter->module = vlc_module_load(parent, "opengl filter", name, true,
+ filter->module = vlc_module_load(vlc_object_logger(parent), "opengl filter",
+ name, true,
ActivateGLFilter, filter, config,
glfmt, size_out);
if (!filter->module)
=====================================
modules/video_output/vulkan/platform.c
=====================================
@@ -61,8 +61,8 @@ vlc_vk_platform_t *vlc_vk_platform_Create(struct vlc_window *wnd, const char *na
vk->ops = NULL;
vk->window = wnd;
- vk->module = vlc_module_load(wnd, "vulkan platform", name, true,
- vlc_vk_start, vk);
+ vk->module = vlc_module_load(vlc_object_logger(wnd), "vulkan platform", name,
+ true, vlc_vk_start, vk);
if (vk->module == NULL)
{
=====================================
src/input/decoder_device.c
=====================================
@@ -53,9 +53,10 @@ vlc_decoder_device_Create(vlc_object_t *o, vlc_window_t *window)
if (!priv)
return NULL;
char *name = var_InheritString(o, "dec-dev");
- module_t *module = vlc_module_load(&priv->device, "decoder device", name,
- true, decoder_device_Open, &priv->device,
- window);
+ module_t *module = vlc_module_load(vlc_object_logger(&priv->device),
+ "decoder device", name,true,
+ decoder_device_Open, &priv->device,
+ window);
free(name);
if (module == NULL)
{
=====================================
src/input/demux.c
=====================================
@@ -193,8 +193,8 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_input,
strict = false;
}
- priv->module = vlc_module_load(p_demux, "demux", module, strict,
- demux_Probe, p_demux);
+ priv->module = vlc_module_load(vlc_object_logger(p_demux), "demux", module,
+ strict, demux_Probe, p_demux);
free(modbuf);
if (priv->module == NULL)
=====================================
src/misc/messages.c
=====================================
@@ -408,7 +408,7 @@ static struct vlc_logger *vlc_LogModuleCreate(vlc_object_t *parent)
return NULL;
/* TODO: module configuration item */
- if (vlc_module_load(VLC_OBJECT(module), "logger", NULL, false,
+ if (vlc_module_load(vlc_object_logger(module), "logger", NULL, false,
vlc_logger_load, module) == NULL) {
vlc_object_delete(VLC_OBJECT(module));
return NULL;
=====================================
src/misc/tracer.c
=====================================
@@ -4,7 +4,7 @@
* modules. See vlc_config.h for output configuration.
*****************************************************************************
* Copyright (C) 2021 VLC authors and VideoLAN
- *
+ *
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
@@ -79,7 +79,7 @@ static struct vlc_tracer *vlc_TraceModuleCreate(vlc_object_t *parent)
return NULL;
char *module_name = var_InheritString(parent, "tracer");
- if (vlc_module_load(VLC_OBJECT(module), "tracer", module_name, false,
+ if (vlc_module_load(vlc_object_logger(module), "tracer", module_name, false,
vlc_tracer_load, module) == NULL) {
vlc_object_delete(VLC_OBJECT(module));
free(module_name);
=====================================
src/video_output/opengl.c
=====================================
@@ -93,9 +93,9 @@ vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *restrict cfg,
gl->surface = wnd;
gl->device = NULL;
- gl->module = vlc_module_load(gl, type, name, true, vlc_gl_start, gl,
- cfg->display.width, cfg->display.height,
- gl_cfg);
+ gl->module = vlc_module_load(vlc_object_logger(gl), type, name, true,
+ vlc_gl_start, gl,
+ cfg->display.width, cfg->display.height, gl_cfg);
if (gl->module == NULL)
{
vlc_object_delete(gl);
@@ -152,8 +152,8 @@ vlc_gl_t *vlc_gl_CreateOffscreen(vlc_object_t *parent,
gl->surface = NULL;
gl->device = device ? vlc_decoder_device_Hold(device) : NULL;
- gl->module = vlc_module_load(gl, type, name, true, vlc_gl_start, gl, width,
- height, gl_cfg);
+ gl->module = vlc_module_load(vlc_object_logger(gl), type, name, true,
+ vlc_gl_start, gl, width, height, gl_cfg);
if (gl->module == NULL)
{
vlc_object_delete(gl);
=====================================
src/video_output/window.c
=====================================
@@ -89,8 +89,8 @@ vlc_window_t *vlc_window_New(vlc_object_t *obj, const char *module,
w->fullscreen = false;
vlc_mutex_init(&w->lock);
- w->module = vlc_module_load(window, "vout window", module, false,
- vlc_window_start, window);
+ w->module = vlc_module_load(vlc_object_logger(window), "vout window", module,
+ false, vlc_window_start, window);
if (!w->module) {
vlc_object_delete(window);
return NULL;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1dede42762272b39987ece1cec32dac40b126e1a...b1e349d74b5d5c8d89e6d3b66b26d73a413a07a8
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1dede42762272b39987ece1cec32dac40b126e1a...b1e349d74b5d5c8d89e6d3b66b26d73a413a07a8
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list