Commit 1a565432 authored by Fabrice Bellard's avatar Fabrice Bellard
Browse files

win32 fixes


Originally committed as revision 84 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent d95ecd05
......@@ -16,12 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "avcodec.h"
#include <inttypes.h>
#include "libac3/ac3.h"
/* currently, I use libac3 which is Copyright (C) Aaron Holtzman and
......
......@@ -16,19 +16,14 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
//#define DEBUG
//#define DEBUG_BITALLOC
#include "avcodec.h"
#include <math.h>
#include "ac3enc.h"
#include "ac3tab.h"
//#define DEBUG
//#define DEBUG_BITALLOC
#define NDEBUG
#include <assert.h>
#define MDCT_NBITS 9
#define N (1 << MDCT_NBITS)
......
......@@ -16,20 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef __FreeBSD__
#include <sys/param.h>
#endif
#include <netinet/in.h>
#include <math.h>
#include "common.h"
#define NDEBUG
#include <assert.h>
#include "../bswap.h"
#include <math.h>
void init_put_bits(PutBitContext *s,
UINT8 *buffer, int buffer_size,
......@@ -79,7 +67,7 @@ void put_bits(PutBitContext *s, int n, unsigned int value)
bit_cnt+=n;
} else {
bit_buf |= value >> (n + bit_cnt - 32);
*(UINT32 *)s->buf_ptr = htonl(bit_buf);
*(UINT32 *)s->buf_ptr = be2me_32(bit_buf);
//printf("bitbuf = %08x\n", bit_buf);
s->buf_ptr+=4;
if (s->buf_ptr >= s->buf_end)
......@@ -97,9 +85,9 @@ void put_bits(PutBitContext *s, int n, unsigned int value)
}
/* return the number of bits output */
long long get_bit_count(PutBitContext *s)
INT64 get_bit_count(PutBitContext *s)
{
return (s->buf_ptr - s->buf + s->data_out_size) * 8 + (long long)s->bit_cnt;
return (s->buf_ptr - s->buf + s->data_out_size) * 8 + (INT64)s->bit_cnt;
}
void align_put_bits(PutBitContext *s)
......
#ifndef COMMON_H
#define COMMON_H
#define FFMPEG_VERSION "0.4.5"
#ifdef WIN32
#define CONFIG_WIN32
#endif
#ifdef HAVE_AV_CONFIG_H
/* only include the following when compiling package */
#include "../config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#ifndef ENODATA
#define ENODATA 61
#endif
#endif
#ifdef CONFIG_WIN32
/* windows */
typedef unsigned short UINT16;
typedef signed short INT16;
typedef unsigned char UINT8;
typedef unsigned int UINT32;
typedef unsigned __int64 UINT64;
typedef signed char INT8;
typedef signed int INT32;
typedef signed __int64 INT64;
typedef UINT8 uint8_t;
typedef INT8 int8_t;
typedef UINT16 uint16_t;
typedef INT16 int16_t;
typedef UINT32 uint32_t;
typedef INT32 int32_t;
#define INT64_C(c) (c ## i64)
#define UINT64_C(c) (c ## i64)
#define inline __inline
/*
Disable warning messages:
warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
warning C4305: 'argument' : truncation from 'const double' to 'float'
*/
#pragma warning( disable : 4244 )
#pragma warning( disable : 4305 )
#define M_PI 3.14159265358979323846
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#ifdef _DEBUG
#define DEBUG
#endif
// code from bits/byteswap.h (C) 1997, 1998 Free Software Foundation, Inc.
#define bswap_32(x) \
((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
#define be2me_32(x) bswap_32(x)
#define snprintf _snprintf
#define CONFIG_ENCODERS 1
#define CONFIG_DECODERS 1
#define CONFIG_AC3 1
#define CONFIG_MPGLIB 1
#else
/* unix */
#include <inttypes.h>
#ifndef __WINE_WINDEF16_H
/* workaround for typedef conflict in MPlayer (wine typedefs) */
typedef unsigned short UINT16;
......@@ -18,6 +94,32 @@ typedef signed char INT8;
typedef signed int INT32;
typedef signed long long INT64;
#ifdef HAVE_AV_CONFIG_H
#ifdef __FreeBSD__
#include <sys/param.h>
#endif
#ifndef INT64_C
#define INT64_C(c) (c ## LL)
#define UINT64_C(c) (c ## ULL)
#endif
#include "../bswap.h"
#ifdef USE_FASTMEMCPY
#include "fastmemcpy.h"
#endif
#ifndef DEBUG
#define NDEBUG
#endif
#include <assert.h>
#endif /* HAVE_AV_CONFIG_H */
#endif /* !CONFIG_WIN32 */
/* bit output */
struct PutBitContext;
......@@ -28,7 +130,7 @@ typedef struct PutBitContext {
UINT32 bit_buf;
int bit_cnt;
UINT8 *buf, *buf_ptr, *buf_end;
long long data_out_size; /* in bytes */
INT64 data_out_size; /* in bytes */
void *opaque;
WriteDataFunc write_data;
} PutBitContext;
......@@ -38,7 +140,7 @@ void init_put_bits(PutBitContext *s,
void *opaque,
void (*write_data)(void *, UINT8 *, int));
void put_bits(PutBitContext *s, int n, unsigned int value);
long long get_bit_count(PutBitContext *s);
INT64 get_bit_count(PutBitContext *s);
void align_put_bits(PutBitContext *s);
void flush_put_bits(PutBitContext *s);
......
......@@ -16,10 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "avcodec.h"
#include "dsputil.h"
......@@ -481,7 +477,9 @@ static void deinterlace_bottom_field(UINT8 *dst, int dst_wrap,
{
UINT8 *src, *ptr;
int y, y1, i;
UINT8 buf[5 * width];
UINT8 *buf;
buf= (UINT8*) malloc(5 * width);
src = src1;
for(y=0;y<height;y+=2) {
......@@ -511,6 +509,7 @@ static void deinterlace_bottom_field(UINT8 *dst, int dst_wrap,
dst += dst_wrap;
src += (2 + 1) * src_wrap;
}
free(buf);
}
......
......@@ -20,10 +20,7 @@
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include "../common.h"
#include "ac3.h"
#include "ac3_internal.h"
......
......@@ -21,10 +21,7 @@
*
*/
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include "../common.h"
#include "ac3.h"
#include "ac3_internal.h"
#include "bitstream.h"
......
......@@ -25,11 +25,8 @@
*
*/
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include "../common.h"
#include <math.h>
#include <string.h>
#include "ac3.h"
#include "ac3_internal.h"
......
......@@ -22,11 +22,7 @@
*
*/
//#include "config.h"
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include "../common.h"
#include <math.h>
#include "ac3.h"
#include "ac3_internal.h"
......
......@@ -22,9 +22,7 @@
*
*/
#include <inttypes.h>
#include <string.h>
#include "../common.h"
#include "ac3.h"
#include "ac3_internal.h"
......
# Microsoft Developer Studio Project File - Name="libavcodec" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=libavcodec - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "libavcodec.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "libavcodec.mak" CFG="libavcodec - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libavcodec - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "libavcodec - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "libavcodec - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../Release/libavcodec"
# PROP Intermediate_Dir "../Release/libavcodec"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /c
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "libavcodec - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../Debug/libavcodec"
# PROP Intermediate_Dir "../Debug/libavcodec"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "libavcodec - Win32 Release"
# Name "libavcodec - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Group "libac3"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\libac3\ac3.h
# End Source File
# Begin Source File
SOURCE=.\libac3\ac3_internal.h
# End Source File
# Begin Source File
SOURCE=.\libac3\bit_allocate.c
# End Source File
# Begin Source File
SOURCE=.\libac3\bitstream.c
# End Source File
# Begin Source File
SOURCE=.\libac3\bitstream.h
# End Source File
# Begin Source File
SOURCE=.\libac3\downmix.c
# End Source File
# Begin Source File
SOURCE=.\libac3\imdct.c
# End Source File
# Begin Source File
SOURCE=.\libac3\parse.c
# End Source File
# Begin Source File
SOURCE=.\libac3\tables.h
# End Source File
# End Group
# Begin Group "mpglib"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\mpglib\dct64_i386.c
# End Source File
# Begin Source File
SOURCE=.\mpglib\decode_i386.c
# End Source File
# Begin Source File
SOURCE=.\mpglib\huffman.h
# End Source File
# Begin Source File
SOURCE=.\mpglib\l2tables.h
# End Source File
# Begin Source File
SOURCE=.\mpglib\layer1.c
# End Source File
# Begin Source File
SOURCE=.\mpglib\layer2.c
# End Source File
# Begin Source File
SOURCE=.\mpglib\layer3.c
# End Source File
# Begin Source File
SOURCE=.\mpglib\mpg123.h
# End Source File
# Begin Source File
SOURCE=.\mpglib\tabinit.c
# End Source File
# End Group
# Begin Source File
SOURCE=.\ac3dec.c
# End Source File
# Begin Source File
SOURCE=.\ac3enc.c
# End Source File
# Begin Source File
SOURCE=.\ac3enc.h
# End Source File
# Begin Source File
SOURCE=.\ac3tab.h
# End Source File
# Begin Source File
SOURCE=.\avcodec.h
# End Source File
# Begin Source File
SOURCE=.\common.c
# End Source File
# Begin Source File
SOURCE=.\common.h
# End Source File
# Begin Source File
SOURCE=.\dsputil.c
# End Source File
# Begin Source File
SOURCE=.\dsputil.h
# End Source File
# Begin Source File
SOURCE=.\fastmemcpy.h
# End Source File
# Begin Source File
SOURCE=.\h263.c
# End Source File
# Begin Source File
SOURCE=.\h263data.h
# End Source File
# Begin Source File
SOURCE=.\h263dec.c
# End Source File
# Begin Source File
SOURCE=.\imgconvert.c
# End Source File
# Begin Source File
SOURCE=.\imgresample.c
# End Source File
# Begin Source File
SOURCE=.\jfdctfst.c
# End Source File
# Begin Source File
SOURCE=.\jrevdct.c
# End Source File
# Begin Source File
SOURCE=.\mjpeg.c
# End Source File
# Begin Source File
SOURCE=.\motion_est.c
# End Source File
# Begin Source File
SOURCE=.\mpeg12.c
# End Source File
# Begin Source File
SOURCE=.\mpeg12data.h
# End Source File
# Begin Source File
SOURCE=.\mpeg4data.h
# End Source File
# Begin Source File
SOURCE=.\mpegaudio.c
# End Source File
# Begin Source File
SOURCE=.\mpegaudio.h
# End Source File
# Begin Source File
SOURCE=.\mpegaudiodec.c
# End Source File
# Begin Source File
SOURCE=.\mpegaudiotab.h
# End Source File
# Begin Source File
SOURCE=.\mpegvideo.c
# End Source File
# Begin Source File
SOURCE=.\mpegvideo.h
# End Source File
# Begin Source File
SOURCE=.\msmpeg4.c
# End Source File
# Begin Source File
SOURCE=.\msmpeg4data.h
# End Source File
# Begin Source File
SOURCE=.\resample.c
# End Source File
# Begin Source File
SOURCE=.\rv10.c
# End Source File
# Begin Source File
SOURCE=.\utils.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# End Target
# End Project
......@@ -16,8 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdlib.h>
#include <stdio.h>
#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
......@@ -423,12 +421,20 @@ void mjpeg_encode_mb(MpegEncContext *s,
//#define DEBUG
#ifndef CONFIG_WIN32
#ifdef DEBUG
#define dprintf(fmt,args...) printf(fmt, ## args)
#else
#define dprintf(fmt,args...)
#endif
#else