tools_common.h revision 9b35249446b07f40ac5fcc3205f2c048616efacc
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 */
10#ifndef TOOLS_COMMON_H_
11#define TOOLS_COMMON_H_
12
13#include <stdio.h>
14
15#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
55#define VP8_FOURCC (0x30385056)
56#define VP9_FOURCC (0x30395056)
57#define VP8_FOURCC_MASK (0x00385056)
58#define VP9_FOURCC_MASK (0x00395056)
59
60/* Sets a stdio stream into binary mode */
61FILE *set_binary_mode(FILE *stream);
62
63void 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_
71