mirror of https://github.com/mpv-player/mpv
build: add configure test for POSIX shm for the sake of vo_kitty
Android's POSIX coverage is pretty sketchy but not like we have a choice.
This commit is contained in:
parent
cb15bc4324
commit
d8ae14653a
|
@ -962,6 +962,11 @@ if features['sixel']
|
||||||
sources += files('video/out/vo_sixel.c')
|
sources += files('video/out/vo_sixel.c')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
features += {'posix_shm': false}
|
||||||
|
if features['posix']
|
||||||
|
features += {'posix_shm': cc.has_function('shm_open', prefix: '#include <sys/mman.h>')}
|
||||||
|
endif
|
||||||
|
|
||||||
spirv_cross = dependency('spirv-cross-c-shared', required: get_option('spirv-cross'))
|
spirv_cross = dependency('spirv-cross-c-shared', required: get_option('spirv-cross'))
|
||||||
features += {'spirv-cross': spirv_cross.found()}
|
features += {'spirv-cross': spirv_cross.found()}
|
||||||
if features['spirv-cross']
|
if features['spirv-cross']
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include <config.h>
|
#include "config.h"
|
||||||
|
|
||||||
#if HAVE_POSIX
|
#if HAVE_POSIX
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -34,7 +34,6 @@
|
||||||
#include <libswscale/swscale.h>
|
#include <libswscale/swscale.h>
|
||||||
#include <libavutil/base64.h>
|
#include <libavutil/base64.h>
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "options/m_config.h"
|
#include "options/m_config.h"
|
||||||
#include "osdep/terminal.h"
|
#include "osdep/terminal.h"
|
||||||
#include "sub/osd.h"
|
#include "sub/osd.h"
|
||||||
|
@ -109,7 +108,7 @@ static bool resized;
|
||||||
|
|
||||||
static void close_shm(struct priv *p)
|
static void close_shm(struct priv *p)
|
||||||
{
|
{
|
||||||
#if HAVE_POSIX
|
#if HAVE_POSIX_SHM
|
||||||
if (p->buffer != NULL) {
|
if (p->buffer != NULL) {
|
||||||
munmap(p->buffer, p->buffer_size);
|
munmap(p->buffer, p->buffer_size);
|
||||||
p->buffer = NULL;
|
p->buffer = NULL;
|
||||||
|
@ -210,7 +209,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *params)
|
||||||
|
|
||||||
static int create_shm(struct vo *vo)
|
static int create_shm(struct vo *vo)
|
||||||
{
|
{
|
||||||
#if HAVE_POSIX
|
#if HAVE_POSIX_SHM
|
||||||
struct priv *p = vo->priv;
|
struct priv *p = vo->priv;
|
||||||
p->shm_fd = shm_open(p->shm_path, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
|
p->shm_fd = shm_open(p->shm_path, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
|
||||||
if (p->shm_fd == -1) {
|
if (p->shm_fd == -1) {
|
||||||
|
@ -344,7 +343,9 @@ static int preinit(struct vo *vo)
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
sa.sa_handler = handle_winch;
|
sa.sa_handler = handle_winch;
|
||||||
sigaction(SIGWINCH, &sa, &saved_sigaction);
|
sigaction(SIGWINCH, &sa, &saved_sigaction);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_POSIX_SHM
|
||||||
if (p->opts.use_shm) {
|
if (p->opts.use_shm) {
|
||||||
p->shm_path = talloc_asprintf(vo, "/mpv-kitty-%p", vo);
|
p->shm_path = talloc_asprintf(vo, "/mpv-kitty-%p", vo);
|
||||||
int p_size = strlen(p->shm_path) - 1;
|
int p_size = strlen(p->shm_path) - 1;
|
||||||
|
|
5
wscript
5
wscript
|
@ -814,6 +814,11 @@ video_output_features = [
|
||||||
'desc': 'drmIsKMS() function',
|
'desc': 'drmIsKMS() function',
|
||||||
'deps': 'drm',
|
'deps': 'drm',
|
||||||
'func': check_pkg_config('libdrm', '>= 2.4.105'),
|
'func': check_pkg_config('libdrm', '>= 2.4.105'),
|
||||||
|
}, {
|
||||||
|
'name': 'posix-shm',
|
||||||
|
'desc': "POSIX shared memory API",
|
||||||
|
'deps': 'posix',
|
||||||
|
'func': check_statement('sys/mman.h', 'shm_open("",0,0)')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue