diff -ur ffmpeg.orig/configure ffmpeg/configure
--- ffmpeg.orig/configure	Fri Nov  6 23:45:38 2009
+++ ffmpeg/configure	Fri Nov  6 23:47:07 2009
@@ -1777,7 +1777,7 @@
 fi
 
 add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
-check_cflags -std=c99
+check_cflags -std=gnu99
 check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
 #include <stdlib.h>
 EOF
@@ -2296,6 +2296,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
@@ -2338,10 +2341,10 @@
 enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
 enabled libtheora  && require  libtheora theora/theora.h theora_info_init -ltheora -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 >= 78" ||
                         die "ERROR: libx264 version must be >= 0.78."; }
-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 ffmpeg.orig/ffmpeg.c ffmpeg/ffmpeg.c
--- ffmpeg.orig/ffmpeg.c	Fri Nov  6 23:45:38 2009
+++ ffmpeg/ffmpeg.c	Fri Nov  6 23:47:20 2009
@@ -50,6 +50,7 @@
 
 #if HAVE_SYS_SELECT_H
 #include <sys/select.h>
+#define usleep(t) Sleep((t) / 1000)
 #endif
 
 #if HAVE_TERMIOS_H
diff -ur ffmpeg.orig/libavcodec/libmp3lame.c ffmpeg/libavcodec/libmp3lame.c
--- ffmpeg.orig/libavcodec/libmp3lame.c	Fri Nov  6 23:45:30 2009
+++ ffmpeg/libavcodec/libmp3lame.c	Fri Nov  6 23:47:36 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 ffmpeg.orig/libavcodec/opt.c ffmpeg/libavcodec/opt.c
--- ffmpeg.orig/libavcodec/opt.c	Fri Nov  6 23:45:28 2009
+++ ffmpeg/libavcodec/opt.c	Fri Nov  6 23:47:51 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 ffmpeg.orig/libavformat/rmdec.c ffmpeg/libavformat/rmdec.c
--- ffmpeg.orig/libavformat/rmdec.c	Fri Nov  6 23:45:37 2009
+++ ffmpeg/libavformat/rmdec.c	Fri Nov  6 23:48:48 2009
@@ -282,7 +282,7 @@
         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);
 
         st->codec->extradata_size= codec_data_size - (url_ftell(pb) - codec_pos);
@@ -298,7 +298,7 @@
         get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
 
 //        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;
         switch(((uint8_t*)st->codec->extradata)[4]>>4){
         case 1: st->codec->codec_id = CODEC_ID_RV10; break;
         case 2: st->codec->codec_id = CODEC_ID_RV20; break;
