• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavformat/os_support.h

Go to the documentation of this file.
00001 /*
00002  * various OS-feature replacement utilities
00003  * copyright (c) 2000, 2001, 2002 Fabrice Bellard
00004  *
00005  * This file is part of Libav.
00006  *
00007  * Libav 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  * Libav 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 Libav; 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 #  define stat _stati64
00036 #  define fstat(f,s) _fstati64((f), (s))
00037 #endif /* defined(__MINGW32__) && !defined(__MINGW32CE__) */
00038 
00039 static inline int is_dos_path(const char *path)
00040 {
00041 #if HAVE_DOS_PATHS
00042     if (path[0] && path[1] == ':')
00043         return 1;
00044 #endif
00045     return 0;
00046 }
00047 
00048 #if defined(_WIN32) && !defined(__MINGW32CE__)
00049 int ff_win32_open(const char *filename, int oflag, int pmode);
00050 #define open ff_win32_open
00051 #endif
00052 
00053 #if CONFIG_NETWORK
00054 #if !HAVE_SOCKLEN_T
00055 typedef int socklen_t;
00056 #endif
00057 
00058 /* most of the time closing a socket is just closing an fd */
00059 #if !HAVE_CLOSESOCKET
00060 #define closesocket close
00061 #endif
00062 
00063 #if !HAVE_POLL_H
00064 typedef unsigned long nfds_t;
00065 
00066 struct pollfd {
00067     int fd;
00068     short events;  /* events to look for */
00069     short revents; /* events that occurred */
00070 };
00071 
00072 /* events & revents */
00073 #define POLLIN     0x0001  /* any readable data available */
00074 #define POLLOUT    0x0002  /* file descriptor is writeable */
00075 #define POLLRDNORM POLLIN
00076 #define POLLWRNORM POLLOUT
00077 #define POLLRDBAND 0x0008  /* priority readable data */
00078 #define POLLWRBAND 0x0010  /* priority data can be written */
00079 #define POLLPRI    0x0020  /* high priority readable data */
00080 
00081 /* revents only */
00082 #define POLLERR    0x0004  /* errors pending */
00083 #define POLLHUP    0x0080  /* disconnected */
00084 #define POLLNVAL   0x1000  /* invalid file descriptor */
00085 
00086 
00087 int poll(struct pollfd *fds, nfds_t numfds, int timeout);
00088 #endif /* HAVE_POLL_H */
00089 #endif /* CONFIG_NETWORK */
00090 
00091 #endif /* AVFORMAT_OS_SUPPORT_H */
Generated on Sun Apr 22 2012 21:54:08 for Libav by doxygen 1.7.1