John Koleszar | c377bf0 | 2010-11-02 09:11:57 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
Tom Finegan | 03848f5 | 2013-11-05 10:02:18 -0800 | [diff] [blame] | 10 | #ifndef TOOLS_COMMON_H_ |
| 11 | #define TOOLS_COMMON_H_ |
| 12 | |
| 13 | #include <stdio.h> |
| 14 | |
Tom Finegan | e657919 | 2013-11-11 06:48:18 -0800 | [diff] [blame^] | 15 | #include "./vpx_config.h" |
| 16 | |
| 17 | #if defined(_MSC_VER) |
| 18 | /* MSVS doesn't define off_t, and uses _f{seek,tell}i64. */ |
| 19 | typedef __int64 off_t; |
| 20 | #define fseeko _fseeki64 |
| 21 | #define ftello _ftelli64 |
| 22 | #elif defined(_WIN32) |
| 23 | /* MinGW defines off_t as long and uses f{seek,tell}o64/off64_t for large |
| 24 | * files. */ |
| 25 | #define fseeko fseeko64 |
| 26 | #define ftello ftello64 |
| 27 | #define off_t off64_t |
| 28 | #endif /* _WIN32 */ |
| 29 | |
| 30 | #if CONFIG_OS_SUPPORT |
| 31 | #if defined(_MSC_VER) |
| 32 | #include <io.h> /* NOLINT */ |
| 33 | #define snprintf _snprintf |
| 34 | #define isatty _isatty |
| 35 | #define fileno _fileno |
| 36 | #else |
| 37 | #include <unistd.h> /* NOLINT */ |
| 38 | #endif /* _MSC_VER */ |
| 39 | #endif /* CONFIG_OS_SUPPORT */ |
| 40 | |
| 41 | /* Use 32-bit file operations in WebM file format when building ARM |
| 42 | * executables (.axf) with RVCT. */ |
| 43 | #if !CONFIG_OS_SUPPORT |
| 44 | typedef long off_t; /* NOLINT */ |
| 45 | #define fseeko fseek |
| 46 | #define ftello ftell |
| 47 | #endif /* CONFIG_OS_SUPPORT */ |
| 48 | |
| 49 | #define LITERALU64(hi, lo) ((((uint64_t)hi) << 32) | lo) |
| 50 | |
| 51 | #ifndef PATH_MAX |
| 52 | #define PATH_MAX 512 |
| 53 | #endif |
| 54 | |
Tom Finegan | 03848f5 | 2013-11-05 10:02:18 -0800 | [diff] [blame] | 55 | #define VP8_FOURCC (0x30385056) |
| 56 | #define VP9_FOURCC (0x30395056) |
| 57 | #define VP8_FOURCC_MASK (0x00385056) |
| 58 | #define VP9_FOURCC_MASK (0x00395056) |
John Koleszar | c377bf0 | 2010-11-02 09:11:57 -0400 | [diff] [blame] | 59 | |
| 60 | /* Sets a stdio stream into binary mode */ |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 61 | FILE *set_binary_mode(FILE *stream); |
John Koleszar | c377bf0 | 2010-11-02 09:11:57 -0400 | [diff] [blame] | 62 | |
Tom Finegan | 03848f5 | 2013-11-05 10:02:18 -0800 | [diff] [blame] | 63 | void die(const char *fmt, ...); |
| 64 | void fatal(const char *fmt, ...); |
| 65 | void warn(const char *fmt, ...); |
| 66 | |
| 67 | /* The tool including this file must define usage_exit() */ |
| 68 | void usage_exit(); |
| 69 | |
| 70 | #endif // TOOLS_COMMON_H_ |