summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-17 21:23:13 +0200
committerwm4 <wm4@nowhere>2013-06-18 02:19:15 +0200
commit171d1ef7feb2bcdc5f9aed84b36adfc3ae576e5d (patch)
tree2ffc923398c15c41aa33bd72c462c059acb87175
parent9bf93314268eb4cdbdae996cbd9f563cef8394ad (diff)
downloadmpv-171d1ef7feb2bcdc5f9aed84b36adfc3ae576e5d.tar.bz2
mpv-171d1ef7feb2bcdc5f9aed84b36adfc3ae576e5d.tar.xz
osdep: remove shmem wrapper
This is unused now that the cache is always threaded.
-rw-r--r--Makefile1
-rwxr-xr-xconfigure3
-rw-r--r--osdep/shmem.c137
-rw-r--r--osdep/shmem.h27
-rw-r--r--stream/stream.c1
-rw-r--r--video/decode/dec_video.c1
6 files changed, 0 insertions, 170 deletions
diff --git a/Makefile b/Makefile
index 9ac246dc36..be24bac316 100644
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,6 @@ SOURCES-$(MPG123) += audio/decode/ad_mpg123.c
SOURCES-$(NEED_GETTIMEOFDAY) += osdep/gettimeofday.c
SOURCES-$(NEED_GLOB) += osdep/glob-win.c
-SOURCES-$(NEED_SHMEM) += osdep/shmem.c
SOURCES-$(NETWORKING) += stream/asf_mmst_streaming.c \
stream/asf_streaming.c \
stream/cookies.c \
diff --git a/configure b/configure
index b9846e570a..948b06bcec 100755
--- a/configure
+++ b/configure
@@ -494,7 +494,6 @@ _stream_cache=yes
_priority=no
def_dos_paths="#define HAVE_DOS_PATHS 0"
def_priority="#undef CONFIG_PRIORITY"
-need_shmem=yes
_build_man=auto
for ac_option do
case "$ac_option" in
@@ -894,7 +893,6 @@ fi
if mingw32 ; then
_getch=getch2-win.c
- need_shmem=no
extra_cflags="$extra_cflags -D__USE_MINGW_ANSI_STDIO=1"
# Hack for missing BYTE_ORDER declarations in <sys/types.h>.
# (For some reason, they are in <sys/param.h>, but we don't bother switching
@@ -3084,7 +3082,6 @@ $(mak_enable "$arch_all" "$arch" ARCH)
$(mak_enable "$subarch_all" "$subarch" ARCH)
NEED_GLOB = $need_glob
-NEED_SHMEM = $need_shmem
# features
ALSA = $_alsa
diff --git a/osdep/shmem.c b/osdep/shmem.c
deleted file mode 100644
index 5fc7db19d3..0000000000
--- a/osdep/shmem.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * shared memory allocation
- *
- * based on mpg123's xfermem.c by
- * Oliver Fromme <oliver.fromme@heim3.tu-clausthal.de>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/uio.h>
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-#include <sys/socket.h>
-#include <fcntl.h>
-#include <inttypes.h>
-
-#include "core/mp_msg.h"
-
-#ifdef AIX
-#include <sys/select.h>
-#endif
-
-#ifdef HAVE_SHM
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#endif
-
-#include "shmem.h"
-
-#if defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
-#define MAP_ANON MAP_ANONYMOUS
-#endif
-
-static int shmem_type=0;
-
-void* shmem_alloc(int64_t size){
-void* p;
-static int devzero = -1;
-if (size > SIZE_MAX) {
- mp_msg(MSGT_OSDEP, MSGL_FATAL,
- "Shared memory allocation larger than system max. allocation size.\n");
- return NULL;
-}
-while(1){
- switch(shmem_type){
- case 0: // ========= MAP_ANON|MAP_SHARED ==========
-#ifdef MAP_ANON
- p=mmap(0,size,PROT_READ|PROT_WRITE,MAP_ANON|MAP_SHARED,-1,0);
- if(p==MAP_FAILED) break; // failed
- mp_dbg(MSGT_OSDEP, MSGL_DBG2, "shmem: %"PRId64" bytes allocated using mmap anon (%p)\n",size,p);
- return p;
-#else
-// system does not support MAP_ANON at all (e.g. solaris 2.5.1/2.6), just fail
- mp_dbg(MSGT_OSDEP, MSGL_DBG3, "shmem: using mmap anon failed\n");
-#endif
- break;
- case 1: // ========= MAP_SHARED + /dev/zero ==========
- if (devzero == -1 && (devzero = open("/dev/zero", O_RDWR, 0)) == -1) break;
- p=mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,devzero,0);
- if(p==MAP_FAILED) break; // failed
- mp_dbg(MSGT_OSDEP, MSGL_DBG2, "shmem: %"PRId64" bytes allocated using mmap /dev/zero (%p)\n",size,p);
- return p;
- case 2: { // ========= shmget() ==========
-#ifdef HAVE_SHM
- struct shmid_ds shmemds;
- int shmemid;
- if ((shmemid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600)) == -1) break;
- if ((p = shmat(shmemid, 0, 0)) == (void *)-1){
- mp_msg(MSGT_OSDEP, MSGL_ERR, "shmem: shmat() failed: %s\n", strerror(errno));
- shmctl (shmemid, IPC_RMID, &shmemds);
- break;
- }
- if (shmctl(shmemid, IPC_RMID, &shmemds) == -1) {
- mp_msg(MSGT_OSDEP, MSGL_ERR, "shmem: shmctl() failed: %s\n", strerror(errno));
- if (shmdt(p) == -1) perror ("shmdt()");
- break;
- }
- mp_dbg(MSGT_OSDEP, MSGL_DBG2, "shmem: %"PRId64" bytes allocated using SHM (%p)\n",size,p);
- return p;
-#else
- mp_msg(MSGT_OSDEP, MSGL_FATAL, "shmem: no SHM support was compiled in!\n");
- return NULL;
-#endif
- }
- default:
- mp_msg(MSGT_OSDEP, MSGL_FATAL,
- "FATAL: Cannot allocate %"PRId64" bytes of shared memory :(\n",size);
- return NULL;
- }
- ++shmem_type;
-}
-}
-
-void shmem_free(void* p,int64_t size){
- switch(shmem_type){
- case 0:
- case 1:
- if(munmap(p,size)) {
- mp_msg(MSGT_OSDEP, MSGL_ERR, "munmap failed on %p %"PRId64" bytes: %s\n",
- p,size,strerror(errno));
- }
- break;
- case 2:
-#ifdef HAVE_SHM
- if (shmdt(p) == -1)
- mp_msg(MSGT_OSDEP, MSGL_ERR, "shmfree: shmdt() failed: %s\n",
- strerror(errno));
-#else
- mp_msg(MSGT_OSDEP, MSGL_ERR, "shmfree: no SHM support was compiled in!\n");
-#endif
- break;
- }
-}
diff --git a/osdep/shmem.h b/osdep/shmem.h
deleted file mode 100644
index 1aa8382f09..0000000000
--- a/osdep/shmem.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_SHMEM_H
-#define MPLAYER_SHMEM_H
-
-#include <stdint.h>
-
-void* shmem_alloc(int64_t size);
-void shmem_free(void* p,int64_t size);
-
-#endif /* MPLAYER_SHMEM_H */
diff --git a/stream/stream.c b/stream/stream.c
index 3281e50fe6..5e27e5827c 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -43,7 +43,6 @@
#include "core/bstr.h"
#include "core/mp_msg.h"
-#include "osdep/shmem.h"
#include "osdep/timer.h"
#include "network.h"
#include "stream.h"
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c
index 3401ff69f8..ed856e046c 100644
--- a/video/decode/dec_video.c
+++ b/video/decode/dec_video.c
@@ -29,7 +29,6 @@
#include "core/mp_msg.h"
#include "osdep/timer.h"
-#include "osdep/shmem.h"
#include "stream/stream.h"
#include "demux/demux.h"