summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/javascript.c8
-rw-r--r--player/javascript/defaults.js1
-rw-r--r--player/lua.c8
-rw-r--r--player/lua/defaults.lua4
4 files changed, 5 insertions, 16 deletions
diff --git a/player/javascript.c b/player/javascript.c
index 8cb263e123..406a469447 100644
--- a/player/javascript.c
+++ b/player/javascript.c
@@ -40,7 +40,6 @@
#include "misc/bstr.h"
#include "osdep/timer.h"
#include "osdep/threads.h"
-#include "osdep/getpid.h"
#include "stream/stream.h"
#include "sub/osd.h"
#include "core.h"
@@ -925,12 +924,6 @@ static void script_get_user_path(js_State *J, void *af)
js_pushstring(J, mp_get_user_path(af, jctx(J)->mpctx->global, path));
}
-// args: none
-static void script_getpid(js_State *J)
-{
- js_pushnumber(J, mp_getpid());
-}
-
// args: prefixed file name, data (c-str)
static void script_write_file(js_State *J, void *af)
{
@@ -1183,7 +1176,6 @@ static const struct fn_entry utils_fns[] = {
FN_ENTRY(split_path, 1),
AF_ENTRY(join_path, 2),
AF_ENTRY(get_user_path, 1),
- FN_ENTRY(getpid, 0),
FN_ENTRY(get_env_list, 0),
FN_ENTRY(read_file, 2),
diff --git a/player/javascript/defaults.js b/player/javascript/defaults.js
index 0904524ce4..c4482c88ce 100644
--- a/player/javascript/defaults.js
+++ b/player/javascript/defaults.js
@@ -663,6 +663,7 @@ mp.get_script_file = function() { return mp.script_file };
mp.get_script_directory = function() { return mp.script_path };
mp.get_time = function() { return mp.get_time_ms() / 1000 };
mp.utils.getcwd = function() { return mp.get_property("working-directory") };
+mp.utils.getpid = function() { return mp.get_property_number("pid") }
mp.get_mouse_pos = function() { return mp.get_property_native("mouse-pos") };
mp.dispatch_event = dispatch_event;
mp.process_timers = process_timers;
diff --git a/player/lua.c b/player/lua.c
index 2eb163ef16..e29bfa36cc 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -45,7 +45,6 @@
#include "osdep/subprocess.h"
#include "osdep/timer.h"
#include "osdep/threads.h"
-#include "osdep/getpid.h"
#include "stream/stream.h"
#include "sub/osd.h"
#include "core.h"
@@ -1146,12 +1145,6 @@ static int script_join_path(lua_State *L)
return 1;
}
-static int script_getpid(lua_State *L)
-{
- lua_pushnumber(L, mp_getpid());
- return 1;
-}
-
static int script_parse_json(lua_State *L, void *tmp)
{
mp_lua_optarg(L, 2);
@@ -1247,7 +1240,6 @@ static const struct fn_entry utils_fns[] = {
FN_ENTRY(file_info),
FN_ENTRY(split_path),
FN_ENTRY(join_path),
- FN_ENTRY(getpid),
AF_ENTRY(parse_json),
AF_ENTRY(format_json),
FN_ENTRY(get_env_list),
diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua
index 920ee425aa..0fe90977e6 100644
--- a/player/lua/defaults.lua
+++ b/player/lua/defaults.lua
@@ -747,6 +747,10 @@ function mp_utils.getcwd()
return mp.get_property("working-directory")
end
+function mp_utils.getpid()
+ return mp.get_property_number("pid")
+end
+
function mp_utils.format_bytes_humanized(b)
local d = {"Bytes", "KiB", "MiB", "GiB", "TiB", "PiB"}
local i = 1