diff -ur -x.svn ffmpeg.orig/configure ffmpeg/configure
--- ffmpeg.orig/configure	Mon Jan 25 00:36:20 2010
+++ ffmpeg/configure	Sun Jan 24 06:35:37 2010
@@ -2448,6 +2448,9 @@
         add_extralibs -pthreads
     elif check_func pthread_create -lpthreadGC2; then
         add_extralibs -lpthreadGC2
+    elif check_func pthread_create -lpthread -lws2_32; then
+        add_cflags -DPTW32_STATIC_LIB
+        add_extralibs -lpthread -lws2_32
     elif ! check_lib pthread.h pthread_create -lpthread; then
         die "ERROR: can't find pthreads library"
     fi
@@ -2493,10 +2496,10 @@
 enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
 enabled libtheora  && require  libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
 enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
-enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 -lm &&
+enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 -lm -lpthread -lws2_32 &&
                       { check_cpp_condition x264.h "X264_BUILD >= 83" ||
                         die "ERROR: libx264 version must be >= 0.83."; }
-enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
+enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore  -lpthread -lws2_32
 enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
 
 # libdc1394 check
diff -ur -x.svn ffmpeg.orig/ffmpeg.c ffmpeg/ffmpeg.c
--- ffmpeg.orig/ffmpeg.c	Mon Jan 25 00:36:20 2010
+++ ffmpeg/ffmpeg.c	Sat Jan 23 12:23:18 2010
@@ -70,6 +70,10 @@
 
 #undef exit
 
+#ifdef WIN32
+#define usleep(t) Sleep((t) / 1000)
+#endif
+
 const char program_name[] = "FFmpeg";
 const int program_birth_year = 2000;
 
diff -ur -x.svn ffmpeg.orig/libavcodec/libmp3lame.c ffmpeg/libavcodec/libmp3lame.c
--- ffmpeg.orig/libavcodec/libmp3lame.c	Mon Jan 25 00:36:09 2010
+++ ffmpeg/libavcodec/libmp3lame.c	Sun Sep  6 21:17:52 2009
@@ -34,6 +34,7 @@
     int stereo;
     uint8_t buffer[BUFFER_SIZE];
     int buffer_index;
+    int buffer_flushed;
 } Mp3AudioContext;
 
 static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
@@ -73,6 +74,8 @@
     avctx->coded_frame= avcodec_alloc_frame();
     avctx->coded_frame->key_frame= 1;
 
+    s->buffer_flushed = 0;
+
     return 0;
 
 err_close:
@@ -166,13 +169,15 @@
                 BUFFER_SIZE - s->buffer_index
                 );
         }
-    }else{
+    }else if (data == NULL && s->buffer_flushed == 0){
         lame_result= lame_encode_flush(
                 s->gfp,
                 s->buffer + s->buffer_index,
                 BUFFER_SIZE - s->buffer_index
                 );
-    }
+        s->buffer_flushed = 1;
+    }else
+        lame_result = 0;
 
     if(lame_result < 0){
         if(lame_result==-1) {
diff -ur -x.svn ffmpeg.orig/libavcodec/opt.c ffmpeg/libavcodec/opt.c
--- ffmpeg.orig/libavcodec/opt.c	Mon Jan 25 00:36:07 2010
+++ ffmpeg/libavcodec/opt.c	Fri Nov 20 15:05:53 2009
@@ -175,6 +175,7 @@
             if(o->type == FF_OPT_TYPE_FLAGS){
                 if     (cmd=='+') d= av_get_int(obj, name, NULL) | (int64_t)d;
                 else if(cmd=='-') d= av_get_int(obj, name, NULL) &~(int64_t)d;
+                else if(buf[0]=='0' && buf[1]=='x') d= strtoul(buf, NULL, 16);
             }else{
                 if     (cmd=='+') d= notfirst*av_get_double(obj, name, NULL) + d;
                 else if(cmd=='-') d= notfirst*av_get_double(obj, name, NULL) - d;
diff -ur -x.svn ffmpeg.orig/libavformat/rmdec.c ffmpeg/libavformat/rmdec.c
--- ffmpeg.orig/libavformat/rmdec.c	Mon Jan 25 00:36:19 2010
+++ ffmpeg/libavformat/rmdec.c	Sat Jan 23 20:08:49 2010
@@ -318,14 +318,14 @@
         fps= get_be16(pb);
         st->codec->codec_type = CODEC_TYPE_VIDEO;
         get_be32(pb);
-        fps2= get_be16(pb);
+        fps2 = get_be16(pb);
         get_be16(pb);
 
         if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (url_ftell(pb) - codec_pos))) < 0)
             return ret;
 
 //        av_log(s, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2);
-        st->codec->time_base.den = fps * st->codec->time_base.num;
+        st->codec->time_base.den = fps2 * st->codec->time_base.num;
         //XXX: do we really need that?
         switch(st->codec->extradata[4]>>4){
         case 1: st->codec->codec_id = CODEC_ID_RV10; break;
