blob: 068e7b518e86a71ac4f6d7e6a2e36213905010d3 [file] [log] [blame]
John Koleszarc377bf02010-11-02 09:11:57 -04001/*
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 Finegan03848f52013-11-05 10:02:18 -080010#ifndef TOOLS_COMMON_H_
11#define TOOLS_COMMON_H_
12
13#include <stdio.h>
14
Tom Finegane6579192013-11-11 06:48:18 -080015#include "./vpx_config.h"
16
17#if defined(_MSC_VER)
18/* MSVS doesn't define off_t, and uses _f{seek,tell}i64. */
19typedef __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
44typedef 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 Finegan03848f52013-11-05 10:02:18 -080055#define VP8_FOURCC (0x30385056)
56#define VP9_FOURCC (0x30395056)
57#define VP8_FOURCC_MASK (0x00385056)
58#define VP9_FOURCC_MASK (0x00395056)
John Koleszarc377bf02010-11-02 09:11:57 -040059
60/* Sets a stdio stream into binary mode */
John Koleszarc6b90392012-07-13 15:21:29 -070061FILE *set_binary_mode(FILE *stream);
John Koleszarc377bf02010-11-02 09:11:57 -040062
Tom Finegan03848f52013-11-05 10:02:18 -080063void die(const char *fmt, ...);
64void fatal(const char *fmt, ...);
65void warn(const char *fmt, ...);
66
67/* The tool including this file must define usage_exit() */
68void usage_exit();
69
70#endif // TOOLS_COMMON_H_