2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
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.
10 #ifndef TOOLS_COMMON_H_
11 #define TOOLS_COMMON_H_
15 #include "./vpx_config.h"
16 #include "vpx/vpx_image.h"
17 #include "vpx/vpx_integer.h"
20 #include "./y4minput.h"
24 /* MSVS doesn't define off_t, and uses _f{seek,tell}i64. */
25 typedef __int64 off_t;
26 #define fseeko _fseeki64
27 #define ftello _ftelli64
29 /* MinGW defines off_t as long and uses f{seek,tell}o64/off64_t for large
31 #define fseeko fseeko64
32 #define ftello ftello64
38 #include <io.h> /* NOLINT */
39 #define snprintf _snprintf
40 #define isatty _isatty
41 #define fileno _fileno
43 #include <unistd.h> /* NOLINT */
45 #endif /* CONFIG_OS_SUPPORT */
47 /* Use 32-bit file operations in WebM file format when building ARM
48 * executables (.axf) with RVCT. */
49 #if !CONFIG_OS_SUPPORT
50 typedef long off_t; /* NOLINT */
53 #endif /* CONFIG_OS_SUPPORT */
55 #define LITERALU64(hi, lo) ((((uint64_t)hi) << 32) | lo)
61 #define IVF_FRAME_HDR_SZ (4 + 8) /* 4 byte size + 8 byte timestamp */
62 #define IVF_FILE_HDR_SZ 32
64 #define RAW_FRAME_HDR_SZ sizeof(uint32_t)
66 #define VP8_FOURCC (0x30385056)
67 #define VP9_FOURCC (0x30395056)
68 #define VP8_FOURCC_MASK (0x00385056)
69 #define VP9_FOURCC_MASK (0x00395056)
78 struct FileTypeDetectionBuffer {
89 struct VpxInputContext {
93 struct FileTypeDetectionBuffer detect;
94 enum VideoFileType file_type;
100 struct VpxRational framerate;
110 /* Sets a stdio stream into binary mode */
111 FILE *set_binary_mode(FILE *stream);
113 void die(const char *fmt, ...);
114 void fatal(const char *fmt, ...);
115 void warn(const char *fmt, ...);
117 /* The tool including this file must define usage_exit() */
120 uint16_t mem_get_le16(const void *data);
121 uint32_t mem_get_le32(const void *data);
123 int read_yuv_frame(struct VpxInputContext *input_ctx, vpx_image_t *yuv_frame);
129 #endif // TOOLS_COMMON_H_