Index: common/common.h =================================================================== --- common/common.h (revision 661) +++ common/common.h (working copy) @@ -24,67 +24,8 @@ #ifndef _COMMON_H #define _COMMON_H 1 -#ifdef HAVE_STDINT_H -#include -#else -#include -#endif -#include -#include -#include +#include -#ifdef _MSC_VER -#define inline __inline -#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n) -#define snprintf _snprintf -#define X264_VERSION "" // no configure script for msvc -#endif - -#ifdef _MSC_VER -#define DECLARE_ALIGNED( type, var, n ) __declspec(align(n)) type var -#else -#define DECLARE_ALIGNED( type, var, n ) type var __attribute__((aligned(n))) -#endif - -/* threads */ -#if defined(__WIN32__) && defined(HAVE_PTHREAD) -#include -#define USE_CONDITION_VAR - -#elif defined(SYS_BEOS) -#include -#define pthread_t thread_id -#define pthread_create(t,u,f,d) { *(t)=spawn_thread(f,"",10,d); \ - resume_thread(*(t)); } -#define pthread_join(t,s) { long tmp; \ - wait_for_thread(t,(s)?(long*)(s):&tmp); } -#ifndef usleep -#define usleep(t) snooze(t) -#endif -#define HAVE_PTHREAD 1 - -#elif defined(HAVE_PTHREAD) -#include -#define USE_CONDITION_VAR -#else -#define pthread_t int -#define pthread_create(t,u,f,d) -#define pthread_join(t,s) -#endif //SYS_* - -#ifndef USE_CONDITION_VAR -#define pthread_mutex_t int -#define pthread_mutex_init(m,f) -#define pthread_mutex_destroy(m) -#define pthread_mutex_lock(m) -#define pthread_mutex_unlock(m) -#define pthread_cond_t int -#define pthread_cond_init(c,f) -#define pthread_cond_destroy(c) -#define pthread_cond_broadcast(c) -#define pthread_cond_wait(c,m) usleep(100) -#endif - /**************************************************************************** * Macros ****************************************************************************/ @@ -101,11 +42,6 @@ #define offsetof(T,F) ((unsigned int)((char *)&((T *)0)->F)) #endif -#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -#define UNUSED __attribute__((unused)) -#else -#define UNUSED -#endif #define CHECKED_MALLOC( var, size )\ {\ Index: common/osdep.h =================================================================== --- common/osdep.h (revision 0) +++ common/osdep.h (revision 0) @@ -0,0 +1,111 @@ +/***************************************************************************** + * osdep.h: h264 encoder + ***************************************************************************** + * Copyright (C) 2007 Gabriel Bouvigne + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +#ifndef _OSDEP_H +#define _OSDEP_H 1 + +#ifdef HAVE_STDINT_H +#include +#else +#include +#endif +#include +#include +#include + +#ifdef _MSC_VER +#define inline __inline +#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n) +#define snprintf _snprintf +#define X264_VERSION "" // no configure script for msvc +#endif + +#ifdef _MSC_VER +#define DECLARE_ALIGNED( type, var, n ) __declspec(align(n)) type var +#else +#define DECLARE_ALIGNED( type, var, n ) type var __attribute__((aligned(n))) +#endif + +#define _CRT_SECURE_NO_DEPRECATE + +/* threads */ +#if defined(__WIN32__) && defined(HAVE_PTHREAD) +#include +#define USE_CONDITION_VAR + +#elif defined(SYS_BEOS) +#include +#define pthread_t thread_id +#define pthread_create(t,u,f,d) { *(t)=spawn_thread(f,"",10,d); \ + resume_thread(*(t)); } +#define pthread_join(t,s) { long tmp; \ + wait_for_thread(t,(s)?(long*)(s):&tmp); } +#ifndef usleep +#define usleep(t) snooze(t) +#endif +#define HAVE_PTHREAD 1 + +#elif defined(HAVE_PTHREAD) +#include +#define USE_CONDITION_VAR +#else +#define pthread_t int +#define pthread_create(t,u,f,d) +#define pthread_join(t,s) +#endif //SYS_* + +#ifndef USE_CONDITION_VAR +#define pthread_mutex_t int +#define pthread_mutex_init(m,f) +#define pthread_mutex_destroy(m) +#define pthread_mutex_lock(m) +#define pthread_mutex_unlock(m) +#define pthread_cond_t int +#define pthread_cond_init(c,f) +#define pthread_cond_destroy(c) +#define pthread_cond_broadcast(c) +#define pthread_cond_wait(c,m) usleep(100) +#endif + + +#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) +#define UNUSED __attribute__((unused)) +#else +#define UNUSED +#endif + + +/* LARGEFILE support */ +#define _LARGEFILE_SOURCE +#define _FILE_OFFSET_BITS 64 + +#include /*needs to be included before MSVC large files kludge*/ + +#ifdef _MSC_VER +#include /* _setmode() */ +#include /* _O_BINARY */ + +#define fseek _fseeki64 +#define ftell _ftelli64 +#endif + +#endif + Index: common/set.c =================================================================== --- common/set.c (revision 661) +++ common/set.c (working copy) @@ -21,7 +21,6 @@ *****************************************************************************/ #include "common.h" -#include #include #define SHIFT(x,s) ((s)<0 ? (x)<<-(s) : (s)==0 ? (x) : ((x)+(1<<((s)-1)))>>(s)) Index: encoder/set.c =================================================================== --- encoder/set.c (revision 661) +++ encoder/set.c (working copy) @@ -21,7 +21,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -#include #include #include Index: matroska.c =================================================================== --- matroska.c (revision 661) +++ matroska.c (working copy) @@ -21,13 +21,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -#define _LARGEFILE_SOURCE -#define _FILE_OFFSET_BITS 64 -#include #include #include +#include "common/common.h" + + #ifdef HAVE_STDINT_H #include #else Index: muxers.c =================================================================== --- muxers.c (revision 661) +++ muxers.c (working copy) @@ -18,10 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -#define _LARGEFILE_SOURCE -#define _FILE_OFFSET_BITS 64 -#include #include #include @@ -30,6 +27,7 @@ #include "matroska.h" #include "muxers.h" + #ifndef _MSC_VER #include "config.h" #endif @@ -245,7 +243,7 @@ { y4m_input_t *h = handle; int i_frame_total = 0; - off_t init_pos = ftell(h->fh); + int64_t init_pos = ftell(h->fh); if( !fseek( h->fh, 0, SEEK_END ) ) { Index: x264.c =================================================================== --- x264.c (revision 661) +++ x264.c (working copy) @@ -21,11 +21,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -#define _LARGEFILE_SOURCE -#define _FILE_OFFSET_BITS 64 #include -#include #include #include @@ -33,10 +30,6 @@ #define _GNU_SOURCE #include -#ifdef _MSC_VER -#include /* _setmode() */ -#include /* _O_BINARY */ -#endif #ifndef _MSC_VER #include "config.h"