diff -ur ffmpeg.orig/configure ffmpeg/configure
--- ffmpeg.orig/configure	Sat Jul 17 23:43:05 2010
+++ ffmpeg/configure	Sat Jul 17 23:46:00 2010
@@ -2607,6 +2607,9 @@
         add_extralibs -pthreads
     elif check_func pthread_create -lpthreadGC2; then
         add_extralibs -lpthreadGC2
+    elif check_func pthread_create -lpthread; then
+        add_cflags -DPTW32_STATIC_LIB
+        add_extralibs -lpthread
     elif ! check_lib pthread.h pthread_create -lpthread; then
         disable pthreads
     fi
@@ -2641,13 +2644,13 @@
                       require  libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
                       require  libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
 enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
-enabled libgsm     && require  libgsm gsm/gsm.h gsm_create -lgsm
+enabled libgsm     && require  libgsm gsm.h gsm_create -lgsm
 enabled libmp3lame && require  libmp3lame lame/lame.h lame_init -lmp3lame
 enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
 enabled libopencore_amrnb  && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
 enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
 enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
-enabled librtmp    && { check_lib librtmp/rtmp.h RTMP_Socket $(pkg-config --libs librtmp) ||
+enabled librtmp    && { check_lib librtmp/rtmp.h RTMP_Socket -lrtmp -lssl -lcrypto -lwinmm -lws2_32 -lgdi32 -lz ||
                         die "ERROR: librtmp not found or RTMP_Socket() missing, librtmp version must be >= 2.2.f"; }
 enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
                            require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
@@ -2657,10 +2660,10 @@
 enabled libvpx     && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx &&
                         check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
                       die "ERROR: libvpx version must be >=0.9.1"; }
-enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 &&
+enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 -lpthread &&
                       { check_cpp_condition x264.h "X264_BUILD >= 98" ||
                         die "ERROR: libx264 version must be >= 0.98."; }
-enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
+enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore -lpthread
 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	Sat Jul 17 23:43:05 2010
+++ ffmpeg/ffmpeg.c	Sat Jul 17 23:46:12 2010
@@ -1702,7 +1702,7 @@
                             do_audio_out(os, ost, ist, decoded_data_buf, decoded_data_size);
                             break;
                         case AVMEDIA_TYPE_VIDEO:
-#if CONFIG_AVFILTER
+#if CONFIG_AVFILTER && !CONFIG_LIBXVID_ENCODER
                             ost->st->codec->sample_aspect_ratio = ist->picref->pixel_aspect;
 #endif
                             do_video_out(os, ost, ist, &picture, &frame_size);
@@ -2095,6 +2095,7 @@
                                 ost->source_index = j;
                                 found = 1;
                             }
+                            break;
                         }
                     }
 
diff -ur ffmpeg.orig/libavcodec/libgsm.c ffmpeg/libavcodec/libgsm.c
--- ffmpeg.orig/libavcodec/libgsm.c	Sat Jul 17 23:42:40 2010
+++ ffmpeg/libavcodec/libgsm.c	Sat Jul 17 23:46:31 2010
@@ -28,7 +28,7 @@
 // The idiosyncrasies of GSM-in-WAV are explained at http://kbs.cs.tu-berlin.de/~jutta/toast.html
 
 #include "avcodec.h"
-#include <gsm/gsm.h>
+#include <gsm.h>
 
 // gsm.h misses some essential constants
 #define GSM_BLOCK_SIZE 33
diff -ur ffmpeg.orig/libavcodec/opt.c ffmpeg/libavcodec/opt.c
--- ffmpeg.orig/libavcodec/opt.c	Sat Jul 17 23:42:42 2010
+++ ffmpeg/libavcodec/opt.c	Sat Jul 17 23:47:00 2010
@@ -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	Sat Jul 17 23:43:04 2010
+++ ffmpeg/libavformat/rmdec.c	Sat Jul 17 23:47:14 2010
@@ -305,7 +305,7 @@
             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;
diff -ur ffmpeg.orig/libavformat/rtsp.c ffmpeg/libavformat/rtsp.c
--- ffmpeg.orig/libavformat/rtsp.c	Sat Jul 17 23:43:03 2010
+++ ffmpeg/libavformat/rtsp.c	Sat Jul 17 23:47:26 2010
@@ -1627,6 +1627,10 @@
     return 0;
 }
 
+#ifdef WIN32
+#define ETIMEDOUT WSAETIMEDOUT
+#endif
+
 static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
                            uint8_t *buf, int buf_size)
 {
