Mercurial > mplayer.hg
changeset 1706:e8f61691814e
shmem.c removed
author | arpi |
---|---|
date | Sun, 26 Aug 2001 19:54:37 +0000 |
parents | b3d87a57b6f4 |
children | 216aae08226c |
files | Gui/gui.mak Gui/language.c Gui/mplayer/widgets.h Gui/shmem.c Gui/shmem.h |
diffstat | 5 files changed, 5 insertions(+), 95 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui/gui.mak Sun Aug 26 19:22:44 2001 +0000 +++ b/Gui/gui.mak Sun Aug 26 19:54:37 2001 +0000 @@ -6,6 +6,6 @@ $(MPLAYERDIR)psignal.c $(MPLAYERDIR)mixer.c MPLAYEROBJS = $(MPLAYERSRCS:.c=.o) -SRCS = $(SKINSRC) $(BITMAPSRCS) wm/ws.c wm/wsconv.c app.c config.c events.c timer.c language.c error.c shmem.c +SRCS = $(SKINSRC) $(BITMAPSRCS) wm/ws.c wm/wsconv.c app.c config.c events.c timer.c language.c error.c OBJS = $(SRCS:.c=.o)
--- a/Gui/language.c Sun Aug 26 19:22:44 2001 +0000 +++ b/Gui/language.c Sun Aug 26 19:54:37 2001 +0000 @@ -16,6 +16,8 @@ char * langNEMDB = "Sorry, not enough memory for draw buffer."; char * langNEMFMR = "Sorry, not enough memory for menu rendering."; char * langNEMFMM = "Sorry, not enough memory for main window shape mask."; + +#if 0 char * langLIRCSNW = "LIRC support not working. Disabled."; char * langAudioDriverSelectNotSupported = "Your audio driver DOES NOT support select(). Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !"; char * langNotSupportedFileFormat = "Sorry, this file format not recognized/supported. If this file is an AVI, ASF or MPEG stream, please contact the author!"; @@ -40,4 +42,4 @@ "Or you should disable DShow support."; char * langCantInitVideoDriver = "FATAL: Cannot initialize video driver!"; char * langUnknowError = "Unknow error. Please contact the developer team."; - +#endif
--- a/Gui/mplayer/widgets.h Sun Aug 26 19:22:44 2001 +0000 +++ b/Gui/mplayer/widgets.h Sun Aug 26 19:54:37 2001 +0000 @@ -5,7 +5,7 @@ #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> -#include "../shmem.h" +#include "../../linux/shmem.h" typedef struct {
--- a/Gui/shmem.c Sun Aug 26 19:22:44 2001 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - * shmem.c - Shared memory allocation - * - * based on mpg123's xfermem.c by - * Oliver Fromme <oliver.fromme@heim3.tu-clausthal.de> - * Sun Apr 6 02:26:26 MET DST 1997 - */ - -#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> -#include <sys/mman.h> -#include <sys/socket.h> -#include <fcntl.h> - -#ifdef AIX -#include <sys/select.h> -#endif - -#include <sys/ipc.h> -#include <sys/shm.h> - -extern int errno; - -#if defined(MAP_ANONYMOUS) && !defined(MAP_ANON) -#define MAP_ANON MAP_ANONYMOUS -#endif - -static int shmem_type=0; - -void* shmem_alloc(int size){ -void* p; -static int devzero = -1; -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 -// printf("shmem: %d bytes allocated using mmap anon (%X)\n",size,p); - return p; -#else -// system does not support MAP_ANON at all (e.g. solaris 2.5.1/2.6), just fail - break; -#endif - 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 -// printf("shmem: %d bytes allocated using mmap /dev/zero (%X)\n",size,p); - return p; - case 2: { // ========= shmget() ========== - struct shmid_ds shmemds; - int shmemid; - if ((shmemid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600)) == -1) break; - if ((int)(p = shmat(shmemid, 0, 0)) == -1){ - perror ("shmat()"); - shmctl (shmemid, IPC_RMID, &shmemds); - break; - } - if (shmctl(shmemid, IPC_RMID, &shmemds) == -1) { - perror ("shmctl()"); - if (shmdt(p) == -1) perror ("shmdt()"); - break; - } -// printf("shmem: %d bytes allocated using shmget() & shmat() (%X)\n",size,p); - return p; - } - default: - printf("FATAL: Cannot alloate %d bytes shared memory :(\n",size); - return NULL; - } - ++shmem_type; -} -} - -void shmem_free(void* p){ - switch(shmem_type){ - case 2: - if (shmdt(p) == -1) perror ("shmdt()"); - break; - } -}