diff --git a/libav/Makefile b/libav/Makefile index ac25e49622..f422ae1415 100644 --- a/libav/Makefile +++ b/libav/Makefile @@ -4,7 +4,11 @@ CFLAGS= $(OPTFLAGS) -Wall -g -I../libavcodec -DHAVE_AV_CONFIG_H OBJS= rm.o mpeg.o asf.o avienc.o jpegenc.o swf.o wav.o raw.o \ avidec.o ffm.o \ avio.o aviobuf.o utils.o \ - udp.o http.o file.o grab.o audio.o img.o + udp.o http.o file.o img.o + +ifeq ($(CONFIG_GRAB),yes) +OBJS+= grab.o audio.o +endif LIB= libav.a diff --git a/libav/asf.c b/libav/asf.c index 0306ed37c9..a447b14057 100644 --- a/libav/asf.c +++ b/libav/asf.c @@ -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 -#include -#include -#include #include "avformat.h" #include "avi.h" @@ -202,8 +198,8 @@ static INT64 unix_to_file_time(int ti) { INT64 t; - t = ti * 10000000LL; - t += 116444736000000000LL; + t = ti * INT64_C(10000000); + t += INT64_C(116444736000000000); return t; } @@ -535,13 +531,13 @@ static int asf_write_packet(AVFormatContext *s, int stream_index, if (codec->codec_type == CODEC_TYPE_AUDIO) { timestamp = (int)((float)codec->frame_number * codec->frame_size * 1000.0 / codec->sample_rate); - duration = (codec->frame_number * codec->frame_size * 10000000LL) / + duration = (codec->frame_number * codec->frame_size * INT64_C(10000000)) / codec->sample_rate; } else { timestamp = (int)((float)codec->frame_number * 1000.0 * FRAME_RATE_BASE / codec->frame_rate); duration = codec->frame_number * - ((10000000LL * FRAME_RATE_BASE) / codec->frame_rate); + ((INT64_C(10000000) * FRAME_RATE_BASE) / codec->frame_rate); } if (duration > asf->duration) asf->duration = duration; @@ -553,7 +549,7 @@ static int asf_write_packet(AVFormatContext *s, int stream_index, static int asf_write_trailer(AVFormatContext *s) { ASFContext *asf = s->priv_data; - long long file_size; + INT64 file_size; /* flush the current packet */ if (asf->pb.buf_ptr > asf->pb.buffer) @@ -920,7 +916,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt) break; } } - next_frame: + next_frame:; } return 0; diff --git a/libav/audio.c b/libav/audio.c index df5d88eaf6..4ff54bf4d2 100644 --- a/libav/audio.c +++ b/libav/audio.c @@ -16,6 +16,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "avformat.h" + #include #include #include @@ -24,11 +26,8 @@ #include #include #include -#include #include -#include "avformat.h" - const char *audio_device = "/dev/dsp"; typedef struct { diff --git a/libav/avformat.h b/libav/avformat.h index 1f0e7eac8f..f6be87a6d5 100644 --- a/libav/avformat.h +++ b/libav/avformat.h @@ -1,8 +1,6 @@ #include "avcodec.h" -#define FFMPEG_VERSION "0.4.5" - #include "avio.h" /* packet functions */ diff --git a/libav/avidec.c b/libav/avidec.c index ec90565feb..342bfd0f07 100644 --- a/libav/avidec.c +++ b/libav/avidec.c @@ -16,12 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include - #include "avformat.h" #include "avi.h" @@ -157,7 +151,7 @@ int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec.width = get_le32(pb); st->codec.height = get_le32(pb); if (frame_period) - st->codec.frame_rate = (1000000LL * FRAME_RATE_BASE) / frame_period; + st->codec.frame_rate = (INT64_C(1000000) * FRAME_RATE_BASE) / frame_period; else st->codec.frame_rate = 25 * FRAME_RATE_BASE; get_le16(pb); /* panes */ diff --git a/libav/avienc.c b/libav/avienc.c index a580e53098..ffd581bc8b 100644 --- a/libav/avienc.c +++ b/libav/avienc.c @@ -16,11 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include - #include "avformat.h" #include "avi.h" @@ -53,7 +48,7 @@ void end_tag(ByteIOContext *pb, offset_t start) pos = url_ftell(pb); url_fseek(pb, start - 4, SEEK_SET); - put_le32(pb, pos - start); + put_le32(pb, (UINT32)(pos - start)); url_fseek(pb, pos, SEEK_SET); } @@ -179,7 +174,7 @@ static int avi_write_header(AVFormatContext *s) } nb_frames = 0; - put_le32(pb, 1000000LL * FRAME_RATE_BASE / video_enc->frame_rate); + put_le32(pb, (UINT32)(INT64_C(1000000) * FRAME_RATE_BASE / video_enc->frame_rate)); put_le32(pb, bitrate / 8); /* XXX: not quite exact */ put_le32(pb, 0); /* padding */ put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */ @@ -340,7 +335,7 @@ static int avi_write_trailer(AVFormatContext *s) /* update file size */ file_size = url_ftell(pb); url_fseek(pb, 4, SEEK_SET); - put_le32(pb, file_size - 8); + put_le32(pb, (UINT32)(file_size - 8)); url_fseek(pb, file_size, SEEK_SET); } put_flush_packet(pb); diff --git a/libav/avio.c b/libav/avio.c index 243f76f379..5e16456a80 100644 --- a/libav/avio.c +++ b/libav/avio.c @@ -16,11 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include - #include "avformat.h" URLProtocol *first_protocol = NULL; diff --git a/libav/avio.h b/libav/avio.h index a3e11b61aa..7d67171237 100644 --- a/libav/avio.h +++ b/libav/avio.h @@ -1,6 +1,6 @@ /* output byte stream handling */ -typedef long long offset_t; +typedef INT64 offset_t; /* unbuffered I/O */ @@ -87,8 +87,8 @@ int init_put_byte(ByteIOContext *s, void put_byte(ByteIOContext *s, int b); void put_buffer(ByteIOContext *s, unsigned char *buf, int size); -void put_le64(ByteIOContext *s, unsigned long long val); -void put_be64(ByteIOContext *s, unsigned long long val); +void put_le64(ByteIOContext *s, UINT64 val); +void put_be64(ByteIOContext *s, UINT64 val); void put_le32(ByteIOContext *s, unsigned int val); void put_be32(ByteIOContext *s, unsigned int val); void put_le16(ByteIOContext *s, unsigned int val); @@ -105,12 +105,12 @@ void put_flush_packet(ByteIOContext *s); int get_buffer(ByteIOContext *s, unsigned char *buf, int size); int get_byte(ByteIOContext *s); unsigned int get_le32(ByteIOContext *s); -unsigned long long get_le64(ByteIOContext *s); +UINT64 get_le64(ByteIOContext *s); unsigned int get_le16(ByteIOContext *s); unsigned int get_be16(ByteIOContext *s); unsigned int get_be32(ByteIOContext *s); -unsigned long long get_be64(ByteIOContext *s); +UINT64 get_be64(ByteIOContext *s); extern inline int url_is_streamed(ByteIOContext *s) { diff --git a/libav/aviobuf.c b/libav/aviobuf.c index c50629e067..242848e3e0 100644 --- a/libav/aviobuf.c +++ b/libav/aviobuf.c @@ -16,17 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "avformat.h" #define IO_BUFFER_SIZE 32768 @@ -186,16 +175,16 @@ void put_be32(ByteIOContext *s, unsigned int val) put_byte(s, val); } -void put_le64(ByteIOContext *s, unsigned long long val) +void put_le64(ByteIOContext *s, UINT64 val) { - put_le32(s, val & 0xffffffff); - put_le32(s, val >> 32); + put_le32(s, (UINT32)(val & 0xffffffff)); + put_le32(s, (UINT32)(val >> 32)); } -void put_be64(ByteIOContext *s, unsigned long long val) +void put_be64(ByteIOContext *s, UINT64 val) { - put_be32(s, val >> 32); - put_be32(s, val & 0xffffffff); + put_be32(s, (UINT32)(val >> 32)); + put_be32(s, (UINT32)(val & 0xffffffff)); } void put_le16(ByteIOContext *s, unsigned int val) @@ -287,7 +276,7 @@ unsigned int get_le32(ByteIOContext *s) return val; } -unsigned long long get_le64(ByteIOContext *s) +UINT64 get_le64(ByteIOContext *s) { UINT64 val; val = (UINT64)get_le32(s); @@ -313,7 +302,7 @@ unsigned int get_be32(ByteIOContext *s) return val; } -unsigned long long get_be64(ByteIOContext *s) +UINT64 get_be64(ByteIOContext *s) { UINT64 val; val = (UINT64)get_be32(s) << 32; @@ -335,7 +324,7 @@ int url_read_packet(void *opaque, UINT8 *buf, int buf_size) return url_read(h, buf, buf_size); } -int url_seek_packet(void *opaque, long long offset, int whence) +int url_seek_packet(void *opaque, INT64 offset, int whence) { URLContext *h = opaque; url_seek(h, offset, whence); diff --git a/libav/ffm.c b/libav/ffm.c index 76e7613286..80f41ff0f0 100644 --- a/libav/ffm.c +++ b/libav/ffm.c @@ -16,13 +16,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include - #include "avformat.h" +#include /* The FFM file is made of blocks of fixed size */ #define FFM_HEADER_SIZE 14 @@ -345,7 +340,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!url_is_streamed(pb)) { ffm->file_size = url_filesize(url_fileno(pb)); } else { - ffm->file_size = (1ULL << 63) - 1; + ffm->file_size = (UINT64_C(1) << 63) - 1; } s->nb_streams = get_be32(pb); diff --git a/libav/file.c b/libav/file.c index 0b255341c8..2294df8055 100644 --- a/libav/file.c +++ b/libav/file.c @@ -16,15 +16,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include - #include "avformat.h" +#include +#ifndef CONFIG_WIN32 +#include +#include +#include +#else +#include +#define open(fname,oflag,pmode) _open(fname,oflag,pmode) +#endif /* CONFIG_WIN32 */ + /* standard file protocol */ @@ -38,6 +40,9 @@ static int file_open(URLContext *h, const char *filename, int flags) } else { access = O_RDONLY; } +#ifdef CONFIG_WIN32 + access |= O_BINARY; +#endif fd = open(filename, access, 0666); if (fd < 0) return -ENOENT; @@ -61,7 +66,11 @@ static int file_write(URLContext *h, unsigned char *buf, int size) static offset_t file_seek(URLContext *h, offset_t pos, int whence) { int fd = (int)h->priv_data; +#ifdef CONFIG_WIN32 + return _lseeki64(fd, pos, whence); +#else return lseek(fd, pos, whence); +#endif } static int file_close(URLContext *h) diff --git a/libav/grab.c b/libav/grab.c index f92cc397e6..00e268d6fd 100644 --- a/libav/grab.c +++ b/libav/grab.c @@ -16,18 +16,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include +#include "avformat.h" #include #include #include #include #include -#include #include -#include "avformat.h" typedef struct { int fd; diff --git a/libav/http.c b/libav/http.c index 824f98b9e3..b7a363e7de 100644 --- a/libav/http.c +++ b/libav/http.c @@ -16,11 +16,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include +#include "avformat.h" #include -#include #include #include #include @@ -28,7 +25,6 @@ #include #include -#include "avformat.h" /* XXX: POST protocol is not completly implemented because ffmpeg use only a subset of it */ diff --git a/libav/img.c b/libav/img.c index d6fafd4798..04c35c2132 100644 --- a/libav/img.c +++ b/libav/img.c @@ -16,14 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include - #include "avformat.h" #define IMGFMT_YUV 1 @@ -336,7 +328,7 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap) /* XXX: hack hack */ h = url_fileno(f); - img_size = lseek((int)h->priv_data, 0, SEEK_END); + img_size = url_seek(h, 0, SEEK_END); if (infer_size(&s->width, &s->height, img_size) < 0) { goto fail1; } diff --git a/libav/jpegenc.c b/libav/jpegenc.c index d02332cd79..ac73a16e72 100644 --- a/libav/jpegenc.c +++ b/libav/jpegenc.c @@ -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 -#include -#include -#include #include "avformat.h" /* Multipart JPEG */ diff --git a/libav/libav.dsp b/libav/libav.dsp new file mode 100644 index 0000000000..e158548cdc --- /dev/null +++ b/libav/libav.dsp @@ -0,0 +1,160 @@ +# Microsoft Developer Studio Project File - Name="libav" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libav - 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 "libav.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 "libav.mak" CFG="libav - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libav - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libav - 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)" == "libav - 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/libav" +# PROP Intermediate_Dir "../Release/libav" +# 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 /I "../libavcodec" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /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)" == "libav - 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/libav" +# PROP Intermediate_Dir "../Debug/libav" +# 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 /I "../libavcodec" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /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 +# SUBTRACT LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "libav - Win32 Release" +# Name "libav - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\asf.c +# End Source File +# Begin Source File + +SOURCE=.\avformat.h +# End Source File +# Begin Source File + +SOURCE=.\avi.h +# End Source File +# Begin Source File + +SOURCE=.\avidec.c +# End Source File +# Begin Source File + +SOURCE=.\avienc.c +# End Source File +# Begin Source File + +SOURCE=.\avio.c +# End Source File +# Begin Source File + +SOURCE=.\avio.h +# End Source File +# Begin Source File + +SOURCE=.\aviobuf.c +# End Source File +# Begin Source File + +SOURCE=.\file.c +# End Source File +# Begin Source File + +SOURCE=.\img.c +# End Source File +# Begin Source File + +SOURCE=.\jpegenc.c +# End Source File +# Begin Source File + +SOURCE=.\mpeg.c +# End Source File +# Begin Source File + +SOURCE=.\raw.c +# End Source File +# Begin Source File + +SOURCE=.\rm.c +# End Source File +# Begin Source File + +SOURCE=.\swf.c +# End Source File +# Begin Source File + +SOURCE=.\utils.c +# End Source File +# Begin Source File + +SOURCE=.\wav.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# End Target +# End Project diff --git a/libav/mpeg.c b/libav/mpeg.c index 86e3af6184..57dae4c5f5 100644 --- a/libav/mpeg.c +++ b/libav/mpeg.c @@ -16,13 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include -#include - #include "avformat.h" #define MAX_PAYLOAD_SIZE 4096 @@ -67,7 +60,7 @@ typedef struct { #define VIDEO_ID 0xe0 static int put_pack_header(AVFormatContext *ctx, - UINT8 *buf, long long timestamp) + UINT8 *buf, INT64 timestamp) { MpegMuxContext *s = ctx->priv_data; PutBitContext pb; @@ -76,11 +69,11 @@ static int put_pack_header(AVFormatContext *ctx, put_bits(&pb, 32, PACK_START_CODE); put_bits(&pb, 4, 0x2); - put_bits(&pb, 3, (timestamp >> 30) & 0x07); + put_bits(&pb, 3, (UINT32)((timestamp >> 30) & 0x07)); put_bits(&pb, 1, 1); - put_bits(&pb, 15, (timestamp >> 15) & 0x7fff); + put_bits(&pb, 15, (UINT32)((timestamp >> 15) & 0x7fff)); put_bits(&pb, 1, 1); - put_bits(&pb, 15, (timestamp) & 0x7fff); + put_bits(&pb, 15, (UINT32)((timestamp) & 0x7fff)); put_bits(&pb, 1, 1); put_bits(&pb, 1, 1); put_bits(&pb, 22, s->mux_rate); @@ -281,8 +274,8 @@ static void flush_packet(AVFormatContext *ctx, int stream_index) (0x02 << 4) | (((timestamp >> 30) & 0x07) << 1) | 1); - put_be16(&ctx->pb, (((timestamp >> 15) & 0x7fff) << 1) | 1); - put_be16(&ctx->pb, (((timestamp) & 0x7fff) << 1) | 1); + put_be16(&ctx->pb, (UINT16)((((timestamp >> 15) & 0x7fff) << 1) | 1)); + put_be16(&ctx->pb, (UINT16)((((timestamp) & 0x7fff) << 1) | 1)); if (startcode == PRIVATE_STREAM_1) { put_byte(&ctx->pb, id); @@ -494,7 +487,6 @@ static int mpeg_mux_read_header(AVFormatContext *s, codec_id = 0; n = 0; } - for(i=0;i -#include -#include -#include -#include #include "avformat.h" /* simple formats */ diff --git a/libav/rm.c b/libav/rm.c index 8c850400e4..d987ba30ca 100644 --- a/libav/rm.c +++ b/libav/rm.c @@ -16,11 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include - #include "avformat.h" /* in ms */ @@ -330,12 +325,15 @@ static int rm_write_header(AVFormatContext *s) static int rm_write_audio(AVFormatContext *s, UINT8 *buf, int size) { - UINT8 buf1[size]; + UINT8 *buf1; RMContext *rm = s->priv_data; ByteIOContext *pb = &s->pb; StreamInfo *stream = rm->audio_stream; int i; + /* XXX: suppress this malloc */ + buf1= (UINT8*) malloc( size * sizeof(UINT8) ); + write_packet_header(s, stream, size, stream->enc->key_frame); /* for AC3, the words seems to be reversed */ @@ -346,6 +344,7 @@ static int rm_write_audio(AVFormatContext *s, UINT8 *buf, int size) put_buffer(pb, buf1, size); put_flush_packet(pb); stream->nb_frames++; + free(buf1); return 0; } diff --git a/libav/swf.c b/libav/swf.c index a93c4f7097..879d7cdb93 100644 --- a/libav/swf.c +++ b/libav/swf.c @@ -16,15 +16,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include - #include "avformat.h" -#include - /* should have a generic way to indicate probable size */ #define DUMMY_FILE_SIZE (100 * 1024 * 1024) #define DUMMY_DURATION 600 /* in seconds */ @@ -51,8 +44,8 @@ #define SHAPE_ID 1 typedef struct { - long long duration_pos; - long long tag_pos; + offset_t duration_pos; + offset_t tag_pos; int tag; } SWFContext; @@ -76,7 +69,7 @@ static void put_swf_end_tag(AVFormatContext *s) { SWFContext *swf = s->priv_data; ByteIOContext *pb = &s->pb; - long long pos; + offset_t pos; int tag_len, tag; pos = url_ftell(pb); @@ -237,7 +230,7 @@ static int swf_write_header(AVFormatContext *s) put_swf_rect(pb, 0, width, 0, height); put_le16(pb, (rate * 256) / FRAME_RATE_BASE); /* frame rate */ swf->duration_pos = url_ftell(pb); - put_le16(pb, DUMMY_DURATION * (INT64)rate / FRAME_RATE_BASE); /* frame count */ + put_le16(pb, (UINT16)(DUMMY_DURATION * (INT64)rate / FRAME_RATE_BASE)); /* frame count */ /* define a shape with the jpeg inside */ diff --git a/libav/udp.c b/libav/udp.c index 329653bf18..f761832177 100644 --- a/libav/udp.c +++ b/libav/udp.c @@ -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 -#include -#include +#include "avformat.h" #include -#include #include #include #include #include #include -#include "avformat.h" - typedef struct { int udp_socket; int max_payload_size; /* in bytes */ diff --git a/libav/utils.c b/libav/utils.c index 33949b6fe1..b5f4697de9 100644 --- a/libav/utils.c +++ b/libav/utils.c @@ -16,16 +16,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include +#include "avformat.h" +#ifndef CONFIG_WIN32 #include #include -#include #include #include - -#include "avformat.h" +#else +#define strcasecmp _stricmp +#include +#include +#endif AVFormat *first_format; @@ -141,7 +142,9 @@ void register_all(void) register_avformat(&wav_format); register_avformat(&pcm_format); register_avformat(&rawvideo_format); +#ifndef CONFIG_WIN32 register_avformat(&ffm_format); +#endif register_avformat(&pgm_format); register_avformat(&ppm_format); register_avformat(&pgmyuv_format); @@ -152,10 +155,14 @@ void register_all(void) register_protocol(&file_protocol); register_protocol(&pipe_protocol); +#ifdef CONFIG_GRAB register_protocol(&audio_protocol); register_protocol(&video_protocol); +#endif +#ifndef CONFIG_WIN32 register_protocol(&udp_protocol); register_protocol(&http_protocol); +#endif } /* memory handling */ @@ -422,9 +429,15 @@ int parse_image_size(int *width_ptr, int *height_ptr, const char *str) INT64 gettime(void) { +#ifdef CONFIG_WIN32 + struct _timeb tb; + _ftime(&tb); + return ((INT64)tb.time * INT64_C(1000) + (INT64)tb.millitm) * INT64_C(1000); +#else struct timeval tv; gettimeofday(&tv,NULL); return (INT64)tv.tv_sec * 1000000 + tv.tv_usec; +#endif } /* syntax: [YYYY-MM-DD ][[HH:]MM:]SS[.m...] . Return the date in micro seconds since 1970 */ diff --git a/libav/wav.c b/libav/wav.c index 9f430bb2f6..c3a430df54 100644 --- a/libav/wav.c +++ b/libav/wav.c @@ -16,11 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include #include "avformat.h" #include "avi.h" @@ -77,7 +72,7 @@ static int wav_write_trailer(AVFormatContext *s) /* update file size */ file_size = url_ftell(pb); url_fseek(pb, 4, SEEK_SET); - put_le32(pb, file_size); + put_le32(pb, (UINT32)file_size); url_fseek(pb, file_size, SEEK_SET); put_flush_packet(pb); @@ -89,7 +84,7 @@ static int wav_write_trailer(AVFormatContext *s) /* return the size of the found tag */ /* XXX: > 2GB ? */ -static int find_tag(ByteIOContext *pb, int tag1) +static int find_tag(ByteIOContext *pb, UINT32 tag1) { unsigned int tag; int size;