Commit e3578af3 authored by James Zern's avatar James Zern
Browse files

examples: remove off_t overrides

this is error prone, int64 will suffice for all cases

Change-Id: I94883f93518cfc356ed57b14dc39d79aebccf47d
parent 96a381c2
...@@ -25,15 +25,10 @@ ...@@ -25,15 +25,10 @@
/* MSVS uses _f{seek,tell}i64. */ /* MSVS uses _f{seek,tell}i64. */
#define fseeko _fseeki64 #define fseeko _fseeki64
#define ftello _ftelli64 #define ftello _ftelli64
typedef long _off_t; // NOLINT - MSVS compatible type
typedef __int64 off_t; // fseeki64 compatible type
#define _OFF_T_DEFINED
#elif defined(_WIN32) #elif defined(_WIN32)
/* MinGW defines off_t as long and uses f{seek,tell}o64/off64_t for large /* MinGW uses f{seek,tell}o64 for large files. */
* files. */
#define fseeko fseeko64 #define fseeko fseeko64
#define ftello ftello64 #define ftello ftello64
#define off_t off64_t
#endif /* _WIN32 */ #endif /* _WIN32 */
#if CONFIG_OS_SUPPORT #if CONFIG_OS_SUPPORT
...@@ -50,7 +45,6 @@ typedef __int64 off_t; // fseeki64 compatible type ...@@ -50,7 +45,6 @@ typedef __int64 off_t; // fseeki64 compatible type
/* Use 32-bit file operations in WebM file format when building ARM /* Use 32-bit file operations in WebM file format when building ARM
* executables (.axf) with RVCT. */ * executables (.axf) with RVCT. */
#if !CONFIG_OS_SUPPORT #if !CONFIG_OS_SUPPORT
typedef long off_t; /* NOLINT */
#define fseeko fseek #define fseeko fseek
#define ftello ftell #define ftello ftell
#endif /* CONFIG_OS_SUPPORT */ #endif /* CONFIG_OS_SUPPORT */
...@@ -90,7 +84,7 @@ struct VpxRational { ...@@ -90,7 +84,7 @@ struct VpxRational {
struct VpxInputContext { struct VpxInputContext {
const char *filename; const char *filename;
FILE *file; FILE *file;
off_t length; int64_t length;
struct FileTypeDetectionBuffer detect; struct FileTypeDetectionBuffer detect;
enum VideoFileType file_type; enum VideoFileType file_type;
uint32_t width; uint32_t width;
......
...@@ -1281,7 +1281,7 @@ static void get_cx_data(struct stream_state *stream, ...@@ -1281,7 +1281,7 @@ static void get_cx_data(struct stream_state *stream,
*got_data = 0; *got_data = 0;
while ((pkt = vpx_codec_get_cx_data(&stream->encoder, &iter))) { while ((pkt = vpx_codec_get_cx_data(&stream->encoder, &iter))) {
static size_t fsize = 0; static size_t fsize = 0;
static off_t ivf_header_pos = 0; static int64_t ivf_header_pos = 0;
switch (pkt->kind) { switch (pkt->kind) {
case VPX_CODEC_CX_FRAME_PKT: case VPX_CODEC_CX_FRAME_PKT:
...@@ -1307,7 +1307,7 @@ static void get_cx_data(struct stream_state *stream, ...@@ -1307,7 +1307,7 @@ static void get_cx_data(struct stream_state *stream,
fsize += pkt->data.frame.sz; fsize += pkt->data.frame.sz;
if (!(pkt->data.frame.flags & VPX_FRAME_IS_FRAGMENT)) { if (!(pkt->data.frame.flags & VPX_FRAME_IS_FRAGMENT)) {
off_t currpos = ftello(stream->file); const int64_t currpos = ftello(stream->file);
fseeko(stream->file, ivf_header_pos, SEEK_SET); fseeko(stream->file, ivf_header_pos, SEEK_SET);
ivf_write_frame_size(stream->file, fsize); ivf_write_frame_size(stream->file, fsize);
fseeko(stream->file, currpos, SEEK_SET); fseeko(stream->file, currpos, SEEK_SET);
...@@ -1534,7 +1534,7 @@ int main(int argc, const char **argv_) { ...@@ -1534,7 +1534,7 @@ int main(int argc, const char **argv_) {
int frames_in = 0, seen_frames = 0; int frames_in = 0, seen_frames = 0;
int64_t estimated_time_left = -1; int64_t estimated_time_left = -1;
int64_t average_rate = -1; int64_t average_rate = -1;
off_t lagged_count = 0; int64_t lagged_count = 0;
open_input_file(&input); open_input_file(&input);
...@@ -1667,15 +1667,15 @@ int main(int argc, const char **argv_) { ...@@ -1667,15 +1667,15 @@ int main(int argc, const char **argv_) {
int64_t rate; int64_t rate;
if (global.limit) { if (global.limit) {
off_t frame_in_lagged = (seen_frames - lagged_count) * 1000; const int64_t frame_in_lagged = (seen_frames - lagged_count) * 1000;
rate = cx_time ? frame_in_lagged * (int64_t)1000000 / cx_time : 0; rate = cx_time ? frame_in_lagged * (int64_t)1000000 / cx_time : 0;
remaining = 1000 * (global.limit - global.skip_frames remaining = 1000 * (global.limit - global.skip_frames
- seen_frames + lagged_count); - seen_frames + lagged_count);
} else { } else {
off_t input_pos = ftello(input.file); const int64_t input_pos = ftello(input.file);
off_t input_pos_lagged = input_pos - lagged_count; const int64_t input_pos_lagged = input_pos - lagged_count;
int64_t limit = input.length; const int64_t limit = input.length;
rate = cx_time ? input_pos_lagged * (int64_t)1000000 / cx_time : 0; rate = cx_time ? input_pos_lagged * (int64_t)1000000 / cx_time : 0;
remaining = limit - input_pos + lagged_count; remaining = limit - input_pos + lagged_count;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment