mirror of
https://github.com/mpv-player/mpv
synced 2025-01-04 14:12:10 +00:00
scripting: minor logging improvements
Give scripting backends a proper name, instead of calling everything "scripts". Log client exit directly in client.c, as that is more general (doesn't change actual output).
This commit is contained in:
parent
ddaab3349b
commit
191cdbd31e
@ -359,6 +359,8 @@ void mpv_detach_destroy(mpv_handle *ctx)
|
|||||||
if (!ctx)
|
if (!ctx)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
MP_VERBOSE(ctx, "Exiting...\n");
|
||||||
|
|
||||||
// reserved_events equals the number of asynchronous requests that weren't
|
// reserved_events equals the number of asynchronous requests that weren't
|
||||||
// yet replied. In order to avoid that trying to reply to a removed client
|
// yet replied. In order to avoid that trying to reply to a removed client
|
||||||
// causes a crash, block until all asynchronous requests were served.
|
// causes a crash, block until all asynchronous requests were served.
|
||||||
|
@ -550,6 +550,7 @@ void update_screensaver_state(struct MPContext *mpctx);
|
|||||||
|
|
||||||
// scripting.c
|
// scripting.c
|
||||||
struct mp_scripting {
|
struct mp_scripting {
|
||||||
|
const char *name; // e.g. "lua script"
|
||||||
const char *file_ext; // e.g. "lua"
|
const char *file_ext; // e.g. "lua"
|
||||||
int (*load)(struct mpv_handle *client, const char *filename);
|
int (*load)(struct mpv_handle *client, const char *filename);
|
||||||
};
|
};
|
||||||
|
@ -1331,6 +1331,7 @@ static void add_functions(struct script_ctx *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const struct mp_scripting mp_scripting_lua = {
|
const struct mp_scripting mp_scripting_lua = {
|
||||||
|
.name = "lua script",
|
||||||
.file_ext = "lua",
|
.file_ext = "lua",
|
||||||
.load = load_lua,
|
.load = load_lua,
|
||||||
};
|
};
|
||||||
|
@ -84,13 +84,12 @@ static void *script_thread(void *p)
|
|||||||
struct thread_arg *arg = p;
|
struct thread_arg *arg = p;
|
||||||
|
|
||||||
char name[90];
|
char name[90];
|
||||||
snprintf(name, sizeof(name), "lua (%s)", mpv_client_name(arg->client));
|
snprintf(name, sizeof(name), "%s (%s)", arg->backend->name,
|
||||||
|
mpv_client_name(arg->client));
|
||||||
mpthread_set_name(name);
|
mpthread_set_name(name);
|
||||||
|
|
||||||
if (arg->backend->load(arg->client, arg->fname) < 0)
|
if (arg->backend->load(arg->client, arg->fname) < 0)
|
||||||
MP_ERR(arg, "Could not load script %s\n", arg->fname);
|
MP_ERR(arg, "Could not load %s %s\n", arg->backend->name, arg->fname);
|
||||||
|
|
||||||
MP_VERBOSE(arg, "Exiting...\n");
|
|
||||||
|
|
||||||
mpv_detach_destroy(arg->client);
|
mpv_detach_destroy(arg->client);
|
||||||
talloc_free(arg);
|
talloc_free(arg);
|
||||||
@ -137,7 +136,7 @@ int mp_load_script(struct MPContext *mpctx, const char *fname)
|
|||||||
}
|
}
|
||||||
arg->log = mp_client_get_log(arg->client);
|
arg->log = mp_client_get_log(arg->client);
|
||||||
|
|
||||||
MP_VERBOSE(arg, "Loading script %s...\n", fname);
|
MP_VERBOSE(arg, "Loading %s %s...\n", backend->name, fname);
|
||||||
|
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
if (pthread_create(&thread, NULL, script_thread, arg)) {
|
if (pthread_create(&thread, NULL, script_thread, arg)) {
|
||||||
@ -257,6 +256,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const struct mp_scripting mp_scripting_cplugin = {
|
const struct mp_scripting mp_scripting_cplugin = {
|
||||||
|
.name = "SO plugin",
|
||||||
.file_ext = "so",
|
.file_ext = "so",
|
||||||
.load = load_cplugin,
|
.load = load_cplugin,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user