Libav
|
00001 /* 00002 * various utilities for ffmpeg system 00003 * copyright (c) 2000, 2001, 2002 Fabrice Bellard 00004 * 00005 * This file is part of FFmpeg. 00006 * 00007 * FFmpeg is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * FFmpeg is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with FFmpeg; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00022 #ifndef AVFORMAT_OS_SUPPORT_H 00023 #define AVFORMAT_OS_SUPPORT_H 00024 00030 #include "config.h" 00031 00032 #if defined(__MINGW32__) && !defined(__MINGW32CE__) 00033 # include <fcntl.h> 00034 # define lseek(f,p,w) _lseeki64((f), (p), (w)) 00035 #endif /* defined(__MINGW32__) && !defined(__MINGW32CE__) */ 00036 00037 static inline int is_dos_path(const char *path) 00038 { 00039 #if HAVE_DOS_PATHS 00040 if (path[0] && path[1] == ':') 00041 return 1; 00042 #endif 00043 return 0; 00044 } 00045 00046 #ifdef __BEOS__ 00047 # include <sys/socket.h> 00048 # include <netinet/in.h> 00049 /* not net_server ? */ 00050 # include <BeBuild.h> 00051 /* R5 didn't have usleep, fake it. Haiku and Zeta has it now. */ 00052 # if B_BEOS_VERSION <= B_BEOS_VERSION_5 00053 # include <OS.h> 00054 /* doesn't set errno but that's enough */ 00055 # define usleep(t) snooze((bigtime_t)(t)) 00056 # endif 00057 # ifndef SA_RESTART 00058 # warning SA_RESTART not implemented; ffserver might misbehave. 00059 # define SA_RESTART 0 00060 # endif 00061 #endif 00062 00063 #if CONFIG_NETWORK 00064 #if !HAVE_SOCKLEN_T 00065 typedef int socklen_t; 00066 #endif 00067 00068 /* most of the time closing a socket is just closing an fd */ 00069 #if !HAVE_CLOSESOCKET 00070 #define closesocket close 00071 #endif 00072 00073 #if CONFIG_FFSERVER 00074 #if !HAVE_POLL_H 00075 typedef unsigned long nfds_t; 00076 00077 struct pollfd { 00078 int fd; 00079 short events; /* events to look for */ 00080 short revents; /* events that occurred */ 00081 }; 00082 00083 /* events & revents */ 00084 #define POLLIN 0x0001 /* any readable data available */ 00085 #define POLLOUT 0x0002 /* file descriptor is writeable */ 00086 #define POLLRDNORM POLLIN 00087 #define POLLWRNORM POLLOUT 00088 #define POLLRDBAND 0x0008 /* priority readable data */ 00089 #define POLLWRBAND 0x0010 /* priority data can be written */ 00090 #define POLLPRI 0x0020 /* high priority readable data */ 00091 00092 /* revents only */ 00093 #define POLLERR 0x0004 /* errors pending */ 00094 #define POLLHUP 0x0080 /* disconnected */ 00095 #define POLLNVAL 0x1000 /* invalid file descriptor */ 00096 00097 00098 int poll(struct pollfd *fds, nfds_t numfds, int timeout); 00099 #endif /* HAVE_POLL_H */ 00100 #endif /* CONFIG_FFSERVER */ 00101 #endif /* CONFIG_NETWORK */ 00102 00103 #endif /* AVFORMAT_OS_SUPPORT_H */